OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
c_h3d_create_sh3ns.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/* CREATE_SH3NS */
69/*=================================================================*/
70void c_h3d_create_sh3ns_(int *ITAB, int *NUMNOD, int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, int *IPART, int *LIPART1, int *H3D_PART)
71{
72 unsigned int * nbelems = new unsigned int [*NUMELTG];
73 try {
74
75
76 // create Elements
77 unsigned int conn[3] ;
78 H3D_ID elem_id ;
79 int i,j,cpt_elem,nbelemwrite;
80 char SH3NPOOL[] = "SH3N";
82 if( !rc ) throw rc;
83
84 char SHELLPOOL[] = "Shell";
86 if( !rc ) throw rc;
87
88 unsigned int elem_count = 1;
89
90
91
92 comp_id = 0;
93 j = 0;
94 for(i=0;i<*NUMELTG;i++) nbelems[i] = 0;
95
96 for(i=0;i<*NUMELTG;i++)
97 {
98 if(H3D_PART[IPARTTG[i] - 1] == 1)
99 {
100 if(IPART[*LIPART1 * (IPARTTG[i] - 1) + 3] != comp_id)
101 {
102 comp_id = IPART[*LIPART1 * (IPARTTG[i] - 1) + 3];
103 j = i;
104 }
105 nbelems[j] = nbelems[j] + 1;
106 }
107 }
108
109 comp_id = 0;
110 cpt_elem = 0;
111 nbelemwrite = 0;
112
113 for(i=0;i<*NUMELTG;i++)
114 {
115 if(H3D_PART[IPARTTG[i] - 1] == 1)
116 {
117 conn[0] = IXTG[*NIXTG * i + 1];
118 conn[1] = IXTG[*NIXTG * i + 2];
119 conn[2] = IXTG[*NIXTG * i + 3];
120 elem_id = IXTG[*NIXTG * i + *NIXTG - 1];
121
122 if(nbelems[i] != 0)
123 {
124 cpt_elem = 0;
125 nbelemwrite = nbelems[i];
126 comp_id = IPART[*LIPART1 * (IPARTTG[i] - 1) + 3] ;
127
129 H3D_ELEM_CONFIG_TRIA3, comp_id,
131 if( !rc ) throw rc;
132 }
133 cpt_elem++;
134 rc = Hyper3DElementWrite(h3d_file, elem_id, conn);
135 if( !rc ) throw rc;
136
137 if (cpt_elem == nbelemwrite)
138 {
140 if( !rc ) throw rc;
141 }
142 }
143 }
144
145 } // end of try
146
147 catch(...) {
149 }
150 delete [] nbelems;
151
152//
153}
154
155void _FCALL C_H3D_CREATE_SH3NS(int *ITAB, int *NUMNOD, int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, int *IPART, int *LIPART1, int *H3D_PART)
156{c_h3d_create_sh3ns_ (ITAB,NUMNOD,IXTG,NIXTG,NUMELTG,IPARTTG,IPART,LIPART1,H3D_PART);}
157
158void create_sh3ns__ (int *ITAB, int *NUMNOD, int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, int *IPART, int *LIPART1, int *H3D_PART)
159{c_h3d_create_sh3ns_ (ITAB,NUMNOD,IXTG,NIXTG,NUMELTG,IPARTTG,IPART,LIPART1,H3D_PART);}
160
161void c_h3d_create_sh3ns (int *ITAB, int *NUMNOD, int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, int *IPART, int *LIPART1, int *H3D_PART)
162{c_h3d_create_sh3ns_ (ITAB,NUMNOD,IXTG,NIXTG,NUMELTG,IPARTTG,IPART,LIPART1,H3D_PART);}
163
164}
void create_sh3ns__(int *ITAB, int *NUMNOD, int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, int *IPART, int *LIPART1, int *H3D_PART)
void c_h3d_create_sh3ns(int *ITAB, int *NUMNOD, int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, int *IPART, int *LIPART1, int *H3D_PART)
void c_h3d_create_sh3ns_(int *ITAB, int *NUMNOD, int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, int *IPART, int *LIPART1, int *H3D_PART)
void _FCALL C_H3D_CREATE_SH3NS(int *ITAB, int *NUMNOD, int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, int *IPART, int *LIPART1, int *H3D_PART)
H3D_ID shell_poolname_id
H3DFileInfo * h3d_file
H3D_ID node_poolname_id
bool rc
H3D_ID sh3n_poolname_id
H3D_ID comp_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