#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_elem_in_block[10], num_nodes_per_elem[10], num_attr[10];
int num_node_sets, num_side_sets, error;
int num_node_maps, num_elem_maps;
int i, j, k, m, *elem_map, *connect, *node_map;
int node_list[100], elem_list[100], side_list[100];
int id, ebids[10], ids[10];
int num_nodes_per_set[10], num_elem_per_set[10];
int num_df_per_set[10];
int node_ind[10], elem_ind[10];
int num_qa_rec, num_info;
int num_glo_vars, num_nod_vars, num_ele_vars;
int whole_time_step, num_time_steps;
int CPU_word_size, IO_word_size;
int prop_array[2];
float *glob_var_vals, *nodal_var_vals, *elem_var_vals;
float time_value;
float x[100], y[100], z[100];
float attrib[100], dist_fact[100];
char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
char *emap_names[2];
char *prop_names[2];
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 = 3;
num_nodes = 28;
num_elem = 8;
num_elem_blk = 7;
num_node_sets = 2;
num_side_sets = 5;
error =
ex_put_init(exoid,
"This is testwt1", num_dim, num_nodes, num_elem, num_elem_blk,
num_node_sets, num_side_sets);
printf("after ex_put_init, error = %d\n", error);
x[0] = 0.0;
y[0] = 0.0;
z[0] = 0.0;
x[1] = 1.0;
y[1] = 0.0;
z[1] = 0.0;
x[2] = 1.0;
y[2] = 1.0;
z[2] = 0.0;
x[3] = 0.0;
y[3] = 1.0;
z[3] = 0.0;
x[4] = 1.0;
y[4] = 0.0;
z[4] = 0.0;
x[5] = 2.0;
y[5] = 0.0;
z[5] = 0.0;
x[6] = 2.0;
y[6] = 1.0;
z[6] = 0.0;
x[7] = 1.0;
y[7] = 1.0;
z[7] = 0.0;
x[8] = 0.0;
y[8] = 0.0;
z[8] = 0.0;
x[9] = 10.0;
y[9] = 0.0;
z[9] = 0.0;
x[10] = 10.0;
y[10] = 0.0;
z[10] = -10.0;
x[11] = 1.0;
y[11] = 0.0;
z[11] = -10.0;
x[12] = 1.0;
y[12] = 10.0;
z[12] = 0.0;
x[13] = 10.0;
y[13] = 10.0;
z[13] = 0.0;
x[14] = 10.0;
y[14] = 10.0;
z[14] = -10.0;
x[15] = 1.0;
y[15] = 10.0;
z[15] = -10.0;
x[16] = 0.0;
y[16] = 0.0;
z[16] = 0.0;
x[17] = 1.0;
y[17] = 0.0;
z[17] = 5.0;
x[18] = 10.0;
y[18] = 0.0;
z[18] = 2.0;
x[19] = 7.0;
y[19] = 5.0;
z[19] = 3.0;
x[20] = 100.0;
y[20] = 100.0;
z[20] = 0.0;
x[21] = 50.0;
y[21] = 50.0;
z[21] = 20.0;
x[22] = 3.0;
y[22] = 0.0;
z[22] = 6.0;
x[23] = 6.0;
y[23] = 0.0;
z[23] = 0.0;
x[24] = 0.0;
y[24] = 0.0;
z[24] = 0.0;
x[25] = 3.0;
y[25] = 2.0;
z[25] = 6.0;
x[26] = 6.0;
y[26] = 2.0;
z[26] = 2.0;
x[27] = 0.0;
y[27] = 2.0;
z[27] = 0.0;
printf("after ex_put_coord, error = %d\n", error);
coord_names[0] = "xcoor";
coord_names[1] = "ycoor";
coord_names[2] = "zcoor";
printf("after ex_put_coord_names, error = %d\n", error);
num_node_maps = 1;
num_elem_maps = 2;
printf("after ex_put_map_param, error = %d\n", error);
prop_names[0] = "ORDER";
prop_names[1] = "NUMBER";
printf("after ex_put_prop_names, error = %d\n", error);
elem_map = (int *)calloc(num_elem, sizeof(int));
for (i = 1; i <= num_elem; i++) {
elem_map[i - 1] = i;
}
id = 111;
printf("after ex_put_elem_map, error = %d\n", error);
free(elem_map);
printf("after ex_put_prop, error = %d\n", error);
elem_map = (int *)calloc(num_elem, sizeof(int));
for (i = 1; i <= num_elem; i++) {
elem_map[i - 1] = i * 2;
}
id = 222;
for (i = 1; i <= num_elem; i++) {
printf("after ex_put_partial_elem_map, error = %d\n", error);
}
free(elem_map);
printf("after ex_put_prop, error = %d\n", error);
emap_names[0] = "Element_Map_111";
emap_names[1] = "Element_Map_222";
printf("after ex_put_names, error = %d\n", error);
prop_names[0] = "NUMBER";
printf("after ex_put_prop_names, error = %d\n", error);
node_map = (int *)calloc(num_nodes, sizeof(int));
for (i = 1; i <= num_nodes; i++) {
node_map[i - 1] = i * 3;
}
id = 333;
printf("after ex_put_node_map, error = %d\n", error);
printf("after ex_put_name, error = %d\n", error);
free(node_map);
printf("after ex_put_prop, error = %d\n", error);
num_elem_in_block[0] = 1;
num_elem_in_block[1] = 2;
num_elem_in_block[2] = 1;
num_elem_in_block[3] = 1;
num_elem_in_block[4] = 1;
num_elem_in_block[5] = 1;
num_elem_in_block[6] = 1;
num_nodes_per_elem[0] = 4;
num_nodes_per_elem[1] = 4;
num_nodes_per_elem[2] = 8;
num_nodes_per_elem[3] = 4;
num_nodes_per_elem[4] = 1;
num_nodes_per_elem[5] = 1;
num_nodes_per_elem[6] = 6;
ebids[0] = 10;
ebids[1] = 11;
ebids[2] = 12;
ebids[3] = 13;
ebids[4] = 14;
ebids[5] = 15;
ebids[6] = 16;
num_attr[0] = 3;
num_attr[1] = 3;
num_attr[2] = 3;
num_attr[3] = 3;
num_attr[4] = 3;
num_attr[5] = 3;
num_attr[6] = 3;
num_nodes_per_elem[0], 0, 0, num_attr[0]);
printf("after ex_put_elem_block, error = %d\n", error);
num_nodes_per_elem[1], 0, 0, num_attr[1]);
printf("after ex_put_elem_block, error = %d\n", error);
num_nodes_per_elem[2], 0, 0, num_attr[2]);
printf("after ex_put_elem_block, error = %d\n", error);
num_nodes_per_elem[3], 0, 0, num_attr[3]);
printf("after ex_put_elem_block, error = %d\n", error);
num_nodes_per_elem[4], 0, 0, num_attr[4]);
printf("after ex_put_elem_block, error = %d\n", error);
num_nodes_per_elem[5], 0, 0, num_attr[5]);
printf("after ex_put_elem_block, error = %d\n", error);
num_nodes_per_elem[6], 0, 0, num_attr[6]);
printf("after ex_put_elem_block, error = %d\n", error);
prop_names[0] = "MATL";
prop_names[1] = "DENSITY";
printf("after ex_put_prop_names, error = %d\n", error);
printf("after ex_put_prop, error = %d\n", error);
printf("after ex_put_prop, error = %d\n", error);
printf("after ex_put_prop, error = %d\n", error);
printf("after ex_put_prop, error = %d\n", error);
printf("after ex_put_prop, error = %d\n", error);
printf("after ex_put_prop, error = %d\n", error);
printf("after ex_put_prop, error = %d\n", error);
connect = (int *)calloc(8, sizeof(int));
connect[0] = 1;
connect[1] = 2;
connect[2] = 3;
connect[3] = 4;
printf("after ex_put_elem_conn, error = %d\n", error);
connect[0] = 1;
connect[1] = 2;
connect[2] = 3;
connect[3] = 4;
connect[4] = 5;
connect[5] = 6;
connect[6] = 7;
connect[7] = 8;
printf("after ex_put_elem_conn, error = %d\n", error);
connect[0] = 9;
connect[1] = 10;
connect[2] = 11;
connect[3] = 12;
connect[4] = 13;
connect[5] = 14;
connect[6] = 15;
connect[7] = 16;
printf("after ex_put_elem_conn, error = %d\n", error);
connect[0] = 17;
connect[1] = 18;
connect[2] = 19;
connect[3] = 20;
printf("after ex_put_elem_conn, error = %d\n", error);
connect[0] = 21;
printf("after ex_put_elem_conn, error = %d\n", error);
connect[0] = 22;
printf("after ex_put_elem_conn, error = %d\n", error);
connect[0] = 23;
connect[1] = 24;
connect[2] = 25;
connect[3] = 26;
connect[4] = 27;
connect[5] = 28;
printf("after ex_put_elem_conn, error = %d\n", error);
free(connect);
attrib[0] = 1.0;
attrib[1] = 2.0;
attrib[2] = 3.0;
attrib[3] = 1.11;
attrib[4] = 2.11;
attrib[5] = 3.11;
attrib[6] = 1.12;
attrib[7] = 2.12;
attrib[8] = 3.12;
attrib[9] = 1.2;
attrib[10] = 2.2;
attrib[11] = 3.2;
attrib[12] = 1.3;
attrib[13] = 2.3;
attrib[14] = 3.3;
attrib[15] = 1.4;
attrib[16] = 2.4;
attrib[17] = 3.4;
attrib[18] = 1.5;
attrib[19] = 2.5;
attrib[20] = 3.5;
attrib[21] = 1.6;
attrib[22] = 2.6;
attrib[23] = 3.6;
printf("after ex_put_elem_attr, error = %d\n", error);
printf("after ex_put_elem_attr, error = %d\n", error);
printf("after ex_put_elem_attr, error = %d\n", error);
printf("after ex_put_elem_attr, error = %d\n", error);
printf("after ex_put_elem_attr, error = %d\n", error);
printf("after ex_put_elem_attr, error = %d\n", error);
printf("after ex_put_elem_attr, error = %d\n", error);
ids[0] = 20;
ids[1] = 21;
num_nodes_per_set[0] = 5;
num_nodes_per_set[1] = 3;
node_ind[0] = 0;
node_ind[1] = 5;
node_list[0] = 10;
node_list[1] = 11;
node_list[2] = 12;
node_list[3] = 13;
node_list[4] = 14;
node_list[5] = 20;
node_list[6] = 21;
node_list[7] = 22;
num_df_per_set[0] = 5;
num_df_per_set[1] = 3;
int ns_df_ind[2] = {0, 5};
dist_fact[0] = 1.0;
dist_fact[1] = 2.0;
dist_fact[2] = 3.0;
dist_fact[3] = 4.0;
dist_fact[4] = 5.0;
dist_fact[5] = 1.1;
dist_fact[6] = 2.1;
dist_fact[7] = 3.1;
{
}
printf("after ex_put_concat_node_sets, error = %d\n", error);
printf("after ex_put_prop, error = %d\n", error);
printf("after ex_put_prop, error = %d\n", error);
prop_array[0] = 1000;
prop_array[1] = 2000;
printf("after ex_put_prop_array, error = %d\n", error);
ids[0] = 30;
ids[1] = 31;
ids[2] = 32;
ids[3] = 33;
ids[4] = 34;
ids[5] = 35;
node_list[0] = 8;
node_list[1] = 5;
elem_list[0] = 3;
node_list[2] = 6;
node_list[3] = 7;
elem_list[1] = 3;
node_list[4] = 2;
node_list[5] = 3;
elem_list[2] = 1;
node_list[6] = 7;
node_list[7] = 8;
elem_list[3] = 3;
node_list[8] = 9;
node_list[9] = 12;
node_list[10] = 11;
node_list[11] = 10;
elem_list[4] = 4;
node_list[12] = 11;
node_list[13] = 12;
node_list[14] = 16;
node_list[15] = 15;
elem_list[5] = 4;
node_list[16] = 16;
node_list[17] = 15;
node_list[18] = 11;
node_list[19] = 12;
elem_list[6] = 4;
node_list[20] = 10;
node_list[21] = 11;
node_list[22] = 15;
node_list[23] = 14;
elem_list[7] = 4;
node_list[24] = 13;
node_list[25] = 16;
node_list[26] = 12;
node_list[27] = 9;
elem_list[8] = 4;
node_list[28] = 14;
node_list[29] = 13;
node_list[30] = 9;
node_list[31] = 10;
elem_list[9] = 4;
node_list[32] = 16;
node_list[33] = 13;
node_list[34] = 14;
node_list[35] = 15;
elem_list[10] = 4;
node_list[36] = 17;
node_list[37] = 18;
node_list[38] = 20;
elem_list[11] = 5;
node_list[39] = 18;
node_list[40] = 19;
node_list[41] = 20;
elem_list[12] = 5;
node_list[42] = 20;
node_list[43] = 19;
node_list[44] = 17;
elem_list[13] = 5;
node_list[45] = 19;
node_list[46] = 18;
node_list[47] = 17;
elem_list[14] = 5;
node_list[48] = 21;
elem_list[15] = 6;
node_list[49] = 22;
elem_list[16] = 7;
node_list[50] = 27;
node_list[51] = 26;
node_list[52] = 23;
node_list[53] = 24;
elem_list[17] = 8;
node_list[54] = 28;
node_list[55] = 27;
node_list[56] = 24;
node_list[57] = 25;
elem_list[18] = 8;
node_list[58] = 28;
node_list[59] = 25;
node_list[60] = 23;
node_list[61] = 26;
elem_list[19] = 8;
node_list[62] = 25;
node_list[63] = 24;
node_list[64] = 23;
elem_list[20] = 8;
node_list[65] = 26;
node_list[66] = 27;
node_list[67] = 28;
elem_list[21] = 8;
node_ind[0] = 0;
node_ind[1] = 4;
node_ind[2] = 8;
node_ind[3] = 36;
node_ind[4] = 47;
node_ind[5] = 49;
num_elem_per_set[0] = 2;
num_elem_per_set[1] = 2;
num_elem_per_set[2] = 7;
num_elem_per_set[3] = 4;
num_elem_per_set[4] = 2;
num_elem_per_set[5] = 5;
num_nodes_per_set[0] = 4;
num_nodes_per_set[1] = 4;
num_nodes_per_set[2] = 28;
num_nodes_per_set[3] = 12;
num_nodes_per_set[4] = 2;
num_nodes_per_set[5] = 18;
elem_ind[0] = 0;
elem_ind[1] = 2;
elem_ind[2] = 4;
elem_ind[3] = 11;
elem_ind[4] = 15;
elem_ind[5] = 17;
elem_list, node_list, side_list);
printf("after ex_cvt_nodes_to_sides, error = %d\n", error);
num_df_per_set[0] = 4;
num_df_per_set[1] = 4;
num_df_per_set[2] = 0;
num_df_per_set[3] = 0;
num_df_per_set[4] = 0;
num_df_per_set[5] = 0;
int ss_df_ind[] = {0, 4, 4, 4, 4, 4};
dist_fact[0] = 30.0;
dist_fact[1] = 30.1;
dist_fact[2] = 30.2;
dist_fact[3] = 30.3;
dist_fact[4] = 31.0;
dist_fact[5] = 31.1;
dist_fact[6] = 31.2;
dist_fact[7] = 31.3;
{
}
printf("after ex_put_concat_side_sets, error = %d\n", error);
printf("after ex_put_prop, error = %d\n", error);
printf("after ex_put_prop, error = %d\n", error);
num_qa_rec = 2;
qa_record[0][0] = "TESTWT1";
qa_record[0][1] = "testwt1";
qa_record[0][2] = "03/16/94";
qa_record[0][3] = "15:41:33";
qa_record[1][0] = "FASTQ";
qa_record[1][1] = "fastq";
qa_record[1][2] = "07/07/93";
qa_record[1][3] = "16:41:33";
error =
ex_put_qa(exoid, num_qa_rec, qa_record);
printf("after ex_put_qa, error = %d\n", error);
num_info = 3;
info[0] = "This is the first information record.";
info[1] = "This is the second information record.";
info[2] = "This is the third information record.";
printf("after ex_put_info, error = %d\n", error);
num_glo_vars = 1;
var_names[0] = "glo vars";
printf("after ex_put_variable_param, error = %d\n", error);
printf("after ex_put_variable_name, error = %d\n", error);
num_nod_vars = 2;
var_names[0] = "nod_var0";
var_names[1] = "nod_var1";
printf("after ex_put_variable_param, error = %d\n", error);
printf("after ex_put_variable_names, error = %d\n", error);
num_ele_vars = 3;
var_names[0] = "ele_var0";
var_names[1] = "ele_var1";
var_names[2] = "ele_var2";
printf("after ex_put_variable_param, error = %d\n", error);
printf("after ex_put_variable_names, error = %d\n", error);
whole_time_step = 1;
num_time_steps = 10;
glob_var_vals = (float *)calloc(num_glo_vars, CPU_word_size);
nodal_var_vals = (float *)calloc(num_nodes, CPU_word_size);
elem_var_vals = (float *)calloc(4, 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);
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);
for (k = 1; k <= num_nod_vars; k++) {
for (j = 0; j < num_nodes; j++) {
nodal_var_vals[j] = (float)k + ((float)(j + 1) * time_value);
}
printf("after ex_put_nodal_var, error = %d\n", error);
}
for (k = 1; k <= num_ele_vars; k++) {
for (j = 0; j < num_elem_blk; j++) {
for (m = 0; m < num_elem_in_block[j]; m++) {
elem_var_vals[m] = (float)(k + 1) + (float)(j + 2) + ((float)(m + 1) * time_value);
}
if (k == 1 && j == 2) {
continue;
}
elem_var_vals);
printf("after ex_put_elem_var, error = %d\n", error);
}
}
whole_time_step++;
printf("after ex_update, error = %d\n", error);
}
free(glob_var_vals);
free(nodal_var_vals);
free(elem_var_vals);
printf("after ex_close, error = %d\n", error);
return 0;
}
@ EX_NODE_MAP
Definition exodusII.h:281
@ EX_SIDE_SET
Definition exodusII.h:278
@ EX_NODE_SET
Definition exodusII.h:270
@ EX_NODAL
Definition exodusII.h:268
@ EX_GLOBAL
Definition exodusII.h:285
@ EX_ELEM_MAP
Definition exodusII.h:280
@ EX_ELEM_BLOCK
Definition exodusII.h:275
@ EX_ABORT
Definition exodusII.h:392
@ EX_VERBOSE
Definition exodusII.h:390
#define EX_CLOBBER
Definition exodusII.h:101
int ex_put_names(int exoid, ex_entity_type obj_type, char *const names[])
Definition ex_put_names.c:37
int ex_put_conn(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, const void_int *node_conn, const void_int *elem_edge_conn, const void_int *elem_face_conn)
Definition ex_put_conn.c:44
int ex_put_prop_names(int exoid, ex_entity_type obj_type, int num_props, char **prop_names)
Definition ex_put_prop_names.c:97
int ex_put_coord_names(int exoid, char *const coord_names[])
Definition ex_put_coord_names.c:46
int ex_put_map_param(int exoid, int num_node_maps, int num_elem_maps)
Definition ex_put_map_param.c:37
int ex_put_num_map(int exoid, ex_entity_type map_type, ex_entity_id map_id, const void_int *map)
Definition ex_put_num_map.c:38
int ex_put_coord(int exoid, const void *x_coor, const void *y_coor, const void *z_coor)
Definition ex_put_coord.c:87
int ex_put_prop(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, const char *prop_name, ex_entity_id value)
Definition ex_put_prop.c:77
int ex_put_attr(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, const void *attrib)
Definition ex_put_attr.c:37
int ex_put_prop_array(int exoid, ex_entity_type obj_type, const char *prop_name, const void_int *values)
Definition ex_put_prop_array.c:71
int ex_put_name(int exoid, ex_entity_type obj_type, ex_entity_id entity_id, const char *name)
Definition ex_put_name.c:85
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_partial_num_map(int exoid, ex_entity_type map_type, ex_entity_id map_id, int64_t ent_start, int64_t ent_count, const void_int *map)
Definition ex_put_partial_num_map.c:34
int ex_put_block(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, const char *entry_descrip, int64_t num_entries_this_blk, int64_t num_nodes_per_entry, int64_t num_edges_per_entry, int64_t num_faces_per_entry, int64_t num_attr_per_entry)
Definition ex_put_block.c:47
int ex_put_concat_sets(int exoid, ex_entity_type set_type, const struct ex_set_specs *set_specs)
Definition ex_put_concat_sets.c:37
int ex_put_time(int exoid, int time_step, const void *time_value)
Definition ex_put_time.c:51
int ex_put_variable_name(int exoid, ex_entity_type obj_type, int var_num, const char *var_name)
Definition ex_put_variable_name.c:39
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
int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_nodes_per_set, void_int *side_sets_elem_index, void_int *side_sets_node_index, void_int *side_sets_elem_list, void_int *side_sets_node_list, void_int *side_sets_side_list)
Definition ex_cvt_nodes_to_sides.c:168
#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
Definition exodusII.h:537
void_int * sets_dist_index
Definition exodusII.h:542
void_int * sets_ids
Definition exodusII.h:538
void_int * num_dist_per_set
Definition exodusII.h:540
void * sets_dist_fact
Definition exodusII.h:545
void_int * sets_extra_list
Definition exodusII.h:544
void_int * num_entries_per_set
Definition exodusII.h:539
void_int * sets_entry_list
Definition exodusII.h:543
void_int * sets_entry_index
Definition exodusII.h:541