74{
75 char *cname,*cname2,*ccomment;
76 int cname_len,cname_len1,ccomment_len;
77 int i,cpt_size,num_layers;
78 float node[3];
79 H3D_ID node_id;
80 unsigned int elem_count = 1;
81
82 cname_len = *size1 + 1;
83 cname=(char*) malloc(sizeof(char)*cname_len);
84 for(i=0;i<*size1;i++) cname[i] = name1[i];
85
86 cpt_size = 0;
87 for(i=0;i<*size1;i++)
88 {
89 if(name1[i] != ' ') cpt_size = i;
90 }
91 cname[cpt_size+1]='\0';
92
93 ccomment_len = *s_comment + 1;
94 ccomment=(char*) malloc(sizeof(char)*ccomment_len);
95 for(i=0;i<*s_comment;i++) ccomment[i] = comment[i];
96 ccomment[*s_comment]='\0';
97
98 char * LAYERPOOL = new char [100];
99 LAYERPOOL[0] ='\0';
100 char * LAYER_STRING = new char [100];
101 LAYER_STRING[0] ='\0';
102 char * NUVAR_STRING = new char [100];
103 NUVAR_STRING[0] ='\0';
104 char * IR_STRING = new char [100];
105 IR_STRING[0] ='\0';
106 char * IS_STRING = new char [100];
107 IS_STRING[0] ='\0';
108 char * IT_STRING = new char [100];
109 IT_STRING[0] ='\0';
110 char * MID_STRING = new char [100];
111 MID_STRING[0] ='\0';
112 char * RES_STRING = new char [100];
113 RES_STRING[0] ='\0';
114 char * ID_STRING = new char [100];
115 ID_STRING[0] ='\0';
116
117 num_layers = 0;
118 if (*is_corner_data == 0) num_layers = 1;
119
120 if( strncmp(cname,
"Strain",6) == 0 )
tensor_type = H3D_DS_STRAIN;
121 if( strncmp(cname,
"Stress",6) == 0 )
tensor_type = H3D_DS_STRESS;
122 if( strncmp(cname,
"Strn rate",9) == 0 )
tensor_type = H3D_DS_STRAIN;
123 if( strncmp(cname,
"CornerStrain",12) == 0 )
tensor_type = H3D_DS_STRAIN;
124 if( strncmp(cname,
"CornerStress",12) == 0 )
tensor_type = H3D_DS_STRESS;
125
126 H3D_ID layer_pool_id = H3D_NULL_ID;
127
128#ifdef _WIN64
129 strcat_s(RES_STRING,100,cname);
130#else
131 RES_STRING = strcat(RES_STRING,cname);
132#endif
133
134 if(*id > 0)
135 {
136 sprintf(ID_STRING, " id %d",*id);
137#ifdef _WIN64
138 strcat_s(RES_STRING,100,ID_STRING);
139#else
140 RES_STRING = strcat(RES_STRING,ID_STRING);
141#endif
142 }
143
144
145 if(*layer > 0 || *nuvar > 0 || *ir > 0 || *is > 0 || *it > 0 )
146 {
147
148 if(*nuvar > 0 && *layer > 0 && *ir > 0 && *is > 0)
149 {
150 sprintf(LAYER_STRING, "USER VARIABLE %d / LAYER IR IS %d %d %d" ,*nuvar,*ir,*is,*it);
151#ifdef _WIN64
152 strcat_s(LAYERPOOL,100,LAYER_STRING);
153#else
154 LAYERPOOL = strcat(LAYERPOOL,LAYER_STRING);
155#endif
156 }
157 else if(*nuvar > 0 && *ir > 0 && *is > 0 && *it > 0)
158 {
159 sprintf(LAYER_STRING, "USER VARIABLE %d / IR IS IT %d %d %d" ,*nuvar,*ir,*is,*it);
160#ifdef _WIN64
161 strcat_s(LAYERPOOL,100,LAYER_STRING);
162#else
163 LAYERPOOL = strcat(LAYERPOOL,LAYER_STRING);
164#endif
165 }
166 else if(*nuvar > 0)
167 {
168 sprintf(LAYER_STRING, "USER VARIABLE %d " ,*nuvar);
169#ifdef _WIN64
170 strcat_s(LAYERPOOL,100,LAYER_STRING);
171#else
172 LAYERPOOL = strcat(LAYERPOOL,LAYER_STRING);
173#endif
174 }
175 else if(*layer > 0 && *ir > 0 && *is > 0 )
176 {
177 sprintf(LAYER_STRING, "LAYER IR IS %d %d %d " ,*layer,*ir,*is);
178#ifdef _WIN64
179 strcat_s(LAYERPOOL,100,LAYER_STRING);
180#else
181 LAYERPOOL = strcat(LAYERPOOL,LAYER_STRING);
182#endif
183 }
184 else if(*layer > 0)
185 {
186 sprintf(LAYER_STRING, "LAYER %d " ,*layer);
187#ifdef _WIN64
188 strcat_s(LAYERPOOL,100,LAYER_STRING);
189#else
190 LAYERPOOL = strcat(LAYERPOOL,LAYER_STRING);
191#endif
192 }
193 else if(*ir > 0 && *is > 0 && *it > 0)
194 {
195 sprintf(LAYER_STRING, "IR IS IT %d %d %d" ,*ir,*is,*it);
196#ifdef _WIN64
197 strcat_s(LAYERPOOL,100,LAYER_STRING);
198#else
199 LAYERPOOL = strcat(LAYERPOOL,LAYER_STRING);
200#endif
201 }
202 }
203 else if(*layer < -1 )
204 {
205 if(*layer == -2)
206 {
207 sprintf(LAYER_STRING, "Layer Lower " );
208#ifdef _WIN64
209 strcat_s(LAYERPOOL,100,LAYER_STRING);
210#else
211 LAYERPOOL = strcat(LAYERPOOL,LAYER_STRING);
212#endif
213 }
214 if(*layer == -3)
215 {
216 sprintf(LAYER_STRING, "Layer Upper " );
217#ifdef _WIN64
218 strcat_s(LAYERPOOL,100,LAYER_STRING);
219#else
220 LAYERPOOL = strcat(LAYERPOOL,LAYER_STRING);
221#endif
222 }
223 }
224 else
225 {
226 sprintf(LAYER_STRING, "Mid" );
227#ifdef _WIN64
228 strcat_s(LAYERPOOL,100,LAYER_STRING);
229#else
230 LAYERPOOL = strcat(LAYERPOOL,LAYER_STRING);
231#endif
232 }
233
235
237
238 try {
239
241
244
246
248#ifdef _WIN64
250#else
252#endif
253
257
258 if (strlen(ccomment) != 0)
259 {
262 }
263
267
270
271 }
272
273 catch(...) {
275 }
276 delete [] LAYERPOOL;
277 delete [] LAYER_STRING;
278 delete [] NUVAR_STRING;
279 delete [] IR_STRING;
280 delete [] IS_STRING;
281 delete [] IT_STRING;
282 delete [] MID_STRING;
283 free(cname);
284 free(ccomment);
285
286}
H3D_TENSOR_TYPE tensor_type
bool Hyper3DDatatypePools(H3DFileInfo *h3d_file, H3D_ID dt_id, H3D_ID poolname_id, unsigned int num_layers, H3D_ID *layername_ids, bool corners, H3D_TENSOR_TYPE tensor_type, float poisson)
bool Hyper3DAddString(H3DFileInfo *h3d_file, const char *const string, H3D_ID *const str_id)
bool Hyper3DDatatypeEnd(H3DFileInfo *h3d_file)
bool Hyper3DExportClearError(H3DFileInfo *h3d_file)
bool Hyper3DDatatypeDescriptionWrite(H3DFileInfo *h3d_file, H3D_ID dt_id, const char *description)
bool Hyper3DDatatypeWrite(H3DFileInfo *h3d_file, const char *label, H3D_ID dt_id, H3D_DS_FORMAT format, H3D_DS_TYPE type, unsigned int num_pools)
bool Hyper3DDatatypeBegin(H3DFileInfo *h3d_file, unsigned int count)