OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
c_h3d_create_rwalls.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
#define PI   3.141592654

Functions

void c_h3d_create_rwalls_ (int *NOM_OPT, int *LNOPT1, int *I16D, int *NPRW, int *NRWALL, int *MAX_NOD_ID, my_real *XWL, my_real *YWL, my_real *ZWL, my_real *V1, my_real *V2, my_real *V3, my_real *VV1, my_real *VV2, my_real *VV3, my_real *XL, my_real *XN, my_real *YN, my_real *ZN, int *NUM_ADDED_NODES)
void _FCALL C_H3D_CREATE_RWALLS (int *NOM_OPT, int *LNOPT1, int *I16D, int *NPRW, int *NRWALL, int *MAX_NOD_ID, my_real *XWL, my_real *YWL, my_real *ZWL, my_real *V1, my_real *V2, my_real *V3, my_real *VV1, my_real *VV2, my_real *VV3, my_real *XL, my_real *XN, my_real *YN, my_real *ZN, int *NUM_ADDED_NODES)
void c_h3d_create_rwalls__ (int *NOM_OPT, int *LNOPT1, int *I16D, int *NPRW, int *NRWALL, int *MAX_NOD_ID, my_real *XWL, my_real *YWL, my_real *ZWL, my_real *V1, my_real *V2, my_real *V3, my_real *VV1, my_real *VV2, my_real *VV3, my_real *XL, my_real *XN, my_real *YN, my_real *ZN, int *NUM_ADDED_NODES)
void c_h3d_create_rwalls (int *NOM_OPT, int *LNOPT1, int *I16D, int *NPRW, int *NRWALL, int *MAX_NOD_ID, my_real *XWL, my_real *YWL, my_real *ZWL, my_real *V1, my_real *V2, my_real *V3, my_real *VV1, my_real *VV2, my_real *VV3, my_real *XL, my_real *XN, my_real *YN, my_real *ZN, int *NUM_ADDED_NODES)

Macro Definition Documentation

◆ _FCALL [1/2]

#define _FCALL

Definition at line 50 of file c_h3d_create_rwalls.cpp.

◆ _FCALL [2/2]

#define _FCALL

Definition at line 50 of file c_h3d_create_rwalls.cpp.

◆ PI

#define PI   3.141592654

Definition at line 71 of file c_h3d_create_rwalls.cpp.

Function Documentation

◆ C_H3D_CREATE_RWALLS()

void _FCALL C_H3D_CREATE_RWALLS ( int * NOM_OPT,
int * LNOPT1,
int * I16D,
int * NPRW,
int * NRWALL,
int * MAX_NOD_ID,
my_real * XWL,
my_real * YWL,
my_real * ZWL,
my_real * V1,
my_real * V2,
my_real * V3,
my_real * VV1,
my_real * VV2,
my_real * VV3,
my_real * XL,
my_real * XN,
my_real * YN,
my_real * ZN,
int * NUM_ADDED_NODES )

Definition at line 454 of file c_h3d_create_rwalls.cpp.

458{c_h3d_create_rwalls_ (NOM_OPT, LNOPT1, I16D, NPRW, NRWALL, MAX_NOD_ID,
459 XWL, YWL, ZWL, V1, V2, V3, VV1, VV2 , VV3, XL, XN, YN , ZN ,NUM_ADDED_NODES );}
void c_h3d_create_rwalls_(int *NOM_OPT, int *LNOPT1, int *I16D, int *NPRW, int *NRWALL, int *MAX_NOD_ID, my_real *XWL, my_real *YWL, my_real *ZWL, my_real *V1, my_real *V2, my_real *V3, my_real *VV1, my_real *VV2, my_real *VV3, my_real *XL, my_real *XN, my_real *YN, my_real *ZN, int *NUM_ADDED_NODES)

◆ c_h3d_create_rwalls()

void c_h3d_create_rwalls ( int * NOM_OPT,
int * LNOPT1,
int * I16D,
int * NPRW,
int * NRWALL,
int * MAX_NOD_ID,
my_real * XWL,
my_real * YWL,
my_real * ZWL,
my_real * V1,
my_real * V2,
my_real * V3,
my_real * VV1,
my_real * VV2,
my_real * VV3,
my_real * XL,
my_real * XN,
my_real * YN,
my_real * ZN,
int * NUM_ADDED_NODES )

Definition at line 468 of file c_h3d_create_rwalls.cpp.

472{c_h3d_create_rwalls_ (NOM_OPT, LNOPT1, I16D, NPRW, NRWALL, MAX_NOD_ID,
473 XWL, YWL, ZWL, V1, V2, V3, VV1, VV2 , VV3, XL , XN, YN , ZN ,NUM_ADDED_NODES );}

◆ c_h3d_create_rwalls_()

void c_h3d_create_rwalls_ ( int * NOM_OPT,
int * LNOPT1,
int * I16D,
int * NPRW,
int * NRWALL,
int * MAX_NOD_ID,
my_real * XWL,
my_real * YWL,
my_real * ZWL,
my_real * V1,
my_real * V2,
my_real * V3,
my_real * VV1,
my_real * VV2,
my_real * VV3,
my_real * XL,
my_real * XN,
my_real * YN,
my_real * ZN,
int * NUM_ADDED_NODES )

Definition at line 79 of file c_h3d_create_rwalls.cpp.

83{
84 try {
85
86
87 float DX0[6] = { 0., 0., 0., 0., 0., 0.};
88 float DY0[6] = { 1.,-1., 0., 0., 0., 0.};
89 float DZ0[6] = { 0., 0.,-1., 1., 1.,-1.};
90 float DX1[6] = { 1., 1., 1., 1., 0., 0.};
91 float DY1[6] = { 0., 0., 0., 0., 1., 1.};
92 float DZ1[6] = { 0., 0., 0., 0., 0., 0.};
93 float X0[6] = {-3.,-3.,-3.,-3.,-3., 3.};
94 float Y0[6] = {-3., 3.,-3., 3.,-3.,-3.};
95 float Z0[6] = {-3., 3., 3.,-3.,-3., 3.};
96
97 float node[3],r,xx,yy,zz,xx0,yy0,zz0,d,alpha,s,c;
98 H3D_ID node_id;
99
100 // create Elements
101 H3D_ID elem_id ;
102 H3D_ID RigidElem ;
103 int i,j,nsn,nbelemwrite,n2,n3,n4,ityp;
104
105 char RWALLPOOL[] = "Rwall";
107 if( !rc ) throw rc;
108
109 char RIGIDPOOL[] = "Rigid";
111 if( !rc ) throw rc;
112
113 unsigned int elem_count = 1;
114
115 int id_node = *MAX_NOD_ID;
116
117 elem_id = 0;
118
119 for(i=0;i<*NRWALL;i++)
120 {
121
122 n2 = i + *NRWALL;
123 n3 = n2 + *NRWALL;
124 n4 = n3 + *NRWALL;
125
126 ityp = NPRW[n4];
127 RigidElem = NOM_OPT[*I16D + i * *LNOPT1 - 1];
128
129 if( ityp == 1)
130 {
131
132 int id_node_0 = id_node + 1 ;
133
135 if( !rc ) throw rc;
136
137 node[0] = XWL[i] + V1[i];
138 node[1] = YWL[i] + V2[i];
139 node[2] = ZWL[i] + V3[i];
140 id_node ++ ;
141 node_id= id_node;
142
143 rc = Hyper3DPositionWrite(h3d_file, node_id, node, H3D_NULL_ID, H3D_NULL_ID);
144 if( !rc ) throw rc;
145
146 node[0] = XWL[i] + VV1[i];
147 node[1] = YWL[i] + VV2[i];
148 node[2] = ZWL[i] + VV3[i];
149 id_node ++ ;
150 node_id= id_node;
151
152 rc = Hyper3DPositionWrite(h3d_file, node_id, node, H3D_NULL_ID, H3D_NULL_ID);
153 if( !rc ) throw rc;
154
155 node[0] = XWL[i] - V1[i];
156 node[1] = YWL[i] - V2[i];
157 node[2] = ZWL[i] - V3[i];
158 id_node ++ ;
159 node_id= id_node;
160
161 rc = Hyper3DPositionWrite(h3d_file, node_id, node, H3D_NULL_ID, H3D_NULL_ID);
162 if( !rc ) throw rc;
163
164 node[0] = XWL[i] - VV1[i];
165 node[1] = YWL[i] - VV2[i];
166 node[2] = ZWL[i] - VV3[i];
167 id_node ++ ;
168 node_id= id_node;
169
170 rc = Hyper3DPositionWrite(h3d_file, node_id, node, H3D_NULL_ID, H3D_NULL_ID);
171 if( !rc ) throw rc;
172
174 if( !rc ) throw rc;
175
176 unsigned int conn[4];
177 conn[0] = id_node - 3 ;
178 conn[1] = id_node - 2 ;
179 conn[2] = id_node - 1 ;
180 conn[3] = id_node ;
181
182 nbelemwrite = 1;
183
185 H3D_ELEM_CONFIG_QUAD4, RigidElem,
187 if( !rc ) throw rc;
188
189 elem_id++;
190 rc = Hyper3DElementWrite(h3d_file, elem_id, conn);
191 if( !rc ) throw rc;
192
194 if( !rc ) throw rc;
195 }
196
197
198
199 else if(ityp == 2)
200 {
201 int cpt = 0;
202 int id_node_0 = id_node + 1 ;
203 alpha = 0.0f ;
205 if( !rc ) throw rc;
206
207 for(int ii=0;ii<24;ii++)
208 {
209
210 s = sin(alpha);
211 c = cos(alpha);
212
213 node[0] = XWL[i] + VV1[i] * s + V1[i] * c - XN[i] * XL[i];
214 node[1] = YWL[i] + VV2[i] * s + V2[i] * c - YN[i] * XL[i];
215 node[2] = ZWL[i] + VV3[i] * s + V3[i] * c - ZN[i] * XL[i];
216
217 id_node ++ ;
218 node_id = id_node;
219 rc = Hyper3DPositionWrite(h3d_file, node_id, node, H3D_NULL_ID, H3D_NULL_ID);
220 if( !rc ) throw rc;
221
222 node[0] = XWL[i] + VV1[i] * s + V1[i] * c + XN[i] * XL[i];
223 node[1] = YWL[i] + VV2[i] * s + V2[i] * c + YN[i] * XL[i];
224 node[2] = ZWL[i] + VV3[i] * s + V3[i] * c + ZN[i] * XL[i];
225
226 id_node ++ ;
227 node_id = id_node;
228 rc = Hyper3DPositionWrite(h3d_file, node_id, node, H3D_NULL_ID, H3D_NULL_ID);
229 if( !rc ) throw rc;
230
231 alpha = alpha + PI /12 ;
232 }
233
234
236 if( !rc ) throw rc;
237
238
239 unsigned int conn[4];
240 id_node = id_node_0;
241
242 for(int ii=0;ii<23;ii++)
243 {
244 conn[0] = id_node ;
245 conn[1] = id_node + 2 ;
246 conn[2] = id_node + 3 ;
247 conn[3] = id_node + 1 ;
248 nbelemwrite = 1;
249
251 H3D_ELEM_CONFIG_QUAD4, RigidElem,
253 if( !rc ) throw rc;
254
255 elem_id++;
256 rc = Hyper3DElementWrite(h3d_file, elem_id, conn);
257 if( !rc ) throw rc;
258
260 if( !rc ) throw rc;
261
262 id_node = id_node + 2;
263 }
264 conn[0] = id_node ;
265 conn[1] = id_node_0 ;
266 conn[2] = id_node_0 + 1 ;
267 conn[3] = id_node + 1 ;
268 nbelemwrite = 1;
269
271 H3D_ELEM_CONFIG_QUAD4, RigidElem,
273 if( !rc ) throw rc;
274
275 elem_id++;
276 rc = Hyper3DElementWrite(h3d_file, elem_id, conn);
277 if( !rc ) throw rc;
278
280 if( !rc ) throw rc;
281
282 id_node = id_node + 1;
283
284
285 }
286
287
288 else if(ityp == 3)
289 {
290 int cpt = 0;
291 int id_node_0 = id_node + 1 ;
292 r = V1[i] ;
294 if( !rc ) throw rc;
295
296 for(int ii=0;ii<6;ii++)
297 {
298 xx0 = X0[ii] ;
299 yy0 = Y0[ii] ;
300 zz0 = Z0[ii] ;
301 for(int jj=0;jj<7;jj++)
302 {
303 xx = xx0;
304 yy = yy0;
305 zz = zz0;
306 for(int ll=0;ll<7;ll++)
307 {
308 d = r/sqrt(xx*xx+yy*yy+zz*zz);
309
310 node[0] = d*xx + XWL[i];
311 node[1] = d*yy + YWL[i];
312 node[2] = d*zz + ZWL[i];
313 id_node ++ ;
314 node_id = id_node;
315 rc = Hyper3DPositionWrite(h3d_file, node_id, node, H3D_NULL_ID, H3D_NULL_ID);
316 if( !rc ) throw rc;
317
318
319 xx = xx + DX0[ii];
320 yy = yy + DY0[ii];
321 zz = zz + DZ0[ii];
322
323 }
324 xx0 = xx0 + DX1[ii];
325 yy0 = yy0 + DY1[ii];
326 zz0 = zz0 + DZ1[ii];
327 }
328 }
329
331 if( !rc ) throw rc;
332
333
334 unsigned int conn[4];
335 id_node = id_node_0;
336
337 for(int ii=0;ii<6;ii++)
338 {
339 for(int jj=0;jj<6;jj++)
340 {
341 for(int ll=0;ll<6;ll++)
342 {
343 conn[0] = id_node ;
344 conn[1] = id_node + 1 ;
345 conn[2] = id_node + 8 ;
346 conn[3] = id_node + 7 ;
347 nbelemwrite = 1;
348
350 H3D_ELEM_CONFIG_QUAD4, RigidElem,
352 if( !rc ) throw rc;
353
354 elem_id++;
355 rc = Hyper3DElementWrite(h3d_file, elem_id, conn);
356 if( !rc ) throw rc;
357
359 if( !rc ) throw rc;
360
361 id_node = id_node + 1;
362 }
363 id_node = id_node + 1;
364 }
365 id_node = id_node + 7;
366 }
367
368 id_node = id_node_0 + 293 ;
369
370 }
371 else if(ityp == 4 )
372 {
373
374 int id_node_0 = id_node + 1 ;
375
377 if( !rc ) throw rc;
378
379 node[0] = XWL[i];
380 node[1] = YWL[i];
381 node[2] = ZWL[i];
382 id_node ++ ;
383 node_id= id_node;
384
385 rc = Hyper3DPositionWrite(h3d_file, node_id, node, H3D_NULL_ID, H3D_NULL_ID);
386 if( !rc ) throw rc;
387
388 node[0] = XWL[i] + V1[i];
389 node[1] = YWL[i] + V2[i];
390 node[2] = ZWL[i] + V3[i];
391 id_node ++ ;
392 node_id= id_node;
393
394 rc = Hyper3DPositionWrite(h3d_file, node_id, node, H3D_NULL_ID, H3D_NULL_ID);
395 if( !rc ) throw rc;
396
397 node[0] = XWL[i] + V1[i] + VV1[i];
398 node[1] = YWL[i] + V2[i] + VV2[i];
399 node[2] = ZWL[i] + V3[i] + VV3[i];
400 id_node ++ ;
401 node_id= id_node;
402
403 rc = Hyper3DPositionWrite(h3d_file, node_id, node, H3D_NULL_ID, H3D_NULL_ID);
404 if( !rc ) throw rc;
405
406 node[0] = XWL[i] + VV1[i];
407 node[1] = YWL[i] + VV2[i];
408 node[2] = ZWL[i] + VV3[i];
409 id_node ++ ;
410 node_id= id_node;
411
412 rc = Hyper3DPositionWrite(h3d_file, node_id, node, H3D_NULL_ID, H3D_NULL_ID);
413 if( !rc ) throw rc;
414
416 if( !rc ) throw rc;
417
418 unsigned int conn[4];
419 conn[0] = id_node - 3 ;
420 conn[1] = id_node - 2 ;
421 conn[2] = id_node - 1 ;
422 conn[3] = id_node ;
423
424 nbelemwrite = 1;
425
427 H3D_ELEM_CONFIG_QUAD4, RigidElem,
429 if( !rc ) throw rc;
430
431 elem_id++;
432 rc = Hyper3DElementWrite(h3d_file, elem_id, conn);
433 if( !rc ) throw rc;
434
436 if( !rc ) throw rc;
437 }
438
439
440
441
442 }
443
444 *NUM_ADDED_NODES = id_node - *MAX_NOD_ID;
445
446 } // end of try
447
448 catch(...) {
450 }
451
452}
#define PI
H3DFileInfo * h3d_file
H3D_ID rigid_poolname_id
H3D_ID node_poolname_id
bool rc
H3D_ID rwall_poolname_id
#define alpha
Definition eval.h:35
bool Hyper3DAddString(H3DFileInfo *h3d_file, const char *const string, H3D_ID *const str_id)
Definition h3d_dl.c:955
bool Hyper3DPositionBegin(H3DFileInfo *h3d_file, unsigned int count, H3D_ID poolname_id)
Definition h3d_dl.c:1113
bool Hyper3DExportClearError(H3DFileInfo *h3d_file)
Definition h3d_dl.c:939
bool Hyper3DPositionEnd(H3DFileInfo *h3d_file)
Definition h3d_dl.c:1127
bool Hyper3DElementWrite(H3DFileInfo *h3d_file, H3D_ID id, H3D_ID *connectivity)
Definition h3d_dl.c:1147
bool Hyper3DPositionWrite(H3DFileInfo *h3d_file, H3D_ID id, float *coords, H3D_ID refsys_id, H3D_ID analysis_id)
Definition h3d_dl.c:1120
bool Hyper3DElementEnd(H3DFileInfo *h3d_file)
Definition h3d_dl.c:1154
bool Hyper3DElementBegin(H3DFileInfo *h3d_file, unsigned int count, H3D_ID poolname_id, H3D_ElementConfig config, H3D_ID parent_id, H3D_ID parent_poolname_id, H3D_ID node_poolname_id)
Definition h3d_dl.c:1137

◆ c_h3d_create_rwalls__()

void c_h3d_create_rwalls__ ( int * NOM_OPT,
int * LNOPT1,
int * I16D,
int * NPRW,
int * NRWALL,
int * MAX_NOD_ID,
my_real * XWL,
my_real * YWL,
my_real * ZWL,
my_real * V1,
my_real * V2,
my_real * V3,
my_real * VV1,
my_real * VV2,
my_real * VV3,
my_real * XL,
my_real * XN,
my_real * YN,
my_real * ZN,
int * NUM_ADDED_NODES )

Definition at line 461 of file c_h3d_create_rwalls.cpp.

465{c_h3d_create_rwalls_ (NOM_OPT, LNOPT1, I16D, NPRW, NRWALL, MAX_NOD_ID,
466 XWL, YWL, ZWL, V1, V2, V3, VV1, VV2 , VV3, XL, XN, YN , ZN ,NUM_ADDED_NODES );}