OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
c_h3d_create_components.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_components_ (int *IPART, int *LIPART1, int *NPART, int *LTITR, int *IGEO, int *NPROPGI, int *H3D_PART, int *NRBODY, int *NRWALL, int *NOM_OPT, int *LNOPT1, int *I16D, int *NPBY, int *NNPBY, int *SUB_NCHILD, int *NSUBS, int *NRBE2, int *NRBE3, int *I16E, int *I16F, int *N2D, int *IRBE2, int *NRBE2L, int *SUB_ID, int *SUB_CHILD, int *SUB_LEVEL, int *SUB_IAD, int *SUB_TITLE, int *IRBE3, int *NRBE3L, int *COMPID_RBODIES, int *COMPID_RBE2S, int *COMPID_RBE3S)
void _FCALL C_H3D_CREATE_COMPONENTS (int *IPART, int *LIPART1, int *NPART, int *LTITR, int *IGEO, int *NPROPGI, int *H3D_PART, int *NRBODY, int *NRWALL, int *NOM_OPT, int *LNOPT1, int *I16D, int *NPBY, int *NNPBY, int *SUB_NCHILD, int *NSUBS, int *NRBE2, int *NRBE3, int *I16E, int *I16F, int *N2D, int *IRBE2, int *NRBE2L, int *SUB_ID, int *SUB_CHILD, int *SUB_LEVEL, int *SUB_IAD, int *SUB_TITLE, int *IRBE3, int *NRBE3L, int *COMPID_RBODIES, int *COMPID_RBE2S, int *COMPID_RBE3S)
void c_h3d_create_components__ (int *IPART, int *LIPART1, int *NPART, int *LTITR, int *IGEO, int *NPROPGI, int *H3D_PART, int *NRBODY, int *NRWALL, int *NOM_OPT, int *LNOPT1, int *I16D, int *NPBY, int *NNPBY, int *SUB_NCHILD, int *NSUBS, int *NRBE2, int *NRBE3, int *I16E, int *I16F, int *N2D, int *IRBE2, int *NRBE2L, int *SUB_ID, int *SUB_CHILD, int *SUB_LEVEL, int *SUB_IAD, int *SUB_TITLE, int *IRBE3, int *NRBE3L, int *COMPID_RBODIES, int *COMPID_RBE2S, int *COMPID_RBE3S)
void c_h3d_create_components (int *IPART, int *LIPART1, int *NPART, int *LTITR, int *IGEO, int *NPROPGI, int *H3D_PART, int *NRBODY, int *NRWALL, int *NOM_OPT, int *LNOPT1, int *I16D, int *NPBY, int *NNPBY, int *SUB_NCHILD, int *NSUBS, int *NRBE2, int *NRBE3, int *I16E, int *I16F, int *N2D, int *IRBE2, int *NRBE2L, int *SUB_ID, int *SUB_CHILD, int *SUB_LEVEL, int *SUB_IAD, int *SUB_TITLE, int *IRBE3, int *NRBE3L, int *COMPID_RBODIES, int *COMPID_RBE2S, int *COMPID_RBE3S)

Macro Definition Documentation

◆ _FCALL [1/2]

#define _FCALL

Definition at line 48 of file c_h3d_create_components.cpp.

◆ _FCALL [2/2]

#define _FCALL

Definition at line 48 of file c_h3d_create_components.cpp.

Function Documentation

◆ C_H3D_CREATE_COMPONENTS()

void _FCALL C_H3D_CREATE_COMPONENTS ( int * IPART,
int * LIPART1,
int * NPART,
int * LTITR,
int * IGEO,
int * NPROPGI,
int * H3D_PART,
int * NRBODY,
int * NRWALL,
int * NOM_OPT,
int * LNOPT1,
int * I16D,
int * NPBY,
int * NNPBY,
int * SUB_NCHILD,
int * NSUBS,
int * NRBE2,
int * NRBE3,
int * I16E,
int * I16F,
int * N2D,
int * IRBE2,
int * NRBE2L,
int * SUB_ID,
int * SUB_CHILD,
int * SUB_LEVEL,
int * SUB_IAD,
int * SUB_TITLE,
int * IRBE3,
int * NRBE3L,
int * COMPID_RBODIES,
int * COMPID_RBE2S,
int * COMPID_RBE3S )

Definition at line 711 of file c_h3d_create_components.cpp.

717{c_h3d_create_components_ (IPART,LIPART1,NPART,LTITR,IGEO,NPROPGI,H3D_PART,NRBODY,NRWALL,NOM_OPT,LNOPT1,I16D, NPBY, NNPBY,SUB_NCHILD,NSUBS,NRBE2,NRBE3,
718 I16E,I16F,N2D,IRBE2,NRBE2L,SUB_ID,SUB_CHILD,SUB_LEVEL,SUB_IAD,SUB_TITLE,IRBE3,NRBE3L,
719 COMPID_RBODIES,COMPID_RBE2S,COMPID_RBE3S);}
void c_h3d_create_components_(int *IPART, int *LIPART1, int *NPART, int *LTITR, int *IGEO, int *NPROPGI, int *H3D_PART, int *NRBODY, int *NRWALL, int *NOM_OPT, int *LNOPT1, int *I16D, int *NPBY, int *NNPBY, int *SUB_NCHILD, int *NSUBS, int *NRBE2, int *NRBE3, int *I16E, int *I16F, int *N2D, int *IRBE2, int *NRBE2L, int *SUB_ID, int *SUB_CHILD, int *SUB_LEVEL, int *SUB_IAD, int *SUB_TITLE, int *IRBE3, int *NRBE3L, int *COMPID_RBODIES, int *COMPID_RBE2S, int *COMPID_RBE3S)

◆ c_h3d_create_components()

void c_h3d_create_components ( int * IPART,
int * LIPART1,
int * NPART,
int * LTITR,
int * IGEO,
int * NPROPGI,
int * H3D_PART,
int * NRBODY,
int * NRWALL,
int * NOM_OPT,
int * LNOPT1,
int * I16D,
int * NPBY,
int * NNPBY,
int * SUB_NCHILD,
int * NSUBS,
int * NRBE2,
int * NRBE3,
int * I16E,
int * I16F,
int * N2D,
int * IRBE2,
int * NRBE2L,
int * SUB_ID,
int * SUB_CHILD,
int * SUB_LEVEL,
int * SUB_IAD,
int * SUB_TITLE,
int * IRBE3,
int * NRBE3L,
int * COMPID_RBODIES,
int * COMPID_RBE2S,
int * COMPID_RBE3S )

Definition at line 731 of file c_h3d_create_components.cpp.

737{c_h3d_create_components_ (IPART,LIPART1,NPART,LTITR,IGEO,NPROPGI,H3D_PART,NRBODY,NRWALL,NOM_OPT,LNOPT1,I16D, NPBY, NNPBY,SUB_NCHILD,NSUBS,NRBE2,NRBE3,
738 I16E,I16F,N2D,IRBE2,NRBE2L,SUB_ID,SUB_CHILD,SUB_LEVEL,SUB_IAD,SUB_TITLE,IRBE3,NRBE3L,
739 COMPID_RBODIES,COMPID_RBE2S,COMPID_RBE3S);}

◆ c_h3d_create_components_()

void c_h3d_create_components_ ( int * IPART,
int * LIPART1,
int * NPART,
int * LTITR,
int * IGEO,
int * NPROPGI,
int * H3D_PART,
int * NRBODY,
int * NRWALL,
int * NOM_OPT,
int * LNOPT1,
int * I16D,
int * NPBY,
int * NNPBY,
int * SUB_NCHILD,
int * NSUBS,
int * NRBE2,
int * NRBE3,
int * I16E,
int * I16F,
int * N2D,
int * IRBE2,
int * NRBE2L,
int * SUB_ID,
int * SUB_CHILD,
int * SUB_LEVEL,
int * SUB_IAD,
int * SUB_TITLE,
int * IRBE3,
int * NRBE3L,
int * COMPID_RBODIES,
int * COMPID_RBE2S,
int * COMPID_RBE3S )

Definition at line 68 of file c_h3d_create_components.cpp.

74{
75 char * name = new char [*LTITR * 3];
76 int * ifiltmp = new int [*LTITR];
77 char * name_part=new char [*LTITR * 3 ];
78 char * name_sub=new char [*LTITR * 3 ];
79 int * assembly_father = new int [*NSUBS];
80
81 try {
82
83 int i,j,k,cpt,ipid,igtyp,isid;
84 unsigned char red[] = {255, 0, 0};
85 unsigned char green[] = {0, 255, 0};
86 unsigned char blue[] = {0, 0, 255};
87 H3D_COMPONENT_ATTRIBS wireframe = H3D_COMP_ATTR_WIREFRAME;
88 H3D_COMPONENT_ATTRIBS opaque = H3D_COMP_ATTR_OPAQUE;
89 H3D_COMPONENT_ATTRIBS transparent = H3D_COMP_ATTR_TRANSPARENT;
90 H3D_COMPONENT_ATTRIBS meshlines = H3D_COMP_ATTR_MESHLINES;
91
92 H3D_ID RigidElem = H3D_NULL_ID;
93
94 // create Components
95 H3D_ID comp_poolname_id = H3D_NULL_ID;
96 rc = Hyper3DAddString(h3d_file, H3D_DEFAULT_COMPPOOL, &comp_poolname_id);
97 if( !rc ) throw rc;
98
99 rc = Hyper3DAddString(h3d_file, H3D_DEFAULT_NODEPOOL, &node_poolname_id);
100 if( !rc ) throw rc;
101
102 rc = Hyper3DAddString(h3d_file, H3D_DEFAULT_ELEMPOOL1D, &elem1D_poolname_id);
103 if( !rc ) throw rc;
104
105 char SHELLPOOL[] = "Shell";
107 if( !rc ) throw rc;
108
109 char SOLIDPOOL[] = "Solid";
111 if( !rc ) throw rc;
112
113 char QUADPOOL[] = "QUAD";
115 if( !rc ) throw rc;
116
117 char SKINPOOL[] = "SKIN";
119 if( !rc ) throw rc;
120
121 char ONEDELEMPOOL[] = "1D";
123 if( !rc ) throw rc;
124
125 char RIGIDPOOL[] = "Rigid";
127 if( !rc ) throw rc;
128
129 char SPHCELLPOOL[] = "SPHCELL";
131 if( !rc ) throw rc;
132
133 char SPHNODEPOOL[] = "SPHNodes";
135 if( !rc ) throw rc;
136
137 char RBODYPOOL[] = "Rbody";
139 if( !rc ) throw rc;
140
141 char RBE2POOL[] = "Rbe2";
143 if( !rc ) throw rc;
144
145 char RBE3POOL[] = "Rbe3";
147 if( !rc ) throw rc;
148
149 char RWALLPOOL[] = "Rwall";
151 if( !rc ) throw rc;
152
153 H3D_ID assm_poolname_id = H3D_NULL_ID;
154 rc = Hyper3DAddString(h3d_file, H3D_DEFAULT_ASSMPOOL, &assm_poolname_id);
155 if( !rc ) throw rc;
156
157 for(i=0;i<*NSUBS;i++)
158 {
159 assembly_father[i] = -1;
160 }
161
162// for(i=0;i<*NSUBS;i++)
163// {
164// int iad_sub = ISUBS[*LISUB1 * i + 2];
165// int nbson_sub = ISUBS[*LISUB1 * i + 1];
166// for(j=0;j<nbson_sub;j++)
167// {
168// assembly_father[IBUFSSG[iad_sub + j - 1] - 1] = i ;
169// }
170// }
171
172 int current_son = 0;
173 for(i=0;i<*NSUBS;i++)
174 {
175 int nbson_sub = SUB_NCHILD[i];
176 for(j=0;j<nbson_sub;j++)
177 {
178 assembly_father[SUB_CHILD[current_son]-1] = i ;
179 current_son++ ;
180 }
181 }
182
183 int level_max = 0;
184 int id_max = 0;
185 for(int isu=0;isu<*NSUBS;isu++)
186 {
187// if(level_max < ISUBS[*LISUB1 * isu + 10]) level_max = ISUBS[*LISUB1 * isu + 10];
188// if(id_max < ISUBS[*LISUB1 * isu]) id_max = ISUBS[*LISUB1 * isu];
189 if(level_max < SUB_LEVEL[isu]) level_max = SUB_LEVEL[isu];
190 if(id_max < SUB_ID[isu]) id_max = SUB_ID[isu];
191 }
192
193
194 for(int ilevel=1;ilevel <= level_max;ilevel++)
195 {
196 for(int isu=0;isu<*NSUBS;isu++)
197 {
198// if( ISUBS[*LISUB1 * isu + 10] == ilevel)
199 if( SUB_LEVEL[isu] == ilevel)
200 {
201 k = 0;
202 cpt = 0;
203// for(j=0;j < *LTITR ; j=j+1)
204// {
205// name[k]=(char) (ISUBS[ *LISUB1 * (isu+1) - *LTITR + j]/65536);
206// if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
207// k++;
208// name[k]=(char) ((ISUBS[ *LISUB1 * (isu+1) - *LTITR + j]%65536)/256);
209// if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
210// k++;
211// name[k]=(char) (ISUBS[ *LISUB1 * (isu+1) - *LTITR + j]%256);
212// if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
213// k++;
214// }
215
216// for(j=0;j < *LTITR * 3 - cpt; j++) name_sub[j] = name[j];
217// name_sub[*LTITR * 3 - cpt] = '\0' ;
218
219
220 for(j=0;j < *LTITR ; j=j+1)
221 {
222 name[k]=(char) (SUB_TITLE[*LTITR * (isu) + j]/65536);
223 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
224 k++;
225 name[k]=(char) ((SUB_TITLE[*LTITR * (isu) + j]%65536)/256);
226 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
227 k++;
228 name[k]=(char) (SUB_TITLE[*LTITR * (isu) + j]%256);
229 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
230 k++;
231 }
232
233 for(j=0;j < *LTITR * 3 - cpt; j++) name_sub[j] = name[j];
234 name_sub[*LTITR * 3 - cpt] = '\0' ;
235
236
237
238// H3D_ID assm_id = ISUBS[*LISUB1 * isu ];
239// H3D_ID model_as_parent = ISUBS[*LISUB1 * (assembly_father[isu] )];
240 H3D_ID assm_id = SUB_ID[ isu ];
241 H3D_ID model_as_parent = SUB_ID[assembly_father[isu]];
242
244 if( !rc ) throw rc;
245
247 if( !rc ) throw rc;
248
250 if( !rc ) throw rc;
251
252 }
253 }
254 }
255
256
257
258 for(i=0;i<*NPART;i++)
259 {
260 ipid = IPART[ *LIPART1 * i + 1 ] ;
261 isid = IPART[ *LIPART1 * i + 2 ] ;
262 igtyp = IGEO[*NPROPGI * (ipid - 1) + 10 ] ;
263
264 if(H3D_PART[i] == 1)
265 {
266
267
268 // create Components
269 if(igtyp == 1 || igtyp == 9|| igtyp == 10 || igtyp == 11 || igtyp == 16|| igtyp == 17|| igtyp == 19 || igtyp == 51)
270 {
272 }
273 else if(*N2D != 0 &&(igtyp == 6 || igtyp == 14 || igtyp == 15 || igtyp == 20 || igtyp == 21 || igtyp == 22 || igtyp == 43))
274 {
276 }
277 else if(igtyp == 6 || igtyp == 14 || igtyp == 15 || igtyp == 20 || igtyp == 21 || igtyp == 22 || igtyp == 43)
278 {
280 }
281 else if(igtyp == 2 || igtyp == 3 || igtyp == 4 || igtyp == 8 || igtyp == 12 || igtyp == 13 || igtyp == 18 ||
282 igtyp == 25 || igtyp == 26 || igtyp == 28 || igtyp == 32|| igtyp == 33 || igtyp == 35 || igtyp == 36 ||
283 igtyp == 44 || igtyp == 45 || igtyp == 46 )
284 {
286 }
287 else if(igtyp == 34)
288 {
290 }
291 else
292 {
294 }
295
296
297 if( !rc ) throw rc;
298
299 k = 0;
300 cpt = 0;
301 for(j=0;j < *LTITR ; j=j+1)
302 {
303 name[k]=(char) (IPART[ *LIPART1 * (i+1) - *LTITR + j]/65536);
304 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
305 k++;
306 name[k]=(char) ((IPART[ *LIPART1 * (i+1) - *LTITR + j]%65536)/256);
307 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
308 k++;
309 name[k]=(char) (IPART[ *LIPART1 * (i+1) - *LTITR + j]%256);
310 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
311 k++;
312 }
313
314 for(j=0;j < *LTITR * 3 - cpt; j++) name_part[j] = name[j];
315 name_part[*LTITR * 3 - cpt] = '\0' ;
316
317 if(strlen(name_part) == 0) sprintf(name_part,"no part name");
318
319 if(igtyp == 1 || igtyp == 9|| igtyp == 10 || igtyp == 11 || igtyp == 16|| igtyp == 17|| igtyp == 19 || igtyp == 51)
320 {
321 rc = Hyper3DComponentWrite(h3d_file, name_part, IPART[*LIPART1 * i + 3],
322// node_poolname_id, ISUBS[*LISUB1 * (isid - 1) ]);
323 node_poolname_id, SUB_ID[isid-1]);
324
325 }
326 else if(igtyp == 6 || igtyp == 14 || igtyp == 15 || igtyp == 20 || igtyp == 21 || igtyp == 22 || igtyp == 43)
327 {
328 rc = Hyper3DComponentWrite(h3d_file, name_part, IPART[*LIPART1 * i + 3],
329// node_poolname_id, ISUBS[*LISUB1 * (isid - 1) ]);
330 node_poolname_id, SUB_ID[isid-1]);
331 }
332 else if(igtyp == 2 || igtyp == 3 || igtyp == 4 || igtyp == 8 || igtyp == 12 || igtyp == 13 || igtyp == 18 ||
333 igtyp == 25 || igtyp == 26 || igtyp == 28 || igtyp == 32|| igtyp == 33 || igtyp == 35 || igtyp == 36 ||
334 igtyp == 44 || igtyp == 45 || igtyp == 46 )
335 {
336 rc = Hyper3DComponentWrite(h3d_file, name_part, IPART[*LIPART1 * i + 3],
337// node_poolname_id, ISUBS[*LISUB1 * (isid - 1) ]);
338 node_poolname_id, SUB_ID[isid-1]);
339 }
340 else if(igtyp == 34)
341 {
342 rc = Hyper3DComponentWrite(h3d_file, name_part, IPART[*LIPART1 * i + 3],
343// node_poolname_id, ISUBS[*LISUB1 * (isid - 1) ]);
344 node_poolname_id, SUB_ID[isid-1]);
345 }
346 else
347 {
348 rc = Hyper3DComponentWrite(h3d_file, name_part, IPART[*LIPART1 * i + 3],
349// node_poolname_id, ISUBS[*LISUB1 * (isid - 1) ]);
350 node_poolname_id, SUB_ID[isid-1]);
351 }
352
353 if( !rc ) throw rc;
354
356 if( !rc ) throw rc;
357
358 }
359
360 }
361 for(i=0;i<*NPART;i++)
362 {
363 ipid = IPART[ *LIPART1 * i + 1 ] ;
364 isid = IPART[ *LIPART1 * i + 2 ] ;
365 igtyp = IGEO[*NPROPGI * (ipid - 1) + 10 ] ;
366
367 if(H3D_PART[i] == 1 || igtyp == 6 || igtyp == 14 || igtyp == 20 || igtyp == 21 || igtyp == 22)
368 {
369
370
371 // create Components skins
373
374 if( !rc ) throw rc;
375
376 k = 0;
377 cpt = 0;
378 for(j=0;j < *LTITR ; j=j+1)
379 {
380 name[k]=(char) (IPART[ *LIPART1 * (i+1) - *LTITR + j]/65536);
381 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
382 k++;
383 name[k]=(char) ((IPART[ *LIPART1 * (i+1) - *LTITR + j]%65536)/256);
384 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
385 k++;
386 name[k]=(char) (IPART[ *LIPART1 * (i+1) - *LTITR + j]%256);
387 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
388 k++;
389 }
390
391 for(j=0;j < *LTITR * 3 - cpt; j++) name_part[j] = name[j];
392 name_part[*LTITR * 3 - cpt] = '\0' ;
393
394 if(strlen(name_part) == 0) sprintf(name_part,"no part name");
395
396 rc = Hyper3DComponentWrite(h3d_file, name_part, IPART[*LIPART1 * i + 3],
397 node_poolname_id, SUB_ID[isid-1]);
398
399 if( !rc ) throw rc;
400
402 if( !rc ) throw rc;
403 }
404
405 }
406
407
408 int id_rbody;
409 if(*NRBODY > 0)
410 {
411 const char *name_rbody = "RBODIES MODEL" ;
412
413 id_max ++;
414 id_rbody = id_max;
415
417 if( !rc ) throw rc;
418
419 rc = Hyper3DAssemblyWrite(h3d_file, name_rbody, id_rbody, 0);
420 if( !rc ) throw rc;
421
422
424 if( !rc ) throw rc;
425 }
426
427
428 if(*COMPID_RBODIES != 0)
429 {
430 if(*NRBODY != 0)
431 {
432 // create Components
434 if( !rc ) throw rc;
435
436 rc = Hyper3DComponentWrite(h3d_file, "Rbodies", *COMPID_RBODIES,
437 node_poolname_id, id_rbody);
438 if( !rc ) throw rc;
439
441 if( !rc ) throw rc;
442 }
443 }
444 else
445 {
446 for(i=0;i<*NRBODY;i++)
447 {
448 // create Components
450 if( !rc ) throw rc;
451
452 k = 0;
453 cpt = 0;
454 for(j=0;j < *LTITR ; j=j+1)
455 {
456 name[k]=(char) (NOM_OPT[ *LNOPT1 * (i+1) - *LTITR + j]/65536);
457 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
458 k++;
459 name[k]=(char) ((NOM_OPT[ *LIPART1 * (i+1) - *LTITR + j]%65536)/256);
460 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
461 k++;
462 name[k]=(char) (NOM_OPT[ *LIPART1 * (i+1) - *LTITR + j]%256);
463 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
464 k++;
465 }
466
467 for(j=0;j < *LTITR * 3 - cpt; j++) name_part[j] = name[j];
468 name_part[*LTITR * 3 - cpt] = '\0' ;
469
470 if(strlen(name_part) == 0) sprintf(name_part,"RBODY");
471
472 rc = Hyper3DComponentWrite(h3d_file, name_part, NPBY[*NNPBY * i + 5],
473 node_poolname_id, id_rbody);
474 if( !rc ) throw rc;
475
477 if( !rc ) throw rc;
478 }
479 }
480
481
482 int id_rbe2;
483 if(*NRBE2 > 0)
484 {
485 const char *name_rbe2 = "RBE2 MODEL" ;
486
487 id_max ++;
488 id_rbe2 = id_max;
489
491 if( !rc ) throw rc;
492
493 rc = Hyper3DAssemblyWrite(h3d_file, name_rbe2, id_rbe2, 0);
494 if( !rc ) throw rc;
495
496
498 if( !rc ) throw rc;
499 }
500
501 if(*COMPID_RBE2S != 0)
502 {
503 if(*NRBE2 != 0)
504 {
505 // create Components
507 if( !rc ) throw rc;
508
509 rc = Hyper3DComponentWrite(h3d_file, "Rbe2s", *COMPID_RBE2S,
510 node_poolname_id, id_rbe2);
511 if( !rc ) throw rc;
512
514 if( !rc ) throw rc;
515 }
516 }
517 else
518 {
519 for(i=0;i<*NRBE2;i++)
520 {
521 // create Components
523 if( !rc ) throw rc;
524
525 k = 0;
526 cpt = 0;
527 for(j=0;j < *LTITR ; j=j+1)
528 {
529 name[k]=(char) (NOM_OPT[*I16E-1 + *LNOPT1 * (i+1) - *LTITR + j]/65536);
530 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
531 k++;
532 name[k]=(char) ((NOM_OPT[*I16E-1 + *LIPART1 * (i+1) - *LTITR + j]%65536)/256);
533 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
534 k++;
535 name[k]=(char) (NOM_OPT[*I16E-1 + *LIPART1 * (i+1) - *LTITR + j]%256);
536 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
537 k++;
538 }
539
540 for(j=0;j < *LTITR * 3 - cpt; j++) name_part[j] = name[j];
541 name_part[*LTITR * 3 - cpt] = '\0' ;
542
543 if(strlen(name_part) == 0) sprintf(name_part,"RBE2");
544
545 rc = Hyper3DComponentWrite(h3d_file, name_part, IRBE2[*NRBE2L * i + 1],
546 node_poolname_id, id_rbe2);
547 if( !rc ) throw rc;
548
549
551 if( !rc ) throw rc;
552 }
553 }
554
555 int id_rbe3;
556 if(*NRBE3 > 0)
557 {
558 const char *name_rbe3 = "RBE3 MODEL" ;
559
560 id_max ++;
561 id_rbe3 = id_max;
562
564 if( !rc ) throw rc;
565
566 rc = Hyper3DAssemblyWrite(h3d_file, name_rbe3, id_rbe3, 0);
567 if( !rc ) throw rc;
568
570 if( !rc ) throw rc;
571 }
572
573
574 if(*COMPID_RBE3S != 0)
575 {
576 if(*NRBE3 != 0)
577 {
578 // create Components
580 if( !rc ) throw rc;
581
582 rc = Hyper3DComponentWrite(h3d_file, "Rbe3s", *COMPID_RBE3S,
583 node_poolname_id, id_rbe3);
584 if( !rc ) throw rc;
585
587 if( !rc ) throw rc;
588 }
589 }
590 else
591 {
592 for(i=0;i<*NRBE3;i++)
593 {
594 // create Components
596 if( !rc ) throw rc;
597
598 k = 0;
599 cpt = 0;
600 for(j=0;j < *LTITR ; j=j+1)
601 {
602 name[k]=(char) (NOM_OPT[*I16F-1 + *LNOPT1 * (i+1) - *LTITR + j]/65536);
603 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
604 k++;
605 name[k]=(char) ((NOM_OPT[*I16F-1 + *LIPART1 * (i+1) - *LTITR + j]%65536)/256);
606 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
607 k++;
608 name[k]=(char) (NOM_OPT[*I16F-1 + *LIPART1 * (i+1) - *LTITR + j]%256);
609 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
610 k++;
611 }
612
613 for(j=0;j < *LTITR * 3 - cpt; j++) name_part[j] = name[j];
614 name_part[*LTITR * 3 - cpt] = '\0' ;
615
616 if(strlen(name_part) == 0) sprintf(name_part,"RBE3");
617
618 rc = Hyper3DComponentWrite(h3d_file, name_part, IRBE3[*NRBE3L * i + 1],
619 node_poolname_id, id_rbe3);
620 if( !rc ) throw rc;
621
623 if( !rc ) throw rc;
624 }
625 }
626
627
628 int id_rwall;
629 if(*NRWALL > 0)
630 {
631 const char *name_rwall = "RWALLS MODEL" ;
632
633 id_max ++;
634 id_rwall = id_max;
635
637 if( !rc ) throw rc;
638
639 rc = Hyper3DAssemblyWrite(h3d_file, name_rwall, id_rwall, 0);
640 if( !rc ) throw rc;
641
642
644 if( !rc ) throw rc;
645 }
646
647 for(i=0;i<*NRWALL;i++)
648 {
649
650 // create Components
652 if( !rc ) throw rc;
653
654 k = 0;
655 cpt = 0;
656 for(j=0;j < *LTITR ; j=j+1)
657 {
658 name[k]=(char) (NOM_OPT[*I16D-1 + *LNOPT1 * (i+1) - *LTITR + j]/65536);
659 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
660 k++;
661 name[k]=(char) ((NOM_OPT[*I16D-1 + *LIPART1 * (i+1) - *LTITR + j]%65536)/256);
662 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
663 k++;
664 name[k]=(char) (NOM_OPT[*I16D-1 + *LIPART1 * (i+1) - *LTITR + j]%256);
665 if(name[k] == ' ' || name[k] == '\0'){cpt++;} else {cpt = 0;}
666 k++;
667 }
668
669 for(j=0;j < *LTITR * 3 - cpt; j++) name_part[j] = name[j];
670 name_part[*LTITR * 3 - cpt] = '\0' ;
671
672 rc = Hyper3DComponentWrite(h3d_file, name_part, NOM_OPT[*I16D + i * *LNOPT1 - 1],
673 node_poolname_id, id_rwall);
674 if( !rc ) throw rc;
675
677 if( !rc ) throw rc;
678 }
679
680
681
682 // assign Component display attributes
683 /*
684 rc = Hyper3DComponentAttribBegin(h3d_file, comp_count, comp_poolname_id);
685 if( !rc ) throw rc;
686
687 rc = Hyper3DComponentAttribWrite(h3d_file, IPART[*LIPART1 * i + 3], meshlines);
688 if( !rc ) throw rc;
689
690 rc = Hyper3DComponentAttribColor(h3d_file, IPART[*LIPART1 * i + 3], red);
691 if( !rc ) throw rc;
692
693 rc = Hyper3DComponentAttribEnd(h3d_file);
694 if( !rc ) throw rc;
695
696 */
697
698
699 } // end of try
700
701 catch(...) {
703 }
704 delete [] name;
705 delete [] ifiltmp;
706 delete [] name_part;
707 delete [] name_sub;
708 delete [] assembly_father;
709
710}
H3D_ID shell_poolname_id
H3D_ID onedelem_poolname_id
H3DFileInfo * h3d_file
H3D_ID elem1D_poolname_id
H3D_ID rigid_poolname_id
H3D_ID model_as_parent
H3D_ID node_poolname_id
bool rc
H3D_ID rbe3_poolname_id
H3D_ID assm_poolname_id
H3D_ID sphnode_poolname_id
H3D_ID rwall_poolname_id
H3D_ID solid_poolname_id
H3D_ID rbody_poolname_id
H3D_ID sphcell_poolname_id
H3D_ID skin_poolname_id
H3D_ID quad_poolname_id
H3D_ID rbe2_poolname_id
H3D_ID comp_poolname_id
H3D_ID assm_id
bool Hyper3DAssemblyEnd(H3DFileInfo *h3d_file)
Definition h3d_dl.c:1054
bool Hyper3DAddString(H3DFileInfo *h3d_file, const char *const string, H3D_ID *const str_id)
Definition h3d_dl.c:955
bool Hyper3DExportClearError(H3DFileInfo *h3d_file)
Definition h3d_dl.c:939
bool Hyper3DComponentEnd(H3DFileInfo *h3d_file)
Definition h3d_dl.c:1079
bool Hyper3DComponentWrite(H3DFileInfo *h3d_file, const char *label, H3D_ID id, H3D_ID node_poolname_id, H3D_ID parent_id)
Definition h3d_dl.c:1072
bool Hyper3DAssemblyWrite(H3DFileInfo *h3d_file, const char *label, H3D_ID id, H3D_ID parent_id)
Definition h3d_dl.c:1046
bool Hyper3DComponentBegin(H3DFileInfo *h3d_file, unsigned int count, H3D_ID poolname_id, H3D_ID parent_poolname_id)
Definition h3d_dl.c:1065
bool Hyper3DAssemblyBegin(H3DFileInfo *h3d_file, unsigned int count, H3D_ID poolname_id, H3D_ID parent_poolname_id)
Definition h3d_dl.c:1038

◆ c_h3d_create_components__()

void c_h3d_create_components__ ( int * IPART,
int * LIPART1,
int * NPART,
int * LTITR,
int * IGEO,
int * NPROPGI,
int * H3D_PART,
int * NRBODY,
int * NRWALL,
int * NOM_OPT,
int * LNOPT1,
int * I16D,
int * NPBY,
int * NNPBY,
int * SUB_NCHILD,
int * NSUBS,
int * NRBE2,
int * NRBE3,
int * I16E,
int * I16F,
int * N2D,
int * IRBE2,
int * NRBE2L,
int * SUB_ID,
int * SUB_CHILD,
int * SUB_LEVEL,
int * SUB_IAD,
int * SUB_TITLE,
int * IRBE3,
int * NRBE3L,
int * COMPID_RBODIES,
int * COMPID_RBE2S,
int * COMPID_RBE3S )

Definition at line 721 of file c_h3d_create_components.cpp.

727{c_h3d_create_components_ (IPART,LIPART1,NPART,LTITR,IGEO,NPROPGI,H3D_PART,NRBODY,NRWALL,NOM_OPT,LNOPT1,I16D, NPBY, NNPBY,SUB_NCHILD,NSUBS,NRBE2,NRBE3,
728 I16E,I16F,N2D,IRBE2,NRBE2L,SUB_ID,SUB_CHILD,SUB_LEVEL,SUB_IAD,SUB_TITLE,IRBE3,NRBE3L,
729 COMPID_RBODIES,COMPID_RBE2S,COMPID_RBE3S);}