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) {
219 static int read_amp_param_value(
int *value) {
239 static int read_amp_data(
char *name,
int type,
int definition,
int time,
292 if (token ==
',' && i == NITEM) {
306 static int read_amplitude(
void) {
314 int flag_definition = 0;
322 ST_HEADER_LINE_PARAM,
328 state = ST_HEADER_LINE;
329 while (state != ST_FINISHED) {
330 if (state == ST_HEADER_LINE) {
331 if (read_amp_head())
return -1;
332 state = ST_HEADER_LINE_PARAM;
333 }
else if (state == ST_HEADER_LINE_PARAM) {
337 if (read_amp_param_name(name,
sizeof(name)))
return -1;
341 if (read_amp_param_type(&type))
return -1;
345 if (read_amp_param_definition(&definition))
return -1;
349 if (read_amp_param_time(&time))
return -1;
353 if (read_amp_param_value(&value))
return -1;
372 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
373 }
else if (token ==
',') {
379 }
else if (state == ST_DATA_INCLUDE) {
384 state = ST_DATA_LINE;
385 }
else if (state == ST_DATA_LINE) {
387 if (read_amp_data(name, type, definition, time, value))
return -1;
405 static int read_contact_or_insert_pair_head(
int *last_token,
int *type) {
422 "',' or NL required after !CONTACT");
430 static int read_contact_pair_param_name(
char *name,
size_t name_len) {
442 "NAME must begin with a letter or '_'");
450 snprintf(name, name_len,
"%s", p);
459 static int read_contact_pair_param_type(
int *type) {
481 static int read_contact_pair_data(
char *name,
int type) {
483 char *slave_grp, *master_grp;
498 if (slave_grp ==
NULL) {
532 if (master_grp ==
NULL) {
558 static int read_contact_pair(
void) {
567 ST_HEADER_LINE_PARAM,
572 state = ST_HEADER_LINE;
573 while (state != ST_FINISHED) {
574 if (state == ST_HEADER_LINE) {
575 if (read_contact_or_insert_pair_head(&token,&type))
return -1;
577 state = ST_DATA_LINE;
578 }
else if (token ==
',') {
579 state = ST_HEADER_LINE_PARAM;
583 }
else if (state == ST_HEADER_LINE_PARAM) {
587 if (read_contact_pair_param_name(name,
sizeof(name)))
return -1;
591 if (read_contact_pair_param_type(&type))
return -1;
610 state = ST_DATA_INCLUDE;
612 state = ST_DATA_LINE;
614 }
else if (token ==
',') {
620 }
else if (state == ST_DATA_INCLUDE) {
624 state = ST_DATA_LINE;
625 }
else if (state == ST_DATA_LINE) {
626 if (read_contact_pair_data(name, type))
return -1;
647 fprintf(stderr,
"!ECOPY has not implemented yet\n");
656 fprintf(stderr,
"!EGEN has not implemented yet\n");
664 static int read_egrp_head(
void) {
683 static int read_egrp_param_egrp(
char *egrp,
size_t egrp_len) {
695 "EGRP must begin with a letter or '_'");
703 snprintf(egrp, egrp_len,
"%s", p);
709 if (strcmp(egrp,
"ALL") == 0) {
716 static int read_egrp_data(
char *egrp) {
717 int i, n, *elem, token;
754 "',' or NL required after element ID");
784 static int read_egrp_generate(
char *egrp) {
785 int i, n,
id, *elem, token;
786 int elem1, elem2, elem3;
845 "',' or NL required after elem2");
853 "Cannot generate between %d and %d with an increment of %d",
854 elem1, elem2, elem3);
857 if ((elem2 - elem1) % elem3) {
859 "Cannot generate between %d and %d with an increment of %d",
860 elem1, elem2, elem3);
864 n = (elem2 - elem1) / elem3 + 1;
872 for (
id = elem1;
id <= elem2;
id += elem3) {
890 static int read_egroup(
void) {
893 int flag_generate = 0;
899 ST_HEADER_LINE_PARAM,
902 ST_DATA_LINE_GENERATE
905 state = ST_HEADER_LINE;
906 while (state != ST_FINISHED) {
907 if (state == ST_HEADER_LINE) {
908 if (read_egrp_head())
return -1;
909 state = ST_HEADER_LINE_PARAM;
910 }
else if (state == ST_HEADER_LINE_PARAM) {
914 if (read_egrp_param_egrp(egrp,
sizeof(egrp)))
return -1;
932 state = ST_DATA_INCLUDE;
933 }
else if (flag_generate) {
934 state = ST_DATA_LINE_GENERATE;
936 state = ST_DATA_LINE;
943 }
else if (token ==
',') {
949 }
else if (state == ST_DATA_INCLUDE) {
954 state = flag_generate ? ST_DATA_LINE_GENERATE : ST_DATA_LINE;
955 }
else if (state == ST_DATA_LINE) {
959 if (read_egrp_data(egrp))
return -1;
967 }
else if (state == ST_DATA_LINE_GENERATE) {
971 if (read_egrp_generate(egrp))
return -1;
983 static int read_elem_head(
void) {
1002 static int read_elem_param_type(
int *type) {
1023 static int read_elem_param_egrp(
char *egrp,
size_t egrp_len) {
1035 "EGRP must begin with a letter or '_'");
1043 snprintf(egrp, egrp_len,
"%s", p);
1049 if (strcmp(egrp,
"ALL") == 0) {
1056 static int read_elem_param_nmatitem(
int *nmatitem) {
1070 if (*nmatitem < 0) {
1077 static int read_elem_data_conn(
int *
id,
int nnode,
int *node) {
1114 if (i == nnode - 1)
break;
1120 "',' or NL required after connectivity");
1129 static int read_elem_data_mat(
int nmatitem,
double *matitem) {
1133 for (i = 0; i < nmatitem; i++) {
1138 for (i = 0; i < nmatitem; i++) {
1152 if (i == nmatitem - 1) {
1167 static int read_element(
void) {
1172 double *matitem =
NULL;
1177 int flag_matitem = 0;
1183 st_header_line_param,
1187 st_data_line_matitem,
1188 st_data_line_regist,
1192 state = st_header_line;
1193 while (state != st_finished) {
1194 if (state == st_header_line) {
1195 if (read_elem_head())
return -1;
1196 state = st_header_line_param;
1197 }
else if (state == st_header_line_param) {
1201 if (read_elem_param_type(&type))
return -1;
1205 if (read_elem_param_egrp(egrp,
sizeof(egrp)))
return -1;
1209 if (read_elem_param_nmatitem(&nmatitem))
return -1;
1229 }
else if (token ==
',') {
1235 }
else if (state == st_prepare) {
1253 if (flag_matitem && nmatitem) {
1256 if (matitem ==
NULL) {
1265 state = flag_input ? st_data_include : st_data_line_conn;
1266 }
else if (state == st_data_include) {
1271 state = st_data_line_conn;
1272 }
else if (state == st_data_line_conn) {
1275 if (read_elem_data_conn(&
id, nnode, node))
return -1;
1283 "',' or NL required after connectivity");
1292 state = st_data_line_matitem;
1298 state = st_data_line_regist;
1300 }
else if (state == st_data_line_matitem) {
1306 if (read_elem_data_mat(nmatitem, matitem))
return -1;
1307 state = st_data_line_regist;
1308 }
else if (state == st_data_line_regist) {
1329 state = st_data_line_conn;
1331 state = st_finalize;
1334 }
else if (state == st_finalize) {
1339 state = st_finished;
1350 static int read_equation_head(
int *last_token) {
1363 "',' or NL required after !EQUATION");
1366 *last_token = token;
1371 static int read_equation_data_line1(
int *neq,
double *cnst) {
1385 if (strcmp(p,
"link") == 0 || strcmp(p,
"LINK") == 0) {
1424 static int read_equation_data_line2(
int neq,
double cnst) {
1430 const int NITEM = 100;
1432 struct hecmw_io_mpcitem *mpcitem;
1433 bool isAllDof =
false;
1436 if (mpcitem ==
NULL) {
1444 if (strcmp(p,
"link") == 0 || strcmp(p,
"LINK") == 0) {
1452 for (i = 0; i < neq; i++) {
1463 mpcitem[i].ngrp[0] =
'\0';
1475 snprintf(mpcitem[i].ngrp,
sizeof(mpcitem[i].ngrp),
"%s", p);
1481 mpcitem[i].node = -1;
1502 if (mpcitem[i].dof == 0) {
1530 "',' or NL required after coefficient");
1533 if (token ==
',' && i == NITEM - 1) {
1546 for (i = 0; i < neq; i++) {
1550 for (i = 0; i < neq; i++) {
1554 for (i = 0; i < neq; i++) {
1565 }
else if (is_link == 1) {
1580 mpcitem[0].ngrp[0] =
'\0';
1595 mpcitem[1].ngrp[0] =
'\0';
1596 mpcitem[1].a = -1.0;
1621 static int read_equation(
void) {
1630 ST_HEADER_LINE_PARAM,
1636 state = ST_HEADER_LINE;
1637 while (state != ST_FINISHED) {
1638 if (state == ST_HEADER_LINE) {
1639 if (read_equation_head(&token))
return -1;
1641 state = ST_HEADER_LINE_PARAM;
1643 state = ST_DATA_LINE1;
1647 }
else if (state == ST_HEADER_LINE_PARAM) {
1661 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE1;
1666 }
else if (state == ST_DATA_INCLUDE) {
1670 state = ST_DATA_LINE1;
1671 }
else if (state == ST_DATA_LINE1) {
1672 if (read_equation_data_line1(&neq, &cnst))
return -1;
1673 state = ST_DATA_LINE2;
1674 }
else if (state == ST_DATA_LINE2) {
1676 if (read_equation_data_line2(neq, cnst))
return -1;
1681 state = ST_DATA_LINE1;
1684 if (strcmp(p,
"link") == 0 || strcmp(p,
"LINK") == 0) {
1685 state = ST_DATA_LINE1;
1687 state = ST_FINISHED;
1690 state = ST_FINISHED;
1703 static int read_header(
void) {
1728 while (*p && *p ==
' ') p++;
1729 if (p ==
NULL) p =
"";
1730 snprintf(
header->header,
sizeof(
header->header),
"%s", p);
1750 static int read_include(
void) {
1795 static int read_initial_head(
void) {
1814 static int read_initial_param_type(
int *type) {
1831 static int read_initial_data(
int type) {
1895 static int read_initial(
void) {
1903 ST_HEADER_LINE_PARAM,
1908 state = ST_HEADER_LINE;
1909 while (state != ST_FINISHED) {
1910 if (state == ST_HEADER_LINE) {
1911 if (read_initial_head())
return -1;
1912 state = ST_HEADER_LINE_PARAM;
1913 }
else if (state == ST_HEADER_LINE_PARAM) {
1917 if (read_initial_param_type(&type))
return -1;
1932 state = ST_DATA_INCLUDE;
1934 state = ST_DATA_LINE;
1941 }
else if (token ==
',') {
1947 }
else if (state == ST_DATA_INCLUDE) {
1951 state = ST_DATA_LINE;
1952 }
else if (state == ST_DATA_LINE) {
1954 if (read_initial_data(type))
return -1;
1959 state = ST_FINISHED;
1972 static int read_matitem_head(
int *item,
int *last_token) {
2007 *last_token = token;
2012 static int read_matitem_param_subitem(
int *subitem) {
2027 if (*subitem <= 0) {
2034 static int read_matitem_data(
int subitem,
int depend_temp,
2035 struct hecmw_io_matitem *matitem) {
2039 struct hecmw_io_matsubitem *p, *q, *msitem;
2042 if (msitem ==
NULL) {
2053 for (i = 0; i < subitem; i++) {
2057 for (i = 0; i < subitem; i++) {
2062 }
else if (token ==
',') {
2096 for (p = matitem->subitem; p; p = (q = p)->next)
2098 if (q && temp <= q->temp) {
2115 msitem->temp = temp;
2116 msitem->next =
NULL;
2119 for (p = matitem->subitem; p; p = (q = p)->next)
2122 matitem->subitem = msitem;
2130 static int read_matitem(
struct hecmw_io_matitem *matitem) {
2135 int flag_subitem = 0;
2136 int depend_temp = 0;
2140 ST_HEADER_LINE_PARAM,
2147 state = ST_HEADER_LINE;
2148 while (state != ST_FINISHED) {
2149 if (state == ST_HEADER_LINE) {
2150 if (read_matitem_head(&item, &token))
return -1;
2152 state = ST_HEADER_LINE_PARAM;
2157 }
else if (state == ST_HEADER_LINE_PARAM) {
2160 if (read_matitem_param_subitem(&subitem))
return -1;
2176 }
else if (state == ST_PREPARE) {
2181 matitem->item = item;
2182 matitem->nval = subitem;
2183 matitem->subitem =
NULL;
2188 state = ST_DATA_LINE;
2189 }
else if (state == ST_DATA_LINE) {
2194 if (read_matitem_data(subitem, depend_temp, matitem))
return -1;
2200 state = ST_FINISHED;
2210 static int read_material_head(
void) {
2229 static int read_material_param_name(
char *name,
size_t name_len) {
2241 "NAME must begin with a letter or '_'");
2249 snprintf(name, name_len,
"%s", p);
2262 static int read_material_param_item(
int *item) {
2283 static int matitem_comp(
const void *matitem1,
const void *matitem2) {
2284 const struct hecmw_io_matitem *m1, *m2;
2289 if (m1->item == m2->item)
return 0;
2290 if (m1->item < m2->item) {
2297 static int read_material_data(
int item,
char *name) {
2300 struct hecmw_io_matitem *matitem;
2309 if (matitem ==
NULL) {
2314 for (i = 0; i < item; i++) {
2315 if (read_matitem(&matitem[i]))
return -1;
2319 qsort(matitem, item,
sizeof(*matitem), matitem_comp);
2322 for (i = 0; i < item; i++) {
2323 if (matitem[i].item != i + 1) {
2330 snprintf(mat->
name,
sizeof(mat->
name),
"%s", name);
2332 mat->
item = matitem;
2341 static int read_material(
void) {
2351 ST_HEADER_LINE_PARAM,
2356 state = ST_HEADER_LINE;
2357 while (state != ST_FINISHED) {
2358 if (state == ST_HEADER_LINE) {
2359 if (read_material_head())
return -1;
2360 state = ST_HEADER_LINE_PARAM;
2361 }
else if (state == ST_HEADER_LINE_PARAM) {
2365 if (read_material_param_name(name,
sizeof(name)))
return -1;
2369 if (read_material_param_item(&item))
return -1;
2388 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
2389 }
else if (token ==
',') {
2395 }
else if (state == ST_DATA_INCLUDE) {
2399 state = ST_DATA_LINE;
2400 }
else if (state == ST_DATA_LINE) {
2402 if (read_material_data(item, name))
return -1;
2403 state = ST_FINISHED;
2417 fprintf(stderr,
"!NCOPY has not implemented yet\n");
2426 fprintf(stderr,
"!NFILL has not implemented yet\n");
2435 fprintf(stderr,
"!NGEN has not implemented yet\n");
2443 static int read_ngrp_head(
void) {
2462 static int read_ngrp_param_ngrp(
char *ngrp,
size_t ngrp_len) {
2474 "NGRP must begin with a letter or '_'");
2482 snprintf(ngrp, ngrp_len,
"%s", p);
2488 if (strcmp(ngrp,
"EQUATION_BLOCK") == 0) {
2492 if (strcmp(ngrp,
"ALL") == 0) {
2499 static int read_ngrp_data(
char *ngrp) {
2500 int i, n, *node, token;
2537 "',' or NL required after node ID");
2565 static int read_ngrp_generate(
char *ngrp) {
2566 int i, n,
id, *node, token;
2567 int nod1, nod2, nod3;
2633 "Cannot generate between %d and %d with an increment of %d", nod1,
2637 if ((nod2 - nod1) % nod3) {
2639 "Cannot generate between %d and %d with an increment of %d", nod1,
2644 n = (nod2 - nod1) / nod3 + 1;
2652 for (
id = nod1;
id <= nod2;
id += nod3) {
2670 static int read_ngroup(
void) {
2673 int flag_generate = 0;
2679 st_header_line_param,
2682 st_data_line_generate
2685 state = st_header_line;
2686 while (state != st_finished) {
2687 if (state == st_header_line) {
2688 if (read_ngrp_head())
return -1;
2689 state = st_header_line_param;
2690 }
else if (state == st_header_line_param) {
2694 if (read_ngrp_param_ngrp(ngrp,
sizeof(ngrp)))
return -1;
2712 state = st_data_include;
2713 }
else if (flag_generate) {
2714 state = st_data_line_generate;
2716 state = st_data_line;
2723 }
else if (token ==
',') {
2729 }
else if (state == st_data_include) {
2733 state = flag_generate ? st_data_line_generate : st_data_line;
2734 }
else if (state == st_data_line) {
2736 if (read_ngrp_data(ngrp))
return -1;
2741 state = st_finished;
2744 }
else if (state == st_data_line_generate) {
2747 if (read_ngrp_generate(ngrp))
return -1;
2748 state = st_finished;
2759 static int read_node_head(
int *last_token) {
2774 *last_token = token;
2779 static int read_node_param_system(
int *system) {
2788 if (token !=
'C' && token !=
'R') {
2796 static int read_node_param_ngrp(
char *ngrp,
size_t ngrp_len) {
2808 "NGRP must begin with a letter or '_'");
2816 snprintf(ngrp, ngrp_len,
"%s", p);
2822 if (strcmp(ngrp,
"ALL") == 0) {
2829 static int read_node_data(
int *id_arg,
double *x_arg,
double *y_arg,
2928 static int read_node_convert_coord(
int system,
double *x,
double *y,
2938 if (system ==
'C') {
2958 static int read_node(
void) {
2961 int flag_system = 0;
2968 ST_HEADER_LINE_PARAM,
2973 state = ST_HEADER_LINE;
2974 while (state != ST_FINISHED) {
2975 if (state == ST_HEADER_LINE) {
2976 if (read_node_head(&token))
return -1;
2978 state = ST_DATA_LINE;
2979 }
else if (token ==
',') {
2980 state = ST_HEADER_LINE_PARAM;
2984 }
else if (state == ST_HEADER_LINE_PARAM) {
2988 if (read_node_param_system(&system))
return -1;
2992 if (read_node_param_ngrp(ngrp,
sizeof(ngrp)))
return -1;
3006 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
3007 }
else if (token ==
',') {
3013 }
else if (state == ST_DATA_INCLUDE) {
3016 state = ST_DATA_LINE;
3017 }
else if (state == ST_DATA_LINE) {
3021 if (read_node_data(&
id, &
x, &
y, &
z))
return -1;
3022 if (read_node_convert_coord(system, &
x, &
y, &
z))
return -1;
3037 state = ST_FINISHED;
3039 state = ST_DATA_LINE;
3052 static int read_section_head(
void) {
3071 static int read_section_param_type(
int *type) {
3095 static int read_section_param_egrp(
char *egrp,
size_t egrp_len) {
3107 "EGRP must begin with a letter or '_'");
3115 snprintf(egrp, egrp_len,
"%s", p);
3124 static int read_section_param_material(
char *material,
size_t material_len) {
3136 "MATERIAL must begin with a letter or '_'");
3144 snprintf(material, material_len,
"%s", p);
3155 read_section_param_composite(
int *composite)
3171 if(*composite <= 0) {
3179 static int read_section_param_secopt(
int *secopt_arg) {
3202 *secopt_arg = secopt;
3207 static int read_section_solid(
union hecmw_io_section_item *sect_item) {
3227 if (thickness <= 0.0) {
3233 sect_item->solid.thickness = thickness;
3238 static int read_section_shell(
union hecmw_io_section_item *sect_item) {
3240 int token, integpoints;
3250 if (thickness <= 0.0) {
3270 if (integpoints <= 0) {
3283 sect_item->shell.thickness = thickness;
3284 sect_item->shell.integpoints = integpoints;
3289 static int read_section_beam(
union hecmw_io_section_item *sect_item) {
3290 double nx, ny, nz, area, Iyy, Izz, Jx;
3422 sect_item->beam.vxyz[0] = nx;
3423 sect_item->beam.vxyz[1] = ny;
3424 sect_item->beam.vxyz[2] = nz;
3425 sect_item->beam.area = area;
3426 sect_item->beam.Iyy = Iyy;
3427 sect_item->beam.Izz = Izz;
3428 sect_item->beam.Jx = Jx;
3433 static int read_section_interface(
union hecmw_io_section_item *sect_item) {
3436 double gapcon = 0.0;
3437 double gaprad1 = 0.0;
3438 double gaprad2 = 0.0;
3449 if (thickness <= 0.0) {
3458 "',' or NL reuqired after THICKNESS");
3467 }
else if (token ==
',') {
3480 "',' or NL reuiqred after GAPCON");
3489 }
else if (token ==
',') {
3502 "',' or NL reuqired after GAPRAD1");
3528 sect_item->interface.thickness = thickness;
3529 sect_item->interface.gapcon = gapcon;
3530 sect_item->interface.gaprad1 = gaprad1;
3531 sect_item->interface.gaprad2 = gaprad2;
3536 static int read_section(
void) {
3541 union hecmw_io_section_item sect_item;
3544 int flag_material = 0;
3545 int flag_composite = 0;
3546 int flag_secopt = 0;
3553 ST_HEADER_LINE_PARAM,
3558 ST_DATA_LINE_INTERFACE,
3562 state = ST_HEADER_LINE;
3563 while (state != ST_FINISHED) {
3564 if (state == ST_HEADER_LINE) {
3565 if (read_section_head())
return -1;
3566 state = ST_HEADER_LINE_PARAM;
3567 }
else if (state == ST_HEADER_LINE_PARAM) {
3571 if (read_section_param_type(&type))
return -1;
3575 if (read_section_param_egrp(egrp,
sizeof(egrp)))
return -1;
3579 if (flag_composite) {
3583 if (read_section_param_material(material,
sizeof(material)))
return -1;
3592 if(read_section_param_composite(&composite))
return -1;
3597 if (read_section_param_secopt(&secopt))
return -1;
3622 state = ST_DATA_INCLUDE;
3624 state = ST_DATA_LINE_SOLID;
3626 state = ST_DATA_LINE_SHELL;
3628 state = ST_DATA_LINE_BEAM;
3630 state = ST_DATA_LINE_INTERFACE;
3634 }
else if (token ==
',') {
3640 }
else if (state == ST_DATA_INCLUDE) {
3647 state = ST_DATA_LINE_SOLID;
3649 state = ST_DATA_LINE_SHELL;
3651 state = ST_DATA_LINE_BEAM;
3653 state = ST_DATA_LINE_INTERFACE;
3657 }
else if (state == ST_DATA_LINE_SOLID) {
3662 if (read_section_solid(§_item))
return -1;
3663 state = ST_DATA_LINE_REGIST;
3664 }
else if (state == ST_DATA_LINE_SHELL) {
3669 if (read_section_shell(§_item))
return -1;
3670 state = ST_DATA_LINE_REGIST;
3671 }
else if (state == ST_DATA_LINE_BEAM) {
3676 if (read_section_beam(§_item))
return -1;
3677 state = ST_DATA_LINE_REGIST;
3678 }
else if (state == ST_DATA_LINE_INTERFACE) {
3683 if (read_section_interface(§_item))
return -1;
3684 state = ST_DATA_LINE_REGIST;
3685 }
else if (state == ST_DATA_LINE_REGIST) {
3696 sect.sect = sect_item;
3703 state = ST_FINISHED;
3714 static int read_sgrp_head(
void) {
3733 static int read_sgrp_param_sgrp(
char *sgrp,
size_t sgrp_len) {
3745 "SGRP must begin with a letter or '_'");
3753 snprintf(sgrp, sgrp_len,
"%s", p);
3762 static int read_sgrp_data(
char *sgrp) {
3763 int i, n, *elem, *surf, token;
3764 struct hecmw_io_id *elem_head, *surf_head, *elem_prev, *surf_prev;
3765 struct hecmw_io_id *eid, *sid, *pe, *qe, *ps, *qs;
3768 elem_head = surf_head =
NULL;
3769 elem_prev = surf_prev =
NULL;
3788 if (elem_head ==
NULL) {
3789 elem_head = elem_prev = eid;
3791 elem_prev->
next = eid;
3817 if (surf_head ==
NULL) {
3818 surf_head = surf_prev = sid;
3820 surf_prev->
next = sid;
3830 "',' or NL required after surface ID");
3852 for (i = 0; i < n; i++) {
3873 static int read_sgroup(
void) {
3881 ST_HEADER_LINE_PARAM,
3886 state = ST_HEADER_LINE;
3887 while (state != ST_FINISHED) {
3888 if (state == ST_HEADER_LINE) {
3889 if (read_sgrp_head())
return -1;
3890 state = ST_HEADER_LINE_PARAM;
3891 }
else if (state == ST_HEADER_LINE_PARAM) {
3895 if (read_sgrp_param_sgrp(sgrp,
sizeof(sgrp)))
return -1;
3914 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
3915 }
else if (token ==
',') {
3921 }
else if (state == ST_DATA_INCLUDE) {
3925 state = ST_DATA_LINE;
3926 }
else if (state == ST_DATA_LINE) {
3928 if (read_sgrp_data(sgrp))
return -1;
3933 state = ST_FINISHED;
3935 state = ST_DATA_LINE;
3949 read_system_head(
void)
3980 }
else if(token ==
',') {
3999 }
else if(token ==
',') {
4032 *last_token = token;
4047 }
else if(token ==
',') {
4066 }
else if(token ==
',') {
4113 }
else if(token ==
',') {
4132 }
else if(token ==
',') {
4183 if(system ==
NULL) {
4199 state = ST_HEADER_LINE;
4200 while(state != ST_FINISHED) {
4201 if(state == ST_HEADER_LINE) {
4202 if(read_system_head())
return -1;
4209 state = ST_FINISHED;
4211 state = ST_DATA_LINE1;
4214 }
else if(state == ST_DATA_LINE1) {
4215 if(read_system_data_line1a(system, &token))
return -1;
4217 state = ST_FINISHED;
4222 if(read_system_data_line1b(system))
return -1;
4225 state = ST_FINISHED;
4227 state = ST_DATA_LINE2;
4230 }
else if(state == ST_DATA_LINE2) {
4231 if(read_system_data_line2(system))
return -1;
4232 state = ST_FINISHED;
4248 static int read_zero(
void) {
4283 if (new_zero ==
NULL) {
4298 static int read_connectivity(
void) {
4312 "',' or NL reqyured after !CONNECTIVITY");
4358 connectivity_type = type;
4370 static struct read_func_table {
4373 } read_func_table[] = {
4398 #define N_READ_FUNC (sizeof(read_func_table) / sizeof(read_func_table[0]))
4401 static ReadFunc get_read_func(
int token) {
4405 if (token == read_func_table[i].token) {
4406 return read_func_table[i].func;
4412 static int parse(
void) {
4422 func = get_read_func(token);
4433 if ((*func)())
return -1;
4444 if (filename ==
NULL) {
4447 "Not specified filename for HECMW-ENTIRE mesh input routine");
4457 snprintf(grid_filename,
sizeof(grid_filename),
"%s", filename);
4460 if ((fp = fopen(filename,
"r")) ==
NULL) {
4479 snprintf(grid_filename,
sizeof(grid_filename),
"Unknown");
4492 if (local_mesh ==
NULL)
return NULL;
4495 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_INP
#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)
@ 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_TOTAL_TIME
@ 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_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)
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_AMP_TYPETIME_TOTAL
#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]