OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
c_h3d_create_shell_tensor_datatype.cpp File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <fcntl.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <time.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dlfcn.h>
#include <stdbool.h>
#include "h3dpublic_defs.h"
#include "h3dpublic_export.h"
#include "h3d_values.h"

Go to the source code of this file.

Macros

#define _FCALL
#define _FCALL

Functions

void c_h3d_create_shell_tensor_datatype_ (int *cpt_data, char *name1, int *size1, int *info1, int *info2, char *name2, int *size2, int *layer, int *ipt, int *ply, int *nuvar, int *gauss, int *id, char *comment, int *s_comment)
void _FCALL C_H3D_CREATE_SHELL_TENSOR_DATATYPE (int *cpt_data, char *name1, int *size1, int *info1, int *info2, char *name2, int *size2, int *layer, int *ipt, int *ply, int *nuvar, int *gauss, int *id, char *comment, int *s_comment)
void c_h3d_create_shell_tensor_datatype__ (int *cpt_data, char *name1, int *size1, int *info1, int *info2, char *name2, int *size2, int *layer, int *ipt, int *ply, int *nuvar, int *gauss, int *id, char *comment, int *s_comment)
void c_h3d_create_shell_tensor_datatype (int *cpt_data, char *name1, int *size1, int *info1, int *info2, char *name2, int *size2, int *layer, int *ipt, int *ply, int *nuvar, int *gauss, int *id, char *comment, int *s_comment)

Macro Definition Documentation

◆ _FCALL [1/2]

#define _FCALL

Definition at line 50 of file c_h3d_create_shell_tensor_datatype.cpp.

◆ _FCALL [2/2]

#define _FCALL

Definition at line 50 of file c_h3d_create_shell_tensor_datatype.cpp.

Function Documentation

◆ C_H3D_CREATE_SHELL_TENSOR_DATATYPE()

void _FCALL C_H3D_CREATE_SHELL_TENSOR_DATATYPE ( int * cpt_data,
char * name1,
int * size1,
int * info1,
int * info2,
char * name2,
int * size2,
int * layer,
int * ipt,
int * ply,
int * nuvar,
int * gauss,
int * id,
char * comment,
int * s_comment )

Definition at line 341 of file c_h3d_create_shell_tensor_datatype.cpp.

344{c_h3d_create_shell_tensor_datatype_ (cpt_data, name1, size1, info1, info2, name2, size2,layer,ipt,ply,nuvar,gauss,id,comment,s_comment);}
void c_h3d_create_shell_tensor_datatype_(int *cpt_data, char *name1, int *size1, int *info1, int *info2, char *name2, int *size2, int *layer, int *ipt, int *ply, int *nuvar, int *gauss, int *id, char *comment, int *s_comment)

◆ c_h3d_create_shell_tensor_datatype()

void c_h3d_create_shell_tensor_datatype ( int * cpt_data,
char * name1,
int * size1,
int * info1,
int * info2,
char * name2,
int * size2,
int * layer,
int * ipt,
int * ply,
int * nuvar,
int * gauss,
int * id,
char * comment,
int * s_comment )

Definition at line 351 of file c_h3d_create_shell_tensor_datatype.cpp.

354{c_h3d_create_shell_tensor_datatype_ (cpt_data, name1, size1, info1, info2, name2, size2,layer,ipt,ply,nuvar,gauss,id,comment,s_comment);}

◆ c_h3d_create_shell_tensor_datatype_()

void c_h3d_create_shell_tensor_datatype_ ( int * cpt_data,
char * name1,
int * size1,
int * info1,
int * info2,
char * name2,
int * size2,
int * layer,
int * ipt,
int * ply,
int * nuvar,
int * gauss,
int * id,
char * comment,
int * s_comment )

Definition at line 71 of file c_h3d_create_shell_tensor_datatype.cpp.

74{
75 char *cname,*cname2,*ccomment;
76 int cname_len,cname_len1,ccomment_len;
77 int i,cpt_size;
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 * IPT_STRING = new char [100];
103 IPT_STRING[0] ='\0';
104 char * GAUSS_STRING = new char [100];
105 GAUSS_STRING[0] ='\0';
106 char * PLY_STRING = new char [100];
107 PLY_STRING[0] ='\0';
108 char * NUVAR_STRING = new char [100];
109 NUVAR_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 if( strncmp(cname,"Strain",6) == 0 ) tensor_type = H3D_DS_STRAIN_2D;
118 if( strncmp(cname,"Stress",6) == 0 ) tensor_type = H3D_DS_STRESS_2D;
119 if( strncmp(cname,"Strn rate",9) == 0 ) tensor_type = H3D_DS_STRAIN_2D;
120
121 H3D_ID layer_pool_id = H3D_NULL_ID;
122
123#ifdef _WIN64
124 strcat_s(RES_STRING,100,cname);
125#else
126 RES_STRING = strcat(RES_STRING,cname);
127#endif
128
129 if(*id > 0)
130 {
131 sprintf(ID_STRING, " id %d",*id);
132#ifdef _WIN64
133 strcat_s(RES_STRING,100,ID_STRING);
134#else
135 RES_STRING = strcat(RES_STRING,ID_STRING);
136#endif
137 }
138
139
140 if(*layer > 0 || *ipt > 0 || *ply > 0|| *gauss > 0|| *nuvar > 0)
141 {
142
143 if(*nuvar > 0 && *ipt > 0)
144 {
145 sprintf(NUVAR_STRING, "USER VARIABLE / IPT %d %d" ,*nuvar,*ipt);
146#ifdef _WIN64
147 strcat_s(LAYERPOOL,100,NUVAR_STRING);
148#else
149 LAYERPOOL = strcat(LAYERPOOL,NUVAR_STRING);
150#endif
151 }
152 else if(*nuvar > 0)
153 {
154 sprintf(LAYER_STRING, "USER VARIABLE %d " ,*nuvar);
155#ifdef _WIN64
156 strcat_s(LAYERPOOL,100,LAYER_STRING);
157#else
158 LAYERPOOL = strcat(LAYERPOOL,LAYER_STRING);
159#endif
160 }
161 else if(*layer > 0)
162 {
163 sprintf(LAYER_STRING, "LAYER %d " ,*layer);
164#ifdef _WIN64
165 strcat_s(LAYERPOOL,100,LAYER_STRING);
166#else
167 LAYERPOOL = strcat(LAYERPOOL,LAYER_STRING);
168#endif
169 }
170 else if(*ply > 0 && *ipt > 0)
171 {
172 sprintf(PLY_STRING, "PLY/IPT %d %d" ,*ply,*ipt);
173#ifdef _WIN64
174 strcat_s(LAYERPOOL,100,PLY_STRING);
175#else
176 LAYERPOOL = strcat(LAYERPOOL,PLY_STRING);
177#endif
178 }
179 else if(*ipt > 0)
180 {
181 sprintf(IPT_STRING, "IPT %d " ,*ipt);
182#ifdef _WIN64
183 strcat_s(LAYERPOOL,100,IPT_STRING);
184#else
185 LAYERPOOL = strcat(LAYERPOOL,IPT_STRING);
186#endif
187 }
188 else if(*ply > 0)
189 {
190 sprintf(IPT_STRING, "PLY %d " ,*ply);
191#ifdef _WIN64
192 strcat_s(LAYERPOOL,100,IPT_STRING);
193#else
194 LAYERPOOL = strcat(LAYERPOOL,IPT_STRING);
195#endif
196 }
197 else if(*gauss > 0)
198 {
199 sprintf(GAUSS_STRING, "GAUSS %d " ,*gauss);
200#ifdef _WIN64
201 strcat_s(LAYERPOOL,100,GAUSS_STRING);
202#else
203 LAYERPOOL = strcat(LAYERPOOL,GAUSS_STRING);
204#endif
205 }
206 }
207 else if(*layer < -1 || *ipt < -1 )
208 {
209 if(*layer == -2)
210 {
211 sprintf(LAYER_STRING, "Layer Lower " );
212#ifdef _WIN64
213 strcat_s(LAYERPOOL,100,LAYER_STRING);
214#else
215 LAYERPOOL = strcat(LAYERPOOL,LAYER_STRING);
216#endif
217 }
218 if(*layer == -3)
219 {
220 sprintf(LAYER_STRING, "Layer Upper " );
221#ifdef _WIN64
222 strcat_s(LAYERPOOL,100,LAYER_STRING);
223#else
224 LAYERPOOL = strcat(LAYERPOOL,LAYER_STRING);
225#endif
226 }
227 if(*ipt == -2)
228 {
229 sprintf(IPT_STRING, "npt Lower " );
230#ifdef _WIN64
231 strcat_s(LAYERPOOL,100,IPT_STRING);
232#else
233 LAYERPOOL = strcat(LAYERPOOL,IPT_STRING);
234#endif
235 }
236 if(*ipt == -3)
237 {
238 sprintf(IPT_STRING, "npt Upper " );
239#ifdef _WIN64
240 strcat_s(LAYERPOOL,100,IPT_STRING);
241#else
242 LAYERPOOL = strcat(LAYERPOOL,IPT_STRING);
243#endif
244 }
245 }
246 else
247 {
248 sprintf(IPT_STRING, "Mid" );
249#ifdef _WIN64
250 strcat_s(LAYERPOOL,100,IPT_STRING);
251#else
252 LAYERPOOL = strcat(LAYERPOOL,IPT_STRING);
253#endif
254 }
255 rc = Hyper3DAddString(h3d_file, LAYERPOOL, &layer_pool_id);
256
257 char edata_type[50];
258//
259
260 //printf( "scalar %d info = %d %s\n", *cpt_data , *info1, name);
261 //fflush(stdout);
262
263 try {
264 // create result data types
265 dt_count++;
266
268 if( !rc ) throw rc;
269
270 pool_count = 2;
271
272 dt_id++;
273#ifdef _WIN64
274 strcpy_s(edata_type,50, RES_STRING );
275#else
276 strcpy(edata_type, RES_STRING);
277#endif
278// if( *layer == -1 && *ipt == -1 && *ply == -1 && *nuvar == -1)
279// {
280// sprintf(edata_type, cname, H3D_DT_DELIMITER);
281// strcat(edata_type," (elemental value)");
282// }
283// else
284// {
285// sprintf(edata_type, cname, H3D_DT_DELIMITER);
286// }
287 rc = Hyper3DDatatypeWrite(h3d_file, edata_type, *cpt_data , H3D_DS_TENSOR2D,
288 H3D_DS_ELEM, pool_count);
289 if( !rc ) throw rc;
290
291 if (strlen(ccomment) != 0)
292 {
293 rc = Hyper3DDatatypeDescriptionWrite(h3d_file, *cpt_data, ccomment);
294 if( !rc ) throw rc;
295 }
296
297// if( (*layer != -1 || *ipt != -1 || *ply != -1 || *gauss != -1 || *nuvar != -1) && *cpt_data != 0)
298// {
300 &layer_pool_id, has_corners, tensor_type, poisson);
301 if( !rc ) throw rc;
302
304 &layer_pool_id, has_corners, tensor_type, poisson);
305 if( !rc ) throw rc;
306/* }
307 else if (*cpt_data != 0)
308 {
309 rc = Hyper3DDatatypePools(h3d_file, *cpt_data , sh4n_poolname_id, 0,
310 layername_ids, has_corners, tensor_type, poisson);
311 if( !rc ) throw rc;
312
313 rc = Hyper3DDatatypePools(h3d_file, *cpt_data , sh3n_poolname_id, 0,
314 layername_ids, has_corners, tensor_type, poisson);
315 if( !rc ) throw rc;
316 }*/
317
319 if( !rc ) throw rc;
320
321 } // end of try
322
323 catch(...) {
325 }
326 delete [] LAYERPOOL;
327 delete [] LAYER_STRING;
328 delete [] IPT_STRING;
329 delete [] GAUSS_STRING;
330 delete [] PLY_STRING;
331 delete [] NUVAR_STRING;
332 delete [] MID_STRING;
333 free(cname);
334 free(ccomment);
335
336}
H3DFileInfo * h3d_file
unsigned int pool_count
unsigned int dt_count
bool has_corners
bool rc
float poisson
H3D_ID sh4n_poolname_id
H3D_ID sh3n_poolname_id
H3D_ID dt_id
char edata_type[50]
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)
Definition h3d_dl.c:1331
bool Hyper3DAddString(H3DFileInfo *h3d_file, const char *const string, H3D_ID *const str_id)
Definition h3d_dl.c:955
bool Hyper3DDatatypeEnd(H3DFileInfo *h3d_file)
Definition h3d_dl.c:1341
bool Hyper3DExportClearError(H3DFileInfo *h3d_file)
Definition h3d_dl.c:939
bool Hyper3DDatatypeDescriptionWrite(H3DFileInfo *h3d_file, H3D_ID dt_id, const char *description)
Definition h3d_dl.c:1324
bool Hyper3DDatatypeWrite(H3DFileInfo *h3d_file, const char *label, H3D_ID dt_id, H3D_DS_FORMAT format, H3D_DS_TYPE type, unsigned int num_pools)
Definition h3d_dl.c:1316
bool Hyper3DDatatypeBegin(H3DFileInfo *h3d_file, unsigned int count)
Definition h3d_dl.c:1310

◆ c_h3d_create_shell_tensor_datatype__()

void c_h3d_create_shell_tensor_datatype__ ( int * cpt_data,
char * name1,
int * size1,
int * info1,
int * info2,
char * name2,
int * size2,
int * layer,
int * ipt,
int * ply,
int * nuvar,
int * gauss,
int * id,
char * comment,
int * s_comment )

Definition at line 346 of file c_h3d_create_shell_tensor_datatype.cpp.

349{c_h3d_create_shell_tensor_datatype_ (cpt_data, name1, size1, info1, info2, name2, size2,layer,ipt,ply,nuvar,gauss,id,comment,s_comment);}