OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
c_h3d_create_rbe3.cpp
Go to the documentation of this file.
1//Copyright> OpenRadioss
2//Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3//Copyright>
4//Copyright> This program is free software: you can redistribute it and/or modify
5//Copyright> it under the terms of the GNU Affero General Public License as published by
6//Copyright> the Free Software Foundation, either version 3 of the License, or
7//Copyright> (at your option) any later version.
8//Copyright>
9//Copyright> This program is distributed in the hope that it will be useful,
10//Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11//Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12//Copyright> GNU Affero General Public License for more details.
13//Copyright>
14//Copyright> You should have received a copy of the GNU Affero General Public License
15//Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16//Copyright>
17//Copyright>
18//Copyright> Commercial Alternative: Altair Radioss Software
19//Copyright>
20//Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21//Copyright> software under a commercial license. Contact Altair to discuss further if the
22//Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23//
24#include <stdio.h>
25#include <string.h>
26#include <stdlib.h>
27#include <math.h>
28#include <fcntl.h>
29
30
31
32#ifdef _WIN32
33/* Windows includes */
34#include <windows.h>
35#include <process.h>
36#include <io.h>
37#include <sys\types.h>
38#include <sys/stat.h>
39
40
41#elif 1
42
43/* Linux includes */
44#include <sys/resource.h>
45#include <sys/types.h>
46#include <time.h>
47#include <sys/stat.h>
48#include <unistd.h>
49#include <dlfcn.h>
50#define _FCALL
51#include <math.h>
52#include <stdbool.h>
53
54#endif
55
56#include "h3dpublic_defs.h"
57#include "h3dpublic_export.h"
58
59#define _FCALL
60
61#include "h3d_values.h"
62
63extern "C"
64/*=================================================================*/
65{
66/*=================================================================*/
67/* C_H3D_CREATE_RBE3 */
68/*=================================================================*/
69void c_h3d_create_rbe3_(int *ITAB, int *NUMNOD, int *IRBE3, int *NRBE3L, int *LRBE3, int *NRBE3, int *COMPID_RBE3S)
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 RBE3POOL[] = "Rbe3";
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_RBE3S != 0 && *NRBE3 != 0)
93 {
95 H3D_ELEM_CONFIG_RIGIDLINK, *COMPID_RBE3S,
97 for(i=0;i<*NRBE3;i++)
98 {
99 elem_id = IRBE3[*NRBE3L * i + 1];
100 nsn = IRBE3[*NRBE3L * i + 4];
101 comp_id = 1;
102
103 conn =(unsigned int *)malloc(nsn*sizeof(unsigned int));
104 coef =(double *)malloc(nsn*sizeof(double));
105 dof =(int *)malloc(nsn*sizeof(int));
106
107 for(j=0;j<nsn;j++) conn[j] = ITAB[LRBE3[IRBE3[*NRBE3L * i ] + j ] - 1 ];
108
109 RigidElem = IRBE3[*NRBE3L * i + 1] ;
110
111 unsigned int conn1[1];
112 double coef1[1] = {1.0};
113 int dof1[1] = {6};
114 conn1[0] = ITAB[IRBE3[*NRBE3L * i + 2]-1];
115
116 if( !rc ) throw rc;
117 rc = Hyper3DElement2Write(h3d_file, elem_id, conn1, dof1 , coef1 , 1 ,conn, dof, coef, nsn);
118 if( !rc ) throw rc;
119
120 free(conn);
121 free(coef);
122 free(dof);
123
124 }
126 if( !rc ) throw rc;
127 }
128 else
129 {
130 for(i=0;i<*NRBE3;i++)
131 {
132 elem_id = IRBE3[*NRBE3L * i + 1];
133 nsn = IRBE3[*NRBE3L * i + 4];
134 comp_id = 1;
135
136 conn =(unsigned int *)malloc(nsn*sizeof(unsigned int));
137 coef =(double *)malloc(nsn*sizeof(double));
138 dof =(int *)malloc(nsn*sizeof(int));
139
140 for(j=0;j<nsn;j++) conn[j] = ITAB[LRBE3[IRBE3[*NRBE3L * i ] + j ] - 1 ];
141
142 RigidElem = IRBE3[*NRBE3L * i + 1] ;
143
144 unsigned int conn1[1];
145 double coef1[1] = {1.0};
146 int dof1[1] = {6};
147 conn1[0] = ITAB[IRBE3[*NRBE3L * i + 2]-1];
148
149
151 H3D_ELEM_CONFIG_RIGIDLINK, RigidElem,
153 if( !rc ) throw rc;
154 rc = Hyper3DElement2Write(h3d_file, elem_id, conn1, dof1 , coef1 , 1 ,conn, dof, coef, nsn);
155 if( !rc ) throw rc;
157 if( !rc ) throw rc;
158
159 free(conn);
160 free(coef);
161 free(dof);
162 }
163 }
164
165
166 } // end of try
167
168 catch(...) {
170 }
171
172}
173
174void _FCALL C_H3D_CREATE_RBE3(int *ITAB, int *NUMNOD, int *IRBE3, int *NRBE3L, int *LRBE3, int *NRBE3, int *COMPID_RBE3S)
175{c_h3d_create_rbe3_ (ITAB, NUMNOD, IRBE3, NRBE3L, LRBE3, NRBE3,COMPID_RBE3S);}
176
177void c_h3d_create_rbe3__ (int *ITAB, int *NUMNOD, int *IRBE3, int *NRBE3L, int *LRBE3, int *NRBE3, int *COMPID_RBE3S)
178{c_h3d_create_rbe3_ (ITAB, NUMNOD, IRBE3, NRBE3L, LRBE3, NRBE3,COMPID_RBE3S);}
179
180void c_h3d_create_rbe3 (int *ITAB, int *NUMNOD, int *IRBE3, int *NRBE3L, int *LRBE3, int *NRBE3, int *COMPID_RBE3S)
181{c_h3d_create_rbe3_ (ITAB, NUMNOD, IRBE3, NRBE3L, LRBE3, NRBE3,COMPID_RBE3S);}
182
183
184/*=================================================================*/
185/* C_H3D_CREATE_RBE3 */
186/*=================================================================*/
187void c_h3d_create_rbe3_impi_(int *ITAB,int *NRBE3,int *IADRBE3,int *SLAVENODS,int *P0RBE3BUF,
188 int *ID_RBE3, int *COMPID_RBE3S)
189{
190
191 try {
192
193
194 // create Elements
195 H3D_ID elem_id ;
196 H3D_ID RigidElem ;
197 int i,j,n,p,nsn,nsn_loc,ptr,iadg;
198 //int PTRPO_TMP[*NSPMD + 1];
199
200 char RBE3POOL[] = "Rbe3";
202 if( !rc ) throw rc;
203
204 char RIGIDPOOL[] = "Rigid";
206 if( !rc ) throw rc;
207
208 unsigned int *conn;
209 double *coef;
210 int *dof;
211 unsigned int elem_count = 1;
212
213
214 if(*COMPID_RBE3S != 0 && *NRBE3 != 0)
215 {
217 H3D_ELEM_CONFIG_RIGIDLINK, *COMPID_RBE3S,
219 for(i=0;i<*NRBE3;i++)
220 {
221 elem_id = ID_RBE3[i];
222 nsn =IADRBE3[i+1] - IADRBE3[i];
223 iadg = IADRBE3[i] ;
224
225
226 conn =(unsigned int *)malloc(nsn*sizeof(unsigned int));
227 coef =(double *)malloc(nsn*sizeof(double));
228 dof =(int *)malloc(nsn*sizeof(int));
229 unsigned int conn1[1];
230 //double coef[nsn];
231 double coef1[1] = {1.0};
232 //int dof[nsn];
233 int dof1[1] = {6};
234 conn1[0] = SLAVENODS[i];
235 j = 0;
236 for(n=0;n<nsn;n++)
237 {
238 conn[n] = P0RBE3BUF[iadg + n];
239 }
240
241 if( !rc ) throw rc;
242 rc = Hyper3DElement2Write(h3d_file, elem_id, conn1, dof1 , coef1 , 1 ,conn, dof, coef, nsn);
243 if( !rc ) throw rc;
244
245 free(conn);
246 free(coef);
247 free(dof);
248 }
250 if( !rc ) throw rc;
251 }
252 else
253 {
254 for(i=0;i<*NRBE3;i++)
255 {
256 elem_id = ID_RBE3[i];
257 nsn =IADRBE3[i+1] - IADRBE3[i];
258 iadg = IADRBE3[i] ;
259
260
261 conn =(unsigned int *)malloc(nsn*sizeof(unsigned int));
262 coef =(double *)malloc(nsn*sizeof(double));
263 dof =(int *)malloc(nsn*sizeof(int));
264 unsigned int conn1[1];
265 //double coef[nsn];
266 double coef1[1] = {1.0};
267 //int dof[nsn];
268 int dof1[1] = {6};
269 conn1[0] = SLAVENODS[i];
270 j = 0;
271 for(n=0;n<nsn;n++)
272 {
273 conn[n] = P0RBE3BUF[iadg + n];
274 }
275
276
277
279 H3D_ELEM_CONFIG_RIGIDLINK, elem_id,
281 if( !rc ) throw rc;
282 rc = Hyper3DElement2Write(h3d_file, elem_id, conn1, dof1 , coef1 , 1 ,conn, dof, coef, nsn);
283 if( !rc ) throw rc;
285 if( !rc ) throw rc;
286
287 free(conn);
288 free(coef);
289 free(dof);
290 }
291 }
292
293
294 } // end of try
295
296 catch(...) {
298 }
299
300}
301
302void _FCALL C_H3D_CREATE_RBE3_IMPI(int *ITAB,int *NRBE3,int *IADRBE3,int *SLAVENODS,int *P0RBE3BUF,
303 int *ID_RBE3, int *COMPID_RBE3S)
304{c_h3d_create_rbe3_impi_ (ITAB,NRBE3,IADRBE3,SLAVENODS,P0RBE3BUF,ID_RBE3,COMPID_RBE3S);}
305
306void c_h3d_create_rbe3_impi__ (int *ITAB,int *NRBE3,int *IADRBE3,int *SLAVENODS,int *P0RBE3BUF,
307 int *ID_RBE3, int *COMPID_RBE3S)
308{c_h3d_create_rbe3_impi_ (ITAB,NRBE3,IADRBE3,SLAVENODS,P0RBE3BUF,ID_RBE3,COMPID_RBE3S);}
309
310void c_h3d_create_rbe3_impi (int *ITAB,int *NRBE3,int *IADRBE3,int *SLAVENODS,int *P0RBE3BUF,
311 int *ID_RBE3, int *COMPID_RBE3S)
312{c_h3d_create_rbe3_impi_ (ITAB,NRBE3,IADRBE3,SLAVENODS,P0RBE3BUF,ID_RBE3,COMPID_RBE3S);}
313
314
315}
void c_h3d_create_rbe3_impi_(int *ITAB, int *NRBE3, int *IADRBE3, int *SLAVENODS, int *P0RBE3BUF, int *ID_RBE3, int *COMPID_RBE3S)
void c_h3d_create_rbe3(int *ITAB, int *NUMNOD, int *IRBE3, int *NRBE3L, int *LRBE3, int *NRBE3, int *COMPID_RBE3S)
void c_h3d_create_rbe3_impi(int *ITAB, int *NRBE3, int *IADRBE3, int *SLAVENODS, int *P0RBE3BUF, int *ID_RBE3, int *COMPID_RBE3S)
void c_h3d_create_rbe3_impi__(int *ITAB, int *NRBE3, int *IADRBE3, int *SLAVENODS, int *P0RBE3BUF, int *ID_RBE3, int *COMPID_RBE3S)
void c_h3d_create_rbe3__(int *ITAB, int *NUMNOD, int *IRBE3, int *NRBE3L, int *LRBE3, int *NRBE3, int *COMPID_RBE3S)
void _FCALL C_H3D_CREATE_RBE3(int *ITAB, int *NUMNOD, int *IRBE3, int *NRBE3L, int *LRBE3, int *NRBE3, int *COMPID_RBE3S)
void _FCALL C_H3D_CREATE_RBE3_IMPI(int *ITAB, int *NRBE3, int *IADRBE3, int *SLAVENODS, int *P0RBE3BUF, int *ID_RBE3, int *COMPID_RBE3S)
void c_h3d_create_rbe3_(int *ITAB, int *NUMNOD, int *IRBE3, int *NRBE3L, int *LRBE3, int *NRBE3, int *COMPID_RBE3S)
H3DFileInfo * h3d_file
H3D_ID rigid_poolname_id
H3D_ID node_poolname_id
bool rc
H3D_ID rbe3_poolname_id
H3D_ID comp_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
#define _FCALL
n