OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
c_h3d_create_rbe2.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_RBE2 */
68/*=================================================================*/
69void c_h3d_create_rbe2_(int *ITAB, int *NUMNOD, int *IRBE2, int *NRBE2L, int *LRBE2, int *NRBE2, int *COMPID_RBE2S)
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 RBE2POOL[] = "Rbe2";
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_RBE2S != 0 && *NRBE2 != 0)
93 {
95 H3D_ELEM_CONFIG_RIGIDLINK, *COMPID_RBE2S,
97 for(i=0;i<*NRBE2;i++)
98 {
99 elem_id = IRBE2[*NRBE2L * i + 1];
100 nsn = IRBE2[*NRBE2L * 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[LRBE2[IRBE2[*NRBE2L * i ] + j ] - 1 ];
108
109 RigidElem = IRBE2[*NRBE2L * i + 1] ;
110
111 unsigned int conn1[1];
112 double coef1[1] = {1.0};
113 int dof1[1] = {6};
114 conn1[0] = ITAB[IRBE2[*NRBE2L * 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 }
125 if( !rc ) throw rc;
126 }
127 else
128 {
129 for(i=0;i<*NRBE2;i++)
130 {
131 elem_id = IRBE2[*NRBE2L * i + 1];
132 nsn = IRBE2[*NRBE2L * i + 4];
133 comp_id = 1;
134
135 conn =(unsigned int *)malloc(nsn*sizeof(unsigned int));
136 coef =(double *)malloc(nsn*sizeof(double));
137 dof =(int *)malloc(nsn*sizeof(int));
138
139 for(j=0;j<nsn;j++) conn[j] = ITAB[LRBE2[IRBE2[*NRBE2L * i ] + j ] - 1 ];
140
141 RigidElem = IRBE2[*NRBE2L * i + 1] ;
142
143 unsigned int conn1[1];
144 double coef1[1] = {1.0};
145 int dof1[1] = {6};
146 conn1[0] = ITAB[IRBE2[*NRBE2L * i + 2]-1];
147
148
150 H3D_ELEM_CONFIG_RIGIDLINK, RigidElem,
152 if( !rc ) throw rc;
153 rc = Hyper3DElement2Write(h3d_file, elem_id, conn1, dof1 , coef1 , 1 ,conn, dof, coef, nsn);
154 if( !rc ) throw rc;
156 if( !rc ) throw rc;
157
158 free(conn);
159 free(coef);
160 free(dof);
161
162 }
163 }
164
165
166 } // end of try
167
168 catch(...) {
170 }
171
172}
173
174void _FCALL C_H3D_CREATE_RBE2(int *ITAB, int *NUMNOD, int *IRBE2, int *NRBE2L, int *LRBE2, int *NRBE2, int *COMPID_RBE2S)
175{c_h3d_create_rbe2_ (ITAB, NUMNOD, IRBE2, NRBE2L, LRBE2, NRBE2,COMPID_RBE2S);}
176
177void c_h3d_create_rbe2__ (int *ITAB, int *NUMNOD, int *IRBE2, int *NRBE2L, int *LRBE2, int *NRBE2, int *COMPID_RBE2S)
178{c_h3d_create_rbe2_ (ITAB, NUMNOD, IRBE2, NRBE2L, LRBE2, NRBE2,COMPID_RBE2S);}
179
180void c_h3d_create_rbe2 (int *ITAB, int *NUMNOD, int *IRBE2, int *NRBE2L, int *LRBE2, int *NRBE2, int *COMPID_RBE2S)
181{c_h3d_create_rbe2_ (ITAB, NUMNOD, IRBE2, NRBE2L, LRBE2, NRBE2,COMPID_RBE2S);}
182
183
184/*=================================================================*/
185/* C_H3D_CREATE_RBE2 */
186/*=================================================================*/
187void c_h3d_create_rbe2_impi_(int *ITAB,int *NRBE2,int *IADRBE2,int *MASTERNODS,int *P0RBE2BUF,
188 int *ID_RBE2, int *COMPID_RBE2S)
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 RBE2POOL[] = "Rbe2";
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_RBE2S != 0 && *NRBE2 != 0)
215 {
217 H3D_ELEM_CONFIG_RIGIDLINK, *COMPID_RBE2S,
219 for(i=0;i<*NRBE2;i++)
220 {
221 elem_id = ID_RBE2[i];
222 nsn =IADRBE2[i+1] - IADRBE2[i];
223 iadg = IADRBE2[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] = MASTERNODS[i];
235 j = 0;
236 for(n=0;n<nsn;n++)
237 {
238 conn[n] = P0RBE2BUF[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 }
253 else
254 {
255 for(i=0;i<*NRBE2;i++)
256 {
257 elem_id = ID_RBE2[i];
258 nsn =IADRBE2[i+1] - IADRBE2[i];
259 iadg = IADRBE2[i] ;
260
261
262 conn =(unsigned int *)malloc(nsn*sizeof(unsigned int));
263 coef =(double *)malloc(nsn*sizeof(double));
264 dof =(int *)malloc(nsn*sizeof(int));
265 unsigned int conn1[1];
266 //double coef[nsn];
267 double coef1[1] = {1.0};
268 //int dof[nsn];
269 int dof1[1] = {6};
270 conn1[0] = MASTERNODS[i];
271 j = 0;
272 for(n=0;n<nsn;n++)
273 {
274 conn[n] = P0RBE2BUF[iadg + n];
275 }
276
277
278
280 H3D_ELEM_CONFIG_RIGIDLINK, elem_id,
282 if( !rc ) throw rc;
283 rc = Hyper3DElement2Write(h3d_file, elem_id, conn1, dof1 , coef1 , 1 ,conn, dof, coef, nsn);
284 if( !rc ) throw rc;
286 if( !rc ) throw rc;
287
288 free(conn);
289 free(coef);
290 free(dof);
291
292 }
293 }
294 } // end of try
295
296 catch(...) {
298 }
299
300}
301
302void _FCALL C_H3D_CREATE_RBE2_IMPI(int *ITAB,int *NRBE2,int *IADRBE2,int *MASTERNODS,int *P0RBE2BUF,
303 int *ID_RBE2, int *COMPID_RBE2S)
304{c_h3d_create_rbe2_impi_ (ITAB,NRBE2,IADRBE2,MASTERNODS,P0RBE2BUF,ID_RBE2,COMPID_RBE2S);}
305
306void c_h3d_create_rbe2_impi__ (int *ITAB,int *NRBE2,int *IADRBE2,int *MASTERNODS,int *P0RBE2BUF,
307 int *ID_RBE2, int *COMPID_RBE2S)
308{c_h3d_create_rbe2_impi_ (ITAB,NRBE2,IADRBE2,MASTERNODS,P0RBE2BUF,ID_RBE2,COMPID_RBE2S);}
309
310void c_h3d_create_rbe2_impi (int *ITAB,int *NRBE2,int *IADRBE2,int *MASTERNODS,int *P0RBE2BUF,
311 int *ID_RBE2, int *COMPID_RBE2S)
312{c_h3d_create_rbe2_impi_ (ITAB,NRBE2,IADRBE2,MASTERNODS,P0RBE2BUF,ID_RBE2,COMPID_RBE2S);}
313
314
315}
void c_h3d_create_rbe2_impi__(int *ITAB, int *NRBE2, int *IADRBE2, int *MASTERNODS, int *P0RBE2BUF, int *ID_RBE2, int *COMPID_RBE2S)
void _FCALL C_H3D_CREATE_RBE2_IMPI(int *ITAB, int *NRBE2, int *IADRBE2, int *MASTERNODS, int *P0RBE2BUF, int *ID_RBE2, int *COMPID_RBE2S)
void c_h3d_create_rbe2_impi_(int *ITAB, int *NRBE2, int *IADRBE2, int *MASTERNODS, int *P0RBE2BUF, int *ID_RBE2, int *COMPID_RBE2S)
void c_h3d_create_rbe2(int *ITAB, int *NUMNOD, int *IRBE2, int *NRBE2L, int *LRBE2, int *NRBE2, int *COMPID_RBE2S)
void c_h3d_create_rbe2_impi(int *ITAB, int *NRBE2, int *IADRBE2, int *MASTERNODS, int *P0RBE2BUF, int *ID_RBE2, int *COMPID_RBE2S)
void c_h3d_create_rbe2_(int *ITAB, int *NUMNOD, int *IRBE2, int *NRBE2L, int *LRBE2, int *NRBE2, int *COMPID_RBE2S)
void _FCALL C_H3D_CREATE_RBE2(int *ITAB, int *NUMNOD, int *IRBE2, int *NRBE2L, int *LRBE2, int *NRBE2, int *COMPID_RBE2S)
void c_h3d_create_rbe2__(int *ITAB, int *NUMNOD, int *IRBE2, int *NRBE2L, int *LRBE2, int *NRBE2, int *COMPID_RBE2S)
H3DFileInfo * h3d_file
H3D_ID rigid_poolname_id
H3D_ID node_poolname_id
bool rc
H3D_ID comp_id
H3D_ID rbe2_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
#define _FCALL
n