31 static void do_logging(
int loglv,
int msgno,
int add_location,
const char *fmt,
40 if (strlen(msg) > 0) s =
": ";
52 static void set_err(
int msgno,
const char *fmt, ...) {
60 static void set_err_token(
int token,
int msgno,
const char *fmt, ...) {
78 static int read_input(
int msgno_invalid_token) {
84 set_err_token(token, msgno_invalid_token,
"'=' required after INPUT");
89 set_err_token(token, msgno_invalid_token,
"Invalid filename for INPUT");
98 strcpy(include_filename, p);
107 sprintf(include_filename,
"%s%s%s", dname,
separator, p);
114 static int read_amp_head(
void) {
133 static int read_amp_param_name(
char *name) {
145 "NAME must begin with a letter or '_'");
162 static int read_amp_param_type(
int *type) {
179 static int read_amp_param_definition(
int *definition) {
196 static int read_amp_param_time(
int *time) {
213 static int read_amp_param_value(
int *value) {
233 static int read_amp_data(
char *name,
int type,
int definition,
int time,
286 if (token ==
',' && i == NITEM) {
300 static int read_amplitude(
void) {
308 int flag_definition = 0;
316 ST_HEADER_LINE_PARAM,
322 state = ST_HEADER_LINE;
323 while (state != ST_FINISHED) {
324 if (state == ST_HEADER_LINE) {
325 if (read_amp_head())
return -1;
326 state = ST_HEADER_LINE_PARAM;
327 }
else if (state == ST_HEADER_LINE_PARAM) {
331 if (read_amp_param_name(name))
return -1;
335 if (read_amp_param_type(&type))
return -1;
339 if (read_amp_param_definition(&definition))
return -1;
343 if (read_amp_param_time(&time))
return -1;
347 if (read_amp_param_value(&value))
return -1;
366 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
367 }
else if (token ==
',') {
373 }
else if (state == ST_DATA_INCLUDE) {
378 state = ST_DATA_LINE;
379 }
else if (state == ST_DATA_LINE) {
381 if (read_amp_data(name, type, definition, time, value))
return -1;
399 static int read_contact_or_insert_pair_head(
int *last_token,
int *type) {
416 "',' or NL required after !CONTACT");
424 static int read_contact_pair_param_name(
char *name) {
436 "NAME must begin with a letter or '_'");
453 static int read_contact_pair_param_type(
int *type) {
475 static int read_contact_pair_data(
char *name,
int type) {
477 char *slave_grp, *master_grp;
492 if (slave_grp ==
NULL) {
526 if (master_grp ==
NULL) {
552 static int read_contact_pair(
void) {
561 ST_HEADER_LINE_PARAM,
566 state = ST_HEADER_LINE;
567 while (state != ST_FINISHED) {
568 if (state == ST_HEADER_LINE) {
569 if (read_contact_or_insert_pair_head(&token,&type))
return -1;
571 state = ST_DATA_LINE;
572 }
else if (token ==
',') {
573 state = ST_HEADER_LINE_PARAM;
577 }
else if (state == ST_HEADER_LINE_PARAM) {
581 if (read_contact_pair_param_name(name))
return -1;
585 if (read_contact_pair_param_type(&type))
return -1;
604 state = ST_DATA_INCLUDE;
606 state = ST_DATA_LINE;
608 }
else if (token ==
',') {
614 }
else if (state == ST_DATA_INCLUDE) {
618 state = ST_DATA_LINE;
619 }
else if (state == ST_DATA_LINE) {
620 if (read_contact_pair_data(name, type))
return -1;
641 fprintf(stderr,
"!ECOPY has not implemented yet\n");
650 fprintf(stderr,
"!EGEN has not implemented yet\n");
658 static int read_egrp_head(
void) {
677 static int read_egrp_param_egrp(
char *egrp) {
689 "EGRP must begin with a letter or '_'");
703 if (strcmp(egrp,
"ALL") == 0) {
710 static int read_egrp_data(
char *egrp) {
711 int i, n, *elem, token;
748 "',' or NL required after element ID");
778 static int read_egrp_generate(
char *egrp) {
779 int i, n,
id, *elem, token;
780 int elem1, elem2, elem3;
839 "',' or NL required after elem2");
847 "Cannot generate between %d and %d with an increment of %d",
848 elem1, elem2, elem3);
851 if ((elem2 - elem1) % elem3) {
853 "Cannot generate between %d and %d with an increment of %d",
854 elem1, elem2, elem3);
858 n = (elem2 - elem1) / elem3 + 1;
866 for (
id = elem1;
id <= elem2;
id += elem3) {
884 static int read_egroup(
void) {
887 int flag_generate = 0;
893 ST_HEADER_LINE_PARAM,
896 ST_DATA_LINE_GENERATE
899 state = ST_HEADER_LINE;
900 while (state != ST_FINISHED) {
901 if (state == ST_HEADER_LINE) {
902 if (read_egrp_head())
return -1;
903 state = ST_HEADER_LINE_PARAM;
904 }
else if (state == ST_HEADER_LINE_PARAM) {
908 if (read_egrp_param_egrp(egrp))
return -1;
926 state = ST_DATA_INCLUDE;
927 }
else if (flag_generate) {
928 state = ST_DATA_LINE_GENERATE;
930 state = ST_DATA_LINE;
937 }
else if (token ==
',') {
943 }
else if (state == ST_DATA_INCLUDE) {
948 state = flag_generate ? ST_DATA_LINE_GENERATE : ST_DATA_LINE;
949 }
else if (state == ST_DATA_LINE) {
953 if (read_egrp_data(egrp))
return -1;
961 }
else if (state == ST_DATA_LINE_GENERATE) {
965 if (read_egrp_generate(egrp))
return -1;
977 static int read_elem_head(
void) {
996 static int read_elem_param_type(
int *type) {
1017 static int read_elem_param_egrp(
char *egrp) {
1029 "EGRP must begin with a letter or '_'");
1043 if (strcmp(egrp,
"ALL") == 0) {
1050 static int read_elem_param_nmatitem(
int *nmatitem) {
1064 if (*nmatitem < 0) {
1071 static int read_elem_data_conn(
int *
id,
int nnode,
int *node) {
1108 if (i == nnode - 1)
break;
1114 "',' or NL required after connectivity");
1123 static int read_elem_data_mat(
int nmatitem,
double *matitem) {
1127 for (i = 0; i < nmatitem; i++) {
1132 for (i = 0; i < nmatitem; i++) {
1146 if (i == nmatitem - 1) {
1161 static int read_element(
void) {
1166 double *matitem =
NULL;
1171 int flag_matitem = 0;
1177 st_header_line_param,
1181 st_data_line_matitem,
1182 st_data_line_regist,
1186 state = st_header_line;
1187 while (state != st_finished) {
1188 if (state == st_header_line) {
1189 if (read_elem_head())
return -1;
1190 state = st_header_line_param;
1191 }
else if (state == st_header_line_param) {
1195 if (read_elem_param_type(&type))
return -1;
1199 if (read_elem_param_egrp(egrp))
return -1;
1203 if (read_elem_param_nmatitem(&nmatitem))
return -1;
1223 }
else if (token ==
',') {
1229 }
else if (state == st_prepare) {
1247 if (flag_matitem && nmatitem) {
1250 if (matitem ==
NULL) {
1259 state = flag_input ? st_data_include : st_data_line_conn;
1260 }
else if (state == st_data_include) {
1265 state = st_data_line_conn;
1266 }
else if (state == st_data_line_conn) {
1269 if (read_elem_data_conn(&
id, nnode, node))
return -1;
1277 "',' or NL required after connectivity");
1286 state = st_data_line_matitem;
1292 state = st_data_line_regist;
1294 }
else if (state == st_data_line_matitem) {
1300 if (read_elem_data_mat(nmatitem, matitem))
return -1;
1301 state = st_data_line_regist;
1302 }
else if (state == st_data_line_regist) {
1323 state = st_data_line_conn;
1325 state = st_finalize;
1328 }
else if (state == st_finalize) {
1333 state = st_finished;
1344 static int read_equation_head(
int *last_token) {
1357 "',' or NL required after !EQUATION");
1360 *last_token = token;
1365 static int read_equation_data_line1(
int *neq,
double *cnst) {
1379 if (strcmp(p,
"link") == 0 || strcmp(p,
"LINK") == 0) {
1418 static int read_equation_data_line2(
int neq,
double cnst) {
1424 const int NITEM = 100;
1426 struct hecmw_io_mpcitem *mpcitem;
1427 bool isAllDof =
false;
1430 if (mpcitem ==
NULL) {
1438 if (strcmp(p,
"link") == 0 || strcmp(p,
"LINK") == 0) {
1446 for (i = 0; i < neq; i++) {
1457 strcpy(mpcitem[i].ngrp,
"");
1469 strcpy(mpcitem[i].ngrp, p);
1475 mpcitem[i].node = -1;
1496 if (mpcitem[i].dof == 0) {
1524 "',' or NL required after coefficient");
1527 if (token ==
',' && i == NITEM - 1) {
1540 for (i = 0; i < neq; i++) {
1544 for (i = 0; i < neq; i++) {
1548 for (i = 0; i < neq; i++) {
1559 }
else if (is_link == 1) {
1574 strcpy(mpcitem[0].ngrp,
"");
1589 strcpy(mpcitem[1].ngrp,
"");
1590 mpcitem[1].a = -1.0;
1615 static int read_equation(
void) {
1624 ST_HEADER_LINE_PARAM,
1630 state = ST_HEADER_LINE;
1631 while (state != ST_FINISHED) {
1632 if (state == ST_HEADER_LINE) {
1633 if (read_equation_head(&token))
return -1;
1635 state = ST_HEADER_LINE_PARAM;
1637 state = ST_DATA_LINE1;
1641 }
else if (state == ST_HEADER_LINE_PARAM) {
1655 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE1;
1660 }
else if (state == ST_DATA_INCLUDE) {
1664 state = ST_DATA_LINE1;
1665 }
else if (state == ST_DATA_LINE1) {
1666 if (read_equation_data_line1(&neq, &cnst))
return -1;
1667 state = ST_DATA_LINE2;
1668 }
else if (state == ST_DATA_LINE2) {
1670 if (read_equation_data_line2(neq, cnst))
return -1;
1675 state = ST_DATA_LINE1;
1678 if (strcmp(p,
"link") == 0 || strcmp(p,
"LINK") == 0) {
1679 state = ST_DATA_LINE1;
1681 state = ST_FINISHED;
1684 state = ST_FINISHED;
1697 static int read_header(
void) {
1722 while (*p && *p ==
' ') p++;
1723 if (p ==
NULL) p =
"";
1726 strncpy(
header->header, p, len);
1727 header->header[len] =
'\0';
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) {
2238 "NAME must begin with a letter or '_'");
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 strcpy(mat->
name, 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))
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) {
2471 "NGRP must begin with a letter or '_'");
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))
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) {
2805 "NGRP must begin with a letter or '_'");
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))
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) {
3104 "EGRP must begin with a letter or '_'");
3121 static int read_section_param_material(
char *material) {
3133 "MATERIAL must begin with a letter or '_'");
3141 strcpy(material, 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))
return -1;
3576 if (flag_composite) {
3580 if (read_section_param_material(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) {
3742 "SGRP must begin with a letter or '_'");
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))
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 strcpy(grid_filename, filename);
4457 if ((fp = fopen(filename,
"r")) ==
NULL) {
4476 strcpy(grid_filename,
"Unknown");
4489 if (local_mesh ==
NULL)
return NULL;
4492 strcpy(grid_filename,
"Unknown");