#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int num_glo_vars = 10;
int num_nod_vars = 2;
int CPU_word_size = 8;
int IO_word_size = 8;
const char *title = "This is a 2D mesh example with tri, quad, beam, truss, circle";
int ebids[] = {100, 200, 300, 400, 500};
int num_dim = 2;
int num_nodes = 13;
int num_elem = 20;
int num_elem_blk = 5;
int num_node_sets = 2;
int num_side_sets = 3;
&CPU_word_size,
&IO_word_size);
ex_put_init(exoid, title, num_dim, num_nodes, num_elem, num_elem_blk, num_node_sets,
num_side_sets);
{
double x[13], y[13];
x[0] = 0.0;
y[0] = 0.0;
x[1] = -0.5;
y[1] = -0.5;
x[2] = 0.5;
y[2] = -0.5;
x[3] = 0.5;
y[3] = 0.5;
x[4] = -0.5;
y[4] = 0.5;
x[5] = -1.0;
y[5] = -1.0;
x[6] = 1.0;
y[6] = -1.0;
x[7] = 1.0;
y[7] = 1.0;
x[8] = -1.0;
y[8] = 1.0;
x[9] = -2.0;
y[9] = 0.0;
x[10] = 0.0;
y[10] = -2.0;
x[11] = 2.0;
y[11] = 0.0;
x[12] = 0.0;
y[12] = 2.0;
}
{
const char *coord_names[] = {"xcoor", "ycoor"};
}
{
int node_map[] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130};
}
{
int elem_map[] = {11, 21, 31, 41, 52, 62, 72, 82, 93, 103,
113, 123, 133, 143, 153, 163, 174, 184, 194, 204};
}
{
const char *block_names[] = {"Triangles", "Quadrilaterals", "", "Trusses", "Circles"};
int num_elem_in_block[] = {4, 4, 4, 4, 4};
int num_nodes_per_elem[] = {3, 4, 2, 2, 1};
num_nodes_per_elem[0], 0, 0, 0);
num_nodes_per_elem[1], 0, 0, 0);
num_nodes_per_elem[2], 0, 0, 3);
num_nodes_per_elem[3], 0, 0, 1);
num_nodes_per_elem[4], 0, 0, 2);
}
{
int conn_t[] = {2, 3, 1, 3, 4, 1, 4, 5, 1, 5, 2, 1};
int conn_q[] = {6, 7, 3, 2, 7, 8, 4, 3, 8, 9, 5, 4, 9, 6, 2, 5};
int conn_B[] = {11, 7, 8, 13, 13, 9, 6, 11};
int conn_T[] = {10, 6, 9, 10, 7, 12, 12, 8};
int conn_c[] = {6, 7, 8, 9};
}
{
const char *attn_T[] = {"Area"};
double attr_T[] = {1.0, 1.1, 1.2, 1.3};
const char *attn_B[] = {"A", "I", "J"};
double attr_B[] = {1.0, 100.0, 200.0, 1.1, 100.1, 200.1, 1.2, 100.2, 200.2, 1.3, 100.3, 200.3};
const char *attn_c[] = {"Radius", "A"};
double attr_c[] = {1.0, 3.14, 1.1, 4.14, 1.2, 5.14, 1.3, 6.14};
}
{
int num_nodes_in_nset[] = {5, 8};
int nsids[] = {20, 22};
int nod1[] = {5, 4, 3, 2, 1};
int nod2[] = {6, 7, 8, 9, 2, 3, 4, 5};
const char *nset_names[] = {"Triangle_Nodes", "Quadrilateral_Nodes"};
}
{
int num_face_in_sset[] = {4, 4, 4};
int ssids[] = {100, 200, 300};
int ss1el[] = {1, 2, 3, 4};
int ss1si[] = {1, 1, 1, 1};
int ss2el[] = {5, 7, 6, 8};
int ss2si[] = {1, 1, 1, 1};
int ss3el[] = {9, 10, 11, 12};
int ss3si[] = {1, 1, 2, 2};
const char *sset_names[] = {"A", "B", "C"};
}
{
const char *gvarn[] = {"g_01", "g_02", "g_03", "g_04", "g_05",
"g_06", "g_07", "g_08", "g_09", "g_10"};
}
{
const char *nvarn[] = {"disp_x", "disp_y"};
}
#if 0
num_ele_vars = 3;
var_names[0] = "this_variable_name_is_short";
var_names[1] = "this_variable_name_is_just_right";
var_names[2] = "this_variable_name_is_tooooo_long";
printf ("after ex_put_variable_param, %d\n", error);
if (error) {
exit(-1);
}
printf ("after ex_put_variable_names, %d\n", error);
if (error) {
exit(-1);
}
{
num_nset_vars = 3;
var_names[0] = "ns_var0";
var_names[1] = "ns_var1";
var_names[2] = "ns_var2";
printf ("after ex_put_variable_param, %d\n", error);
if (error) {
exit(-1);
}
printf ("after ex_put_variable_names, %d\n", error);
if (error) {
exit(-1);
}
}
{
num_sset_vars = 3;
var_names[0] = "ss_var0";
var_names[1] = "ss_var1";
var_names[2] = "ss_var2";
printf ("after ex_put_variable_param, %d\n", error);
if (error) {
exit(-1);
}
printf ("after ex_put_variable_names, %d\n", error);
if (error) {
exit(-1);
}
}
#endif
{
int i, j, k;
int whole_time_step = 1;
int num_time_steps = 10;
double gvar[10];
double nvar[20];
for (i = 0; i < num_time_steps; i++) {
double time_value = (double)(i) / 100.;
for (j = 0; j < num_glo_vars; j++) {
gvar[j] = (double)(j + 2) * time_value;
}
for (k = 0; k < num_nod_vars; k++) {
for (j = 0; j < num_nodes; j++) {
nvar[j] = (double)k + ((double)(j + 1) * time_value);
}
}
#if 0
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);
}
num_elem_in_block[j], elem_var_vals);
printf ("after ex_put_elem_var, %d\n", error);
if (error) {
exit(-1);
}
}
}
for (k=1; k<=num_sset_vars; k++)
{
for (j=0; j<num_side_sets; j++)
{
for (m=0; m<num_face_in_sset[j]; m++)
{
sset_var_vals[m] = (float)(k+2) + (float)(j+3) +
((float)(m+1)*time_value);
}
num_face_in_sset[j], sset_var_vals);
printf ("after ex_put_sset_var, %d\n", error);
if (error) {
exit(-1);
}
}
}
for (k=1; k<=num_nset_vars; k++)
{
for (j=0; j<num_node_sets; j++)
{
for (m=0; m<num_nodes_in_nset[j]; m++)
{
nset_var_vals[m] = (float)(k+3) + (float)(j+4) +
((float)(m+1)*time_value);
}
num_nodes_in_nset[j], nset_var_vals);
printf ("after ex_put_nset_var, %d\n", error);
if (error) {
exit(-1);
}
}
}
#endif
whole_time_step++;
}
}
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_VERBOSE
Definition exodusII.h:390
SEACAS_DEPRECATED int ex_put_nset_var(int exoid, int time_step, int nset_var_index, ex_entity_id nset_id, int64_t num_nodes_this_nset, const void *nset_var_vals)
Definition ex_put_nset_var.c:47
SEACAS_DEPRECATED int ex_put_sset_var(int exoid, int time_step, int sset_var_index, ex_entity_id sset_id, int64_t num_faces_this_sset, const void *sset_var_vals)
Definition ex_put_sset_var.c:46
SEACAS_DEPRECATED int ex_put_elem_var(int exoid, int time_step, int elem_var_index, ex_entity_id elem_blk_id, int64_t num_elem_this_blk, const void *elem_var_vals)
Definition ex_put_elem_var.c:114
#define EX_CLOBBER
Definition exodusII.h:101
int ex_put_set_param(int exoid, ex_entity_type set_type, ex_entity_id set_id, int64_t num_entries_in_set, int64_t num_dist_fact_in_set)
Definition ex_put_set_param.c:39
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_coord_names(int exoid, char *const coord_names[])
Definition ex_put_coord_names.c:46
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_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_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_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_set(int exoid, ex_entity_type set_type, ex_entity_id set_id, const void_int *set_entry_list, const void_int *set_extra_list)
Definition ex_put_set.c:41
int ex_put_attr_names(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, char **names)
int ex_put_id_map(int exoid, ex_entity_type map_type, const void_int *map)
Definition ex_put_id_map.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_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_opts(int options)
Definition ex_opts.c:56
int ex_close(int exoid)
Definition ex_close.c:47