OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
c_h3d_update_quad_tensor.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#include "h3dpublic_defs.h"
56#include "h3dpublic_export.h"
57
58#define _FCALL
59
60#include "h3d_values.h"
61
62#ifdef MYREAL4
63#define my_real float
64#endif
65
66#ifdef MYREAL8
67#define my_real double
68#endif
69
70extern "C"
71/*=================================================================*/
72{
73
74
75/*=================================================================*/
76/* C_H3D_UPDATE_H3DFILE_QUAD_TENSOR */
77/*=================================================================*/
78
79void c_h3d_update_quad_tensor_(my_real *TT,int *IH3D, int *ITAB, int *NUMNOD, int *IXC, int *NIXC, int *NUMELC, int *IPARTC,
80 int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, my_real *FUNC ,int *ID_ELEM,int *CPT_DATATYPE,
81 int *NUMELS, int *NUMELQ , int *NUMELT , int *NUMELP , int *NUMELR , int *IS_WRITTEN)
82{
83 int i;
84 H3D_ID elem_id;
85 H3D_ID comp_id;
86//
87 // initialize
88
89 try {
90 // create Subcase (Loadcase)
91 unsigned int max_sims = 10;
92 unsigned int sub_count = 1;
93 float elem_result[6] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
94
95 // create Result Data sets
96 unsigned int num_corners = 0;
97 unsigned int num_modes = 0;
98 bool complex = false;
99 float value[1] ;
100
101 sim_idx = *IH3D;
102
103 rc = Hyper3DDatasetBegin(h3d_file, *NUMELQ, sim_idx, subcase_id, H3D_DS_ELEM,
104 H3D_DS_TENSOR3D, num_corners, num_modes, *CPT_DATATYPE,
106
107 if( !rc ) throw rc;
108
109
110 for( i = 0; i < *NUMELQ; i++ )
111 {
112 if(IS_WRITTEN[i] == 1)
113 {
114 elem_id = ID_ELEM[i];
115 elem_result[0] = FUNC[6*i];
116 elem_result[1] = FUNC[6*i+1];
117 elem_result[2] = FUNC[6*i+2];
118 elem_result[3] = FUNC[6*i+3];
119 elem_result[4] = FUNC[6*i+4];
120 elem_result[5] = FUNC[6*i+5];
121 rc = Hyper3DDatasetWrite(h3d_file, elem_id, &elem_result[0]);
122 IS_WRITTEN[i] = 0;
123 }
124 }
125
127 if( !rc ) throw rc;
128
129 } // end of try
130
131 catch(...) {
133 }
134}
135
136void _FCALL C_H3D_UPDATE_QUAD_TENSOR(my_real *TT,int *IH3D, int *ITAB, int *NUMNOD, int *IXC, int *NIXC, int *NUMELC, int *IPARTC,
137 int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, my_real *FUNC ,int *ID_ELEM,int *CPT_DATATYPE,
138 int *NUMELS, int *NUMELQ , int *NUMELT , int *NUMELP , int *NUMELR, int *IS_WRITTEN)
139{c_h3d_update_quad_tensor_ (TT,IH3D,ITAB,NUMNOD,IXC,NIXC,NUMELC,IPARTC,IXTG,NIXTG,NUMELTG,IPARTTG,FUNC,ID_ELEM,CPT_DATATYPE,
140 NUMELS,NUMELQ,NUMELT,NUMELP,NUMELR,IS_WRITTEN);}
141
142void c_h3d_update_quad_tensor__ (my_real *TT,int *IH3D, int *ITAB, int *NUMNOD, int *IXC, int *NIXC, int *NUMELC, int *IPARTC,
143 int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, my_real *FUNC ,int *ID_ELEM,int *CPT_DATATYPE,
144 int *NUMELS, int *NUMELQ , int *NUMELT , int *NUMELP , int *NUMELR, int *IS_WRITTEN)
145{c_h3d_update_quad_tensor_ (TT,IH3D,ITAB,NUMNOD,IXC,NIXC,NUMELC,IPARTC,IXTG,NIXTG,NUMELTG,IPARTTG,FUNC,ID_ELEM,CPT_DATATYPE,
146 NUMELS,NUMELQ,NUMELT,NUMELP,NUMELR,IS_WRITTEN);}
147
148void c_h3d_update_quad_tensor (my_real *TT,int *IH3D, int *ITAB, int *NUMNOD, int *IXC, int *NIXC, int *NUMELC, int *IPARTC,
149 int *IXTG, int *NIXTG, int *NUMELTG, int *IPARTTG, my_real *FUNC ,int *ID_ELEM,int *CPT_DATATYPE,
150 int *NUMELS, int *NUMELQ , int *NUMELT , int *NUMELP , int *NUMELR, int *IS_WRITTEN)
151{c_h3d_update_quad_tensor_ (TT,IH3D,ITAB,NUMNOD,IXC,NIXC,NUMELC,IPARTC,IXTG,NIXTG,NUMELTG,IPARTTG,FUNC,ID_ELEM,CPT_DATATYPE,
152 NUMELS,NUMELQ,NUMELT,NUMELP,NUMELR,IS_WRITTEN);}
153
154}
H3DFileInfo * h3d_file
bool rc
H3D_ID comp_id
H3D_SIM_IDX sim_idx
H3D_ID subcase_id
H3D_ID quad_poolname_id
void c_h3d_update_quad_tensor__(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 *NUMELS, int *NUMELQ, int *NUMELT, int *NUMELP, int *NUMELR, int *IS_WRITTEN)
void c_h3d_update_quad_tensor(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 *NUMELS, int *NUMELQ, int *NUMELT, int *NUMELP, int *NUMELR, int *IS_WRITTEN)
void c_h3d_update_quad_tensor_(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 *NUMELS, int *NUMELQ, int *NUMELT, int *NUMELP, int *NUMELR, int *IS_WRITTEN)
void _FCALL C_H3D_UPDATE_QUAD_TENSOR(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 *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 Hyper3DDatasetEnd(H3DFileInfo *h3d_file)
Definition h3d_dl.c:1400
bool Hyper3DDatasetWrite(H3DFileInfo *h3d_file, H3D_ID id, const float *data)
Definition h3d_dl.c:1372
#define _FCALL