OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
c_h3d_create_solid_scalar_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_scalar_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 *idMds, int *idMdsVar, int *idMatMds, char *comment, int *s_comment, char *mdsUvarName, int *sizeMdsUvarName, int *id, int *mode)
void _FCALL C_H3D_CREATE_SOLID_SCALAR_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 *idMds, int *idMdsVar, int *idMatMds, char *comment, int *s_comment, char *mdsUvarName, int *sizeMdsUvarName, int *id, int *mode)
void c_h3d_create_solid_scalar_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 *idMds, int *idMdsVar, int *idMatMds, char *comment, int *s_comment, char *mdsUvarName, int *sizeMdsUvarName, int *id, int *mode)
void c_create_solid_scalar_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 *idMds, int *idMdsVar, int *idMatMds, char *comment, int *s_comment, char *mdsUvarName, int *sizeMdsUvarName, int *id, int *mode)

Macro Definition Documentation

◆ _FCALL [1/2]

#define _FCALL

Definition at line 47 of file c_h3d_create_solid_scalar_datatype.cpp.

◆ _FCALL [2/2]

#define _FCALL

Definition at line 47 of file c_h3d_create_solid_scalar_datatype.cpp.

Function Documentation

◆ c_create_solid_scalar_datatype()

void c_create_solid_scalar_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 * idMds,
int * idMdsVar,
int * idMatMds,
char * comment,
int * s_comment,
char * mdsUvarName,
int * sizeMdsUvarName,
int * id,
int * mode )

Definition at line 340 of file c_h3d_create_solid_scalar_datatype.cpp.

344 {
345 c_h3d_create_solid_scalar_datatype_(cpt_data, name1, size1, info, name2, size2, layer, nuvar, ir, is, it, idMds, idMdsVar,
346 idMatMds, comment, s_comment, mdsUvarName, sizeMdsUvarName, id, mode);
347 }
void c_h3d_create_solid_scalar_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 *idMds, int *idMdsVar, int *idMatMds, char *comment, int *s_comment, char *mdsUvarName, int *sizeMdsUvarName, int *id, int *mode)

◆ C_H3D_CREATE_SOLID_SCALAR_DATATYPE()

void _FCALL C_H3D_CREATE_SOLID_SCALAR_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 * idMds,
int * idMdsVar,
int * idMatMds,
char * comment,
int * s_comment,
char * mdsUvarName,
int * sizeMdsUvarName,
int * id,
int * mode )

Definition at line 322 of file c_h3d_create_solid_scalar_datatype.cpp.

326 {
327 c_h3d_create_solid_scalar_datatype_(cpt_data, name1, size1, info, name2, size2, layer, nuvar, ir, is, it, idMds, idMdsVar,
328 idMatMds, comment, s_comment, mdsUvarName, sizeMdsUvarName, id, mode);
329 }

◆ c_h3d_create_solid_scalar_datatype_()

void c_h3d_create_solid_scalar_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 * idMds,
int * idMdsVar,
int * idMatMds,
char * comment,
int * s_comment,
char * mdsUvarName,
int * sizeMdsUvarName,
int * id,
int * mode )

Definition at line 68 of file c_h3d_create_solid_scalar_datatype.cpp.

72 {
73 char *cname, *cname2, *ccomment, *cmdsuvar;
74 int cname_len, cname_len1, ccomment_len, cmdsuvar_len;
75 int i, cpt_size;
76 float node[3];
77 H3D_ID node_id;
78 unsigned int elem_count = 1;
79
80 cname_len = *size1 + 1;
81 cname = (char *)malloc(sizeof(char) * cname_len);
82 for (i = 0; i < *size1; i++)
83 cname[i] = name1[i];
84
85 cpt_size = 0;
86 for (i = 0; i < *size1; i++)
87 {
88 if (name1[i] != ' ')
89 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++)
96 ccomment[i] = comment[i];
97 ccomment[*s_comment] = '\0';
98
99 cmdsuvar_len = *sizeMdsUvarName + 1;
100 cmdsuvar = (char *)malloc(sizeof(char) * cmdsuvar_len);
101 for (i = 0; i < *sizeMdsUvarName; i++)
102 cmdsuvar[i] = mdsUvarName[i];
103 cmdsuvar[*sizeMdsUvarName] = '\0';
104
105 char *LAYERPOOL = new char[100];
106 LAYERPOOL[0] = '\0';
107 char *LAYER_STRING = new char[100];
108 LAYER_STRING[0] = '\0';
109 char *NUVAR_STRING = new char[100];
110 NUVAR_STRING[0] = '\0';
111 char *IR_STRING = new char[100];
112 IR_STRING[0] = '\0';
113 char *IS_STRING = new char[100];
114 IS_STRING[0] = '\0';
115 char *IT_STRING = new char[100];
116 IT_STRING[0] = '\0';
117 char *MID_STRING = new char[100];
118 MID_STRING[0] = '\0';
119 char *RES_STRING = new char[100];
120 RES_STRING[0] = '\0';
121 char *ID_STRING = new char[100];
122 ID_STRING[0] = '\0';
123 char *MODE_STRING = new char[100];
124 ID_STRING[0] = '\0';
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
135 if (*idMdsVar > 0 && *idMds > 0)
136 {
137 sprintf(NUVAR_STRING, " LAW %d", *idMatMds);
138#ifdef _WIN64
139 strcat_s(RES_STRING, 100, NUVAR_STRING);
140#else
141 RES_STRING = strcat(RES_STRING, NUVAR_STRING);
142#endif
143
144 sprintf(NUVAR_STRING, ": %s ", cmdsuvar);
145#ifdef _WIN64
146 strcat_s(RES_STRING, 100, NUVAR_STRING);
147#else
148 RES_STRING = strcat(RES_STRING, NUVAR_STRING);
149#endif
150 // a commenter pour test
151 // sprintf(NUVAR_STRING, " (%d) \0",*idMdsVar);
152 // RES_STRING = strcat(RES_STRING,NUVAR_STRING);
153 }
154 else if (*nuvar > 0)
155 {
156 sprintf(NUVAR_STRING, " %d ", *nuvar);
157#ifdef _WIN64
158 strcat_s(RES_STRING, 100, NUVAR_STRING);
159#else
160 RES_STRING = strcat(RES_STRING, NUVAR_STRING);
161#endif
162 }
163
164 // printf("String en sortie : %s \n",RES_STRING);
165 // fflush(stdout);
166
167 if (*layer > 0 || *nuvar > 0 || *ir > 0 || *is > 0 || *it > 0)
168 {
169
170 if (*nuvar > 0 && *layer > 0 && *ir > 0 && *is > 0)
171 {
172 sprintf(LAYER_STRING, "USER VARIABLE %d / LAYER IR IS %d %d %d", *nuvar, *ir, *is, *it);
173#ifdef _WIN64
174 strcat_s(LAYERPOOL, 100, LAYER_STRING);
175#else
176 LAYERPOOL = strcat(LAYERPOOL, LAYER_STRING);
177#endif
178 }
179 else if (*nuvar > 0 && *ir > 0 && *is > 0 && *it > 0)
180 {
181 sprintf(LAYER_STRING, "USER VARIABLE %d / IR IS IT %d %d %d", *nuvar, *ir, *is, *it);
182#ifdef _WIN64
183 strcat_s(LAYERPOOL, 100, LAYER_STRING);
184#else
185 LAYERPOOL = strcat(LAYERPOOL, LAYER_STRING);
186#endif
187 }
188 else if (*nuvar > 0)
189 {
190 sprintf(LAYER_STRING, "USER VARIABLE %d ", *nuvar);
191#ifdef _WIN64
192 strcat_s(LAYERPOOL, 100, LAYER_STRING);
193#else
194 LAYERPOOL = strcat(LAYERPOOL, LAYER_STRING);
195#endif
196 }
197 else if (*layer > 0 && *ir > 0 && *is > 0)
198 {
199 sprintf(LAYER_STRING, "LAYER IR IS %d %d %d ", *layer, *ir, *is);
200#ifdef _WIN64
201 strcat_s(LAYERPOOL, 100, LAYER_STRING);
202#else
203 LAYERPOOL = strcat(LAYERPOOL, LAYER_STRING);
204#endif
205 }
206 else if (*layer > 0)
207 {
208 sprintf(LAYER_STRING, "LAYER %d ", *layer);
209#ifdef _WIN64
210 strcat_s(LAYERPOOL, 100, LAYER_STRING);
211#else
212 LAYERPOOL = strcat(LAYERPOOL, LAYER_STRING);
213#endif
214 }
215 else if (*ir > 0 && *is > 0 && *it > 0)
216 {
217 sprintf(LAYER_STRING, "IR IS IT %d %d %d", *ir, *is, *it);
218#ifdef _WIN64
219 strcat_s(LAYERPOOL, 100, LAYER_STRING);
220#else
221 LAYERPOOL = strcat(LAYERPOOL, LAYER_STRING);
222#endif
223 }
224 }
225 else if (*layer < -1)
226 {
227 if (*layer == -2)
228 {
229 sprintf(LAYER_STRING, "Layer Lower ");
230#ifdef _WIN64
231 strcat_s(LAYERPOOL, 100, LAYER_STRING);
232#else
233 LAYERPOOL = strcat(LAYERPOOL, LAYER_STRING);
234#endif
235 }
236 if (*layer == -3)
237 {
238 sprintf(LAYER_STRING, "Layer Upper ");
239#ifdef _WIN64
240 strcat_s(LAYERPOOL, 100, LAYER_STRING);
241#else
242 LAYERPOOL = strcat(LAYERPOOL, LAYER_STRING);
243#endif
244 }
245 }
246 else
247 {
248 sprintf(LAYER_STRING, "Mid");
249#ifdef _WIN64
250 strcat_s(LAYERPOOL, 100, LAYER_STRING);
251#else
252 LAYERPOOL = strcat(LAYERPOOL, LAYER_STRING);
253#endif
254 }
255 rc = Hyper3DAddString(h3d_file, LAYERPOOL, &layer_pool_id);
256
257 char edata_type[100];
258 //
259
260 // printf( "scalar %d info = %d %s\n", *cpt_data , *info1, name);
261 // fflush(stdout);
262
263 try
264 {
265 // create result data types
266 dt_count++;
267
269 if (!rc)
270 throw rc;
271
272 pool_count = 2;
273
274 dt_id++;
275 sprintf(edata_type, RES_STRING, H3D_DT_DELIMITER);
276
277 rc = Hyper3DDatatypeWrite(h3d_file, edata_type, *cpt_data, H3D_DS_SCALAR,
278 H3D_DS_ELEM, pool_count);
279 if (!rc)
280 throw rc;
281
282 if (strlen(ccomment) != 0)
283 {
284 rc = Hyper3DDatatypeDescriptionWrite(h3d_file, *cpt_data, ccomment);
285 if (!rc)
286 throw rc;
287 }
288
290 &layer_pool_id, has_corners, tensor_type, poisson);
291 if (!rc)
292 throw rc;
293
295 &layer_pool_id, has_corners, tensor_type, poisson);
296 if (!rc)
297 throw rc;
298
300 if (!rc)
301 throw rc;
302
303 } // end of try
304
305 catch (...)
306 {
308 }
309 delete[] LAYERPOOL;
310 delete[] LAYER_STRING;
311 delete[] NUVAR_STRING;
312 delete[] IR_STRING;
313 delete[] IS_STRING;
314 delete[] IT_STRING;
315 delete[] MID_STRING;
316 delete[] RES_STRING;
317 delete[] MODE_STRING;
318 free(cname);
319 free(ccomment);
320 }
H3DFileInfo * h3d_file
unsigned int pool_count
unsigned int dt_count
bool has_corners
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_scalar_datatype__()

void c_h3d_create_solid_scalar_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 * idMds,
int * idMdsVar,
int * idMatMds,
char * comment,
int * s_comment,
char * mdsUvarName,
int * sizeMdsUvarName,
int * id,
int * mode )

Definition at line 331 of file c_h3d_create_solid_scalar_datatype.cpp.

335 {
336 c_h3d_create_solid_scalar_datatype_(cpt_data, name1, size1, info, name2, size2, layer, nuvar, ir, is, it, idMds, idMdsVar,
337 idMatMds, comment, s_comment, mdsUvarName, sizeMdsUvarName, id, mode);
338 }