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_noloc(
int msgno,
const char *fmt, ...) {
59 static void set_err(
int msgno,
const char *fmt, ...) {
67 static void set_err_token(
int token,
int msgno,
const char *fmt, ...) {
81 static void log_warn(
int msgno,
const char *fmt, ...) {
95 static void free_Integer(
void *v) {
104 static struct material_keywords {
107 } material_keywords[] = {
114 #define N_MAT_KEYS (sizeof(material_keywords) / sizeof(material_keywords[0]))
116 static int is_material_keyword(
int keyword) {
120 if (keyword == material_keywords[i].keyword)
return 1;
125 static char *get_material_string(
int keyword) {
129 if (keyword == material_keywords[i].keyword) {
130 return material_keywords[i].string;
138 static int flag_material_zone;
141 static struct material_data {
143 struct hecmw_io_matitem *matitem;
144 struct material_data *next;
147 static int is_material_zone(
void) {
return flag_material_zone; }
149 static void set_material_zone(
int flag) { flag_material_zone = flag ? 1 : 0; }
151 static int add_mat_data(
int keyword,
struct hecmw_io_matitem *matitem) {
153 struct material_data *p, *q, *mdata;
155 for (p = matdata; p; p = p->next) {
156 if (p->keyword == keyword)
break;
159 struct hecmw_io_matsubitem *sip, *siq;
160 struct hecmw_io_matitem *item = p->matitem;
161 p->matitem = matitem;
162 matitem->item = item->item;
163 for (sip = item->subitem; sip; sip = siq) {
170 get_material_string(keyword), matname);
180 mdata->keyword = keyword;
181 mdata->matitem = matitem;
185 for (i = 0, p = matdata; p; p = (q = p)->next, i++)
187 matitem->item = i + 1;
197 static int count_mat_item(
void) {
199 struct material_data *p, *q;
201 for (n = 0, p = matdata; p; p = (q = p)->next, n++)
206 static int regist_material(
void) {
209 struct material_data *p, *q;
211 n = count_mat_item();
212 if (n == 0)
return 0;
223 snprintf(mat->
name,
sizeof(mat->
name),
"%s", matname);
231 for (i = 0, p = matdata; p; p = q, i++) {
234 mat->
item[i] = *p->matitem;
253 static int read_mat_data_line_common(
int nval,
int nval_line,
double *val,
261 for (i = 0; i < nval; i++) {
269 set_err_token(token, errmsgno,
"VAL or ',' or NL reuqired");
274 }
else if (token ==
',') {
283 set_err_token(token, errmsgno,
"',' or NL required after VAL");
289 i += nval_line - (i % nval_line);
296 set_err_token(token, errmsgno,
"NL required");
306 static int read_mat_data_common(
int nval,
int nval_line,
int temp_col,
307 struct hecmw_io_matitem **matitem,
int msgno) {
309 struct hecmw_io_matitem *item =
NULL;
310 struct hecmw_io_matsubitem *subitem =
NULL;
311 struct hecmw_io_matsubitem *q, *p =
NULL;
321 item->subitem =
NULL;
325 if (subitem ==
NULL) {
330 subitem->val =
HECMW_malloc(
sizeof(*subitem->val) * nval);
331 if (subitem->val ==
NULL) {
336 if (read_mat_data_line_common(nval, nval_line, subitem->val, msgno))
339 subitem->temp = subitem->val[temp_col - 1];
340 subitem->next =
NULL;
343 item->subitem = subitem;
361 for (p = item->subitem; p; p = q) {
373 static int read_param_dependencies(
int *dependencies,
int msgno) {
378 set_err_token(token, msgno,
"'=' required after DEPENDENCIES");
383 set_err_token(token, msgno,
"Invalid DEPENDENCIES");
387 if (*dependencies <= 0) {
388 set_err_token(token, msgno,
"DEPENDENCIES must be positive integer");
396 static struct etype_conv {
432 static int get_HECMW_etype(
int abaqus_etype) {
435 for (i = 0; i <
sizeof(etype_conv) /
sizeof(etype_conv[0]); i++) {
436 if (etype_conv[i].abaqus_etype == abaqus_etype) {
437 return etype_conv[i].hecmw_etype;
443 static int get_secopt_abaqus(
int abaqus_etype) {
446 for (i = 0; i <
sizeof(etype_conv) /
sizeof(etype_conv[0]); i++) {
447 if (etype_conv[i].abaqus_etype == abaqus_etype) {
448 return etype_conv[i].secopt;
454 static int get_secopt(
char *elset,
int msgno) {
459 if (elem ==
NULL)
return -1;
462 for (i = 0; i < elem->
n; i++) {
464 if (secopt ==
NULL) {
465 set_err_noloc(msgno,
"");
469 secopt_prev = secopt->
i;
471 if (secopt_prev != secopt->
i)
goto error;
489 static int read_input(
int msgno_invalid_token) {
495 set_err_token(token, msgno_invalid_token,
"'=' required after INPUT");
500 set_err_token(token, msgno_invalid_token,
"Invalid filename for INPUT");
509 snprintf(include_filename,
sizeof(include_filename),
"%s", p);
518 snprintf(include_filename,
sizeof(include_filename),
"%s%s%s", dname,
separator, p);
525 static int read_amplitude_keyword(
void) {
538 "',' required after *AMPLITUDE");
544 static int read_amplitude_param_name(
char *name,
size_t name_len) {
556 "NAME must begin with a letter");
564 snprintf(name, name_len,
"%s", p);
573 static int read_amplitude_param_definition(
int *definition) {
579 "'=' required after DEFINITION");
591 static int read_amplitude_param_time(
int *time) {
608 static int read_amplitude_param_value(
int *value) {
628 static int read_amplitude_data(
char *name,
int definition,
int time,
685 if (token ==
',' && i == NITEM) {
689 "Only %d items allow per line", NITEM);
700 static int read_amplitude(
void) {
706 int flag_definition = 0;
714 ST_KEYWORD_LINE_PARAM,
719 state = ST_KEYWORD_LINE;
720 while (state != ST_FINISHED) {
721 if (state == ST_KEYWORD_LINE) {
722 if (read_amplitude_keyword())
return -1;
723 state = ST_KEYWORD_LINE_PARAM;
724 }
else if (state == ST_KEYWORD_LINE_PARAM) {
728 if (read_amplitude_param_name(name,
sizeof(name)))
return -1;
732 if (read_amplitude_param_definition(&definition))
return -1;
736 if (read_amplitude_param_time(&time))
return -1;
740 if (read_amplitude_param_value(&value))
return -1;
759 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
760 }
else if (token ==
',') {
766 }
else if (state == ST_DATA_INCLUDE) {
770 state = ST_DATA_LINE;
771 }
else if (state == ST_DATA_LINE) {
774 if (read_amplitude_data(name, definition, time, value))
return -1;
794 fprintf(stderr,
"*ECOPY has not implemented yet\n");
805 fprintf(stderr,
"*EGEN has not implemented yet\n");
813 static int read_elset_keyword(
void) {
831 static int read_elset_param_elset(
char *elset,
size_t elset_len,
int *isAll) {
843 "ELSET must begin with a letter");
851 snprintf(elset, elset_len,
"%s", p);
857 if (strcmp(elset,
"ALL") == 0) {
865 static int read_elset_data(
int *nelem,
int **elem_array) {
866 int token, i,
n, *elem;
904 "',' or NL required after element ID");
919 for (p = head; p; p = q) {
930 for (p = head; p; p = q) {
938 static int read_elset_data_generate(
int *nelem,
int **elem_array) {
939 int token, i, n,
id, *elem;
940 int elem1, elem2, elem3;
992 "NL required after increment");
999 "',' or NL required after elem2");
1005 if (elem1 > elem2) {
1007 "Cannot generate between %d and %d with an increment of %d", elem1,
1011 if ((elem2 - elem1) % elem3) {
1013 "Cannot generate between %d and %d with an increment of %d", elem1,
1018 n = (elem2 - elem1) / elem3 + 1;
1026 for (
id = elem1;
id <= elem2;
id += elem3) {
1036 static int read_elset(
void) {
1039 int flag_generate = 0;
1045 ST_KEYWORD_LINE_PARAM,
1047 ST_DATA_LINE_GENERATE
1050 state = ST_KEYWORD_LINE;
1051 while (state != ST_FINISHED) {
1052 if (state == ST_KEYWORD_LINE) {
1053 if (read_elset_keyword())
return -1;
1054 state = ST_KEYWORD_LINE_PARAM;
1055 }
else if (state == ST_KEYWORD_LINE_PARAM) {
1059 if (read_elset_param_elset(elset,
sizeof(elset), &isAll))
return -1;
1077 state = flag_generate ? ST_DATA_LINE_GENERATE : ST_DATA_LINE;
1078 }
else if (token ==
',') {
1084 }
else if (state == ST_DATA_LINE) {
1090 if (read_elset_data(&n, &elem))
return -1;
1098 state = ST_FINISHED;
1100 state = ST_DATA_LINE;
1103 }
else if (state == ST_DATA_LINE_GENERATE) {
1109 if (read_elset_data_generate(&n, &elem))
return -1;
1117 state = ST_FINISHED;
1129 static int read_element_header(
void) {
1147 static int read_element_param_type(
int *
hecmw_etype,
int *abaqus_etype) {
1156 *abaqus_etype = token;
1169 static int read_element_param_elset(
char *elset,
size_t elset_len) {
1181 "ELSET must begin with a letter");
1189 snprintf(elset, elset_len,
"%s", p);
1195 if (strcmp(elset,
"ALL") == 0) {
1197 snprintf(elset, elset_len,
"ABAQUS_ESET_ALL");
1203 static int read_element_data(
int *
id,
int nnode,
int *node) {
1248 if (i == nnode - 1)
break;
1254 "',' or NL required after connectivity");
1274 static int read_element(
void) {
1288 ST_KEYWORD_LINE_PARAM,
1294 state = ST_KEYWORD_LINE;
1295 while (state != ST_FINISHED) {
1296 if (state == ST_KEYWORD_LINE) {
1297 if (read_element_header())
return -1;
1298 state = ST_KEYWORD_LINE_PARAM;
1299 }
else if (state == ST_KEYWORD_LINE_PARAM) {
1303 if (read_element_param_type(&
hecmw_etype, &type))
return -1;
1312 if (read_element_param_elset(elset,
sizeof(elset)))
return -1;
1331 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
1332 }
else if (token ==
',') {
1338 }
else if (state == ST_DATA_INCLUDE) {
1342 state = ST_DATA_LINE;
1343 }
else if (state == ST_DATA_LINE) {
1345 if (read_element_data(&
id, nnode, node))
return -1;
1346 state = ST_DATA_LINE_REGIST;
1347 }
else if (state == ST_DATA_LINE_REGIST) {
1361 if (secopt ==
NULL) {
1365 secopt->
i = get_secopt_abaqus(type);
1367 if (elem_secopt ==
NULL) {
1370 if (elem_secopt ==
NULL)
return -1;
1385 state = ST_DATA_LINE;
1387 state = ST_FINISHED;
1399 static int read_equation_keyword(
int *token) {
1409 "',' or NL required after *EQUATION");
1415 static int read_equation_data_line1(
int *neq) {
1439 static int read_equation_data_line2(
int neq) {
1444 struct hecmw_io_mpcitem *mpcitem =
NULL;
1447 if (mpcitem ==
NULL) {
1452 for (i = 0; i < neq; i++) {
1463 mpcitem[i].ngrp[0] =
'\0';
1475 snprintf(mpcitem[i].ngrp,
sizeof(mpcitem[i].ngrp),
"%s", p);
1481 mpcitem[i].node = -1;
1526 "',' or NL required after coefficient");
1529 if (token ==
',' && i == NITEM - 1) {
1549 static int read_equation(
void) {
1556 ST_KEYWORD_LINE_PARAM,
1562 state = ST_KEYWORD_LINE;
1563 while (state != ST_FINISHED) {
1564 if (state == ST_KEYWORD_LINE) {
1565 if (read_equation_keyword(&token))
return -1;
1567 state = ST_KEYWORD_LINE_PARAM;
1569 state = ST_DATA_LINE1;
1573 }
else if (state == ST_KEYWORD_LINE_PARAM) {
1587 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE1;
1592 }
else if (state == ST_DATA_INCLUDE) {
1595 state = ST_DATA_LINE1;
1596 }
else if (state == ST_DATA_LINE1) {
1597 if (read_equation_data_line1(&neq))
return -1;
1599 state = ST_DATA_LINE2;
1600 }
else if (state == ST_DATA_LINE2) {
1602 if (read_equation_data_line2(neq))
return -1;
1606 state = ST_DATA_LINE1;
1608 state = ST_FINISHED;
1620 static int read_heading(
void) {
1642 "TITLE required after *HEADING");
1650 while (*p && *p ==
' ') p++;
1651 if (p ==
NULL) p =
"";
1652 snprintf(
header->header,
sizeof(
header->header),
"%s", p);
1670 static int read_include(
void) {
1701 "NL required after INPUT value");
1713 static int read_initial_keyword(
void) {
1732 static int read_initial_param_type(
int *type) {
1749 static int read_initial_data(
int type) {
1781 "Node ID or NGROUP name required");
1822 static int read_initial(
void) {
1830 ST_KEYWORD_LINE_PARAM,
1835 state = ST_KEYWORD_LINE;
1836 while (state != ST_FINISHED) {
1837 if (state == ST_KEYWORD_LINE) {
1838 if (read_initial_keyword())
return -1;
1839 state = ST_KEYWORD_LINE_PARAM;
1840 }
else if (state == ST_KEYWORD_LINE_PARAM) {
1844 if (read_initial_param_type(&type))
return -1;
1859 state = ST_DATA_INCLUDE;
1861 state = ST_DATA_LINE;
1868 }
else if (token ==
',') {
1874 }
else if (state == ST_DATA_INCLUDE) {
1878 state = ST_DATA_LINE;
1879 }
else if (state == ST_DATA_LINE) {
1881 if (read_initial_data(type))
return -1;
1885 state = ST_FINISHED;
1897 static int read_conductivity_keyword(
int *last_token) {
1910 "',' or NL required after *CONDUCTIVITY");
1913 *last_token = token;
1918 static int read_conductivity_param_dependencies(
int *dependencies) {
1922 static int read_conductivity_param_type(
int *type) {
1945 static int read_conductivity_data(
int type,
int dependencies,
1946 struct hecmw_io_matitem **matitem) {
1964 return read_mat_data_common(n + dependencies, 8, temp_col, matitem,
1968 static int read_conductivity(
void) {
1970 int flag_dependencies = 0;
1972 int dependencies = 0;
1974 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
1976 state = ST_KEYWORD_LINE;
1977 while (state != ST_FINISHED) {
1978 if (state == ST_KEYWORD_LINE) {
1979 if (read_conductivity_keyword(&token))
return -1;
1981 state = ST_KEYWORD_LINE_PARAM;
1983 state = ST_DATA_LINE;
1987 }
else if (state == ST_KEYWORD_LINE_PARAM) {
1990 if (read_conductivity_param_dependencies(&dependencies))
return -1;
1991 flag_dependencies = 1;
1993 if (read_conductivity_param_type(&type))
return -1;
2005 state = ST_DATA_LINE;
2007 }
else if (state == ST_DATA_LINE) {
2008 struct hecmw_io_matitem *item;
2009 if (read_conductivity_data(type, dependencies, &item))
return -1;
2011 state = ST_FINISHED;
2021 static int read_density_keyword(
int *last_token) {
2034 "',' or NL required after *DENSITY");
2037 *last_token = token;
2042 static int read_density_param_dependencies(
int *dependencies) {
2046 static int read_density_data(
int dependencies,
2047 struct hecmw_io_matitem **matitem) {
2048 return read_mat_data_common(2 + dependencies, 8, 2, matitem,
2052 static int read_density(
void) {
2054 int flag_dependencies = 0;
2055 int dependencies = 0;
2056 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
2058 state = ST_KEYWORD_LINE;
2059 while (state != ST_FINISHED) {
2060 if (state == ST_KEYWORD_LINE) {
2061 if (read_density_keyword(&token))
return -1;
2063 state = ST_KEYWORD_LINE_PARAM;
2065 state = ST_DATA_LINE;
2069 }
else if (state == ST_KEYWORD_LINE_PARAM) {
2072 if (read_density_param_dependencies(&dependencies))
return -1;
2073 flag_dependencies = 1;
2083 state = ST_DATA_LINE;
2084 }
else if (state == ST_DATA_LINE) {
2085 struct hecmw_io_matitem *item;
2086 if (read_density_data(dependencies, &item))
return -1;
2088 state = ST_FINISHED;
2098 static int read_elastic_keyword(
int *last_token) {
2111 "',' or NL required after *ELASTIC");
2114 *last_token = token;
2119 static int read_elastic_param_dependencies(
int *dependencies) {
2123 static int read_elastic_param_type(
int *type) {
2148 static int read_elastic_param_moduli(
int *moduli) {
2169 static int read_elastic_data(
int type,
int dependencies,
2170 struct hecmw_io_matitem **matitem) {
2192 return read_mat_data_common(n + dependencies, 8, temp_col, matitem,
2196 static int read_elastic(
void) {
2198 int flag_dependencies = 0;
2200 int flag_moduli = 0;
2201 int dependencies = 0;
2204 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
2206 state = ST_KEYWORD_LINE;
2207 while (state != ST_FINISHED) {
2208 if (state == ST_KEYWORD_LINE) {
2209 if (read_elastic_keyword(&token))
return -1;
2211 state = ST_KEYWORD_LINE_PARAM;
2213 state = ST_DATA_LINE;
2217 }
else if (state == ST_KEYWORD_LINE_PARAM) {
2220 if (read_elastic_param_dependencies(&dependencies))
return -1;
2221 flag_dependencies = 1;
2223 if (read_elastic_param_type(&type))
return -1;
2226 if (read_elastic_param_moduli(&moduli))
return -1;
2238 state = ST_DATA_LINE;
2240 }
else if (state == ST_DATA_LINE) {
2241 struct hecmw_io_matitem *item;
2242 if (read_elastic_data(type, dependencies, &item))
return -1;
2244 state = ST_FINISHED;
2254 static int read_specific_keyword(
int *last_token) {
2267 "',' or NL required after *SPECIFIC HEAT");
2270 *last_token = token;
2275 static int read_specific_param_dependencies(
int *dependencies) {
2279 static int read_specific_data(
int dependencies,
2280 struct hecmw_io_matitem **matitem) {
2281 return read_mat_data_common(2 + dependencies, 8, 2, matitem,
2285 static int read_specific_heat(
void) {
2287 int flag_dependencies = 0;
2288 int dependencies = 0;
2289 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
2291 state = ST_KEYWORD_LINE;
2292 while (state != ST_FINISHED) {
2293 if (state == ST_KEYWORD_LINE) {
2294 if (read_specific_keyword(&token))
return -1;
2296 state = ST_KEYWORD_LINE_PARAM;
2298 state = ST_DATA_LINE;
2302 }
else if (state == ST_KEYWORD_LINE_PARAM) {
2305 if (read_specific_param_dependencies(&dependencies))
return -1;
2306 flag_dependencies = 1;
2316 state = ST_DATA_LINE;
2317 }
else if (state == ST_DATA_LINE) {
2318 struct hecmw_io_matitem *item;
2319 if (read_specific_data(dependencies, &item))
return -1;
2321 state = ST_FINISHED;
2331 static int read_material_param_name(
char *name,
size_t name_len) {
2343 "NAME must begin with a letter");
2351 snprintf(name, name_len,
"%s", p);
2364 static int read_material(
void) {
2387 if (read_material_param_name(name,
sizeof(name)))
return -1;
2395 snprintf(matname,
sizeof(matname),
"%s", name);
2405 fprintf(stderr,
"*NCOPY has not implemented yet\n");
2416 fprintf(stderr,
"*NFILL has not implemented yet\n");
2427 fprintf(stderr,
"*NGEN has not implemented yet\n");
2435 static int read_nset_keyword(
void) {
2453 static int read_nset_param_nset(
char *nset,
size_t nset_len,
int *isAll) {
2465 "NSET must begin with a letter");
2473 snprintf(nset, nset_len,
"%s", p);
2479 if (strcmp(nset,
"EQUATION_BLOCK") == 0) {
2483 if (strcmp(nset,
"ALL") == 0) {
2485 snprintf(nset, nset_len,
"ABAQUS_NSET_ALL");
2492 static int read_nset_param_instance() {
2504 "NSET must begin with a letter");
2510 static int read_nset_data(
int *nnode,
int **node_array) {
2511 int i, n, *node, token;
2553 "',' or NL required after node ID");
2568 for (p = head; p; p = q) {
2579 for (p = head; p; p = q) {
2587 static int read_nset_data_generate(
int *nnode,
int **node_array) {
2588 int token, i, n,
id, *node, nod1, nod2, nod3;
2640 "NL required after increment");
2647 "',' or NL required after nod2");
2655 "Cannot generate between %d and %d with an increment of %d", nod1,
2659 if ((nod2 - nod1) % nod3) {
2661 "Cannot generate between %d and %d with an increment of %d", nod1,
2666 n = (nod2 - nod1) / nod3 + 1;
2674 for (
id = nod1;
id <= nod2;
id += nod3) {
2685 static int read_nset(
void) {
2688 int flag_generate = 0;
2689 int flag_unsorted = 0;
2695 ST_KEYWORD_LINE_PARAM,
2697 ST_DATA_LINE_GENERATE
2700 state = ST_KEYWORD_LINE;
2701 while (state != ST_FINISHED) {
2702 if (state == ST_KEYWORD_LINE) {
2703 if (read_nset_keyword())
return -1;
2704 state = ST_KEYWORD_LINE_PARAM;
2705 }
else if (state == ST_KEYWORD_LINE_PARAM) {
2709 if (read_nset_param_nset(nset,
sizeof(nset), &isAll))
return -1;
2719 read_nset_param_instance();
2733 if (flag_generate) {
2734 state = ST_DATA_LINE_GENERATE;
2736 state = ST_DATA_LINE;
2738 }
else if (token ==
',') {
2744 }
else if (state == ST_DATA_LINE) {
2748 if (read_nset_data(&n, &node))
return -1;
2757 state = ST_FINISHED;
2759 state = ST_DATA_LINE;
2762 }
else if (state == ST_DATA_LINE_GENERATE) {
2768 if (read_nset_data_generate(&n, &node))
return -1;
2777 state = ST_FINISHED;
2789 static int read_node_keyword(
int *token) {
2800 "',' or NL required after *NODE");
2806 static int read_node_param_system(
int *system) {
2815 if (token !=
'C' && token !=
'R') {
2823 static int read_node_param_nset(
char *nset,
size_t nset_len,
int *isAll) {
2835 "NSET must begin with a letter");
2843 snprintf(nset, nset_len,
"%s", p);
2849 if (strcmp(nset,
"ALL") == 0) {
2851 snprintf(nset, nset_len,
"ABAQUS_ESET_ALL");
2858 static int read_node_data(
int *
id,
double *x,
double *y,
double *z) {
2952 static int read_node_data_system(
int system,
double *x,
double *y,
double *z) {
2961 if (system ==
'C') {
2980 static int read_node(
void) {
2983 int flag_system = 0;
2991 ST_KEYWORD_LINE_PARAM,
2996 state = ST_KEYWORD_LINE;
2997 while (state != ST_FINISHED) {
2998 if (state == ST_KEYWORD_LINE) {
2999 if (read_node_keyword(&token))
return -1;
3001 state = ST_DATA_LINE;
3002 }
else if (token ==
',') {
3003 state = ST_KEYWORD_LINE_PARAM;
3007 }
else if (state == ST_KEYWORD_LINE_PARAM) {
3011 if (read_node_param_system(&system))
return -1;
3015 if (read_node_param_nset(nset,
sizeof(nset), &isAll))
return -1;
3031 state = flag_input ? ST_DATA_INCLUDE : ST_DATA_LINE;
3032 }
else if (token ==
',') {
3038 }
else if (state == ST_DATA_INCLUDE) {
3041 state = ST_DATA_LINE;
3042 }
else if (state == ST_DATA_LINE) {
3046 if (read_node_data(&
id, &
x, &
y, &
z))
return -1;
3051 state = ST_FINISHED;
3053 state = ST_DATA_LINE;
3058 if (read_node_data_system(system, &
x, &
y, &
z))
return -1;
3077 static int read_shellsect_keyword(
void) {
3090 "',' required after *SHELL SECTION");
3096 static int read_shellsect_param_elset(
char *elset,
size_t elset_len) {
3108 "ELSET must begin with a letter");
3116 snprintf(elset, elset_len,
"%s", p);
3125 static int read_shellsect_param_material(
char *material,
size_t material_len) {
3137 "MATERIAL must begin with a letter");
3145 snprintf(material, material_len,
"%s", p);
3154 static int read_shellsect_data(
double *thickness,
int *integpoints) {
3168 if (*thickness <= 0.0) {
3191 if (*integpoints <= 0) {
3200 "NL required after INTEGPOINTS");
3207 static int read_shell_section(
void) {
3211 int flag_material = 0;
3212 int flag_composite = 0;
3215 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
3217 state = ST_KEYWORD_LINE;
3218 while (state != ST_FINISHED) {
3219 if (state == ST_KEYWORD_LINE) {
3220 if (read_shellsect_keyword())
return -1;
3221 state = ST_KEYWORD_LINE_PARAM;
3222 }
else if (state == ST_KEYWORD_LINE_PARAM) {
3226 if (read_shellsect_param_elset(elset,
sizeof(elset)))
return -1;
3230 if (flag_composite) {
3234 if (read_shellsect_param_material(material,
sizeof(material)))
return -1;
3249 if (!flag_material) {
3254 state = ST_DATA_LINE;
3255 }
else if (token ==
',') {
3261 }
else if (state == ST_DATA_LINE) {
3265 union hecmw_io_section_item sect_item;
3269 if (read_shellsect_data(&thickness, &integpoints))
return -1;
3272 sect_item.shell.thickness = thickness;
3273 sect_item.shell.integpoints = integpoints;
3274 snprintf(sect.egrp,
sizeof(sect.egrp),
"%s", elset);
3275 snprintf(sect.material,
sizeof(sect.material),
"%s", material);
3276 sect.composite = composite;
3279 sect.sect = sect_item;
3286 state = ST_FINISHED;
3296 static int read_solidsect_keyword(
void) {
3309 "',' required after *SOLID SECTION");
3315 static int read_solidsect_param_elset(
char *elset,
size_t elset_len) {
3327 "ELSET must begin with a letter");
3335 snprintf(elset, elset_len,
"%s", p);
3344 static int read_solidsect_param_material(
char *material,
size_t material_len) {
3356 "MATERIAL must begin with a letter");
3364 snprintf(material, material_len,
"%s", p);
3373 static int read_solidsect_param_orientation(
char *orientation,
size_t orientation_len) {
3380 "'=' reuqired after ORIENTATION");
3386 "ORIENTATION must begin with a letter");
3394 snprintf(orientation, orientation_len,
"%s", p);
3403 static int read_solidsect_data(
double *thickness) {
3426 if (*thickness <= 0.0) {
3434 static int read_solid_section(
void) {
3438 int flag_material = 0;
3439 int flag_composite = 0;
3443 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
3445 state = ST_KEYWORD_LINE;
3446 while (state != ST_FINISHED) {
3447 if (state == ST_KEYWORD_LINE) {
3448 if (read_solidsect_keyword())
return -1;
3449 state = ST_KEYWORD_LINE_PARAM;
3450 }
else if (state == ST_KEYWORD_LINE_PARAM) {
3454 if (read_solidsect_param_elset(elset,
sizeof(elset)))
return -1;
3458 if (flag_composite) {
3462 if (read_solidsect_param_material(material,
sizeof(material)))
return -1;
3465 if (read_solidsect_param_orientation(orientation,
sizeof(orientation)))
return -1;
3479 if (!flag_material) {
3484 state = ST_DATA_LINE;
3485 }
else if (token ==
',') {
3491 }
else if (state == ST_DATA_LINE) {
3495 union hecmw_io_section_item sect_item;
3499 if (read_solidsect_data(&thickness))
return -1;
3503 set_err_noloc(
HECMW_IO_E1026,
"Two or more secopt found in %s", elset);
3508 sect_item.solid.thickness = thickness;
3509 snprintf(sect.egrp,
sizeof(sect.egrp),
"%s", elset);
3510 snprintf(sect.material,
sizeof(sect.material),
"%s", material);
3511 sect.composite = composite;
3512 sect.secopt = secopt;
3514 sect.sect = sect_item;
3521 state = ST_FINISHED;
3532 read_system_keyword(
void)
3562 }
else if(token ==
',') {
3581 }
else if(token ==
',') {
3614 *last_token = token;
3628 }
else if(token ==
',') {
3647 }
else if(token ==
',') {
3694 }
else if(token ==
',') {
3713 }
else if(token ==
',') {
3763 fprintf(stderr,
"*SYSTEM has not implemented yet\n");
3767 if(system ==
NULL) {
3783 state = ST_KEYWORD_LINE;
3784 while(state != ST_FINISHED) {
3785 if(state == ST_KEYWORD_LINE) {
3786 if(read_system_keyword())
return -1;
3793 state = ST_FINISHED;
3795 state = ST_DATA_LINE1;
3798 }
else if(state == ST_DATA_LINE1) {
3799 if(read_system_data_line1a(system, &token))
return -1;
3801 state = ST_FINISHED;
3806 if(read_system_data_line1b(system))
return -1;
3809 state = ST_FINISHED;
3811 state = ST_DATA_LINE2;
3814 }
else if(state == ST_DATA_LINE2) {
3815 if(read_system_data_line2(system))
return -1;
3816 state = ST_FINISHED;
3830 static int read_boundary_keyword(
void) {
3843 "',' is not required after *BOUNDARY SECTION");
3848 "Auto-generated cards should be added in !BOUNDARY section of *.cnt "
3855 static int read_boundary_data(
int *nnode,
int **node_array) {
3856 int i, n, *node, token;
3857 int isFirst, isSuggest, isNode;
3886 fprintf(stderr,
"%s", c);
3890 fprintf(stderr,
", %d", i);
3894 fprintf(stderr,
", %f", a);
3923 "',' or NL required after node ID");
3935 for (p = head; p; p = q) {
3946 if (isSuggest == 1) {
3947 fprintf(stderr,
"\n");
3953 for (p = head; p; p = q) {
3961 static int read_boundary(
void) {
3963 int flag_boundary = 0;
3964 int isNodeInput = 0;
3965 static int nbound = 0;
3967 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
3969 state = ST_KEYWORD_LINE;
3970 while (state != ST_FINISHED) {
3971 if (state == ST_KEYWORD_LINE) {
3972 if (read_boundary_keyword())
return -1;
3973 state = ST_DATA_LINE;
3975 }
else if (state == ST_KEYWORD_LINE_PARAM) {
3977 }
else if (state == ST_DATA_LINE) {
3982 if (read_boundary_data(&n, &node))
return -1;
3988 snprintf(nset,
sizeof(nset),
"BND%d", nbound);
3996 state = ST_FINISHED;
3998 state = ST_DATA_LINE;
4006 if (isNodeInput == 1) {
4007 fprintf(stderr,
"NGRP=BND%d\n", nbound);
4015 static int read_cload_keyword(
void) {
4017 static int isFirst = 0;
4028 "',' is not required after *CLOAD SECTION");
4033 "Auto-generated cards should be added in !CLOAD section of *.cnt "
4040 static int read_cload(
void) {
4044 static int ncload = 0;
4046 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
4048 state = ST_KEYWORD_LINE;
4049 while (state != ST_FINISHED) {
4050 if (state == ST_KEYWORD_LINE) {
4051 if (read_cload_keyword())
return -1;
4052 state = ST_DATA_LINE;
4054 }
else if (state == ST_KEYWORD_LINE_PARAM) {
4056 }
else if (state == ST_DATA_LINE) {
4060 if (read_boundary_data(&n, &node))
return -1;
4066 snprintf(nset,
sizeof(nset),
"CLOAD%d", ncload);
4074 state = ST_FINISHED;
4076 state = ST_DATA_LINE;
4085 fprintf(stderr,
"NGRP=CLOAD%d\n", ncload);
4093 static int read_dload_keyword(
void) {
4095 static int isFirst = 0;
4106 "',' is not required after *DLOAD SECTION");
4111 "Auto-generated cards should be added in !DLOAD section of *.cnt "
4118 static int read_dload(
void) {
4122 static int ndload = 0;
4124 enum { ST_FINISHED, ST_KEYWORD_LINE, ST_KEYWORD_LINE_PARAM, ST_DATA_LINE };
4126 state = ST_KEYWORD_LINE;
4127 while (state != ST_FINISHED) {
4128 if (state == ST_KEYWORD_LINE) {
4129 if (read_dload_keyword())
return -1;
4130 state = ST_DATA_LINE;
4132 }
else if (state == ST_KEYWORD_LINE_PARAM) {
4134 }
else if (state == ST_DATA_LINE) {
4138 if (read_boundary_data(&n, &elem))
return -1;
4143 snprintf(elset,
sizeof(elset),
"DLOAD%d", ndload);
4151 state = ST_FINISHED;
4153 state = ST_DATA_LINE;
4162 fprintf(stderr,
"NGRP=DLOAD%d is automatically generated\n", ndload);
4175 static struct read_func_table {
4178 } read_func_table[] = {
4206 #define N_READ_FUNC (sizeof(read_func_table) / sizeof(read_func_table[0]))
4209 static ReadFunc get_read_func(
int token) {
4213 if (token == read_func_table[i].token) {
4214 return read_func_table[i].func;
4220 static int parse(
void) {
4227 func = get_read_func(token);
4241 if (p[0] ==
'*')
break;
4247 if (is_material_keyword(token) && !is_material_zone()) {
4251 if (!is_material_keyword(token) && is_material_zone()) {
4252 if (regist_material())
return -1;
4253 set_material_zone(0);
4256 if ((*func)())
return -1;
4258 set_material_zone(1);
4261 if (is_material_zone()) {
4262 if (regist_material())
return -1;
4263 set_material_zone(0);
4270 static int post_abaqus(
void) {
4282 if (filename ==
NULL) {
4284 "Not specified filename for ABAQUS mesh input routine");
4294 snprintf(grid_filename,
sizeof(grid_filename),
"%s", filename);
4297 if ((fp = fopen(filename,
"r")) ==
NULL) {
4316 if (post_abaqus()) {
4320 snprintf(grid_filename,
sizeof(grid_filename),
"Unknown");
4333 if (local_mesh ==
NULL)
return NULL;
4336 snprintf(grid_filename,
sizeof(grid_filename),
"Unknown");
char * HECMW_ablex_get_text(void)
int HECMW_ablex_get_lineno(void)
int HECMW_ablex_unput_token(void)
int HECMW_ablex_next_token(void)
@ HECMW_ABLEX_H_CONDUCTIVITY
@ HECMW_ABLEX_H_SHELL_SECTION
@ HECMW_ABLEX_K_DEPENDENCIES
@ HECMW_ABLEX_K_ISOTROPIC
@ HECMW_ABLEX_K_ENGINEERING_CONSTANTS
@ HECMW_ABLEX_K_STEP_TIME
@ HECMW_ABLEX_H_AMPLITUDE
@ HECMW_ABLEX_H_SOLID_SECTION
@ HECMW_ABLEX_K_ORIENTATION
@ HECMW_ABLEX_H_SPECIFIC_HEAT
@ HECMW_ABLEX_K_DEFINITION
@ HECMW_ABLEX_K_TEMPERATURE
@ HECMW_ABLEX_K_ANISOTROPIC
@ HECMW_ABLEX_K_ORTHOTROPIC
@ HECMW_ABLEX_K_INSTANTANEOUS
int HECMW_ablex_is_including(void)
int HECMW_ablex_switch_to_include(const char *filename)
double HECMW_ablex_get_number(void)
int HECMW_ablex_set_input(FILE *fp)
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
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)
int HECMW_read_abaqus_mesh(const char *filename)
struct hecmwST_local_mesh * HECMW_get_abaqus_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)
struct hecmw_io_id_array * HECMW_io_get_elem_in_egrp(const char *name)
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_material * HECMW_io_add_mat(const char *name, struct hecmw_io_material *mat)
struct hecmwST_local_mesh * HECMW_io_make_local_mesh(void)
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_calloc(nmemb, size)
#define HECMW_malloc(size)
int HECMW_map_int_add(struct hecmw_map_int *map, int key, void *value)
void * HECMW_map_int_get(const struct hecmw_map_int *map, int key)
void HECMW_map_int_finalize(struct hecmw_map_int *map)
int HECMW_map_int_init(struct hecmw_map_int *map, void(*free_fnc)(void *))
#define HECMW_IO_ABAQUS_E0501
#define HECMW_IO_ABAQUS_E1500
#define HECMW_IO_ABAQUS_E0900
#define HECMW_IO_ABAQUS_E1503
#define HECMW_IO_ABAQUS_E0901
#define HECMW_IO_ABAQUS_E0503
#define HECMW_IO_ABAQUS_E0002
#define HECMW_IO_ABAQUS_E0502
#define HECMW_IO_ABAQUS_W0095
#define HECMW_IO_ABAQUS_E0098
#define HECMW_IO_ABAQUS_E1705
#define HECMW_IO_ABAQUS_E2100
#define HECMW_IO_ABAQUS_E2500
#define HECMW_IO_ABAQUS_E1706
#define HECMW_IO_ABAQUS_E1002
#define HECMW_IO_ABAQUS_E0604
#define HECMW_IO_ABAQUS_E0101
#define HECMW_IO_ABAQUS_E1700
#define HECMW_IO_ABAQUS_E2200
#define HECMW_IO_ABAQUS_E0601
#define HECMW_IO_ABAQUS_E0603
#define HECMW_IO_ABAQUS_E2107
#define HECMW_IO_ABAQUS_E2103
#define HECMW_IO_ABAQUS_E0600
#define HECMW_IO_ABAQUS_E2400
#define HECMW_IO_ABAQUS_E1101
#define HECMW_IO_ABAQUS_E0096
#define HECMW_IO_ABAQUS_E0606
#define HECMW_IO_ABAQUS_E0500
#define HECMW_IO_ABAQUS_E0100
#define HECMW_IO_ABAQUS_E1702
#define HECMW_IO_ABAQUS_E1000
#define HECMW_IO_ABAQUS_E1707
#define HECMW_IO_ABAQUS_E1703
#define HECMW_IO_ABAQUS_E1600
#define HECMW_IO_ABAQUS_E0701
#define HECMW_IO_ABAQUS_E0703
#define HECMW_IO_ABAQUS_E1001
#define HECMW_IO_ABAQUS_E1502
#define HECMW_IO_ABAQUS_W0097
#define HECMW_IO_ABAQUS_E1900
#define HECMW_IO_ABAQUS_W0099
#define HECMW_IO_ABAQUS_E2105
#define HECMW_IO_ABAQUS_E1501
#define HECMW_IO_ABAQUS_E0702
#define HECMW_IO_ABAQUS_E2108
#define HECMW_IO_ABAQUS_E0700
#define HECMW_IO_ABAQUS_E1102
#define HECMW_IO_ABAQUS_E2102
#define HECMW_IO_ABAQUS_E1100
#define HECMW_IO_ABAQUS_E1601
#define HECMW_IO_ABAQUS_E0003
#define HECMW_IO_ABAQUS_E0800
#define HECMW_IO_ABAQUS_E0001
#define HECMW_IO_ABAQUS_E2300
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_TYPE_SHELL
#define HECMW_AMP_TYPEVAL_RELATIVE
#define HECMW_AMP_TYPEVAL_ABSOLUTE
#define HECMW_AMP_TYPETIME_STEP
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::hecmw_io_matitem * item
char name[HECMW_NAME_LEN+1]
union hecmw_io_section::hecmw_io_section_item sect