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_pair_head(
int *last_token) {
412 "',' or NL required after !CONTACT");
420 static int read_contact_pair_param_name(
char *name) {
432 "NAME must begin with a letter or '_'");
449 static int read_contact_pair_param_type(
int *type) {
469 static int read_contact_pair_data(
char *name,
int type) {
471 char *slave_grp, *master_grp;
486 if (slave_grp ==
NULL) {
518 if (master_grp ==
NULL) {
544 static int read_contact_pair(
void) {
553 ST_HEADER_LINE_PARAM,
558 state = ST_HEADER_LINE;
559 while (state != ST_FINISHED) {
560 if (state == ST_HEADER_LINE) {
561 if (read_contact_pair_head(&token))
return -1;
563 state = ST_DATA_LINE;
564 }
else if (token ==
',') {
565 state = ST_HEADER_LINE_PARAM;
569 }
else if (state == ST_HEADER_LINE_PARAM) {
573 if (read_contact_pair_param_name(name))
return -1;
577 if (read_contact_pair_param_type(&type))
return -1;
596 state = ST_DATA_INCLUDE;
598 state = ST_DATA_LINE;
600 }
else if (token ==
',') {
606 }
else if (state == ST_DATA_INCLUDE) {
610 state = ST_DATA_LINE;
611 }
else if (state == ST_DATA_LINE) {
612 if (read_contact_pair_data(name, type))
return -1;
633 fprintf(stderr,
"!ECOPY has not implemented yet\n");
642 fprintf(stderr,
"!EGEN has not implemented yet\n");
650 static int read_egrp_head(
void) {
669 static int read_egrp_param_egrp(
char *egrp) {
681 "EGRP must begin with a letter or '_'");
695 if (strcmp(egrp,
"ALL") == 0) {
702 static int read_egrp_data(
char *egrp) {
703 int i, n, *elem, token;
740 "',' or NL required after element ID");
770 static int read_egrp_generate(
char *egrp) {
771 int i, n,
id, *elem, token;
772 int elem1, elem2, elem3;
831 "',' or NL required after elem2");
839 "Cannot generate between %d and %d with an increment of %d",
840 elem1, elem2, elem3);
843 if ((elem2 - elem1) % elem3) {
845 "Cannot generate between %d and %d with an increment of %d",
846 elem1, elem2, elem3);
850 n = (elem2 - elem1) / elem3 + 1;
858 for (
id = elem1;
id <= elem2;
id += elem3) {
876 static int read_egroup(
void) {
879 int flag_generate = 0;
885 ST_HEADER_LINE_PARAM,
888 ST_DATA_LINE_GENERATE
891 state = ST_HEADER_LINE;
892 while (state != ST_FINISHED) {
893 if (state == ST_HEADER_LINE) {
894 if (read_egrp_head())
return -1;
895 state = ST_HEADER_LINE_PARAM;
896 }
else if (state == ST_HEADER_LINE_PARAM) {
900 if (read_egrp_param_egrp(egrp))
return -1;
918 state = ST_DATA_INCLUDE;
919 }
else if (flag_generate) {
920 state = ST_DATA_LINE_GENERATE;
922 state = ST_DATA_LINE;
929 }
else if (token ==
',') {
935 }
else if (state == ST_DATA_INCLUDE) {
940 state = flag_generate ? ST_DATA_LINE_GENERATE : ST_DATA_LINE;
941 }
else if (state == ST_DATA_LINE) {
945 if (read_egrp_data(egrp))
return -1;
953 }
else if (state == ST_DATA_LINE_GENERATE) {
957 if (read_egrp_generate(egrp))
return -1;
969 static int read_elem_head(
void) {
988 static int read_elem_param_type(
int *type) {
1009 static int read_elem_param_egrp(
char *egrp) {
1021 "EGRP must begin with a letter or '_'");
1035 if (strcmp(egrp,
"ALL") == 0) {
1042 static int read_elem_param_nmatitem(
int *nmatitem) {
1056 if (*nmatitem < 0) {
1063 static int read_elem_data_conn(
int *
id,
int nnode,
int *node) {
1100 if (i == nnode - 1)
break;
1106 "',' or NL required after connectivity");
1115 static int read_elem_data_mat(
int nmatitem,
double *matitem) {
1119 for (i = 0; i < nmatitem; i++) {
1124 for (i = 0; i < nmatitem; i++) {
1138 if (i == nmatitem - 1) {
1153 static int read_element(
void) {
1158 double *matitem =
NULL;
1163 int flag_matitem = 0;
1169 st_header_line_param,
1173 st_data_line_matitem,
1174 st_data_line_regist,
1178 state = st_header_line;
1179 while (state != st_finished) {
1180 if (state == st_header_line) {
1181 if (read_elem_head())
return -1;
1182 state = st_header_line_param;
1183 }
else if (state == st_header_line_param) {
1187 if (read_elem_param_type(&type))
return -1;
1191 if (read_elem_param_egrp(egrp))
return -1;
1195 if (read_elem_param_nmatitem(&nmatitem))
return -1;
1215 }
else if (token ==
',') {
1221 }
else if (state == st_prepare) {
1239 if (flag_matitem && nmatitem) {
1242 if (matitem ==
NULL) {
1251 state = flag_input ? st_data_include : st_data_line_conn;
1252 }
else if (state == st_data_include) {
1257 state = st_data_line_conn;
1258 }
else if (state == st_data_line_conn) {
1261 if (read_elem_data_conn(&
id, nnode, node))
return -1;
1269 "',' or NL required after connectivity");
1278 state = st_data_line_matitem;
1284 state = st_data_line_regist;
1286 }
else if (state == st_data_line_matitem) {
1292 if (read_elem_data_mat(nmatitem, matitem))
return -1;
1293 state = st_data_line_regist;
1294 }
else if (state == st_data_line_regist) {
1315 state = st_data_line_conn;
1317 state = st_finalize;
1320 }
else if (state == st_finalize) {
1325 state = st_finished;
1336 static int read_equation_head(
int *last_token) {
1349 "',' or NL required after !EQUATION");
1352 *last_token = token;
1357 static int read_equation_data_line1(
int *neq,
double *cnst) {
1371 if (strcmp(p,
"link") == 0 || strcmp(p,
"LINK") == 0) {
1410 static int read_equation_data_line2(
int neq,
double cnst) {
1416 const int NITEM = 100;
1418 struct hecmw_io_mpcitem *mpcitem;
1419 bool isAllDof =
false;
1422 if (mpcitem ==
NULL) {
1430 if (strcmp(p,
"link") == 0 || strcmp(p,
"LINK") == 0) {
1438 for (i = 0; i < neq; i++) {
1449 strcpy(mpcitem[i].ngrp,
"");
1461 strcpy(mpcitem[i].ngrp, p);
1467 mpcitem[i].node = -1;
1488 if (mpcitem[i].dof == 0) {
1516 "',' or NL required after coefficient");
1519 if (token ==
',' && i == NITEM - 1) {
1532 for (i = 0; i < neq; i++) {
1536 for (i = 0; i < neq; i++) {
1540 for (i = 0; i < neq; i++) {
1551 }
else if (is_link == 1) {
1566 strcpy(mpcitem[0].ngrp,
"");
1581 strcpy(mpcitem[1].ngrp,
"");
1582 mpcitem[1].a = -1.0;
1607 static int read_equation(
void) {
1616 ST_HEADER_LINE_PARAM,
1622 state = ST_HEADER_LINE;
1623 while (state != ST_FINISHED) {
1624 if (state == ST_HEADER_LINE) {
1625 if (read_equation_head(&token))
return -1;
1627 state = ST_HEADER_LINE_PARAM;
1629 state = ST_DATA_LINE1;
1633 }
else if (state == ST_HEADER_LINE_PARAM) {
1647 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE1;
1652 }
else if (state == ST_DATA_INCLUDE) {
1656 state = ST_DATA_LINE1;
1657 }
else if (state == ST_DATA_LINE1) {
1658 if (read_equation_data_line1(&neq, &cnst))
return -1;
1659 state = ST_DATA_LINE2;
1660 }
else if (state == ST_DATA_LINE2) {
1662 if (read_equation_data_line2(neq, cnst))
return -1;
1667 state = ST_DATA_LINE1;
1670 if (strcmp(p,
"link") == 0 || strcmp(p,
"LINK") == 0) {
1671 state = ST_DATA_LINE1;
1673 state = ST_FINISHED;
1676 state = ST_FINISHED;
1689 static int read_header(
void) {
1714 while (*p && *p ==
' ') p++;
1715 if (p ==
NULL) p =
"";
1718 strncpy(
header->header, p, len);
1719 header->header[len] =
'\0';
1739 static int read_include(
void) {
1784 static int read_initial_head(
void) {
1803 static int read_initial_param_type(
int *type) {
1820 static int read_initial_data(
int type) {
1884 static int read_initial(
void) {
1892 ST_HEADER_LINE_PARAM,
1897 state = ST_HEADER_LINE;
1898 while (state != ST_FINISHED) {
1899 if (state == ST_HEADER_LINE) {
1900 if (read_initial_head())
return -1;
1901 state = ST_HEADER_LINE_PARAM;
1902 }
else if (state == ST_HEADER_LINE_PARAM) {
1906 if (read_initial_param_type(&type))
return -1;
1921 state = ST_DATA_INCLUDE;
1923 state = ST_DATA_LINE;
1930 }
else if (token ==
',') {
1936 }
else if (state == ST_DATA_INCLUDE) {
1940 state = ST_DATA_LINE;
1941 }
else if (state == ST_DATA_LINE) {
1943 if (read_initial_data(type))
return -1;
1948 state = ST_FINISHED;
1961 static int read_matitem_head(
int *item,
int *last_token) {
1996 *last_token = token;
2001 static int read_matitem_param_subitem(
int *subitem) {
2016 if (*subitem <= 0) {
2023 static int read_matitem_data(
int subitem,
int depend_temp,
2024 struct hecmw_io_matitem *matitem) {
2028 struct hecmw_io_matsubitem *p, *q, *msitem;
2031 if (msitem ==
NULL) {
2042 for (i = 0; i < subitem; i++) {
2046 for (i = 0; i < subitem; i++) {
2051 }
else if (token ==
',') {
2085 for (p = matitem->subitem; p; p = (q = p)->next)
2087 if (q && temp <= q->temp) {
2104 msitem->temp = temp;
2105 msitem->next =
NULL;
2108 for (p = matitem->subitem; p; p = (q = p)->next)
2111 matitem->subitem = msitem;
2119 static int read_matitem(
struct hecmw_io_matitem *matitem) {
2124 int flag_subitem = 0;
2125 int depend_temp = 0;
2129 ST_HEADER_LINE_PARAM,
2136 state = ST_HEADER_LINE;
2137 while (state != ST_FINISHED) {
2138 if (state == ST_HEADER_LINE) {
2139 if (read_matitem_head(&item, &token))
return -1;
2141 state = ST_HEADER_LINE_PARAM;
2146 }
else if (state == ST_HEADER_LINE_PARAM) {
2149 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) {
2230 "NAME must begin with a letter or '_'");
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 strcpy(mat->
name, name);
2321 mat->
item = matitem;
2330 static int read_material(
void) {
2340 ST_HEADER_LINE_PARAM,
2345 state = ST_HEADER_LINE;
2346 while (state != ST_FINISHED) {
2347 if (state == ST_HEADER_LINE) {
2348 if (read_material_head())
return -1;
2349 state = ST_HEADER_LINE_PARAM;
2350 }
else if (state == ST_HEADER_LINE_PARAM) {
2354 if (read_material_param_name(name))
return -1;
2358 if (read_material_param_item(&item))
return -1;
2377 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
2378 }
else if (token ==
',') {
2384 }
else if (state == ST_DATA_INCLUDE) {
2388 state = ST_DATA_LINE;
2389 }
else if (state == ST_DATA_LINE) {
2391 if (read_material_data(item, name))
return -1;
2392 state = ST_FINISHED;
2406 fprintf(stderr,
"!NCOPY has not implemented yet\n");
2415 fprintf(stderr,
"!NFILL has not implemented yet\n");
2424 fprintf(stderr,
"!NGEN has not implemented yet\n");
2432 static int read_ngrp_head(
void) {
2451 static int read_ngrp_param_ngrp(
char *ngrp) {
2463 "NGRP must begin with a letter or '_'");
2477 if (strcmp(ngrp,
"EQUATION_BLOCK") == 0) {
2481 if (strcmp(ngrp,
"ALL") == 0) {
2488 static int read_ngrp_data(
char *ngrp) {
2489 int i, n, *node, token;
2526 "',' or NL required after node ID");
2554 static int read_ngrp_generate(
char *ngrp) {
2555 int i, n,
id, *node, token;
2556 int nod1, nod2, nod3;
2622 "Cannot generate between %d and %d with an increment of %d", nod1,
2626 if ((nod2 - nod1) % nod3) {
2628 "Cannot generate between %d and %d with an increment of %d", nod1,
2633 n = (nod2 - nod1) / nod3 + 1;
2641 for (
id = nod1;
id <= nod2;
id += nod3) {
2659 static int read_ngroup(
void) {
2662 int flag_generate = 0;
2668 st_header_line_param,
2671 st_data_line_generate
2674 state = st_header_line;
2675 while (state != st_finished) {
2676 if (state == st_header_line) {
2677 if (read_ngrp_head())
return -1;
2678 state = st_header_line_param;
2679 }
else if (state == st_header_line_param) {
2683 if (read_ngrp_param_ngrp(ngrp))
return -1;
2701 state = st_data_include;
2702 }
else if (flag_generate) {
2703 state = st_data_line_generate;
2705 state = st_data_line;
2712 }
else if (token ==
',') {
2718 }
else if (state == st_data_include) {
2722 state = flag_generate ? st_data_line_generate : st_data_line;
2723 }
else if (state == st_data_line) {
2725 if (read_ngrp_data(ngrp))
return -1;
2730 state = st_finished;
2733 }
else if (state == st_data_line_generate) {
2736 if (read_ngrp_generate(ngrp))
return -1;
2737 state = st_finished;
2748 static int read_node_head(
int *last_token) {
2763 *last_token = token;
2768 static int read_node_param_system(
int *system) {
2777 if (token !=
'C' && token !=
'R') {
2785 static int read_node_param_ngrp(
char *ngrp) {
2797 "NGRP must begin with a letter or '_'");
2811 if (strcmp(ngrp,
"ALL") == 0) {
2818 static int read_node_data(
int *id_arg,
double *x_arg,
double *y_arg,
2917 static int read_node_convert_coord(
int system,
double *x,
double *y,
2927 if (system ==
'C') {
2947 static int read_node(
void) {
2950 int flag_system = 0;
2957 ST_HEADER_LINE_PARAM,
2962 state = ST_HEADER_LINE;
2963 while (state != ST_FINISHED) {
2964 if (state == ST_HEADER_LINE) {
2965 if (read_node_head(&token))
return -1;
2967 state = ST_DATA_LINE;
2968 }
else if (token ==
',') {
2969 state = ST_HEADER_LINE_PARAM;
2973 }
else if (state == ST_HEADER_LINE_PARAM) {
2977 if (read_node_param_system(&system))
return -1;
2981 if (read_node_param_ngrp(ngrp))
return -1;
2995 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
2996 }
else if (token ==
',') {
3002 }
else if (state == ST_DATA_INCLUDE) {
3005 state = ST_DATA_LINE;
3006 }
else if (state == ST_DATA_LINE) {
3010 if (read_node_data(&
id, &
x, &
y, &
z))
return -1;
3011 if (read_node_convert_coord(system, &
x, &
y, &
z))
return -1;
3026 state = ST_FINISHED;
3028 state = ST_DATA_LINE;
3041 static int read_section_head(
void) {
3060 static int read_section_param_type(
int *type) {
3084 static int read_section_param_egrp(
char *egrp) {
3096 "EGRP must begin with a letter or '_'");
3113 static int read_section_param_material(
char *material) {
3125 "MATERIAL must begin with a letter or '_'");
3133 strcpy(material, p);
3144 read_section_param_composite(
int *composite)
3160 if(*composite <= 0) {
3168 static int read_section_param_secopt(
int *secopt_arg) {
3191 *secopt_arg = secopt;
3196 static int read_section_solid(
union hecmw_io_section_item *sect_item) {
3216 if (thickness <= 0.0) {
3222 sect_item->solid.thickness = thickness;
3227 static int read_section_shell(
union hecmw_io_section_item *sect_item) {
3229 int token, integpoints;
3239 if (thickness <= 0.0) {
3259 if (integpoints <= 0) {
3272 sect_item->shell.thickness = thickness;
3273 sect_item->shell.integpoints = integpoints;
3278 static int read_section_beam(
union hecmw_io_section_item *sect_item) {
3279 double nx, ny, nz, area, Iyy, Izz, Jx;
3411 sect_item->beam.vxyz[0] = nx;
3412 sect_item->beam.vxyz[1] = ny;
3413 sect_item->beam.vxyz[2] = nz;
3414 sect_item->beam.area = area;
3415 sect_item->beam.Iyy = Iyy;
3416 sect_item->beam.Izz = Izz;
3417 sect_item->beam.Jx = Jx;
3422 static int read_section_interface(
union hecmw_io_section_item *sect_item) {
3425 double gapcon = 0.0;
3426 double gaprad1 = 0.0;
3427 double gaprad2 = 0.0;
3438 if (thickness <= 0.0) {
3447 "',' or NL reuqired after THICKNESS");
3456 }
else if (token ==
',') {
3469 "',' or NL reuiqred after GAPCON");
3478 }
else if (token ==
',') {
3491 "',' or NL reuqired after GAPRAD1");
3517 sect_item->interface.thickness = thickness;
3518 sect_item->interface.gapcon = gapcon;
3519 sect_item->interface.gaprad1 = gaprad1;
3520 sect_item->interface.gaprad2 = gaprad2;
3525 static int read_section(
void) {
3530 union hecmw_io_section_item sect_item;
3533 int flag_material = 0;
3534 int flag_composite = 0;
3535 int flag_secopt = 0;
3542 ST_HEADER_LINE_PARAM,
3547 ST_DATA_LINE_INTERFACE,
3551 state = ST_HEADER_LINE;
3552 while (state != ST_FINISHED) {
3553 if (state == ST_HEADER_LINE) {
3554 if (read_section_head())
return -1;
3555 state = ST_HEADER_LINE_PARAM;
3556 }
else if (state == ST_HEADER_LINE_PARAM) {
3560 if (read_section_param_type(&type))
return -1;
3564 if (read_section_param_egrp(egrp))
return -1;
3568 if (flag_composite) {
3572 if (read_section_param_material(material))
return -1;
3581 if(read_section_param_composite(&composite))
return -1;
3586 if (read_section_param_secopt(&secopt))
return -1;
3611 state = ST_DATA_INCLUDE;
3613 state = ST_DATA_LINE_SOLID;
3615 state = ST_DATA_LINE_SHELL;
3617 state = ST_DATA_LINE_BEAM;
3619 state = ST_DATA_LINE_INTERFACE;
3623 }
else if (token ==
',') {
3629 }
else if (state == ST_DATA_INCLUDE) {
3636 state = ST_DATA_LINE_SOLID;
3638 state = ST_DATA_LINE_SHELL;
3640 state = ST_DATA_LINE_BEAM;
3642 state = ST_DATA_LINE_INTERFACE;
3646 }
else if (state == ST_DATA_LINE_SOLID) {
3651 if (read_section_solid(§_item))
return -1;
3652 state = ST_DATA_LINE_REGIST;
3653 }
else if (state == ST_DATA_LINE_SHELL) {
3658 if (read_section_shell(§_item))
return -1;
3659 state = ST_DATA_LINE_REGIST;
3660 }
else if (state == ST_DATA_LINE_BEAM) {
3665 if (read_section_beam(§_item))
return -1;
3666 state = ST_DATA_LINE_REGIST;
3667 }
else if (state == ST_DATA_LINE_INTERFACE) {
3672 if (read_section_interface(§_item))
return -1;
3673 state = ST_DATA_LINE_REGIST;
3674 }
else if (state == ST_DATA_LINE_REGIST) {
3685 sect.sect = sect_item;
3692 state = ST_FINISHED;
3703 static int read_sgrp_head(
void) {
3722 static int read_sgrp_param_sgrp(
char *sgrp) {
3734 "SGRP must begin with a letter or '_'");
3751 static int read_sgrp_data(
char *sgrp) {
3752 int i, n, *elem, *surf, token;
3753 struct hecmw_io_id *elem_head, *surf_head, *elem_prev, *surf_prev;
3754 struct hecmw_io_id *eid, *sid, *pe, *qe, *ps, *qs;
3757 elem_head = surf_head =
NULL;
3758 elem_prev = surf_prev =
NULL;
3777 if (elem_head ==
NULL) {
3778 elem_head = elem_prev = eid;
3780 elem_prev->
next = eid;
3806 if (surf_head ==
NULL) {
3807 surf_head = surf_prev = sid;
3809 surf_prev->
next = sid;
3819 "',' or NL required after surface ID");
3841 for (i = 0; i < n; i++) {
3862 static int read_sgroup(
void) {
3870 ST_HEADER_LINE_PARAM,
3875 state = ST_HEADER_LINE;
3876 while (state != ST_FINISHED) {
3877 if (state == ST_HEADER_LINE) {
3878 if (read_sgrp_head())
return -1;
3879 state = ST_HEADER_LINE_PARAM;
3880 }
else if (state == ST_HEADER_LINE_PARAM) {
3884 if (read_sgrp_param_sgrp(sgrp))
return -1;
3903 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
3904 }
else if (token ==
',') {
3910 }
else if (state == ST_DATA_INCLUDE) {
3914 state = ST_DATA_LINE;
3915 }
else if (state == ST_DATA_LINE) {
3917 if (read_sgrp_data(sgrp))
return -1;
3922 state = ST_FINISHED;
3924 state = ST_DATA_LINE;
3938 read_system_head(
void)
3969 }
else if(token ==
',') {
3988 }
else if(token ==
',') {
4021 *last_token = token;
4036 }
else if(token ==
',') {
4055 }
else if(token ==
',') {
4102 }
else if(token ==
',') {
4121 }
else if(token ==
',') {
4172 if(system ==
NULL) {
4188 state = ST_HEADER_LINE;
4189 while(state != ST_FINISHED) {
4190 if(state == ST_HEADER_LINE) {
4191 if(read_system_head())
return -1;
4198 state = ST_FINISHED;
4200 state = ST_DATA_LINE1;
4203 }
else if(state == ST_DATA_LINE1) {
4204 if(read_system_data_line1a(system, &token))
return -1;
4206 state = ST_FINISHED;
4211 if(read_system_data_line1b(system))
return -1;
4214 state = ST_FINISHED;
4216 state = ST_DATA_LINE2;
4219 }
else if(state == ST_DATA_LINE2) {
4220 if(read_system_data_line2(system))
return -1;
4221 state = ST_FINISHED;
4237 static int read_zero(
void) {
4272 if (new_zero ==
NULL) {
4287 static int read_connectivity(
void) {
4301 "',' or NL reqyured after !CONNECTIVITY");
4347 connectivity_type = type;
4359 static struct read_func_table {
4362 } read_func_table[] = {
4386 #define N_READ_FUNC (sizeof(read_func_table) / sizeof(read_func_table[0]))
4389 static ReadFunc get_read_func(
int token) {
4393 if (token == read_func_table[i].token) {
4394 return read_func_table[i].func;
4400 static int parse(
void) {
4410 func = get_read_func(token);
4421 if ((*func)())
return -1;
4432 if (filename ==
NULL) {
4435 "Not specified filename for HECMW-ENTIRE mesh input routine");
4445 strcpy(grid_filename, filename);
4448 if ((fp = fopen(filename,
"r")) ==
NULL) {
4467 strcpy(grid_filename,
"Unknown");
4480 if (local_mesh ==
NULL)
return NULL;
4483 strcpy(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)
int HECMW_heclex_is_including(void)
@ HECMW_HECLEX_K_SURF_SURF
@ HECMW_HECLEX_K_GENERATE
@ 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_TEMPERATURE
@ HECMW_HECLEX_K_TIMEVALUE
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)
char head[HECMW_HEADER_LEN+1]
#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_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_snprintf(char *str, size_t size, const char *format,...)
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]