OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
c_h3d_create_rbodies.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_rbodies_ (int *ITAB, int *NUMNOD, int *NPBY, int *NNPBY, int *LPBY, int *NRBODY, int *COMPID_RBODIES)
void _FCALL C_H3D_CREATE_RBODIES (int *ITAB, int *NUMNOD, int *NPBY, int *NNPBY, int *LPBY, int *NRBODY, int *COMPID_RBODIES)
void c_h3d_create_rbodies__ (int *ITAB, int *NUMNOD, int *NPBY, int *NNPBY, int *LPBY, int *NRBODY, int *COMPID_RBODIES)
void c_h3d_create_rbodies (int *ITAB, int *NUMNOD, int *NPBY, int *NNPBY, int *LPBY, int *NRBODY, int *COMPID_RBODIES)
void c_h3d_create_rbodies_impi_ (int *ITAB, int *NRBYKIN, int *MASTERND, int *ID_RBY, int *PTRPO, int *PTRPOO, int *PORBY, int *NSPMD, int *COMPID_RBODIES)
void _FCALL C_H3D_CREATE_RBODIES_IMPI (int *ITAB, int *NRBYKIN, int *MASTERND, int *ID_RBY, int *PTRPO, int *PTRPOO, int *PORBY, int *NSPMD, int *COMPID_RBODIES)
void c_h3d_create_rbodies_impi__ (int *ITAB, int *NRBYKIN, int *MASTERND, int *ID_RBY, int *PTRPO, int *PTRPOO, int *PORBY, int *NSPMD, int *COMPID_RBODIES)
void c_h3d_create_rbodies_impi (int *ITAB, int *NRBYKIN, int *MASTERND, int *ID_RBY, int *PTRPO, int *PTRPOO, int *PORBY, int *NSPMD, int *COMPID_RBODIES)

Macro Definition Documentation

◆ _FCALL [1/2]

#define _FCALL

Definition at line 50 of file c_h3d_create_rbodies.cpp.

◆ _FCALL [2/2]

#define _FCALL

Definition at line 50 of file c_h3d_create_rbodies.cpp.

Function Documentation

◆ C_H3D_CREATE_RBODIES()

void _FCALL C_H3D_CREATE_RBODIES ( int * ITAB,
int * NUMNOD,
int * NPBY,
int * NNPBY,
int * LPBY,
int * NRBODY,
int * COMPID_RBODIES )

Definition at line 188 of file c_h3d_create_rbodies.cpp.

189{c_h3d_create_rbodies_ (ITAB, NUMNOD, NPBY, NNPBY, LPBY, NRBODY, COMPID_RBODIES);}
void c_h3d_create_rbodies_(int *ITAB, int *NUMNOD, int *NPBY, int *NNPBY, int *LPBY, int *NRBODY, int *COMPID_RBODIES)

◆ c_h3d_create_rbodies()

void c_h3d_create_rbodies ( int * ITAB,
int * NUMNOD,
int * NPBY,
int * NNPBY,
int * LPBY,
int * NRBODY,
int * COMPID_RBODIES )

Definition at line 194 of file c_h3d_create_rbodies.cpp.

195{c_h3d_create_rbodies_ (ITAB, NUMNOD, NPBY, NNPBY, LPBY, NRBODY, COMPID_RBODIES);}

◆ c_h3d_create_rbodies_()

void c_h3d_create_rbodies_ ( int * ITAB,
int * NUMNOD,
int * NPBY,
int * NNPBY,
int * LPBY,
int * NRBODY,
int * COMPID_RBODIES )

Definition at line 69 of file c_h3d_create_rbodies.cpp.

70{
71 try {
72
73
74 // create Elements
75 H3D_ID elem_id ;
76 H3D_ID RigidElem ;
77 int i,j,nsn;
78
79 char RBODYPOOL[] = "Rbody";
81 if( !rc ) throw rc;
82
83 char RIGIDPOOL[] = "Rigid";
85 if( !rc ) throw rc;
86
87 unsigned int elem_count = 1;
88 unsigned int *conn;
89 double *coef;
90 int *dof;
91
92 if(*COMPID_RBODIES != 0 && *NRBODY != 0)
93 {
95 H3D_ELEM_CONFIG_RIGIDLINK, *COMPID_RBODIES,
97 for(i=0;i<*NRBODY;i++)
98 {
99 elem_id = NPBY[*NNPBY * i + 5];
100 nsn = NPBY[*NNPBY * i + 1];
101 comp_id = 1;
102
103 conn =(unsigned int *)malloc(nsn*sizeof(unsigned int));
104 coef =(double *)malloc(nsn*sizeof(double));
105 for(int n=0; n < nsn ; n++){coef[n] = 0.0;}
106
107 dof =(int *)malloc(nsn*sizeof(int));
108
109 for(j=0;j<nsn;j++)
110 {
111 conn[j] = ITAB[LPBY[NPBY[*NNPBY * i + 10] + j ] - 1 ];
112 dof[j] = 0;
113 }
114
115 RigidElem = NPBY[*NNPBY * i + 5] ;
116
117 unsigned int conn1[1];
118 double coef1[1] = {1.0};
119 int dof1[1] = {6};
120 conn1[0] = ITAB[NPBY[*NNPBY * i]-1];
121
122
123 if( !rc ) throw rc;
124 rc = Hyper3DElement2Write(h3d_file, elem_id, conn1, dof1 , coef1 , 1 ,conn, dof, coef, nsn);
125 if( !rc ) throw rc;
126
127 free(conn);
128 free(coef);
129 free(dof);
130
131 }
133 if( !rc ) throw rc;
134 }
135 else
136 {
137 for(i=0;i<*NRBODY;i++)
138 {
139 elem_id = NPBY[*NNPBY * i + 5];
140 nsn = NPBY[*NNPBY * i + 1];
141 comp_id = 1;
142
143 conn =(unsigned int *)malloc(nsn*sizeof(unsigned int));
144 coef =(double *)malloc(nsn*sizeof(double));
145 for(int n=0; n < nsn ; n++){coef[n] = 0.0;}
146
147 dof =(int *)malloc(nsn*sizeof(int));
148
149 for(j=0;j<nsn;j++)
150 {
151 conn[j] = ITAB[LPBY[NPBY[*NNPBY * i + 10] + j ] - 1 ];
152 dof[j] = 0;
153 }
154
155 RigidElem = NPBY[*NNPBY * i + 5] ;
156
157 unsigned int conn1[1];
158 double coef1[1] = {1.0};
159 int dof1[1] = {6};
160 conn1[0] = ITAB[NPBY[*NNPBY * i]-1];
161
162
164 H3D_ELEM_CONFIG_RIGIDLINK, RigidElem,
166 if( !rc ) throw rc;
167 rc = Hyper3DElement2Write(h3d_file, elem_id, conn1, dof1 , coef1 , 1 ,conn, dof, coef, nsn);
168 if( !rc ) throw rc;
170 if( !rc ) throw rc;
171
172 free(conn);
173 free(coef);
174 free(dof);
175
176 }
177 }
178
179
180 } // end of try
181
182 catch(...) {
184 }
185
186}
H3DFileInfo * h3d_file
H3D_ID rigid_poolname_id
H3D_ID node_poolname_id
bool rc
H3D_ID comp_id
H3D_ID rbody_poolname_id
bool Hyper3DElement2Write(H3DFileInfo *h3d_file, H3D_ID id, unsigned int *inode, int *idof, double *icoeff, unsigned int num_inodes, unsigned int *dnode, int *ddof, double *dcoeff, unsigned int num_dnodes)
Definition h3d_dl.c:1170
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 Hyper3DElement2End(H3DFileInfo *h3d_file)
Definition h3d_dl.c:1181
bool Hyper3DElement2Begin(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:1160
n

◆ c_h3d_create_rbodies__()

void c_h3d_create_rbodies__ ( int * ITAB,
int * NUMNOD,
int * NPBY,
int * NNPBY,
int * LPBY,
int * NRBODY,
int * COMPID_RBODIES )

Definition at line 191 of file c_h3d_create_rbodies.cpp.

192{c_h3d_create_rbodies_ (ITAB, NUMNOD, NPBY, NNPBY, LPBY, NRBODY, COMPID_RBODIES);}

◆ C_H3D_CREATE_RBODIES_IMPI()

void _FCALL C_H3D_CREATE_RBODIES_IMPI ( int * ITAB,
int * NRBYKIN,
int * MASTERND,
int * ID_RBY,
int * PTRPO,
int * PTRPOO,
int * PORBY,
int * NSPMD,
int * COMPID_RBODIES )

Definition at line 389 of file c_h3d_create_rbodies.cpp.

390{c_h3d_create_rbodies_impi_ (ITAB,NRBYKIN, MASTERND, ID_RBY, PTRPO, PTRPOO, PORBY,NSPMD,COMPID_RBODIES);}
void c_h3d_create_rbodies_impi_(int *ITAB, int *NRBYKIN, int *MASTERND, int *ID_RBY, int *PTRPO, int *PTRPOO, int *PORBY, int *NSPMD, int *COMPID_RBODIES)

◆ c_h3d_create_rbodies_impi()

void c_h3d_create_rbodies_impi ( int * ITAB,
int * NRBYKIN,
int * MASTERND,
int * ID_RBY,
int * PTRPO,
int * PTRPOO,
int * PORBY,
int * NSPMD,
int * COMPID_RBODIES )

Definition at line 395 of file c_h3d_create_rbodies.cpp.

396{c_h3d_create_rbodies_impi_ (ITAB,NRBYKIN, MASTERND, ID_RBY, PTRPO, PTRPOO, PORBY,NSPMD,COMPID_RBODIES);}

◆ c_h3d_create_rbodies_impi_()

void c_h3d_create_rbodies_impi_ ( int * ITAB,
int * NRBYKIN,
int * MASTERND,
int * ID_RBY,
int * PTRPO,
int * PTRPOO,
int * PORBY,
int * NSPMD,
int * COMPID_RBODIES )

Definition at line 201 of file c_h3d_create_rbodies.cpp.

202{
203
204 int * PTRPO_TMP = new int [*NSPMD + 1];
205 try {
206
207
208 // create Elements
209 H3D_ID elem_id ;
210 H3D_ID RigidElem ;
211 int i,j,n,p,nsn,nsn_loc,ptr;
212 //int PTRPO_TMP[*NSPMD + 1];
213
214 char RBODYPOOL[] = "Rbody";
216 if( !rc ) throw rc;
217
218 char RIGIDPOOL[] = "Rigid";
220 if( !rc ) throw rc;
221
222 unsigned int *conn;
223 double *coef;
224 int *dof;
225 unsigned int elem_count = 1;
226
227 for(i=0;i<*NSPMD + 1;i++)
228 {
229 PTRPO_TMP[i] = PTRPO[i];
230 }
231
232 if(*COMPID_RBODIES != 0 && *NRBYKIN != 0)
233 {
235 H3D_ELEM_CONFIG_RIGIDLINK, *COMPID_RBODIES,
237 for(i=0;i<*NRBYKIN;i++)
238 {
239 elem_id = ID_RBY[i];
240 RigidElem = MASTERND[i] + 1 ;
241 nsn = 0;
242
243 for(p=0;p<*NSPMD;p++)
244 {
245 ptr = PTRPO_TMP[p];
246 if(ptr < PTRPOO[p+1])
247 {
248 if(PORBY[ptr-1] == i+1)
249 {
250 nsn = nsn + PORBY[ptr];
251 ptr = ptr + 2 ;
252 PTRPO_TMP[p]=PTRPO_TMP[p] + nsn + 2;
253 }
254 }
255 }
256
257 conn =(unsigned int *)malloc(nsn*sizeof(unsigned int));
258 coef =(double *)malloc(nsn*sizeof(double));
259 dof =(int *)malloc(nsn*sizeof(int));
260
261 for(n=0; n < nsn ; n++){coef[n] = 0.0; dof[n]=0; conn[n]=0;}
262 unsigned int conn1[1];
263 //double coef[nsn];
264 double coef1[1] = {1.0};
265 //int dof[nsn];
266 int dof1[1] = {6};
267 conn1[0] = RigidElem;
268 j = 0;
269
270 for(p=0;p<*NSPMD;p++)
271 {
272 ptr = PTRPO[p];
273 if(ptr < PTRPOO[p+1])
274 {
275 if(PORBY[ptr - 1] == i+1)
276 {
277 nsn_loc = PORBY[ptr];
278 ptr = ptr + 2 ;
279 for(n=0;n<nsn_loc;n++)
280 {
281 conn[j] = PORBY[ptr+n-1] + 1;
282
283 j++;
284 }
285 PTRPO[p]=PTRPO[p] + nsn + 2;
286 }
287 }
288
289 }
290
291 if( !rc ) throw rc;
292 rc = Hyper3DElement2Write(h3d_file, elem_id, conn1, dof1 , coef1 , 1 ,conn, dof, coef, nsn);
293 if( !rc ) throw rc;
294
295 free(conn);
296 free(coef);
297 free(dof);
298
299 }
301 if( !rc ) throw rc;
302 }
303 else
304 {
305
306 for(i=0;i<*NRBYKIN;i++)
307 {
308 elem_id = ID_RBY[i];
309 RigidElem = MASTERND[i] + 1 ;
310 nsn = 0;
311
312 for(p=0;p<*NSPMD;p++)
313 {
314 ptr = PTRPO_TMP[p];
315 if(ptr < PTRPOO[p+1])
316 {
317 if(PORBY[ptr-1] == i+1)
318 {
319 nsn = nsn + PORBY[ptr];
320 ptr = ptr + 2 ;
321 PTRPO_TMP[p]=PTRPO_TMP[p] + nsn + 2;
322 }
323 }
324
325 }
326
327
328 conn =(unsigned int *)malloc(nsn*sizeof(unsigned int));
329 coef =(double *)malloc(nsn*sizeof(double));
330 dof =(int *)malloc(nsn*sizeof(int));
331
332 for(n=0; n < nsn ; n++){coef[n] = 0.0; dof[n]=0; conn[n]=0;}
333 unsigned int conn1[1];
334 //double coef[nsn];
335 double coef1[1] = {1.0};
336 //int dof[nsn];
337 int dof1[1] = {6};
338 conn1[0] = RigidElem;
339 j = 0;
340
341 for(p=0;p<*NSPMD;p++)
342 {
343 ptr = PTRPO[p];
344 if(ptr < PTRPOO[p+1])
345 {
346 if(PORBY[ptr - 1] == i+1)
347 {
348 nsn_loc = PORBY[ptr];
349 ptr = ptr + 2 ;
350 for(n=0;n<nsn_loc;n++)
351 {
352 conn[j] = PORBY[ptr+n-1] + 1;
353
354 j++;
355 }
356 PTRPO[p]=PTRPO[p] + nsn + 2;
357 }
358 }
359
360 }
361
362
363
365 H3D_ELEM_CONFIG_RIGIDLINK, elem_id,
367 if( !rc ) throw rc;
368 rc = Hyper3DElement2Write(h3d_file, elem_id, conn1, dof1 , coef1 , 1 ,conn, dof, coef, nsn);
369 if( !rc ) throw rc;
371 if( !rc ) throw rc;
372
373 free(conn);
374 free(coef);
375 free(dof);
376
377 }
378 }
379
380 } // end of try
381
382 catch(...) {
384 }
385 delete [] PTRPO_TMP;
386
387}

◆ c_h3d_create_rbodies_impi__()

void c_h3d_create_rbodies_impi__ ( int * ITAB,
int * NRBYKIN,
int * MASTERND,
int * ID_RBY,
int * PTRPO,
int * PTRPOO,
int * PORBY,
int * NSPMD,
int * COMPID_RBODIES )

Definition at line 392 of file c_h3d_create_rbodies.cpp.

393{c_h3d_create_rbodies_impi_ (ITAB,NRBYKIN, MASTERND, ID_RBY, PTRPO, PTRPOO, PORBY,NSPMD,COMPID_RBODIES);}