31 static void do_logging(
int loglv,
int msgno,
int add_location,
const char *fmt,
40 if (strlen(msg) > 0) s =
": ";
51 static void set_err(
int msgno,
const char *fmt, ...) {
59 static void set_err_token(
int token,
int msgno,
const char *fmt, ...) {
77 static int read_input(
int msgno_invalid_token) {
83 set_err_token(token, msgno_invalid_token,
"'=' required after INPUT");
88 set_err_token(token, msgno_invalid_token,
"Invalid filename for INPUT");
101 snprintf(include_filename,
sizeof(include_filename),
"%s", p);
110 snprintf(include_filename,
sizeof(include_filename),
"%s%s%s", dname,
separator, p);
117 static int read_amp_head(
void) {
136 static int read_amp_param_name(
char *name,
size_t name_len) {
148 "NAME must begin with a letter or '_'");
156 snprintf(name, name_len,
"%s", p);
165 static int read_amp_param_type(
int *type) {
182 static int read_amp_param_definition(
int *definition) {
199 static int read_amp_param_time(
int *time) {
216 static int read_amp_param_value(
int *value) {
236 static int read_amp_data(
char *name,
int type,
int definition,
int time,
289 if (token ==
',' && i == NITEM) {
303 static int read_amplitude(
void) {
311 int flag_definition = 0;
319 ST_HEADER_LINE_PARAM,
325 state = ST_HEADER_LINE;
326 while (state != ST_FINISHED) {
327 if (state == ST_HEADER_LINE) {
328 if (read_amp_head())
return -1;
329 state = ST_HEADER_LINE_PARAM;
330 }
else if (state == ST_HEADER_LINE_PARAM) {
334 if (read_amp_param_name(name,
sizeof(name)))
return -1;
338 if (read_amp_param_type(&type))
return -1;
342 if (read_amp_param_definition(&definition))
return -1;
346 if (read_amp_param_time(&time))
return -1;
350 if (read_amp_param_value(&value))
return -1;
369 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
370 }
else if (token ==
',') {
376 }
else if (state == ST_DATA_INCLUDE) {
381 state = ST_DATA_LINE;
382 }
else if (state == ST_DATA_LINE) {
384 if (read_amp_data(name, type, definition, time, value))
return -1;
402 static int read_contact_or_insert_pair_head(
int *last_token,
int *type) {
419 "',' or NL required after !CONTACT");
427 static int read_contact_pair_param_name(
char *name,
size_t name_len) {
439 "NAME must begin with a letter or '_'");
447 snprintf(name, name_len,
"%s", p);
456 static int read_contact_pair_param_type(
int *type) {
478 static int read_contact_pair_data(
char *name,
int type) {
480 char *slave_grp, *master_grp;
495 if (slave_grp ==
NULL) {
529 if (master_grp ==
NULL) {
555 static int read_contact_pair(
void) {
564 ST_HEADER_LINE_PARAM,
569 state = ST_HEADER_LINE;
570 while (state != ST_FINISHED) {
571 if (state == ST_HEADER_LINE) {
572 if (read_contact_or_insert_pair_head(&token,&type))
return -1;
574 state = ST_DATA_LINE;
575 }
else if (token ==
',') {
576 state = ST_HEADER_LINE_PARAM;
580 }
else if (state == ST_HEADER_LINE_PARAM) {
584 if (read_contact_pair_param_name(name,
sizeof(name)))
return -1;
588 if (read_contact_pair_param_type(&type))
return -1;
607 state = ST_DATA_INCLUDE;
609 state = ST_DATA_LINE;
611 }
else if (token ==
',') {
617 }
else if (state == ST_DATA_INCLUDE) {
621 state = ST_DATA_LINE;
622 }
else if (state == ST_DATA_LINE) {
623 if (read_contact_pair_data(name, type))
return -1;
644 fprintf(stderr,
"!ECOPY has not implemented yet\n");
653 fprintf(stderr,
"!EGEN has not implemented yet\n");
661 static int read_egrp_head(
void) {
680 static int read_egrp_param_egrp(
char *egrp,
size_t egrp_len) {
692 "EGRP must begin with a letter or '_'");
700 snprintf(egrp, egrp_len,
"%s", p);
706 if (strcmp(egrp,
"ALL") == 0) {
713 static int read_egrp_data(
char *egrp) {
714 int i, n, *elem, token;
751 "',' or NL required after element ID");
781 static int read_egrp_generate(
char *egrp) {
782 int i, n,
id, *elem, token;
783 int elem1, elem2, elem3;
842 "',' or NL required after elem2");
850 "Cannot generate between %d and %d with an increment of %d",
851 elem1, elem2, elem3);
854 if ((elem2 - elem1) % elem3) {
856 "Cannot generate between %d and %d with an increment of %d",
857 elem1, elem2, elem3);
861 n = (elem2 - elem1) / elem3 + 1;
869 for (
id = elem1;
id <= elem2;
id += elem3) {
887 static int read_egroup(
void) {
890 int flag_generate = 0;
896 ST_HEADER_LINE_PARAM,
899 ST_DATA_LINE_GENERATE
902 state = ST_HEADER_LINE;
903 while (state != ST_FINISHED) {
904 if (state == ST_HEADER_LINE) {
905 if (read_egrp_head())
return -1;
906 state = ST_HEADER_LINE_PARAM;
907 }
else if (state == ST_HEADER_LINE_PARAM) {
911 if (read_egrp_param_egrp(egrp,
sizeof(egrp)))
return -1;
929 state = ST_DATA_INCLUDE;
930 }
else if (flag_generate) {
931 state = ST_DATA_LINE_GENERATE;
933 state = ST_DATA_LINE;
940 }
else if (token ==
',') {
946 }
else if (state == ST_DATA_INCLUDE) {
951 state = flag_generate ? ST_DATA_LINE_GENERATE : ST_DATA_LINE;
952 }
else if (state == ST_DATA_LINE) {
956 if (read_egrp_data(egrp))
return -1;
964 }
else if (state == ST_DATA_LINE_GENERATE) {
968 if (read_egrp_generate(egrp))
return -1;
980 static int read_elem_head(
void) {
999 static int read_elem_param_type(
int *type) {
1020 static int read_elem_param_egrp(
char *egrp,
size_t egrp_len) {
1032 "EGRP must begin with a letter or '_'");
1040 snprintf(egrp, egrp_len,
"%s", p);
1046 if (strcmp(egrp,
"ALL") == 0) {
1053 static int read_elem_param_nmatitem(
int *nmatitem) {
1067 if (*nmatitem < 0) {
1074 static int read_elem_data_conn(
int *
id,
int nnode,
int *node) {
1111 if (i == nnode - 1)
break;
1117 "',' or NL required after connectivity");
1126 static int read_elem_data_mat(
int nmatitem,
double *matitem) {
1130 for (i = 0; i < nmatitem; i++) {
1135 for (i = 0; i < nmatitem; i++) {
1149 if (i == nmatitem - 1) {
1164 static int read_element(
void) {
1169 double *matitem =
NULL;
1174 int flag_matitem = 0;
1180 st_header_line_param,
1184 st_data_line_matitem,
1185 st_data_line_regist,
1189 state = st_header_line;
1190 while (state != st_finished) {
1191 if (state == st_header_line) {
1192 if (read_elem_head())
return -1;
1193 state = st_header_line_param;
1194 }
else if (state == st_header_line_param) {
1198 if (read_elem_param_type(&type))
return -1;
1202 if (read_elem_param_egrp(egrp,
sizeof(egrp)))
return -1;
1206 if (read_elem_param_nmatitem(&nmatitem))
return -1;
1226 }
else if (token ==
',') {
1232 }
else if (state == st_prepare) {
1250 if (flag_matitem && nmatitem) {
1253 if (matitem ==
NULL) {
1262 state = flag_input ? st_data_include : st_data_line_conn;
1263 }
else if (state == st_data_include) {
1268 state = st_data_line_conn;
1269 }
else if (state == st_data_line_conn) {
1272 if (read_elem_data_conn(&
id, nnode, node))
return -1;
1280 "',' or NL required after connectivity");
1289 state = st_data_line_matitem;
1295 state = st_data_line_regist;
1297 }
else if (state == st_data_line_matitem) {
1303 if (read_elem_data_mat(nmatitem, matitem))
return -1;
1304 state = st_data_line_regist;
1305 }
else if (state == st_data_line_regist) {
1326 state = st_data_line_conn;
1328 state = st_finalize;
1331 }
else if (state == st_finalize) {
1336 state = st_finished;
1347 static int read_equation_head(
int *last_token) {
1360 "',' or NL required after !EQUATION");
1363 *last_token = token;
1368 static int read_equation_data_line1(
int *neq,
double *cnst) {
1382 if (strcmp(p,
"link") == 0 || strcmp(p,
"LINK") == 0) {
1421 static int read_equation_data_line2(
int neq,
double cnst) {
1427 const int NITEM = 100;
1429 struct hecmw_io_mpcitem *mpcitem;
1430 bool isAllDof =
false;
1433 if (mpcitem ==
NULL) {
1441 if (strcmp(p,
"link") == 0 || strcmp(p,
"LINK") == 0) {
1449 for (i = 0; i < neq; i++) {
1460 mpcitem[i].ngrp[0] =
'\0';
1472 snprintf(mpcitem[i].ngrp,
sizeof(mpcitem[i].ngrp),
"%s", p);
1478 mpcitem[i].node = -1;
1499 if (mpcitem[i].dof == 0) {
1527 "',' or NL required after coefficient");
1530 if (token ==
',' && i == NITEM - 1) {
1543 for (i = 0; i < neq; i++) {
1547 for (i = 0; i < neq; i++) {
1551 for (i = 0; i < neq; i++) {
1562 }
else if (is_link == 1) {
1577 mpcitem[0].ngrp[0] =
'\0';
1592 mpcitem[1].ngrp[0] =
'\0';
1593 mpcitem[1].a = -1.0;
1618 static int read_equation(
void) {
1627 ST_HEADER_LINE_PARAM,
1633 state = ST_HEADER_LINE;
1634 while (state != ST_FINISHED) {
1635 if (state == ST_HEADER_LINE) {
1636 if (read_equation_head(&token))
return -1;
1638 state = ST_HEADER_LINE_PARAM;
1640 state = ST_DATA_LINE1;
1644 }
else if (state == ST_HEADER_LINE_PARAM) {
1658 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE1;
1663 }
else if (state == ST_DATA_INCLUDE) {
1667 state = ST_DATA_LINE1;
1668 }
else if (state == ST_DATA_LINE1) {
1669 if (read_equation_data_line1(&neq, &cnst))
return -1;
1670 state = ST_DATA_LINE2;
1671 }
else if (state == ST_DATA_LINE2) {
1673 if (read_equation_data_line2(neq, cnst))
return -1;
1678 state = ST_DATA_LINE1;
1681 if (strcmp(p,
"link") == 0 || strcmp(p,
"LINK") == 0) {
1682 state = ST_DATA_LINE1;
1684 state = ST_FINISHED;
1687 state = ST_FINISHED;
1700 static int read_header(
void) {
1725 while (*p && *p ==
' ') p++;
1726 if (p ==
NULL) p =
"";
1727 snprintf(
header->header,
sizeof(
header->header),
"%s", p);
1747 static int read_include(
void) {
1792 static int read_initial_head(
void) {
1811 static int read_initial_param_type(
int *type) {
1828 static int read_initial_data(
int type) {
1892 static int read_initial(
void) {
1900 ST_HEADER_LINE_PARAM,
1905 state = ST_HEADER_LINE;
1906 while (state != ST_FINISHED) {
1907 if (state == ST_HEADER_LINE) {
1908 if (read_initial_head())
return -1;
1909 state = ST_HEADER_LINE_PARAM;
1910 }
else if (state == ST_HEADER_LINE_PARAM) {
1914 if (read_initial_param_type(&type))
return -1;
1929 state = ST_DATA_INCLUDE;
1931 state = ST_DATA_LINE;
1938 }
else if (token ==
',') {
1944 }
else if (state == ST_DATA_INCLUDE) {
1948 state = ST_DATA_LINE;
1949 }
else if (state == ST_DATA_LINE) {
1951 if (read_initial_data(type))
return -1;
1956 state = ST_FINISHED;
1969 static int read_matitem_head(
int *item,
int *last_token) {
2004 *last_token = token;
2009 static int read_matitem_param_subitem(
int *subitem) {
2024 if (*subitem <= 0) {
2031 static int read_matitem_data(
int subitem,
int depend_temp,
2032 struct hecmw_io_matitem *matitem) {
2036 struct hecmw_io_matsubitem *p, *q, *msitem;
2039 if (msitem ==
NULL) {
2050 for (i = 0; i < subitem; i++) {
2054 for (i = 0; i < subitem; i++) {
2059 }
else if (token ==
',') {
2093 for (p = matitem->subitem; p; p = (q = p)->next)
2095 if (q && temp <= q->temp) {
2112 msitem->temp = temp;
2113 msitem->next =
NULL;
2116 for (p = matitem->subitem; p; p = (q = p)->next)
2119 matitem->subitem = msitem;
2127 static int read_matitem(
struct hecmw_io_matitem *matitem) {
2132 int flag_subitem = 0;
2133 int depend_temp = 0;
2137 ST_HEADER_LINE_PARAM,
2144 state = ST_HEADER_LINE;
2145 while (state != ST_FINISHED) {
2146 if (state == ST_HEADER_LINE) {
2147 if (read_matitem_head(&item, &token))
return -1;
2149 state = ST_HEADER_LINE_PARAM;
2154 }
else if (state == ST_HEADER_LINE_PARAM) {
2157 if (read_matitem_param_subitem(&subitem))
return -1;
2173 }
else if (state == ST_PREPARE) {
2178 matitem->item = item;
2179 matitem->nval = subitem;
2180 matitem->subitem =
NULL;
2185 state = ST_DATA_LINE;
2186 }
else if (state == ST_DATA_LINE) {
2191 if (read_matitem_data(subitem, depend_temp, matitem))
return -1;
2197 state = ST_FINISHED;
2207 static int read_material_head(
void) {
2226 static int read_material_param_name(
char *name,
size_t name_len) {
2238 "NAME must begin with a letter or '_'");
2246 snprintf(name, name_len,
"%s", p);
2259 static int read_material_param_item(
int *item) {
2280 static int matitem_comp(
const void *matitem1,
const void *matitem2) {
2281 const struct hecmw_io_matitem *m1, *m2;
2286 if (m1->item == m2->item)
return 0;
2287 if (m1->item < m2->item) {
2294 static int read_material_data(
int item,
char *name) {
2297 struct hecmw_io_matitem *matitem;
2306 if (matitem ==
NULL) {
2311 for (i = 0; i < item; i++) {
2312 if (read_matitem(&matitem[i]))
return -1;
2316 qsort(matitem, item,
sizeof(*matitem), matitem_comp);
2319 for (i = 0; i < item; i++) {
2320 if (matitem[i].item != i + 1) {
2327 snprintf(mat->
name,
sizeof(mat->
name),
"%s", name);
2329 mat->
item = matitem;
2338 static int read_material(
void) {
2348 ST_HEADER_LINE_PARAM,
2353 state = ST_HEADER_LINE;
2354 while (state != ST_FINISHED) {
2355 if (state == ST_HEADER_LINE) {
2356 if (read_material_head())
return -1;
2357 state = ST_HEADER_LINE_PARAM;
2358 }
else if (state == ST_HEADER_LINE_PARAM) {
2362 if (read_material_param_name(name,
sizeof(name)))
return -1;
2366 if (read_material_param_item(&item))
return -1;
2385 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
2386 }
else if (token ==
',') {
2392 }
else if (state == ST_DATA_INCLUDE) {
2396 state = ST_DATA_LINE;
2397 }
else if (state == ST_DATA_LINE) {
2399 if (read_material_data(item, name))
return -1;
2400 state = ST_FINISHED;
2414 fprintf(stderr,
"!NCOPY has not implemented yet\n");
2423 fprintf(stderr,
"!NFILL has not implemented yet\n");
2432 fprintf(stderr,
"!NGEN has not implemented yet\n");
2440 static int read_ngrp_head(
void) {
2459 static int read_ngrp_param_ngrp(
char *ngrp,
size_t ngrp_len) {
2471 "NGRP must begin with a letter or '_'");
2479 snprintf(ngrp, ngrp_len,
"%s", p);
2485 if (strcmp(ngrp,
"EQUATION_BLOCK") == 0) {
2489 if (strcmp(ngrp,
"ALL") == 0) {
2496 static int read_ngrp_data(
char *ngrp) {
2497 int i, n, *node, token;
2534 "',' or NL required after node ID");
2562 static int read_ngrp_generate(
char *ngrp) {
2563 int i, n,
id, *node, token;
2564 int nod1, nod2, nod3;
2630 "Cannot generate between %d and %d with an increment of %d", nod1,
2634 if ((nod2 - nod1) % nod3) {
2636 "Cannot generate between %d and %d with an increment of %d", nod1,
2641 n = (nod2 - nod1) / nod3 + 1;
2649 for (
id = nod1;
id <= nod2;
id += nod3) {
2667 static int read_ngroup(
void) {
2670 int flag_generate = 0;
2676 st_header_line_param,
2679 st_data_line_generate
2682 state = st_header_line;
2683 while (state != st_finished) {
2684 if (state == st_header_line) {
2685 if (read_ngrp_head())
return -1;
2686 state = st_header_line_param;
2687 }
else if (state == st_header_line_param) {
2691 if (read_ngrp_param_ngrp(ngrp,
sizeof(ngrp)))
return -1;
2709 state = st_data_include;
2710 }
else if (flag_generate) {
2711 state = st_data_line_generate;
2713 state = st_data_line;
2720 }
else if (token ==
',') {
2726 }
else if (state == st_data_include) {
2730 state = flag_generate ? st_data_line_generate : st_data_line;
2731 }
else if (state == st_data_line) {
2733 if (read_ngrp_data(ngrp))
return -1;
2738 state = st_finished;
2741 }
else if (state == st_data_line_generate) {
2744 if (read_ngrp_generate(ngrp))
return -1;
2745 state = st_finished;
2756 static int read_node_head(
int *last_token) {
2771 *last_token = token;
2776 static int read_node_param_system(
int *system) {
2785 if (token !=
'C' && token !=
'R') {
2793 static int read_node_param_ngrp(
char *ngrp,
size_t ngrp_len) {
2805 "NGRP must begin with a letter or '_'");
2813 snprintf(ngrp, ngrp_len,
"%s", p);
2819 if (strcmp(ngrp,
"ALL") == 0) {
2826 static int read_node_data(
int *id_arg,
double *x_arg,
double *y_arg,
2925 static int read_node_convert_coord(
int system,
double *x,
double *y,
2935 if (system ==
'C') {
2955 static int read_node(
void) {
2958 int flag_system = 0;
2965 ST_HEADER_LINE_PARAM,
2970 state = ST_HEADER_LINE;
2971 while (state != ST_FINISHED) {
2972 if (state == ST_HEADER_LINE) {
2973 if (read_node_head(&token))
return -1;
2975 state = ST_DATA_LINE;
2976 }
else if (token ==
',') {
2977 state = ST_HEADER_LINE_PARAM;
2981 }
else if (state == ST_HEADER_LINE_PARAM) {
2985 if (read_node_param_system(&system))
return -1;
2989 if (read_node_param_ngrp(ngrp,
sizeof(ngrp)))
return -1;
3003 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
3004 }
else if (token ==
',') {
3010 }
else if (state == ST_DATA_INCLUDE) {
3013 state = ST_DATA_LINE;
3014 }
else if (state == ST_DATA_LINE) {
3018 if (read_node_data(&
id, &
x, &
y, &
z))
return -1;
3019 if (read_node_convert_coord(system, &
x, &
y, &
z))
return -1;
3034 state = ST_FINISHED;
3036 state = ST_DATA_LINE;
3049 static int read_section_head(
void) {
3068 static int read_section_param_type(
int *type) {
3092 static int read_section_param_egrp(
char *egrp,
size_t egrp_len) {
3104 "EGRP must begin with a letter or '_'");
3112 snprintf(egrp, egrp_len,
"%s", p);
3121 static int read_section_param_material(
char *material,
size_t material_len) {
3133 "MATERIAL must begin with a letter or '_'");
3141 snprintf(material, material_len,
"%s", p);
3152 read_section_param_composite(
int *composite)
3168 if(*composite <= 0) {
3176 static int read_section_param_secopt(
int *secopt_arg) {
3199 *secopt_arg = secopt;
3204 static int read_section_solid(
union hecmw_io_section_item *sect_item) {
3224 if (thickness <= 0.0) {
3230 sect_item->solid.thickness = thickness;
3235 static int read_section_shell(
union hecmw_io_section_item *sect_item) {
3237 int token, integpoints;
3247 if (thickness <= 0.0) {
3267 if (integpoints <= 0) {
3280 sect_item->shell.thickness = thickness;
3281 sect_item->shell.integpoints = integpoints;
3286 static int read_section_beam(
union hecmw_io_section_item *sect_item) {
3287 double nx, ny, nz, area, Iyy, Izz, Jx;
3419 sect_item->beam.vxyz[0] = nx;
3420 sect_item->beam.vxyz[1] = ny;
3421 sect_item->beam.vxyz[2] = nz;
3422 sect_item->beam.area = area;
3423 sect_item->beam.Iyy = Iyy;
3424 sect_item->beam.Izz = Izz;
3425 sect_item->beam.Jx = Jx;
3430 static int read_section_interface(
union hecmw_io_section_item *sect_item) {
3433 double gapcon = 0.0;
3434 double gaprad1 = 0.0;
3435 double gaprad2 = 0.0;
3446 if (thickness <= 0.0) {
3455 "',' or NL reuqired after THICKNESS");
3464 }
else if (token ==
',') {
3477 "',' or NL reuiqred after GAPCON");
3486 }
else if (token ==
',') {
3499 "',' or NL reuqired after GAPRAD1");
3525 sect_item->interface.thickness = thickness;
3526 sect_item->interface.gapcon = gapcon;
3527 sect_item->interface.gaprad1 = gaprad1;
3528 sect_item->interface.gaprad2 = gaprad2;
3533 static int read_section(
void) {
3538 union hecmw_io_section_item sect_item;
3541 int flag_material = 0;
3542 int flag_composite = 0;
3543 int flag_secopt = 0;
3550 ST_HEADER_LINE_PARAM,
3555 ST_DATA_LINE_INTERFACE,
3559 state = ST_HEADER_LINE;
3560 while (state != ST_FINISHED) {
3561 if (state == ST_HEADER_LINE) {
3562 if (read_section_head())
return -1;
3563 state = ST_HEADER_LINE_PARAM;
3564 }
else if (state == ST_HEADER_LINE_PARAM) {
3568 if (read_section_param_type(&type))
return -1;
3572 if (read_section_param_egrp(egrp,
sizeof(egrp)))
return -1;
3576 if (flag_composite) {
3580 if (read_section_param_material(material,
sizeof(material)))
return -1;
3589 if(read_section_param_composite(&composite))
return -1;
3594 if (read_section_param_secopt(&secopt))
return -1;
3619 state = ST_DATA_INCLUDE;
3621 state = ST_DATA_LINE_SOLID;
3623 state = ST_DATA_LINE_SHELL;
3625 state = ST_DATA_LINE_BEAM;
3627 state = ST_DATA_LINE_INTERFACE;
3631 }
else if (token ==
',') {
3637 }
else if (state == ST_DATA_INCLUDE) {
3644 state = ST_DATA_LINE_SOLID;
3646 state = ST_DATA_LINE_SHELL;
3648 state = ST_DATA_LINE_BEAM;
3650 state = ST_DATA_LINE_INTERFACE;
3654 }
else if (state == ST_DATA_LINE_SOLID) {
3659 if (read_section_solid(§_item))
return -1;
3660 state = ST_DATA_LINE_REGIST;
3661 }
else if (state == ST_DATA_LINE_SHELL) {
3666 if (read_section_shell(§_item))
return -1;
3667 state = ST_DATA_LINE_REGIST;
3668 }
else if (state == ST_DATA_LINE_BEAM) {
3673 if (read_section_beam(§_item))
return -1;
3674 state = ST_DATA_LINE_REGIST;
3675 }
else if (state == ST_DATA_LINE_INTERFACE) {
3680 if (read_section_interface(§_item))
return -1;
3681 state = ST_DATA_LINE_REGIST;
3682 }
else if (state == ST_DATA_LINE_REGIST) {
3693 sect.sect = sect_item;
3700 state = ST_FINISHED;
3711 static int read_sgrp_head(
void) {
3730 static int read_sgrp_param_sgrp(
char *sgrp,
size_t sgrp_len) {
3742 "SGRP must begin with a letter or '_'");
3750 snprintf(sgrp, sgrp_len,
"%s", p);
3759 static int read_sgrp_data(
char *sgrp) {
3760 int i, n, *elem, *surf, token;
3761 struct hecmw_io_id *elem_head, *surf_head, *elem_prev, *surf_prev;
3762 struct hecmw_io_id *eid, *sid, *pe, *qe, *ps, *qs;
3765 elem_head = surf_head =
NULL;
3766 elem_prev = surf_prev =
NULL;
3785 if (elem_head ==
NULL) {
3786 elem_head = elem_prev = eid;
3788 elem_prev->
next = eid;
3814 if (surf_head ==
NULL) {
3815 surf_head = surf_prev = sid;
3817 surf_prev->
next = sid;
3827 "',' or NL required after surface ID");
3849 for (i = 0; i < n; i++) {
3870 static int read_sgroup(
void) {
3878 ST_HEADER_LINE_PARAM,
3883 state = ST_HEADER_LINE;
3884 while (state != ST_FINISHED) {
3885 if (state == ST_HEADER_LINE) {
3886 if (read_sgrp_head())
return -1;
3887 state = ST_HEADER_LINE_PARAM;
3888 }
else if (state == ST_HEADER_LINE_PARAM) {
3892 if (read_sgrp_param_sgrp(sgrp,
sizeof(sgrp)))
return -1;
3911 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
3912 }
else if (token ==
',') {
3918 }
else if (state == ST_DATA_INCLUDE) {
3922 state = ST_DATA_LINE;
3923 }
else if (state == ST_DATA_LINE) {
3925 if (read_sgrp_data(sgrp))
return -1;
3930 state = ST_FINISHED;
3932 state = ST_DATA_LINE;
3946 read_system_head(
void)
3977 }
else if(token ==
',') {
3996 }
else if(token ==
',') {
4029 *last_token = token;
4044 }
else if(token ==
',') {
4063 }
else if(token ==
',') {
4110 }
else if(token ==
',') {
4129 }
else if(token ==
',') {
4180 if(system ==
NULL) {
4196 state = ST_HEADER_LINE;
4197 while(state != ST_FINISHED) {
4198 if(state == ST_HEADER_LINE) {
4199 if(read_system_head())
return -1;
4206 state = ST_FINISHED;
4208 state = ST_DATA_LINE1;
4211 }
else if(state == ST_DATA_LINE1) {
4212 if(read_system_data_line1a(system, &token))
return -1;
4214 state = ST_FINISHED;
4219 if(read_system_data_line1b(system))
return -1;
4222 state = ST_FINISHED;
4224 state = ST_DATA_LINE2;
4227 }
else if(state == ST_DATA_LINE2) {
4228 if(read_system_data_line2(system))
return -1;
4229 state = ST_FINISHED;
4245 static int read_zero(
void) {
4280 if (new_zero ==
NULL) {
4295 static int read_connectivity(
void) {
4309 "',' or NL reqyured after !CONNECTIVITY");
4355 connectivity_type = type;
4367 static struct read_func_table {
4370 } read_func_table[] = {
4395 #define N_READ_FUNC (sizeof(read_func_table) / sizeof(read_func_table[0]))
4398 static ReadFunc get_read_func(
int token) {
4402 if (token == read_func_table[i].token) {
4403 return read_func_table[i].func;
4409 static int parse(
void) {
4419 func = get_read_func(token);
4430 if ((*func)())
return -1;
4441 if (filename ==
NULL) {
4444 "Not specified filename for HECMW-ENTIRE mesh input routine");
4454 snprintf(grid_filename,
sizeof(grid_filename),
"%s", filename);
4457 if ((fp = fopen(filename,
"r")) ==
NULL) {
4476 snprintf(grid_filename,
sizeof(grid_filename),
"Unknown");
4489 if (local_mesh ==
NULL)
return NULL;
4492 snprintf(grid_filename,
sizeof(grid_filename),
"Unknown");
HECMW_Comm HECMW_comm_get_comm(void)
#define HECMW_MAX_NODE_MAX
#define HECMW_FILENAME_LEN
int HECMW_convert_connectivity(int from, int hecmw_etype, int *conn)
#define HECMW_CONNTYPE_ABAQUS
#define HECMW_CONNTYPE_NASTRAN
#define HECMW_CONNTYPE_HECMW
int HECMW_set_error(int errorno, const char *fmt,...)
int HECMW_get_max_node(int etype)
int HECMW_cylindrical_to_cartesian(const struct hecmw_coord *coord, struct hecmw_coord *result)
double HECMW_degree_to_radian(double deg)
char * HECMW_heclex_get_text(void)
int HECMW_heclex_next_token(void)
double HECMW_heclex_get_number(void)
int HECMW_heclex_switch_to_include(const char *filename)
int HECMW_heclex_unput_token(void)
int HECMW_heclex_get_lineno(void)
int HECMW_heclex_set_input(FILE *fp)
@ HECMW_HECLEX_K_SURF_SURF
@ HECMW_HECLEX_K_GENERATE
@ HECMW_HECLEX_H_EMBED_PAIR
@ HECMW_HECLEX_H_EQUATION
@ HECMW_HECLEX_K_COMPOSITE
@ HECMW_HECLEX_K_DEFINITION
@ HECMW_HECLEX_K_MATERIAL
@ HECMW_HECLEX_H_CONNECTIVITY
@ HECMW_HECLEX_K_ABSOLUTE
@ HECMW_HECLEX_K_RELATIVE
@ HECMW_HECLEX_H_MATERIAL
@ HECMW_HECLEX_K_NODE_SURF
@ HECMW_HECLEX_H_AMPLITUDE
@ HECMW_HECLEX_H_CONTACT_PAIR
@ HECMW_HECLEX_K_INTERFACE
@ HECMW_HECLEX_K_STEP_TIME
@ HECMW_HECLEX_K_NODE_ELEM
@ HECMW_HECLEX_K_TEMPERATURE
@ HECMW_HECLEX_K_TIMEVALUE
int HECMW_heclex_is_including(void)
int HECMW_read_entire_mesh(const char *filename)
struct hecmwST_local_mesh * HECMW_get_entire_mesh(const char *filename)
struct hecmw_io_mpc * HECMW_io_add_mpc(int neq, const struct hecmw_io_mpcitem *mpcitem, double cnst)
int HECMW_io_check_mpc_dof(int dof)
int HECMW_io_is_reserved_name(const char *name)
int HECMW_io_add_ngrp(const char *name, int nnode, int *node)
struct hecmw_io_section * HECMW_io_add_sect(struct hecmw_io_section *sect)
int HECMW_io_add_sgrp(const char *name, int n_item, int *elem, int *surf)
struct hecmw_io_amplitude * HECMW_io_add_amp(const char *name, int definition, int time, int value, double val, double t)
int HECMW_io_add_egrp(const char *name, int nelem, int *elem)
struct hecmw_io_initial * HECMW_io_add_initial(int type, int node, const char *ngrp, double val)
struct hecmw_io_contact * HECMW_io_add_contact(const char *name, int type, const char *slave_grp, const char *master_grp)
struct hecmw_io_material * HECMW_io_add_mat(const char *name, struct hecmw_io_material *mat)
struct hecmwST_local_mesh * HECMW_io_make_local_mesh(void)
void HECMW_io_set_zero(struct hecmw_io_zero *zero)
struct hecmw_io_element * HECMW_io_add_elem(int id, int type, int *node, int nmatitem, double *matitem)
int HECMW_io_pre_process(void)
void HECMW_io_set_system(struct hecmw_system_param *system)
struct hecmw_io_node * HECMW_io_add_node(int id, double x, double y, double z)
int HECMW_io_post_process(void)
struct hecmw_io_material * HECMW_io_get_mat(const char *name)
int HECMW_io_set_gridfile(char *gridfile)
int HECMW_io_finalize(void)
struct hecmw_system_param * HECMW_io_get_system(void)
void HECMW_io_set_header(struct hecmw_io_header *header)
#define HECMW_INITIAL_TYPE_TEMPERATURE
int HECMW_log(int loglv, const char *fmt,...)
#define HECMW_malloc(size)
#define HECMW_IO_HEC_E0002
#define HECMW_IO_HEC_E0600
#define HECMW_IO_HEC_E1106
#define HECMW_IO_HEC_E0601
#define HECMW_IO_HEC_E0604
#define HECMW_IO_HEC_E2000
#define HECMW_IO_HEC_E0900
#define HECMW_IO_HEC_E2101
#define HECMW_IO_HEC_E1500
#define HECMW_IO_HEC_E1104
#define HECMW_IO_HEC_E1100
#define HECMW_IO_HEC_E1700
#define HECMW_IO_HEC_E1800
#define HECMW_IO_HEC_E1709
#define HECMW_IO_HEC_E1105
#define HECMW_IO_HEC_E1001
#define HECMW_IO_HEC_E0701
#define HECMW_IO_HEC_E0702
#define HECMW_IO_HEC_E0001
#define HECMW_IO_HEC_E1103
#define HECMW_IO_HEC_E1710
#define HECMW_IO_HEC_E0098
#define HECMW_IO_HEC_E2100
#define HECMW_IO_HEC_E1702
#define HECMW_IO_HEC_E0703
#define HECMW_IO_HEC_E0003
#define HECMW_IO_HEC_E1708
#define HECMW_IO_HEC_E1704
#define HECMW_IO_HEC_E0606
#define HECMW_IO_HEC_E1900
#define HECMW_IO_HEC_E0800
#define HECMW_IO_HEC_E1706
#define HECMW_IO_HEC_E1502
#define HECMW_IO_HEC_E1707
#define HECMW_IO_HEC_E0099
#define HECMW_IO_HEC_E0100
#define HECMW_IO_HEC_E0602
#define HECMW_IO_HEC_E1000
#define HECMW_IO_HEC_E1703
#define HECMW_IO_HEC_E1002
#define HECMW_IO_HEC_E1107
#define HECMW_IO_HEC_E0502
#define HECMW_IO_HEC_E1102
#define HECMW_IO_HEC_E0501
#define HECMW_IO_HEC_E0901
#define HECMW_IO_HEC_E1801
#define HECMW_IO_HEC_E1501
#define HECMW_IO_HEC_E0500
#define HECMW_IO_HEC_E0200
#define HECMW_IO_HEC_E1101
#define HECMW_IO_HEC_E0700
#define HECMW_IO_HEC_E1503
#define HECMW_IO_HEC_E1600
#define HECMW_IO_HEC_E1601
#define HECMW_IO_HEC_E1705
#define HECMW_IO_HEC_E0503
#define HECMW_IO_HEC_E0603
#define HECMW_IO_HEC_E0101
#define HECMW_IO_HEC_E1701
char * HECMW_dirname(const char *path)
int HECMW_get_path_separator(void)
int HECMW_is_absolute_path(const char *path)
#define HECMW_AMP_TYPEDEF_TABULAR
#define HECMW_SECT_TYPE_SOLID
#define HECMW_SECT_OPT_PSTRAIN
#define HECMW_SECT_TYPE_SHELL
#define HECMW_SECT_TYPE_INTERFACE
#define HECMW_SECT_OPT_ASYMMETRY_RI
#define HECMW_CONTACT_TYPE_NODE_SURF
#define HECMW_SECT_OPT_PSTRESS
#define HECMW_CONTACT_TYPE_NODE_ELEM
#define HECMW_AMP_TYPEVAL_RELATIVE
#define HECMW_AMP_TYPEVAL_ABSOLUTE
#define HECMW_CONTACT_TYPE_SURF_SURF
#define HECMW_SECT_OPT_ASYMMETRY
#define HECMW_SECT_TYPE_BEAM
#define HECMW_AMP_TYPETIME_STEP
#define HECMW_SECT_OPT_PSTRAIN_RI
#define HECMW_SECT_OPT_PSTRESS_RI
int HECMW_system(struct hecmw_system_param *param, struct hecmw_coord *coord, struct hecmw_coord *result)
void HECMW_abort(HECMW_Comm comm)
char * HECMW_toupper(char *s)
void HECMW_print_msg(int loglv, int msgno, const char *fmt,...)
int HECMW_vsnprintf(char *str, size_t size, const char *format, va_list ap)
#define HECMW_assert(cond)
Separator_result * separator
struct hecmw_io_id * next
struct hecmw_io_material * next
struct hecmw_io_material::hecmw_io_matitem * item
char name[HECMW_NAME_LEN+1]
char egrp[HECMW_NAME_LEN+1]
union hecmw_io_section::hecmw_io_section_item sect
char material[HECMW_NAME_LEN+1]