OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
c_h3d_update_shell_vector.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
63#ifdef MYREAL4
64#define my_real float
65#endif
66
67#ifdef MYREAL8
68#define my_real double
69#endif
70
71extern "C"
72/*=================================================================*/
73{
74
75
76
77/*=================================================================*/
78/* C_H3D_UPDATE_H3DFILE_SHELL_VECTOR */
79/*=================================================================*/
80
81void c_h3d_update_shell_vector_(my_real *TT,int *IH3D, int *ITAB, int *NUMNOD, int *IXC, int *NIXC, int *NUMELC, int *IPARTC,
82 int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, my_real *FUNC ,int *ID_ELEM,int *CPT_DATATYPE,
83 int *ITY_ELEM, int *NUMELS, int *NUMELQ , int *NUMELT , int *NUMELP , int *NUMELR, int *IS_WRITTEN)
84{
85 int i;
86 int offset;
87 H3D_ID elem_id;
88 H3D_ID comp_id;
89//
90 // initialize
91
92 try {
93 // create Subcase (Loadcase)
94 unsigned int max_sims = 10;
95 unsigned int sub_count = 1;
96 float elem_result[] = { 0.0f, 0.0f, 0.0f };
97
98 // create Result Data sets
99 unsigned int num_corners = 0;
100 unsigned int num_modes = 0;
101 bool complex = false;
102 float value[1] ;
103
104 sim_idx = *IH3D;
105
106
107 if( *NUMELC != 0)
108 {
109
110 rc = Hyper3DDatasetBegin(h3d_file, *NUMELC, sim_idx, subcase_id, H3D_DS_ELEM,
111 H3D_DS_VECTOR, num_corners, num_modes, *CPT_DATATYPE,
113 if( !rc ) throw rc;
114
115 offset = 0;
116
117 for( i = 0; i < *NUMELC + *NUMELTG; i++ )
118 {
119 if( ITY_ELEM[i] == 3 && IS_WRITTEN[i] == 1)
120 {
121 elem_id = ID_ELEM[i];
122 elem_result[0] = FUNC[3*i];
123 elem_result[1] = FUNC[3*i+1];
124 elem_result[2] = FUNC[3*i+2];
125 rc = Hyper3DDatasetWriteWithSystem(h3d_file, elem_id, &elem_result[0],0,H3D_DS_GLOBAL);
126 }
127 }
128
130 if( !rc ) throw rc;
131 }
132
133 offset = *NUMELC;
134
135
136 if( *NUMELTG != 0)
137 {
138
139 rc = Hyper3DDatasetBegin(h3d_file, *NUMELTG, sim_idx, subcase_id, H3D_DS_ELEM,
140 H3D_DS_VECTOR, num_corners, num_modes, *CPT_DATATYPE,
142 if( !rc ) throw rc;
143
144 for( i = 0; i < *NUMELC + *NUMELTG; i++ )
145 {
146 if( ITY_ELEM[i] == 7 && IS_WRITTEN[i] == 1)
147 {
148 elem_id = ID_ELEM[i];
149 elem_result[0] = FUNC[3*i];
150 elem_result[1] = FUNC[3*i+1];
151 elem_result[2] = FUNC[3*i+2];
152 rc = Hyper3DDatasetWriteWithSystem(h3d_file, elem_id, &elem_result[0],0,H3D_DS_GLOBAL);
153 }
154 }
156 if( !rc ) throw rc;
157 }
158
159 } // end of try
160
161 catch(...) {
163 }
164}
165
166void _FCALL C_H3D_UPDATE_SHELL_VECTOR(my_real *TT,int *IH3D, int *ITAB, int *NUMNOD, int *IXC, int *NIXC, int *NUMELC, int *IPARTC,
167 int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, my_real *FUNC ,int *ID_ELEM,int *CPT_DATATYPE,
168 int *ITY_ELEM, int *NUMELS, int *NUMELQ , int *NUMELT , int *NUMELP , int *NUMELR, int *IS_WRITTEN)
169{c_h3d_update_shell_vector_ (TT,IH3D,ITAB,NUMNOD,IXC,NIXC,NUMELC,IPARTC,IXTG,NIXTG,NUMELTG,IPARTTG,FUNC,ID_ELEM,CPT_DATATYPE,ITY_ELEM,
170 NUMELS,NUMELQ,NUMELT,NUMELP,NUMELR,IS_WRITTEN);}
171
172void c_h3d_update_shell_vector__ (my_real *TT,int *IH3D, int *ITAB, int *NUMNOD, int *IXC, int *NIXC, int *NUMELC, int *IPARTC,
173 int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, my_real *FUNC ,int *ID_ELEM,int *CPT_DATATYPE,
174 int *ITY_ELEM, int *NUMELS, int *NUMELQ , int *NUMELT , int *NUMELP , int *NUMELR, int *IS_WRITTEN)
175{c_h3d_update_shell_vector_ (TT,IH3D,ITAB,NUMNOD,IXC,NIXC,NUMELC,IPARTC,IXTG,NIXTG,NUMELTG,IPARTTG,FUNC,ID_ELEM,CPT_DATATYPE,ITY_ELEM,
176 NUMELS,NUMELQ,NUMELT,NUMELP,NUMELR,IS_WRITTEN);}
177
178void c_h3d_update_shell_vector (my_real *TT,int *IH3D, int *ITAB, int *NUMNOD, int *IXC, int *NIXC, int *NUMELC, int *IPARTC,
179 int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, my_real *FUNC ,int *ID_ELEM,int *CPT_DATATYPE,
180 int *ITY_ELEM, int *NUMELS, int *NUMELQ , int *NUMELT , int *NUMELP , int *NUMELR, int *IS_WRITTEN)
181{c_h3d_update_shell_vector_ (TT,IH3D,ITAB,NUMNOD,IXC,NIXC,NUMELC,IPARTC,IXTG,NIXTG,NUMELTG,IPARTTG,FUNC,ID_ELEM,CPT_DATATYPE,ITY_ELEM,
182 NUMELS,NUMELQ,NUMELT,NUMELP,NUMELR,IS_WRITTEN);}
183
184}
H3DFileInfo * h3d_file
bool rc
H3D_ID sh4n_poolname_id
H3D_ID sh3n_poolname_id
H3D_ID comp_id
H3D_SIM_IDX sim_idx
H3D_ID subcase_id
void _FCALL C_H3D_UPDATE_SHELL_VECTOR(my_real *TT, int *IH3D, int *ITAB, int *NUMNOD, int *IXC, int *NIXC, int *NUMELC, int *IPARTC, int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, my_real *FUNC, int *ID_ELEM, int *CPT_DATATYPE, int *ITY_ELEM, int *NUMELS, int *NUMELQ, int *NUMELT, int *NUMELP, int *NUMELR, int *IS_WRITTEN)
void c_h3d_update_shell_vector(my_real *TT, int *IH3D, int *ITAB, int *NUMNOD, int *IXC, int *NIXC, int *NUMELC, int *IPARTC, int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, my_real *FUNC, int *ID_ELEM, int *CPT_DATATYPE, int *ITY_ELEM, int *NUMELS, int *NUMELQ, int *NUMELT, int *NUMELP, int *NUMELR, int *IS_WRITTEN)
void c_h3d_update_shell_vector_(my_real *TT, int *IH3D, int *ITAB, int *NUMNOD, int *IXC, int *NIXC, int *NUMELC, int *IPARTC, int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, my_real *FUNC, int *ID_ELEM, int *CPT_DATATYPE, int *ITY_ELEM, int *NUMELS, int *NUMELQ, int *NUMELT, int *NUMELP, int *NUMELR, int *IS_WRITTEN)
void c_h3d_update_shell_vector__(my_real *TT, int *IH3D, int *ITAB, int *NUMNOD, int *IXC, int *NIXC, int *NUMELC, int *IPARTC, int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, my_real *FUNC, int *ID_ELEM, int *CPT_DATATYPE, int *ITY_ELEM, int *NUMELS, int *NUMELQ, int *NUMELT, int *NUMELP, int *NUMELR, int *IS_WRITTEN)
#define FUNC
Definition clamov.c:8
#define my_real
Definition cppsort.cpp:32
bool Hyper3DDatasetBegin(H3DFileInfo *h3d_file, unsigned int count, H3D_SIM_IDX idx, H3D_ID subcase_id, H3D_DS_TYPE type, H3D_DS_FORMAT format, unsigned int num_corners, unsigned int num_modes, H3D_ID dt_id, int layer_idx, H3D_ID data_poolname_id, bool complex)
Definition h3d_dl.c:1352
bool Hyper3DExportClearError(H3DFileInfo *h3d_file)
Definition h3d_dl.c:939
bool Hyper3DDatasetWriteWithSystem(H3DFileInfo *h3d_file, H3D_ID id, const float *data, H3D_ID sys_id, H3D_ANALYSIS_SYSTEM system_flag)
Definition h3d_dl.c:1379
bool Hyper3DDatasetEnd(H3DFileInfo *h3d_file)
Definition h3d_dl.c:1400
#define _FCALL