OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
c_h3d_create_solid_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_solid_tensor_datatype_ (int *cpt_data, char *name1, int *size1, int *info, char *name2, int *size2, int *layer, int *nuvar, int *ir, int *is, int *it, int *id, char *comment, int *s_comment, int *is_corner_data)
void _FCALL C_H3D_CREATE_SOLID_TENSOR_DATATYPE (int *cpt_data, char *name1, int *size1, int *info, char *name2, int *size2, int *layer, int *nuvar, int *ir, int *is, int *it, int *id, char *comment, int *s_comment, int *is_corner_data)
void c_h3d_create_solid_tensor_datatype__ (int *cpt_data, char *name1, int *size1, int *info, char *name2, int *size2, int *layer, int *nuvar, int *ir, int *is, int *it, int *id, char *comment, int *s_comment, int *is_corner_data)
void c_create_solid_tensor_datatype (int *cpt_data, char *name1, int *size1, int *info, char *name2, int *size2, int *layer, int *nuvar, int *ir, int *is, int *it, int *id, char *comment, int *s_comment, int *is_corner_data)

Macro Definition Documentation

◆ _FCALL [1/2]

#define _FCALL

Definition at line 50 of file c_h3d_create_solid_tensor_datatype.cpp.

◆ _FCALL [2/2]

#define _FCALL

Definition at line 50 of file c_h3d_create_solid_tensor_datatype.cpp.

Function Documentation

◆ c_create_solid_tensor_datatype()

void c_create_solid_tensor_datatype ( int * cpt_data,
char * name1,
int * size1,
int * info,
char * name2,
int * size2,
int * layer,
int * nuvar,
int * ir,
int * is,
int * it,
int * id,
char * comment,
int * s_comment,
int * is_corner_data )

Definition at line 300 of file c_h3d_create_solid_tensor_datatype.cpp.

303{c_h3d_create_solid_tensor_datatype_ (cpt_data, name1, size1, info, name2, size2, layer, nuvar, ir, is, it, id, comment, s_comment,is_corner_data);}
void c_h3d_create_solid_tensor_datatype_(int *cpt_data, char *name1, int *size1, int *info, char *name2, int *size2, int *layer, int *nuvar, int *ir, int *is, int *it, int *id, char *comment, int *s_comment, int *is_corner_data)

◆ C_H3D_CREATE_SOLID_TENSOR_DATATYPE()

void _FCALL C_H3D_CREATE_SOLID_TENSOR_DATATYPE ( int * cpt_data,
char * name1,
int * size1,
int * info,
char * name2,
int * size2,
int * layer,
int * nuvar,
int * ir,
int * is,
int * it,
int * id,
char * comment,
int * s_comment,
int * is_corner_data )

Definition at line 290 of file c_h3d_create_solid_tensor_datatype.cpp.

293{c_h3d_create_solid_tensor_datatype_ (cpt_data, name1, size1, info, name2, size2, layer, nuvar, ir, is, it, id, comment, s_comment,is_corner_data);}

◆ c_h3d_create_solid_tensor_datatype_()

void c_h3d_create_solid_tensor_datatype_ ( int * cpt_data,
char * name1,
int * size1,
int * info,
char * name2,
int * size2,
int * layer,
int * nuvar,
int * ir,
int * is,
int * it,
int * id,
char * comment,
int * s_comment,
int * is_corner_data )

Definition at line 71 of file c_h3d_create_solid_tensor_datatype.cpp.

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
234 rc = Hyper3DAddString(h3d_file, LAYERPOOL, &layer_pool_id);
235
236 char edata_type[50];
237
238 try {
239 // create result data types
240 dt_count++;
241
243 if( !rc ) throw rc;
244
245 pool_count = 2;
246
247 dt_id++;
248#ifdef _WIN64
249 strcpy_s(edata_type, 50, RES_STRING);
250#else
251 strcpy(edata_type, RES_STRING);
252#endif
253
254 rc = Hyper3DDatatypeWrite(h3d_file, edata_type, *cpt_data , H3D_DS_TENSOR3D,
255 H3D_DS_ELEM, pool_count);
256 if( !rc ) throw rc;
257
258 if (strlen(ccomment) != 0)
259 {
260 rc = Hyper3DDatatypeDescriptionWrite(h3d_file, *cpt_data, ccomment);
261 if( !rc ) throw rc;
262 }
263
264 rc = Hyper3DDatatypePools(h3d_file, *cpt_data , solid_poolname_id, num_layers,
265 &layer_pool_id, is_corner_data, tensor_type, poisson);
266 if( !rc ) throw rc;
267
269 if( !rc ) throw rc;
270
271 } // end of try
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}
H3DFileInfo * h3d_file
unsigned int pool_count
unsigned int dt_count
bool rc
float poisson
H3D_ID solid_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_solid_tensor_datatype__()

void c_h3d_create_solid_tensor_datatype__ ( int * cpt_data,
char * name1,
int * size1,
int * info,
char * name2,
int * size2,
int * layer,
int * nuvar,
int * ir,
int * is,
int * it,
int * id,
char * comment,
int * s_comment,
int * is_corner_data )

Definition at line 295 of file c_h3d_create_solid_tensor_datatype.cpp.

298{c_h3d_create_solid_tensor_datatype_ (cpt_data, name1, size1, info, name2, size2, layer, nuvar, ir, is, it, id, comment, s_comment,is_corner_data);}