OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
c_h3d_create_skins.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/*=================================================================*/
68/* c_h3d_create_skins based on QUAD(4n) */
69/*=================================================================*/
70void c_h3d_create_skins_(int *ITAB, int *NUMNOD, int *IPART, int *LIPART1,int *H3D_PART,
71 int *IXQ, int *NIXQ,int *NUMELQ,int *IPARTQ)
72{
73 unsigned int * nbelems = new unsigned int [*NUMELQ];
74 try {
75
76
77 // create Elements
78 unsigned int conn4[4] ;
79 H3D_ID elem_id ;
80 int i,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10;
81 int cpt_elem,nbelemwrite;
82 int elem_nodes = 0;
83 int elem_nodes_m1 = 0;
84 int j = 0;
85
86 char SKINPOOL[] = "SKIN";
88 if( !rc ) throw rc;
89
90
91 unsigned int elem_count = 1;
92
93// QUAD
94
95 for(i=0;i<*NUMELQ;i++) nbelems[i] = 0;
96
97 comp_id = 0;
98
99 for(i=0;i<*NUMELQ;i++)
100 {
101 if(H3D_PART[IPARTQ[i] - 1] == 1)
102 {
103 if(IPARTQ[i] > 0)
104 {
105 elem_nodes = 4;
106
107 if(IPART[*LIPART1 * (IPARTQ[i] - 1) + 3] != comp_id)
108 {
109 comp_id = IPART[*LIPART1 * (IPARTQ[i] - 1) + 3];
110 j = i;
111 }
112 nbelems[j] = nbelems[j] + 1;
113 }
114 }
115 }
116
117 comp_id = 0;
118 cpt_elem = 0;
119 nbelemwrite = 0;
120
121 for(i=0;i<*NUMELQ;i++)
122 {
123 if(IPARTQ[i] > 0)
124 {
125 if(H3D_PART[IPARTQ[i] - 1] == 1)
126 {
127 elem_id = IXQ[*NIXQ * i + *NIXQ - 1];
128 comp_id = IPART[*LIPART1 * (IPARTQ[i] - 1) + 3];
129
130 conn4[0] = IXQ[*NIXQ * i + 1];
131 conn4[1] = IXQ[*NIXQ * i + 2];
132 conn4[2] = IXQ[*NIXQ * i + 3];
133 conn4[3] = IXQ[*NIXQ * i + 4];
134
135
136
137 if(nbelems[i] != 0)
138 {
139 cpt_elem = 0;
140 nbelemwrite = nbelems[i];
141 comp_id = IPART[*LIPART1 * (IPARTQ[i] - 1) + 3];
142
143 if(conn4[3] == conn4[2])
144 {
146 H3D_ELEM_CONFIG_TRIA3, comp_id,
148 }
149 else
150 {
152 H3D_ELEM_CONFIG_QUAD4, comp_id,
154 }
155 if( !rc ) throw rc;
156 }
157
158
159 cpt_elem++;
160 rc = Hyper3DElementWrite(h3d_file, elem_id, conn4);
161 if( !rc ) throw rc;
162
163
164
165
166 if (cpt_elem == nbelemwrite)
167 {
169 if( !rc ) throw rc;
170 }
171
172 }
173 }
174 }
175
176
177
178 } // end of try
179
180 catch(...) {
182 }
183 delete [] nbelems;
184
185//
186}
187
188void _FCALL C_H3D_CREATE_SKINS(int *ITAB, int *NUMNOD, int *IPART, int *LIPART1,int *H3D_PART,
189 int *IXQ, int *NIXQ,int *NUMELQ,int *IPARTQ)
190{c_h3d_create_skins_ (ITAB, NUMNOD, IPART, LIPART1, H3D_PART, IXQ, NIXQ, NUMELQ, IPARTQ);}
191
192void c_h3d_create_skins__ (int *ITAB, int *NUMNOD, int *IPART, int *LIPART1,int *H3D_PART,
193 int *IXQ, int *NIXQ,int *NUMELQ,int *IPARTQ)
194{c_h3d_create_skins_ (ITAB, NUMNOD, IPART, LIPART1, H3D_PART, IXQ, NIXQ, NUMELQ, IPARTQ);}
195
196void c_h3d_create_skins (int *ITAB, int *NUMNOD, int *IPART, int *LIPART1,int *H3D_PART,
197 int *IXQ, int *NIXQ,int *NUMELQ,int *IPARTQ)
198{c_h3d_create_skins_ (ITAB, NUMNOD, IPART, LIPART1, H3D_PART, IXQ, NIXQ, NUMELQ, IPARTQ);}
199}
void c_h3d_create_skins_(int *ITAB, int *NUMNOD, int *IPART, int *LIPART1, int *H3D_PART, int *IXQ, int *NIXQ, int *NUMELQ, int *IPARTQ)
void c_h3d_create_skins__(int *ITAB, int *NUMNOD, int *IPART, int *LIPART1, int *H3D_PART, int *IXQ, int *NIXQ, int *NUMELQ, int *IPARTQ)
void c_h3d_create_skins(int *ITAB, int *NUMNOD, int *IPART, int *LIPART1, int *H3D_PART, int *IXQ, int *NIXQ, int *NUMELQ, int *IPARTQ)
void _FCALL C_H3D_CREATE_SKINS(int *ITAB, int *NUMNOD, int *IPART, int *LIPART1, int *H3D_PART, int *IXQ, int *NIXQ, int *NUMELQ, int *IPARTQ)
H3DFileInfo * h3d_file
H3D_ID node_poolname_id
bool rc
H3D_ID comp_id
H3D_ID skin_poolname_id
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 Hyper3DElementWrite(H3DFileInfo *h3d_file, H3D_ID id, H3D_ID *connectivity)
Definition h3d_dl.c:1147
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
#define _FCALL