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_noloc(
int msgno,
const char *fmt, ...) {
60 static void set_err(
int msgno,
const char *fmt, ...) {
68 static void set_err_token(
int token,
int msgno,
const char *fmt, ...) {
82 static void log_warn(
int msgno,
const char *fmt, ...) {
96 static void free_Integer(
void *v) {
105 static struct material_keywords {
108 } material_keywords[] = {
115 #define N_MAT_KEYS (sizeof(material_keywords) / sizeof(material_keywords[0]))
117 static int is_material_keyword(
int keyword) {
121 if (keyword == material_keywords[i].keyword)
return 1;
126 static char *get_material_string(
int keyword) {
130 if (keyword == material_keywords[i].keyword) {
131 return material_keywords[i].string;
139 static int flag_material_zone;
142 static struct material_data {
144 struct hecmw_io_matitem *matitem;
145 struct material_data *next;
148 static int is_material_zone(
void) {
return flag_material_zone; }
150 static void set_material_zone(
int flag) { flag_material_zone = flag ? 1 : 0; }
152 static int add_mat_data(
int keyword,
struct hecmw_io_matitem *matitem) {
154 struct material_data *p, *q, *mdata;
156 for (p = matdata; p; p = p->next) {
157 if (p->keyword == keyword)
break;
160 struct hecmw_io_matsubitem *sip, *siq;
161 struct hecmw_io_matitem *item = p->matitem;
162 p->matitem = matitem;
163 matitem->item = item->item;
164 for (sip = item->subitem; sip; sip = siq) {
171 get_material_string(keyword), matname);
181 mdata->keyword = keyword;
182 mdata->matitem = matitem;
186 for (i = 0, p = matdata; p; p = (q = p)->next, i++)
188 matitem->item = i + 1;
198 static int count_mat_item(
void) {
200 struct material_data *p, *q;
202 for (n = 0, p = matdata; p; p = (q = p)->next, n++)
207 static int regist_material(
void) {
210 struct material_data *p, *q;
212 n = count_mat_item();
213 if (n == 0)
return 0;
224 strcpy(mat->
name, matname);
232 for (i = 0, p = matdata; p; p = q, i++) {
235 mat->
item[i] = *p->matitem;
254 static int read_mat_data_line_common(
int nval,
int nval_line,
double *val,
262 for (i = 0; i < nval; i++) {
270 set_err_token(token, errmsgno,
"VAL or ',' or NL reuqired");
275 }
else if (token ==
',') {
284 set_err_token(token, errmsgno,
"',' or NL required after VAL");
290 i += nval_line - (i % nval_line);
297 set_err_token(token, errmsgno,
"NL required");
307 static int read_mat_data_common(
int nval,
int nval_line,
int temp_col,
308 struct hecmw_io_matitem **matitem,
int msgno) {
310 struct hecmw_io_matitem *item =
NULL;
311 struct hecmw_io_matsubitem *subitem =
NULL;
312 struct hecmw_io_matsubitem *q, *p =
NULL;
322 item->subitem =
NULL;
326 if (subitem ==
NULL) {
331 subitem->val =
HECMW_malloc(
sizeof(*subitem->val) * nval);
332 if (subitem->val ==
NULL) {
337 if (read_mat_data_line_common(nval, nval_line, subitem->val, msgno))
340 subitem->temp = subitem->val[temp_col - 1];
341 subitem->next =
NULL;
344 item->subitem = subitem;
362 for (p = item->subitem; p; p = q) {
374 static int read_param_dependencies(
int *dependencies,
int msgno) {
379 set_err_token(token, msgno,
"'=' required after DEPENDENCIES");
384 set_err_token(token, msgno,
"Invalid DEPENDENCIES");
388 if (*dependencies <= 0) {
389 set_err_token(token, msgno,
"DEPENDENCIES must be positive integer");
397 static struct etype_conv {
433 static int get_HECMW_etype(
int abaqus_etype) {
436 for (i = 0; i <
sizeof(etype_conv) /
sizeof(etype_conv[0]); i++) {
437 if (etype_conv[i].abaqus_etype == abaqus_etype) {
438 return etype_conv[i].hecmw_etype;
444 static int get_secopt_abaqus(
int abaqus_etype) {
447 for (i = 0; i <
sizeof(etype_conv) /
sizeof(etype_conv[0]); i++) {
448 if (etype_conv[i].abaqus_etype == abaqus_etype) {
449 return etype_conv[i].secopt;
455 static int get_secopt(
char *elset,
int msgno) {
460 if (elem ==
NULL)
return -1;
463 for (i = 0; i < elem->
n; i++) {
465 if (secopt ==
NULL) {
466 set_err_noloc(msgno,
"");
470 secopt_prev = secopt->
i;
472 if (secopt_prev != secopt->
i)
goto error;
490 static int read_input(
int msgno_invalid_token) {
496 set_err_token(token, msgno_invalid_token,
"'=' required after INPUT");
501 set_err_token(token, msgno_invalid_token,
"Invalid filename for INPUT");
510 strcpy(include_filename, p);
519 sprintf(include_filename,
"%s%s%s", dname,
separator, p);
526 static int read_amplitude_keyword(
void) {
539 "',' required after *AMPLITUDE");
545 static int read_amplitude_param_name(
char *name) {
557 "NAME must begin with a letter");
574 static int read_amplitude_param_definition(
int *definition) {
580 "'=' required after DEFINITION");
592 static int read_amplitude_param_time(
int *time) {
609 static int read_amplitude_param_value(
int *value) {
629 static int read_amplitude_data(
char *name,
int definition,
int time,
686 if (token ==
',' && i == NITEM) {
690 "Only %d items allow per line", NITEM);
701 static int read_amplitude(
void) {
707 int flag_definition = 0;
715 ST_KEYWORD_LINE_PARAM,
720 state = ST_KEYWORD_LINE;
721 while (state != ST_FINISHED) {
722 if (state == ST_KEYWORD_LINE) {
723 if (read_amplitude_keyword())
return -1;
724 state = ST_KEYWORD_LINE_PARAM;
725 }
else if (state == ST_KEYWORD_LINE_PARAM) {
729 if (read_amplitude_param_name(name))
return -1;
733 if (read_amplitude_param_definition(&definition))
return -1;
737 if (read_amplitude_param_time(&time))
return -1;
741 if (read_amplitude_param_value(&value))
return -1;
760 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
761 }
else if (token ==
',') {
767 }
else if (state == ST_DATA_INCLUDE) {
771 state = ST_DATA_LINE;
772 }
else if (state == ST_DATA_LINE) {
775 if (read_amplitude_data(name, definition, time, value))
return -1;
795 fprintf(stderr,
"*ECOPY has not implemented yet\n");
806 fprintf(stderr,
"*EGEN has not implemented yet\n");
814 static int read_elset_keyword(
void) {
832 static int read_elset_param_elset(
char *elset,
int *isAll) {
844 "ELSET must begin with a letter");
858 if (strcmp(elset,
"ALL") == 0) {
866 static int read_elset_data(
int *nelem,
int **elem_array) {
867 int token, i,
n, *elem;
905 "',' or NL required after element ID");
920 for (p = head; p; p = q) {
931 for (p = head; p; p = q) {
939 static int read_elset_data_generate(
int *nelem,
int **elem_array) {
940 int token, i, n,
id, *elem;
941 int elem1, elem2, elem3;
993 "NL required after increment");
1000 "',' or NL required after elem2");
1006 if (elem1 > elem2) {
1008 "Cannot generate between %d and %d with an increment of %d", elem1,
1012 if ((elem2 - elem1) % elem3) {
1014 "Cannot generate between %d and %d with an increment of %d", elem1,
1019 n = (elem2 - elem1) / elem3 + 1;
1027 for (
id = elem1;
id <= elem2;
id += elem3) {
1037 static int read_elset(
void) {
1040 int flag_generate = 0;
1046 ST_KEYWORD_LINE_PARAM,
1048 ST_DATA_LINE_GENERATE
1051 state = ST_KEYWORD_LINE;
1052 while (state != ST_FINISHED) {
1053 if (state == ST_KEYWORD_LINE) {
1054 if (read_elset_keyword())
return -1;
1055 state = ST_KEYWORD_LINE_PARAM;
1056 }
else if (state == ST_KEYWORD_LINE_PARAM) {
1060 if (read_elset_param_elset(elset, &isAll))
return -1;
1078 state = flag_generate ? ST_DATA_LINE_GENERATE : ST_DATA_LINE;
1079 }
else if (token ==
',') {
1085 }
else if (state == ST_DATA_LINE) {
1091 if (read_elset_data(&n, &elem))
return -1;
1099 state = ST_FINISHED;
1101 state = ST_DATA_LINE;
1104 }
else if (state == ST_DATA_LINE_GENERATE) {
1110 if (read_elset_data_generate(&n, &elem))
return -1;
1118 state = ST_FINISHED;
1130 static int read_element_header(
void) {
1148 static int read_element_param_type(
int *
hecmw_etype,
int *abaqus_etype) {
1157 *abaqus_etype = token;
1170 static int read_element_param_elset(
char *elset) {
1182 "ELSET must begin with a letter");
1196 if (strcmp(elset,
"ALL") == 0) {
1198 strcpy(elset,
"ABAQUS_ESET_ALL");
1204 static int read_element_data(
int *
id,
int nnode,
int *node) {
1249 if (i == nnode - 1)
break;
1255 "',' or NL required after connectivity");
1275 static int read_element(
void) {
1289 ST_KEYWORD_LINE_PARAM,
1295 state = ST_KEYWORD_LINE;
1296 while (state != ST_FINISHED) {
1297 if (state == ST_KEYWORD_LINE) {
1298 if (read_element_header())
return -1;
1299 state = ST_KEYWORD_LINE_PARAM;
1300 }
else if (state == ST_KEYWORD_LINE_PARAM) {
1304 if (read_element_param_type(&
hecmw_etype, &type))
return -1;
1313 if (read_element_param_elset(elset))
return -1;
1332 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
1333 }
else if (token ==
',') {
1339 }
else if (state == ST_DATA_INCLUDE) {
1343 state = ST_DATA_LINE;
1344 }
else if (state == ST_DATA_LINE) {
1346 if (read_element_data(&
id, nnode, node))
return -1;
1347 state = ST_DATA_LINE_REGIST;
1348 }
else if (state == ST_DATA_LINE_REGIST) {
1362 if (secopt ==
NULL) {
1366 secopt->
i = get_secopt_abaqus(type);
1368 if (elem_secopt ==
NULL) {
1371 if (elem_secopt ==
NULL)
return -1;
1386 state = ST_DATA_LINE;
1388 state = ST_FINISHED;
1400 static int read_equation_keyword(
int *token) {
1410 "',' or NL required after *EQUATION");
1416 static int read_equation_data_line1(
int *neq) {
1440 static int read_equation_data_line2(
int neq) {
1445 struct hecmw_io_mpcitem *mpcitem =
NULL;
1448 if (mpcitem ==
NULL) {
1453 for (i = 0; i < neq; i++) {
1464 strcpy(mpcitem[i].ngrp,
"");
1476 strcpy(mpcitem[i].ngrp, p);
1482 mpcitem[i].node = -1;
1527 "',' or NL required after coefficient");
1530 if (token ==
',' && i == NITEM - 1) {
1550 static int read_equation(
void) {
1557 ST_KEYWORD_LINE_PARAM,
1563 state = ST_KEYWORD_LINE;
1564 while (state != ST_FINISHED) {
1565 if (state == ST_KEYWORD_LINE) {
1566 if (read_equation_keyword(&token))
return -1;
1568 state = ST_KEYWORD_LINE_PARAM;
1570 state = ST_DATA_LINE1;
1574 }
else if (state == ST_KEYWORD_LINE_PARAM) {
1588 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE1;
1593 }
else if (state == ST_DATA_INCLUDE) {
1596 state = ST_DATA_LINE1;
1597 }
else if (state == ST_DATA_LINE1) {
1598 if (read_equation_data_line1(&neq))
return -1;
1600 state = ST_DATA_LINE2;
1601 }
else if (state == ST_DATA_LINE2) {
1603 if (read_equation_data_line2(neq))
return -1;
1607 state = ST_DATA_LINE1;
1609 state = ST_FINISHED;
1621 static int read_heading(
void) {
1643 "TITLE required after *HEADING");
1651 while (*p && *p ==
' ') p++;
1652 if (p ==
NULL) p =
"";
1655 strncpy(
header->header, p, len);
1656 header->header[len] =
'\0';
1674 static int read_include(
void) {
1705 "NL required after INPUT value");
1717 static int read_initial_keyword(
void) {
1736 static int read_initial_param_type(
int *type) {
1753 static int read_initial_data(
int type) {
1785 "Node ID or NGROUP name required");
1826 static int read_initial(
void) {
1834 ST_KEYWORD_LINE_PARAM,
1839 state = ST_KEYWORD_LINE;
1840 while (state != ST_FINISHED) {
1841 if (state == ST_KEYWORD_LINE) {
1842 if (read_initial_keyword())
return -1;
1843 state = ST_KEYWORD_LINE_PARAM;
1844 }
else if (state == ST_KEYWORD_LINE_PARAM) {
1848 if (read_initial_param_type(&type))
return -1;
1863 state = ST_DATA_INCLUDE;
1865 state = ST_DATA_LINE;
1872 }
else if (token ==
',') {
1878 }
else if (state == ST_DATA_INCLUDE) {
1882 state = ST_DATA_LINE;
1883 }
else if (state == ST_DATA_LINE) {
1885 if (read_initial_data(type))
return -1;
1889 state = ST_FINISHED;
1901 static int read_conductivity_keyword(
int *last_token) {
1914 "',' or NL required after *CONDUCTIVITY");
1917 *last_token = token;
1922 static int read_conductivity_param_dependencies(
int *dependencies) {
1926 static int read_conductivity_param_type(
int *type) {
1949 static int read_conductivity_data(
int type,
int dependencies,
1950 struct hecmw_io_matitem **matitem) {
1968 return read_mat_data_common(n + dependencies, 8, temp_col, matitem,
1972 static int read_conductivity(
void) {
1974 int flag_dependencies = 0;
1976 int dependencies = 0;
1978 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
1980 state = ST_KEYWORD_LINE;
1981 while (state != ST_FINISHED) {
1982 if (state == ST_KEYWORD_LINE) {
1983 if (read_conductivity_keyword(&token))
return -1;
1985 state = ST_KEYWORD_LINE_PARAM;
1987 state = ST_DATA_LINE;
1991 }
else if (state == ST_KEYWORD_LINE_PARAM) {
1994 if (read_conductivity_param_dependencies(&dependencies))
return -1;
1995 flag_dependencies = 1;
1997 if (read_conductivity_param_type(&type))
return -1;
2009 state = ST_DATA_LINE;
2011 }
else if (state == ST_DATA_LINE) {
2012 struct hecmw_io_matitem *item;
2013 if (read_conductivity_data(type, dependencies, &item))
return -1;
2015 state = ST_FINISHED;
2025 static int read_density_keyword(
int *last_token) {
2038 "',' or NL required after *DENSITY");
2041 *last_token = token;
2046 static int read_density_param_dependencies(
int *dependencies) {
2050 static int read_density_data(
int dependencies,
2051 struct hecmw_io_matitem **matitem) {
2052 return read_mat_data_common(2 + dependencies, 8, 2, matitem,
2056 static int read_density(
void) {
2058 int flag_dependencies = 0;
2059 int dependencies = 0;
2060 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
2062 state = ST_KEYWORD_LINE;
2063 while (state != ST_FINISHED) {
2064 if (state == ST_KEYWORD_LINE) {
2065 if (read_density_keyword(&token))
return -1;
2067 state = ST_KEYWORD_LINE_PARAM;
2069 state = ST_DATA_LINE;
2073 }
else if (state == ST_KEYWORD_LINE_PARAM) {
2076 if (read_density_param_dependencies(&dependencies))
return -1;
2077 flag_dependencies = 1;
2087 state = ST_DATA_LINE;
2088 }
else if (state == ST_DATA_LINE) {
2089 struct hecmw_io_matitem *item;
2090 if (read_density_data(dependencies, &item))
return -1;
2092 state = ST_FINISHED;
2102 static int read_elastic_keyword(
int *last_token) {
2115 "',' or NL required after *ELASTIC");
2118 *last_token = token;
2123 static int read_elastic_param_dependencies(
int *dependencies) {
2127 static int read_elastic_param_type(
int *type) {
2152 static int read_elastic_param_moduli(
int *moduli) {
2173 static int read_elastic_data(
int type,
int dependencies,
2174 struct hecmw_io_matitem **matitem) {
2196 return read_mat_data_common(n + dependencies, 8, temp_col, matitem,
2200 static int read_elastic(
void) {
2202 int flag_dependencies = 0;
2204 int flag_moduli = 0;
2205 int dependencies = 0;
2208 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
2210 state = ST_KEYWORD_LINE;
2211 while (state != ST_FINISHED) {
2212 if (state == ST_KEYWORD_LINE) {
2213 if (read_elastic_keyword(&token))
return -1;
2215 state = ST_KEYWORD_LINE_PARAM;
2217 state = ST_DATA_LINE;
2221 }
else if (state == ST_KEYWORD_LINE_PARAM) {
2224 if (read_elastic_param_dependencies(&dependencies))
return -1;
2225 flag_dependencies = 1;
2227 if (read_elastic_param_type(&type))
return -1;
2230 if (read_elastic_param_moduli(&moduli))
return -1;
2242 state = ST_DATA_LINE;
2244 }
else if (state == ST_DATA_LINE) {
2245 struct hecmw_io_matitem *item;
2246 if (read_elastic_data(type, dependencies, &item))
return -1;
2248 state = ST_FINISHED;
2258 static int read_specific_keyword(
int *last_token) {
2271 "',' or NL required after *SPECIFIC HEAT");
2274 *last_token = token;
2279 static int read_specific_param_dependencies(
int *dependencies) {
2283 static int read_specific_data(
int dependencies,
2284 struct hecmw_io_matitem **matitem) {
2285 return read_mat_data_common(2 + dependencies, 8, 2, matitem,
2289 static int read_specific_heat(
void) {
2291 int flag_dependencies = 0;
2292 int dependencies = 0;
2293 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
2295 state = ST_KEYWORD_LINE;
2296 while (state != ST_FINISHED) {
2297 if (state == ST_KEYWORD_LINE) {
2298 if (read_specific_keyword(&token))
return -1;
2300 state = ST_KEYWORD_LINE_PARAM;
2302 state = ST_DATA_LINE;
2306 }
else if (state == ST_KEYWORD_LINE_PARAM) {
2309 if (read_specific_param_dependencies(&dependencies))
return -1;
2310 flag_dependencies = 1;
2320 state = ST_DATA_LINE;
2321 }
else if (state == ST_DATA_LINE) {
2322 struct hecmw_io_matitem *item;
2323 if (read_specific_data(dependencies, &item))
return -1;
2325 state = ST_FINISHED;
2335 static int read_material_param_name(
char *name) {
2347 "NAME must begin with a letter");
2368 static int read_material(
void) {
2391 if (read_material_param_name(name))
return -1;
2399 strcpy(matname, name);
2409 fprintf(stderr,
"*NCOPY has not implemented yet\n");
2420 fprintf(stderr,
"*NFILL has not implemented yet\n");
2431 fprintf(stderr,
"*NGEN has not implemented yet\n");
2439 static int read_nset_keyword(
void) {
2457 static int read_nset_param_nset(
char *nset,
int *isAll) {
2469 "NSET must begin with a letter");
2483 if (strcmp(nset,
"EQUATION_BLOCK") == 0) {
2487 if (strcmp(nset,
"ALL") == 0) {
2489 strcpy(nset,
"ABAQUS_NSET_ALL");
2496 static int read_nset_param_instance() {
2508 "NSET must begin with a letter");
2514 static int read_nset_data(
int *nnode,
int **node_array) {
2515 int i, n, *node, token;
2557 "',' or NL required after node ID");
2572 for (p = head; p; p = q) {
2583 for (p = head; p; p = q) {
2591 static int read_nset_data_generate(
int *nnode,
int **node_array) {
2592 int token, i, n,
id, *node, nod1, nod2, nod3;
2644 "NL required after increment");
2651 "',' or NL required after nod2");
2659 "Cannot generate between %d and %d with an increment of %d", nod1,
2663 if ((nod2 - nod1) % nod3) {
2665 "Cannot generate between %d and %d with an increment of %d", nod1,
2670 n = (nod2 - nod1) / nod3 + 1;
2678 for (
id = nod1;
id <= nod2;
id += nod3) {
2689 static int read_nset(
void) {
2692 int flag_generate = 0;
2693 int flag_unsorted = 0;
2699 ST_KEYWORD_LINE_PARAM,
2701 ST_DATA_LINE_GENERATE
2704 state = ST_KEYWORD_LINE;
2705 while (state != ST_FINISHED) {
2706 if (state == ST_KEYWORD_LINE) {
2707 if (read_nset_keyword())
return -1;
2708 state = ST_KEYWORD_LINE_PARAM;
2709 }
else if (state == ST_KEYWORD_LINE_PARAM) {
2713 if (read_nset_param_nset(nset, &isAll))
return -1;
2723 read_nset_param_instance();
2737 if (flag_generate) {
2738 state = ST_DATA_LINE_GENERATE;
2740 state = ST_DATA_LINE;
2742 }
else if (token ==
',') {
2748 }
else if (state == ST_DATA_LINE) {
2752 if (read_nset_data(&n, &node))
return -1;
2761 state = ST_FINISHED;
2763 state = ST_DATA_LINE;
2766 }
else if (state == ST_DATA_LINE_GENERATE) {
2772 if (read_nset_data_generate(&n, &node))
return -1;
2781 state = ST_FINISHED;
2793 static int read_node_keyword(
int *token) {
2804 "',' or NL required after *NODE");
2810 static int read_node_param_system(
int *system) {
2819 if (token !=
'C' && token !=
'R') {
2827 static int read_node_param_nset(
char *nset,
int *isAll) {
2839 "NSET must begin with a letter");
2853 if (strcmp(nset,
"ALL") == 0) {
2855 strcpy(nset,
"ABAQUS_ESET_ALL");
2862 static int read_node_data(
int *
id,
double *x,
double *y,
double *z) {
2956 static int read_node_data_system(
int system,
double *x,
double *y,
double *z) {
2965 if (system ==
'C') {
2984 static int read_node(
void) {
2987 int flag_system = 0;
2995 ST_KEYWORD_LINE_PARAM,
3000 state = ST_KEYWORD_LINE;
3001 while (state != ST_FINISHED) {
3002 if (state == ST_KEYWORD_LINE) {
3003 if (read_node_keyword(&token))
return -1;
3005 state = ST_DATA_LINE;
3006 }
else if (token ==
',') {
3007 state = ST_KEYWORD_LINE_PARAM;
3011 }
else if (state == ST_KEYWORD_LINE_PARAM) {
3015 if (read_node_param_system(&system))
return -1;
3019 if (read_node_param_nset(nset, &isAll))
return -1;
3035 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
3036 }
else if (token ==
',') {
3042 }
else if (state == ST_DATA_INCLUDE) {
3045 state = ST_DATA_LINE;
3046 }
else if (state == ST_DATA_LINE) {
3050 if (read_node_data(&
id, &
x, &
y, &
z))
return -1;
3055 state = ST_FINISHED;
3057 state = ST_DATA_LINE;
3062 if (read_node_data_system(system, &
x, &
y, &
z))
return -1;
3081 static int read_shellsect_keyword(
void) {
3094 "',' required after *SHELL SECTION");
3100 static int read_shellsect_param_elset(
char *elset) {
3112 "ELSET must begin with a letter");
3129 static int read_shellsect_param_material(
char *material) {
3141 "MATERIAL must begin with a letter");
3149 strcpy(material, p);
3158 static int read_shellsect_data(
double *thickness,
int *integpoints) {
3172 if (*thickness <= 0.0) {
3195 if (*integpoints <= 0) {
3204 "NL required after INTEGPOINTS");
3211 static int read_shell_section(
void) {
3215 int flag_material = 0;
3216 int flag_composite = 0;
3219 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
3221 state = ST_KEYWORD_LINE;
3222 while (state != ST_FINISHED) {
3223 if (state == ST_KEYWORD_LINE) {
3224 if (read_shellsect_keyword())
return -1;
3225 state = ST_KEYWORD_LINE_PARAM;
3226 }
else if (state == ST_KEYWORD_LINE_PARAM) {
3230 if (read_shellsect_param_elset(elset))
return -1;
3234 if (flag_composite) {
3238 if (read_shellsect_param_material(material))
return -1;
3253 if (!flag_material) {
3258 state = ST_DATA_LINE;
3259 }
else if (token ==
',') {
3265 }
else if (state == ST_DATA_LINE) {
3269 union hecmw_io_section_item sect_item;
3273 if (read_shellsect_data(&thickness, &integpoints))
return -1;
3276 sect_item.shell.thickness = thickness;
3277 sect_item.shell.integpoints = integpoints;
3278 strcpy(sect.egrp, elset);
3279 strcpy(sect.material, material);
3280 sect.composite = composite;
3283 sect.sect = sect_item;
3290 state = ST_FINISHED;
3300 static int read_solidsect_keyword(
void) {
3313 "',' required after *SOLID SECTION");
3319 static int read_solidsect_param_elset(
char *elset) {
3331 "ELSET must begin with a letter");
3348 static int read_solidsect_param_material(
char *material) {
3360 "MATERIAL must begin with a letter");
3368 strcpy(material, p);
3377 static int read_solidsect_param_orientation(
char *orientation) {
3384 "'=' reuqired after ORIENTATION");
3390 "ORIENTATION must begin with a letter");
3398 strcpy(orientation, p);
3407 static int read_solidsect_data(
double *thickness) {
3430 if (*thickness <= 0.0) {
3438 static int read_solid_section(
void) {
3442 int flag_material = 0;
3443 int flag_composite = 0;
3447 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
3449 state = ST_KEYWORD_LINE;
3450 while (state != ST_FINISHED) {
3451 if (state == ST_KEYWORD_LINE) {
3452 if (read_solidsect_keyword())
return -1;
3453 state = ST_KEYWORD_LINE_PARAM;
3454 }
else if (state == ST_KEYWORD_LINE_PARAM) {
3458 if (read_solidsect_param_elset(elset))
return -1;
3462 if (flag_composite) {
3466 if (read_solidsect_param_material(material))
return -1;
3469 if (read_solidsect_param_orientation(orientation))
return -1;
3483 if (!flag_material) {
3488 state = ST_DATA_LINE;
3489 }
else if (token ==
',') {
3495 }
else if (state == ST_DATA_LINE) {
3499 union hecmw_io_section_item sect_item;
3503 if (read_solidsect_data(&thickness))
return -1;
3507 set_err_noloc(
HECMW_IO_E1026,
"Two or more secopt found in %s", elset);
3512 sect_item.solid.thickness = thickness;
3513 strcpy(sect.egrp, elset);
3514 strcpy(sect.material, material);
3515 sect.composite = composite;
3516 sect.secopt = secopt;
3518 sect.sect = sect_item;
3525 state = ST_FINISHED;
3536 read_system_keyword(
void)
3566 }
else if(token ==
',') {
3585 }
else if(token ==
',') {
3618 *last_token = token;
3632 }
else if(token ==
',') {
3651 }
else if(token ==
',') {
3698 }
else if(token ==
',') {
3717 }
else if(token ==
',') {
3767 fprintf(stderr,
"*SYSTEM has not implemented yet\n");
3771 if(system ==
NULL) {
3787 state = ST_KEYWORD_LINE;
3788 while(state != ST_FINISHED) {
3789 if(state == ST_KEYWORD_LINE) {
3790 if(read_system_keyword())
return -1;
3797 state = ST_FINISHED;
3799 state = ST_DATA_LINE1;
3802 }
else if(state == ST_DATA_LINE1) {
3803 if(read_system_data_line1a(system, &token))
return -1;
3805 state = ST_FINISHED;
3810 if(read_system_data_line1b(system))
return -1;
3813 state = ST_FINISHED;
3815 state = ST_DATA_LINE2;
3818 }
else if(state == ST_DATA_LINE2) {
3819 if(read_system_data_line2(system))
return -1;
3820 state = ST_FINISHED;
3834 static int read_boundary_keyword(
void) {
3847 "',' is not required after *BOUNDARY SECTION");
3852 "Auto-generated cards should be added in !BOUNDARY section of *.cnt "
3859 static int read_boundary_data(
int *nnode,
int **node_array) {
3860 int i, n, *node, token;
3861 int isFirst, isSuggest, isNode;
3890 fprintf(stderr,
"%s", c);
3894 fprintf(stderr,
", %d", i);
3898 fprintf(stderr,
", %f", a);
3927 "',' or NL required after node ID");
3939 for (p = head; p; p = q) {
3950 if (isSuggest == 1) {
3951 fprintf(stderr,
"\n");
3957 for (p = head; p; p = q) {
3965 static int read_boundary(
void) {
3967 int flag_boundary = 0;
3968 int isNodeInput = 0;
3969 static int nbound = 0;
3971 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
3973 state = ST_KEYWORD_LINE;
3974 while (state != ST_FINISHED) {
3975 if (state == ST_KEYWORD_LINE) {
3976 if (read_boundary_keyword())
return -1;
3977 state = ST_DATA_LINE;
3979 }
else if (state == ST_KEYWORD_LINE_PARAM) {
3981 }
else if (state == ST_DATA_LINE) {
3986 if (read_boundary_data(&n, &node))
return -1;
3992 sprintf(nset,
"BND%d", nbound);
4000 state = ST_FINISHED;
4002 state = ST_DATA_LINE;
4010 if (isNodeInput == 1) {
4011 fprintf(stderr,
"NGRP=BND%d\n", nbound);
4019 static int read_cload_keyword(
void) {
4021 static int isFirst = 0;
4032 "',' is not required after *CLOAD SECTION");
4037 "Auto-generated cards should be added in !CLOAD section of *.cnt "
4044 static int read_cload(
void) {
4048 static int ncload = 0;
4050 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
4052 state = ST_KEYWORD_LINE;
4053 while (state != ST_FINISHED) {
4054 if (state == ST_KEYWORD_LINE) {
4055 if (read_cload_keyword())
return -1;
4056 state = ST_DATA_LINE;
4058 }
else if (state == ST_KEYWORD_LINE_PARAM) {
4060 }
else if (state == ST_DATA_LINE) {
4064 if (read_boundary_data(&n, &node))
return -1;
4070 sprintf(nset,
"CLOAD%d", ncload);
4078 state = ST_FINISHED;
4080 state = ST_DATA_LINE;
4089 fprintf(stderr,
"NGRP=CLOAD%d\n", ncload);
4097 static int read_dload_keyword(
void) {
4099 static int isFirst = 0;
4110 "',' is not required after *DLOAD SECTION");
4115 "Auto-generated cards should be added in !DLOAD section of *.cnt "
4122 static int read_dload(
void) {
4126 static int ndload = 0;
4128 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
4130 state = ST_KEYWORD_LINE;
4131 while (state != ST_FINISHED) {
4132 if (state == ST_KEYWORD_LINE) {
4133 if (read_dload_keyword())
return -1;
4134 state = ST_DATA_LINE;
4136 }
else if (state == ST_KEYWORD_LINE_PARAM) {
4138 }
else if (state == ST_DATA_LINE) {
4142 if (read_boundary_data(&n, &elem))
return -1;
4147 sprintf(elset,
"DLOAD%d", ndload);
4155 state = ST_FINISHED;
4157 state = ST_DATA_LINE;
4166 fprintf(stderr,
"NGRP=DLOAD%d is automatically generated\n", ndload);
4179 static struct read_func_table {
4182 } read_func_table[] = {
4210 #define N_READ_FUNC (sizeof(read_func_table) / sizeof(read_func_table[0]))
4213 static ReadFunc get_read_func(
int token) {
4217 if (token == read_func_table[i].token) {
4218 return read_func_table[i].func;
4224 static int parse(
void) {
4231 func = get_read_func(token);
4245 if (p[0] ==
'*')
break;
4251 if (is_material_keyword(token) && !is_material_zone()) {
4255 if (!is_material_keyword(token) && is_material_zone()) {
4256 if (regist_material())
return -1;
4257 set_material_zone(0);
4260 if ((*func)())
return -1;
4262 set_material_zone(1);
4265 if (is_material_zone()) {
4266 if (regist_material())
return -1;
4267 set_material_zone(0);
4274 static int post_abaqus(
void) {
4286 if (filename ==
NULL) {
4288 "Not specified filename for ABAQUS mesh input routine");
4298 strcpy(grid_filename, filename);
4301 if ((fp = fopen(filename,
"r")) ==
NULL) {
4320 if (post_abaqus()) {
4324 strcpy(grid_filename,
"Unknown");
4337 if (local_mesh ==
NULL)
return NULL;
4340 strcpy(grid_filename,
"Unknown");