#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int exoid, num_dim, num_nodes, num_elem, num_elem_blk;
int num_node_sets, num_side_sets, error;
int i, j;
int num_qa_rec, num_info;
int num_glo_vars;
int whole_time_step, num_time_steps;
int CPU_word_size, IO_word_size;
float *glob_var_vals;
float time_value;
char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
CPU_word_size = 0;
IO_word_size = 4;
&CPU_word_size,
&IO_word_size);
printf("after ex_create for test.exo, exoid = %d\n", exoid);
printf(" cpu word size: %d io word size: %d\n", CPU_word_size, IO_word_size);
num_dim = 1;
num_nodes = 0;
num_elem = 0;
num_elem_blk = 0;
num_node_sets = 0;
num_side_sets = 0;
error =
ex_put_init(exoid,
"This is a test", num_dim, num_nodes, num_elem, num_elem_blk,
num_node_sets, num_side_sets);
printf("after ex_put_init, error = %d\n", error);
if (error) {
exit(-1);
}
coord_names[0] = "xcoor";
printf("after ex_put_coord_names, error = %d\n", error);
if (error) {
exit(-1);
}
num_qa_rec = 2;
qa_record[0][0] = "TESTWT";
qa_record[0][1] = "testwt";
qa_record[0][2] = "07/07/93";
qa_record[0][3] = "15:41:33";
qa_record[1][0] = "";
qa_record[1][1] = " ";
qa_record[1][2] = "";
qa_record[1][3] = " ";
error =
ex_put_qa(exoid, num_qa_rec, qa_record);
printf("after ex_put_qa, error = %d\n", error);
if (error) {
exit(-1);
}
num_info = 3;
info[0] = "This is the first information record.";
info[1] = "";
info[2] = " ";
printf("after ex_put_info, error = %d\n", error);
if (error) {
exit(-1);
}
num_glo_vars = 1;
var_names[0] = "glo_vars";
printf("after ex_put_variable_param, error = %d\n", error);
if (error) {
exit(-1);
}
printf("after ex_put_variable_names, error = %d\n", error);
if (error) {
exit(-1);
}
whole_time_step = 1;
num_time_steps = 10;
glob_var_vals = (float *)calloc(num_glo_vars, CPU_word_size);
for (i = 0; i < num_time_steps; i++) {
time_value = (float)(i + 1) / 100.;
error =
ex_put_time(exoid, whole_time_step, &time_value);
printf("after ex_put_time, error = %d\n", error);
if (error) {
exit(-1);
}
for (j = 0; j < num_glo_vars; j++) {
glob_var_vals[j] = (float)(j + 2) * time_value;
}
printf("after ex_put_glob_vars, error = %d\n", error);
if (error) {
exit(-1);
}
whole_time_step++;
printf("after ex_update, error = %d\n", error);
if (error) {
exit(-1);
}
}
free(glob_var_vals);
printf("after ex_close, error = %d\n", error);
if (error) {
exit(-1);
}
return 0;
}
@ EX_GLOBAL
Definition exodusII.h:285
@ EX_ABORT
Definition exodusII.h:392
@ EX_VERBOSE
Definition exodusII.h:390
#define EX_CLOBBER
Definition exodusII.h:101
int ex_put_coord_names(int exoid, char *const coord_names[])
Definition ex_put_coord_names.c:46
int ex_put_init(int exoid, const char *title, int64_t num_dim, int64_t num_nodes, int64_t num_elem, int64_t num_elem_blk, int64_t num_node_sets, int64_t num_side_sets)
Definition ex_put_init.c:53
int ex_put_time(int exoid, int time_step, const void *time_value)
Definition ex_put_time.c:51
int ex_put_variable_names(int exoid, ex_entity_type obj_type, int num_vars, char *const var_names[])
Definition ex_put_variable_names.c:125
int ex_put_variable_param(int exoid, ex_entity_type obj_type, int num_vars)
Definition ex_put_variable_param.c:124
int ex_put_var(int exoid, int time_step, ex_entity_type var_type, int var_index, ex_entity_id obj_id, int64_t num_entries_this_obj, const void *var_vals)
Definition ex_put_var.c:77
#define ex_create(path, mode, comp_ws, io_ws)
Definition exodusII.h:591
int ex_put_qa(int exoid, int num_qa_records, char *qa_record[][4])
Definition ex_put_qa.c:63
int ex_opts(int options)
Definition ex_opts.c:56
int ex_put_info(int exoid, int num_info, char *const info[])
Definition ex_put_info.c:73
int ex_close(int exoid)
Definition ex_close.c:47
int ex_update(int exoid)
Definition ex_update.c:30