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) {
318 ST_HEADER_LINE_PARAM,
324 state = ST_HEADER_LINE;
325 while (state != ST_FINISHED) {
326 if (state == ST_HEADER_LINE) {
327 if (read_amp_head())
return -1;
328 state = ST_HEADER_LINE_PARAM;
329 }
else if (state == ST_HEADER_LINE_PARAM) {
333 if (read_amp_param_name(name,
sizeof(name)))
return -1;
337 if (read_amp_param_type(&type))
return -1;
340 if (read_amp_param_definition(&definition))
return -1;
343 if (read_amp_param_time(&time))
return -1;
346 if (read_amp_param_value(&value))
return -1;
364 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
365 }
else if (token ==
',') {
371 }
else if (state == ST_DATA_INCLUDE) {
376 state = ST_DATA_LINE;
377 }
else if (state == ST_DATA_LINE) {
379 if (read_amp_data(name, type, definition, time, value))
return -1;
397 static int read_contact_or_insert_pair_head(
int *last_token,
int *type) {
414 "',' or NL required after !CONTACT");
422 static int read_contact_pair_param_name(
char *name,
size_t name_len) {
434 "NAME must begin with a letter or '_'");
442 snprintf(name, name_len,
"%s", p);
451 static int read_contact_pair_param_type(
int *type) {
473 static int read_contact_pair_data(
char *name,
int type) {
475 char *slave_grp, *master_grp;
490 if (slave_grp ==
NULL) {
524 if (master_grp ==
NULL) {
550 static int read_contact_pair(
void) {
559 ST_HEADER_LINE_PARAM,
564 state = ST_HEADER_LINE;
565 while (state != ST_FINISHED) {
566 if (state == ST_HEADER_LINE) {
567 if (read_contact_or_insert_pair_head(&token,&type))
return -1;
569 state = ST_DATA_LINE;
570 }
else if (token ==
',') {
571 state = ST_HEADER_LINE_PARAM;
575 }
else if (state == ST_HEADER_LINE_PARAM) {
579 if (read_contact_pair_param_name(name,
sizeof(name)))
return -1;
583 if (read_contact_pair_param_type(&type))
return -1;
602 state = ST_DATA_INCLUDE;
604 state = ST_DATA_LINE;
606 }
else if (token ==
',') {
612 }
else if (state == ST_DATA_INCLUDE) {
616 state = ST_DATA_LINE;
617 }
else if (state == ST_DATA_LINE) {
618 if (read_contact_pair_data(name, type))
return -1;
639 fprintf(stderr,
"!ECOPY has not implemented yet\n");
648 fprintf(stderr,
"!EGEN has not implemented yet\n");
656 static int read_egrp_head(
void) {
675 static int read_egrp_param_egrp(
char *egrp,
size_t egrp_len) {
687 "EGRP must begin with a letter or '_'");
695 snprintf(egrp, egrp_len,
"%s", p);
701 if (strcmp(egrp,
"ALL") == 0) {
708 static int read_egrp_data(
char *egrp) {
709 int i, n, *elem, token;
746 "',' or NL required after element ID");
776 static int read_egrp_generate(
char *egrp) {
777 int i, n,
id, *elem, token;
778 int elem1, elem2, elem3;
837 "',' or NL required after elem2");
845 "Cannot generate between %d and %d with an increment of %d",
846 elem1, elem2, elem3);
849 if ((elem2 - elem1) % elem3) {
851 "Cannot generate between %d and %d with an increment of %d",
852 elem1, elem2, elem3);
856 n = (elem2 - elem1) / elem3 + 1;
864 for (
id = elem1;
id <= elem2;
id += elem3) {
882 static int read_egroup(
void) {
885 int flag_generate = 0;
891 ST_HEADER_LINE_PARAM,
894 ST_DATA_LINE_GENERATE
897 state = ST_HEADER_LINE;
898 while (state != ST_FINISHED) {
899 if (state == ST_HEADER_LINE) {
900 if (read_egrp_head())
return -1;
901 state = ST_HEADER_LINE_PARAM;
902 }
else if (state == ST_HEADER_LINE_PARAM) {
906 if (read_egrp_param_egrp(egrp,
sizeof(egrp)))
return -1;
924 state = ST_DATA_INCLUDE;
925 }
else if (flag_generate) {
926 state = ST_DATA_LINE_GENERATE;
928 state = ST_DATA_LINE;
935 }
else if (token ==
',') {
941 }
else if (state == ST_DATA_INCLUDE) {
946 state = flag_generate ? ST_DATA_LINE_GENERATE : ST_DATA_LINE;
947 }
else if (state == ST_DATA_LINE) {
951 if (read_egrp_data(egrp))
return -1;
959 }
else if (state == ST_DATA_LINE_GENERATE) {
963 if (read_egrp_generate(egrp))
return -1;
975 static int read_elem_head(
void) {
994 static int read_elem_param_type(
int *type) {
1015 static int read_elem_param_egrp(
char *egrp,
size_t egrp_len) {
1027 "EGRP must begin with a letter or '_'");
1035 snprintf(egrp, egrp_len,
"%s", p);
1041 if (strcmp(egrp,
"ALL") == 0) {
1048 static int read_elem_param_nmatitem(
int *nmatitem) {
1062 if (*nmatitem < 0) {
1069 static int read_elem_data_conn(
int *
id,
int nnode,
int *node) {
1106 if (i == nnode - 1)
break;
1112 "',' or NL required after connectivity");
1121 static int read_elem_data_mat(
int nmatitem,
double *matitem) {
1125 for (i = 0; i < nmatitem; i++) {
1130 for (i = 0; i < nmatitem; i++) {
1144 if (i == nmatitem - 1) {
1159 static int read_element(
void) {
1164 double *matitem =
NULL;
1169 int flag_matitem = 0;
1175 st_header_line_param,
1179 st_data_line_matitem,
1180 st_data_line_regist,
1184 state = st_header_line;
1185 while (state != st_finished) {
1186 if (state == st_header_line) {
1187 if (read_elem_head())
return -1;
1188 state = st_header_line_param;
1189 }
else if (state == st_header_line_param) {
1193 if (read_elem_param_type(&type))
return -1;
1197 if (read_elem_param_egrp(egrp,
sizeof(egrp)))
return -1;
1201 if (read_elem_param_nmatitem(&nmatitem))
return -1;
1221 }
else if (token ==
',') {
1227 }
else if (state == st_prepare) {
1245 if (flag_matitem && nmatitem) {
1248 if (matitem ==
NULL) {
1257 state = flag_input ? st_data_include : st_data_line_conn;
1258 }
else if (state == st_data_include) {
1263 state = st_data_line_conn;
1264 }
else if (state == st_data_line_conn) {
1267 if (read_elem_data_conn(&
id, nnode, node))
return -1;
1275 "',' or NL required after connectivity");
1284 state = st_data_line_matitem;
1290 state = st_data_line_regist;
1292 }
else if (state == st_data_line_matitem) {
1298 if (read_elem_data_mat(nmatitem, matitem))
return -1;
1299 state = st_data_line_regist;
1300 }
else if (state == st_data_line_regist) {
1321 state = st_data_line_conn;
1323 state = st_finalize;
1326 }
else if (state == st_finalize) {
1331 state = st_finished;
1342 static int read_equation_head(
int *last_token) {
1355 "',' or NL required after !EQUATION");
1358 *last_token = token;
1363 static int read_equation_data_line1(
int *neq,
double *cnst) {
1377 if (strcmp(p,
"link") == 0 || strcmp(p,
"LINK") == 0) {
1416 static int read_equation_data_line2(
int neq,
double cnst) {
1421 const int NITEM = 100;
1423 struct hecmw_io_mpcitem *mpcitem;
1424 bool isAllDof =
false;
1427 if (mpcitem ==
NULL) {
1435 if (strcmp(p,
"link") == 0 || strcmp(p,
"LINK") == 0) {
1443 for (i = 0; i < neq; i++) {
1454 mpcitem[i].ngrp[0] =
'\0';
1466 snprintf(mpcitem[i].ngrp,
sizeof(mpcitem[i].ngrp),
"%s", p);
1472 mpcitem[i].node = -1;
1493 if (mpcitem[i].dof == 0) {
1521 "',' or NL required after coefficient");
1524 if (token ==
',' && i == NITEM - 1) {
1537 for (i = 0; i < neq; i++) {
1541 for (i = 0; i < neq; i++) {
1545 for (i = 0; i < neq; i++) {
1556 }
else if (is_link == 1) {
1571 mpcitem[0].ngrp[0] =
'\0';
1586 mpcitem[1].ngrp[0] =
'\0';
1587 mpcitem[1].a = -1.0;
1612 static int read_equation(
void) {
1621 ST_HEADER_LINE_PARAM,
1627 state = ST_HEADER_LINE;
1628 while (state != ST_FINISHED) {
1629 if (state == ST_HEADER_LINE) {
1630 if (read_equation_head(&token))
return -1;
1632 state = ST_HEADER_LINE_PARAM;
1634 state = ST_DATA_LINE1;
1638 }
else if (state == ST_HEADER_LINE_PARAM) {
1652 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE1;
1657 }
else if (state == ST_DATA_INCLUDE) {
1661 state = ST_DATA_LINE1;
1662 }
else if (state == ST_DATA_LINE1) {
1663 if (read_equation_data_line1(&neq, &cnst))
return -1;
1664 state = ST_DATA_LINE2;
1665 }
else if (state == ST_DATA_LINE2) {
1667 if (read_equation_data_line2(neq, cnst))
return -1;
1672 state = ST_DATA_LINE1;
1675 if (strcmp(p,
"link") == 0 || strcmp(p,
"LINK") == 0) {
1676 state = ST_DATA_LINE1;
1678 state = ST_FINISHED;
1681 state = ST_FINISHED;
1694 static int read_header(
void) {
1719 while (*p && *p ==
' ') p++;
1720 if (p ==
NULL) p =
"";
1721 snprintf(
header->header,
sizeof(
header->header),
"%s", p);
1741 static int read_include(
void) {
1786 static int read_initial_head(
void) {
1805 static int read_initial_param_type(
int *type) {
1822 static int read_initial_data(
int type) {
1886 static int read_initial(
void) {
1894 ST_HEADER_LINE_PARAM,
1899 state = ST_HEADER_LINE;
1900 while (state != ST_FINISHED) {
1901 if (state == ST_HEADER_LINE) {
1902 if (read_initial_head())
return -1;
1903 state = ST_HEADER_LINE_PARAM;
1904 }
else if (state == ST_HEADER_LINE_PARAM) {
1908 if (read_initial_param_type(&type))
return -1;
1923 state = ST_DATA_INCLUDE;
1925 state = ST_DATA_LINE;
1932 }
else if (token ==
',') {
1938 }
else if (state == ST_DATA_INCLUDE) {
1942 state = ST_DATA_LINE;
1943 }
else if (state == ST_DATA_LINE) {
1945 if (read_initial_data(type))
return -1;
1950 state = ST_FINISHED;
1963 static int read_matitem_head(
int *item,
int *last_token) {
1998 *last_token = token;
2003 static int read_matitem_param_subitem(
int *subitem) {
2018 if (*subitem <= 0) {
2025 static int read_matitem_data(
int subitem,
int depend_temp,
2026 struct hecmw_io_matitem *matitem) {
2030 struct hecmw_io_matsubitem *p, *q, *msitem;
2033 if (msitem ==
NULL) {
2044 for (i = 0; i < subitem; i++) {
2048 for (i = 0; i < subitem; i++) {
2053 }
else if (token ==
',') {
2087 for (p = matitem->subitem; p; p = (q = p)->next)
2089 if (q && temp <= q->temp) {
2106 msitem->temp = temp;
2107 msitem->next =
NULL;
2110 for (p = matitem->subitem; p; p = (q = p)->next)
2113 matitem->subitem = msitem;
2121 static int read_matitem(
struct hecmw_io_matitem *matitem) {
2126 int depend_temp = 0;
2130 ST_HEADER_LINE_PARAM,
2137 state = ST_HEADER_LINE;
2138 while (state != ST_FINISHED) {
2139 if (state == ST_HEADER_LINE) {
2140 if (read_matitem_head(&item, &token))
return -1;
2142 state = ST_HEADER_LINE_PARAM;
2147 }
else if (state == ST_HEADER_LINE_PARAM) {
2150 if (read_matitem_param_subitem(&subitem))
return -1;
2165 }
else if (state == ST_PREPARE) {
2170 matitem->item = item;
2171 matitem->nval = subitem;
2172 matitem->subitem =
NULL;
2177 state = ST_DATA_LINE;
2178 }
else if (state == ST_DATA_LINE) {
2183 if (read_matitem_data(subitem, depend_temp, matitem))
return -1;
2189 state = ST_FINISHED;
2199 static int read_material_head(
void) {
2218 static int read_material_param_name(
char *name,
size_t name_len) {
2230 "NAME must begin with a letter or '_'");
2238 snprintf(name, name_len,
"%s", p);
2251 static int read_material_param_item(
int *item) {
2272 static int matitem_comp(
const void *matitem1,
const void *matitem2) {
2273 const struct hecmw_io_matitem *m1, *m2;
2278 if (m1->item == m2->item)
return 0;
2279 if (m1->item < m2->item) {
2286 static int read_material_data(
int item,
char *name) {
2289 struct hecmw_io_matitem *matitem;
2298 if (matitem ==
NULL) {
2303 for (i = 0; i < item; i++) {
2304 if (read_matitem(&matitem[i]))
return -1;
2308 qsort(matitem, item,
sizeof(*matitem), matitem_comp);
2311 for (i = 0; i < item; i++) {
2312 if (matitem[i].item != i + 1) {
2319 snprintf(mat->
name,
sizeof(mat->
name),
"%s", name);
2321 mat->
item = matitem;
2330 static int read_material(
void) {
2339 ST_HEADER_LINE_PARAM,
2344 state = ST_HEADER_LINE;
2345 while (state != ST_FINISHED) {
2346 if (state == ST_HEADER_LINE) {
2347 if (read_material_head())
return -1;
2348 state = ST_HEADER_LINE_PARAM;
2349 }
else if (state == ST_HEADER_LINE_PARAM) {
2353 if (read_material_param_name(name,
sizeof(name)))
return -1;
2357 if (read_material_param_item(&item))
return -1;
2375 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
2376 }
else if (token ==
',') {
2382 }
else if (state == ST_DATA_INCLUDE) {
2386 state = ST_DATA_LINE;
2387 }
else if (state == ST_DATA_LINE) {
2389 if (read_material_data(item, name))
return -1;
2390 state = ST_FINISHED;
2404 fprintf(stderr,
"!NCOPY has not implemented yet\n");
2413 fprintf(stderr,
"!NFILL has not implemented yet\n");
2422 fprintf(stderr,
"!NGEN has not implemented yet\n");
2430 static int read_ngrp_head(
void) {
2449 static int read_ngrp_param_ngrp(
char *ngrp,
size_t ngrp_len) {
2461 "NGRP must begin with a letter or '_'");
2469 snprintf(ngrp, ngrp_len,
"%s", p);
2475 if (strcmp(ngrp,
"EQUATION_BLOCK") == 0) {
2479 if (strcmp(ngrp,
"ALL") == 0) {
2486 static int read_ngrp_data(
char *ngrp) {
2487 int i, n, *node, token;
2524 "',' or NL required after node ID");
2552 static int read_ngrp_generate(
char *ngrp) {
2553 int i, n,
id, *node, token;
2554 int nod1, nod2, nod3;
2620 "Cannot generate between %d and %d with an increment of %d", nod1,
2624 if ((nod2 - nod1) % nod3) {
2626 "Cannot generate between %d and %d with an increment of %d", nod1,
2631 n = (nod2 - nod1) / nod3 + 1;
2639 for (
id = nod1;
id <= nod2;
id += nod3) {
2657 static int read_ngroup(
void) {
2660 int flag_generate = 0;
2666 st_header_line_param,
2669 st_data_line_generate
2672 state = st_header_line;
2673 while (state != st_finished) {
2674 if (state == st_header_line) {
2675 if (read_ngrp_head())
return -1;
2676 state = st_header_line_param;
2677 }
else if (state == st_header_line_param) {
2681 if (read_ngrp_param_ngrp(ngrp,
sizeof(ngrp)))
return -1;
2699 state = st_data_include;
2700 }
else if (flag_generate) {
2701 state = st_data_line_generate;
2703 state = st_data_line;
2710 }
else if (token ==
',') {
2716 }
else if (state == st_data_include) {
2720 state = flag_generate ? st_data_line_generate : st_data_line;
2721 }
else if (state == st_data_line) {
2723 if (read_ngrp_data(ngrp))
return -1;
2728 state = st_finished;
2731 }
else if (state == st_data_line_generate) {
2734 if (read_ngrp_generate(ngrp))
return -1;
2735 state = st_finished;
2746 static int read_node_head(
int *last_token) {
2761 *last_token = token;
2766 static int read_node_param_system(
int *system) {
2775 if (token !=
'C' && token !=
'R') {
2783 static int read_node_param_ngrp(
char *ngrp,
size_t ngrp_len) {
2795 "NGRP must begin with a letter or '_'");
2803 snprintf(ngrp, ngrp_len,
"%s", p);
2809 if (strcmp(ngrp,
"ALL") == 0) {
2816 static int read_node_data(
int *id_arg,
double *x_arg,
double *y_arg,
2915 static int read_node_convert_coord(
int system,
double *x,
double *y,
2925 if (system ==
'C') {
2945 static int read_node(
void) {
2954 ST_HEADER_LINE_PARAM,
2959 state = ST_HEADER_LINE;
2960 while (state != ST_FINISHED) {
2961 if (state == ST_HEADER_LINE) {
2962 if (read_node_head(&token))
return -1;
2964 state = ST_DATA_LINE;
2965 }
else if (token ==
',') {
2966 state = ST_HEADER_LINE_PARAM;
2970 }
else if (state == ST_HEADER_LINE_PARAM) {
2974 if (read_node_param_system(&system))
return -1;
2977 if (read_node_param_ngrp(ngrp,
sizeof(ngrp)))
return -1;
2991 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
2992 }
else if (token ==
',') {
2998 }
else if (state == ST_DATA_INCLUDE) {
3001 state = ST_DATA_LINE;
3002 }
else if (state == ST_DATA_LINE) {
3006 if (read_node_data(&
id, &
x, &
y, &
z))
return -1;
3007 if (read_node_convert_coord(system, &
x, &
y, &
z))
return -1;
3022 state = ST_FINISHED;
3024 state = ST_DATA_LINE;
3037 static int read_section_head(
void) {
3056 static int read_section_param_type(
int *type) {
3080 static int read_section_param_egrp(
char *egrp,
size_t egrp_len) {
3092 "EGRP must begin with a letter or '_'");
3100 snprintf(egrp, egrp_len,
"%s", p);
3109 static int read_section_param_material(
char *material,
size_t material_len) {
3121 "MATERIAL must begin with a letter or '_'");
3129 snprintf(material, material_len,
"%s", p);
3140 read_section_param_composite(
int *composite)
3156 if(*composite <= 0) {
3164 static int read_section_param_secopt(
int *secopt_arg) {
3187 *secopt_arg = secopt;
3192 static int read_section_solid(
union hecmw_io_section_item *sect_item) {
3212 if (thickness <= 0.0) {
3218 sect_item->solid.thickness = thickness;
3223 static int read_section_shell(
union hecmw_io_section_item *sect_item) {
3225 int token, integpoints;
3235 if (thickness <= 0.0) {
3255 if (integpoints <= 0) {
3268 sect_item->shell.thickness = thickness;
3269 sect_item->shell.integpoints = integpoints;
3274 static int read_section_beam(
union hecmw_io_section_item *sect_item) {
3275 double nx, ny, nz, area, Iyy, Izz, Jx;
3407 sect_item->beam.vxyz[0] = nx;
3408 sect_item->beam.vxyz[1] = ny;
3409 sect_item->beam.vxyz[2] = nz;
3410 sect_item->beam.area = area;
3411 sect_item->beam.Iyy = Iyy;
3412 sect_item->beam.Izz = Izz;
3413 sect_item->beam.Jx = Jx;
3418 static int read_section_interface(
union hecmw_io_section_item *sect_item) {
3421 double gapcon = 0.0;
3422 double gaprad1 = 0.0;
3423 double gaprad2 = 0.0;
3434 if (thickness <= 0.0) {
3443 "',' or NL reuqired after THICKNESS");
3452 }
else if (token ==
',') {
3465 "',' or NL reuiqred after GAPCON");
3474 }
else if (token ==
',') {
3487 "',' or NL reuqired after GAPRAD1");
3513 sect_item->interface.thickness = thickness;
3514 sect_item->interface.gapcon = gapcon;
3515 sect_item->interface.gaprad1 = gaprad1;
3516 sect_item->interface.gaprad2 = gaprad2;
3521 static int read_section(
void) {
3526 union hecmw_io_section_item sect_item;
3529 int flag_material = 0;
3530 int flag_composite = 0;
3537 ST_HEADER_LINE_PARAM,
3542 ST_DATA_LINE_INTERFACE,
3546 state = ST_HEADER_LINE;
3547 while (state != ST_FINISHED) {
3548 if (state == ST_HEADER_LINE) {
3549 if (read_section_head())
return -1;
3550 state = ST_HEADER_LINE_PARAM;
3551 }
else if (state == ST_HEADER_LINE_PARAM) {
3555 if (read_section_param_type(&type))
return -1;
3559 if (read_section_param_egrp(egrp,
sizeof(egrp)))
return -1;
3563 if (flag_composite) {
3567 if (read_section_param_material(material,
sizeof(material)))
return -1;
3576 if(read_section_param_composite(&composite))
return -1;
3581 if (read_section_param_secopt(&secopt))
return -1;
3605 state = ST_DATA_INCLUDE;
3607 state = ST_DATA_LINE_SOLID;
3609 state = ST_DATA_LINE_SHELL;
3611 state = ST_DATA_LINE_BEAM;
3613 state = ST_DATA_LINE_INTERFACE;
3617 }
else if (token ==
',') {
3623 }
else if (state == ST_DATA_INCLUDE) {
3630 state = ST_DATA_LINE_SOLID;
3632 state = ST_DATA_LINE_SHELL;
3634 state = ST_DATA_LINE_BEAM;
3636 state = ST_DATA_LINE_INTERFACE;
3640 }
else if (state == ST_DATA_LINE_SOLID) {
3645 if (read_section_solid(§_item))
return -1;
3646 state = ST_DATA_LINE_REGIST;
3647 }
else if (state == ST_DATA_LINE_SHELL) {
3652 if (read_section_shell(§_item))
return -1;
3653 state = ST_DATA_LINE_REGIST;
3654 }
else if (state == ST_DATA_LINE_BEAM) {
3659 if (read_section_beam(§_item))
return -1;
3660 state = ST_DATA_LINE_REGIST;
3661 }
else if (state == ST_DATA_LINE_INTERFACE) {
3666 if (read_section_interface(§_item))
return -1;
3667 state = ST_DATA_LINE_REGIST;
3668 }
else if (state == ST_DATA_LINE_REGIST) {
3679 sect.sect = sect_item;
3686 state = ST_FINISHED;
3697 static int read_sgrp_head(
void) {
3716 static int read_sgrp_param_sgrp(
char *sgrp,
size_t sgrp_len) {
3728 "SGRP must begin with a letter or '_'");
3736 snprintf(sgrp, sgrp_len,
"%s", p);
3745 static int read_sgrp_data(
char *sgrp) {
3746 int i, n, *elem, *surf, token;
3747 struct hecmw_io_id *elem_head, *surf_head, *elem_prev, *surf_prev;
3748 struct hecmw_io_id *eid, *sid, *pe, *qe, *ps, *qs;
3751 elem_head = surf_head =
NULL;
3752 elem_prev = surf_prev =
NULL;
3771 if (elem_head ==
NULL) {
3772 elem_head = elem_prev = eid;
3774 elem_prev->
next = eid;
3800 if (surf_head ==
NULL) {
3801 surf_head = surf_prev = sid;
3803 surf_prev->
next = sid;
3813 "',' or NL required after surface ID");
3835 for (i = 0; i < n; i++) {
3856 static int read_sgroup(
void) {
3864 ST_HEADER_LINE_PARAM,
3869 state = ST_HEADER_LINE;
3870 while (state != ST_FINISHED) {
3871 if (state == ST_HEADER_LINE) {
3872 if (read_sgrp_head())
return -1;
3873 state = ST_HEADER_LINE_PARAM;
3874 }
else if (state == ST_HEADER_LINE_PARAM) {
3878 if (read_sgrp_param_sgrp(sgrp,
sizeof(sgrp)))
return -1;
3897 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
3898 }
else if (token ==
',') {
3904 }
else if (state == ST_DATA_INCLUDE) {
3908 state = ST_DATA_LINE;
3909 }
else if (state == ST_DATA_LINE) {
3911 if (read_sgrp_data(sgrp))
return -1;
3916 state = ST_FINISHED;
3918 state = ST_DATA_LINE;
3932 read_system_head(
void)
3963 }
else if(token ==
',') {
3982 }
else if(token ==
',') {
4015 *last_token = token;
4030 }
else if(token ==
',') {
4049 }
else if(token ==
',') {
4096 }
else if(token ==
',') {
4115 }
else if(token ==
',') {
4166 if(system ==
NULL) {
4182 state = ST_HEADER_LINE;
4183 while(state != ST_FINISHED) {
4184 if(state == ST_HEADER_LINE) {
4185 if(read_system_head())
return -1;
4192 state = ST_FINISHED;
4194 state = ST_DATA_LINE1;
4197 }
else if(state == ST_DATA_LINE1) {
4198 if(read_system_data_line1a(system, &token))
return -1;
4200 state = ST_FINISHED;
4205 if(read_system_data_line1b(system))
return -1;
4208 state = ST_FINISHED;
4210 state = ST_DATA_LINE2;
4213 }
else if(state == ST_DATA_LINE2) {
4214 if(read_system_data_line2(system))
return -1;
4215 state = ST_FINISHED;
4231 static int read_zero(
void) {
4266 if (new_zero ==
NULL) {
4281 static int read_connectivity(
void) {
4295 "',' or NL reqyured after !CONNECTIVITY");
4341 connectivity_type = type;
4353 static struct read_func_table {
4356 } read_func_table[] = {
4381 #define N_READ_FUNC (sizeof(read_func_table) / sizeof(read_func_table[0]))
4384 static ReadFunc get_read_func(
int token) {
4388 if (token == read_func_table[i].token) {
4389 return read_func_table[i].func;
4395 static int parse(
void) {
4405 func = get_read_func(token);
4416 if ((*func)())
return -1;
4427 if (filename ==
NULL) {
4430 "Not specified filename for HECMW-ENTIRE mesh input routine");
4440 snprintf(grid_filename,
sizeof(grid_filename),
"%s", filename);
4443 if ((fp = fopen(filename,
"r")) ==
NULL) {
4462 snprintf(grid_filename,
sizeof(grid_filename),
"Unknown");
4475 if (local_mesh ==
NULL)
return NULL;
4478 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]