OOFEM 3.0
Loading...
Searching...
No Matches
cltypes.C
Go to the documentation of this file.
1/*
2 *
3 * ##### ##### ###### ###### ### ###
4 * ## ## ## ## ## ## ## ### ##
5 * ## ## ## ## #### #### ## # ##
6 * ## ## ## ## ## ## ## ##
7 * ## ## ## ## ## ## ## ##
8 * ##### ##### ## ###### ## ##
9 *
10 *
11 * OOFEM : Object Oriented Finite Element Code
12 *
13 * Copyright (C) 1993 - 2025 Borek Patzak
14 *
15 *
16 *
17 * Czech Technical University, Faculty of Civil Engineering,
18 * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19 *
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
35#include "error.h"
36#include "chartype.h"
37#include "internalstatetype.h"
39#include "elementgeometrytype.h"
40#include "unknowntype.h"
41#include "materialmode.h"
42#include "matresponsemode.h"
43#include "valuemodetype.h"
45#include "meshpackagetype.h"
46#include "domaintype.h"
47#include "doftype.h"
48#include "dofiditem.h"
49#include "contextioerr.h"
50#include "field.h"
51#include "xfem/xfemmanager.h"
52
53#include <cstring>
54#include <string>
55
56namespace oofem {
57char cltypesGiveUnknownTypeModeKey(ValueModeType mode)
58{
59 switch ( mode ) {
60 case VM_Unknown: return 0;
61
62 case VM_Total: return 'u';
63
64 case VM_Velocity: return 'v';
65
66 case VM_Acceleration: return 'a';
67
68 case VM_TotalIntrinsic: return 'i';
69
70 default: OOFEM_ERROR("unsupported ValueModeType");
71 }
72}
73
74
76{
77 switch ( type ) {
78 case IST_StrainTensor:
79 case IST_StrainTensorTemp:
80 case IST_DeviatoricStrain:
81 case IST_PlasticStrainTensor:
82 case IST_ThermalStrainTensor:
83 case IST_ElasticStrainTensor:
84 case IST_CylindricalStrainTensor:
85 case IST_CreepStrainTensor:
86 case IST_ShellStrainTensor:
87 case IST_CurvatureTensor:
88 case IST_CurvatureTensorTemp:
89 case IST_EigenStrainTensor:
90 case IST_CrackStrainTensor:
91 return ISVT_TENSOR_S3E;
92
93 case IST_StressTensor:
94 case IST_StressTensorTemp:
95 case IST_CylindricalStressTensor:
96 case IST_DeviatoricStress:
97 case IST_CauchyStressTensor:
98
99 case IST_ShellForceTensor:
100 case IST_ShellForceTensorTemp:
101 case IST_ShellMomentTensor:
102 case IST_MomentTensor:
103 case IST_MomentTensorTemp:
104
106 case IST_AutogenousShrinkageTensor:
107 case IST_DryingShrinkageTensor:
108 case IST_TotalShrinkageTensor:
109
110 // Damage tensors
111 case IST_DamageTensor:
112 case IST_DamageTensorTemp:
113 case IST_DamageInvTensor:
114 case IST_DamageInvTensorTemp:
115 case IST_PrincipalDamageTensor:
116 case IST_PrincipalDamageTempTensor:
117 return ISVT_TENSOR_S3;
118
119 case IST_DeformationGradientTensor:
120 case IST_FirstPKStressTensor:
121 case IST_MacroSlipGradient:
122 case IST_ReinfMembraneStress:
123 //case IST_MaterialOrientation:
124 return ISVT_TENSOR_G;
125
126 case IST_BeamForceMomentTensor:
127 case IST_BeamStrainCurvatureTensor:
128 case IST_PrincipalStressTensor:
129 case IST_PrincipalStressTempTensor:
130 case IST_PrincipalStrainTensor:
131 case IST_PrincipalStrainTempTensor:
132 case IST_PrincipalPlasticStrainTensor:
133 case IST_DisplacementVector:
134 case IST_DisplacementVectorTemp:
135 case IST_CrackState:
136 case IST_CrackStateTemp:
137 case IST_MicroplaneDamageValues:
138 case IST_Velocity:
139 case IST_MaterialOrientation_x:
140 case IST_MaterialOrientation_y:
141 case IST_MaterialOrientation_z:
142 case IST_TemperatureFlow:
143 case IST_MassConcentrationFlow_1:
144 case IST_HumidityFlow:
145 case IST_CrackDirs:
146 case IST_CrackStatuses:
147 case IST_CrackStatusesTemp:
148 case IST_CrackVector:
149 case IST_2ndCrackVector:
150 case IST_3rdCrackVector:
151 case IST_InterfaceFirstPKTraction:
152 case IST_InterfaceTraction:
153 case IST_InterfaceJump:
154 case IST_InterfaceNormal:
155 case IST_PrincStressVector1:
156 case IST_PrincStressVector2:
157 case IST_PrincStressVector3:
158 case IST_MacroSlipVector:
159 case IST_TransferStress:
160 case IST_X_LCS:
161 case IST_Y_LCS:
162 case IST_Z_LCS:
163 return ISVT_VECTOR;
164
165 case IST_MaxEquivalentStrainLevel:
166 case IST_ErrorIndicatorLevel:
167 case IST_InternalStressError:
168 case IST_PrimaryUnknownError:
169 case IST_RelMeshDensity:
170 case IST_Temperature:
171 case IST_MassConcentration_1:
172 case IST_HydrationDegree:
173 case IST_Humidity:
174 case IST_Pressure:
175 case IST_VOFFraction:
176 case IST_Density:
177 case IST_MaterialInterfaceVal:
178 case IST_MaterialNumber:
179 case IST_ElementNumber:
180 case IST_BoneVolumeFraction:
181 case IST_PlasStrainEnerDens:
182 case IST_ElasStrainEnerDens:
183 case IST_TotalStrainEnerDens:
184 case IST_DamageScalar:
185 case IST_CrackedFlag:
186 case IST_CumPlasticStrain:
187 case IST_CumPlasticStrain_2:
188 case IST_StressWorkDensity:
189 case IST_DissWorkDensity:
190 case IST_FreeEnergyDensity:
191 case IST_ThermalConductivityIsotropic:
192 case IST_HeatCapacity:
193 case IST_AverageTemperature:
194 case IST_YoungModulusVirginPaste:
195 case IST_PoissonRatioVirginPaste:
196 case IST_YoungModulusConcrete:
197 case IST_PoissonRatioConcrete:
198 case IST_VolumetricPlasticStrain:
199 case IST_Viscosity:
200 case IST_DeviatoricStrainMeasure:
201 case IST_DeviatoricStressMeasure:
202 case IST_vonMisesStress:
203 case IST_XFEMEnrichment:
204 case IST_XFEMNumIntersecPoints:
205 case IST_XFEMLevelSetPhi:
206 case IST_Maturity:
207 case IST_CrossSectionNumber:
208 case IST_CrackWidth:
209 case IST_2ndCrackWidth:
210 case IST_3rdCrackWidth:
211 case IST_TensileStrength:
212 case IST_ResidualTensileStrength:
213 case IST_CrackIndex:
214 case IST_FiberStressNL:
215 case IST_FiberStressLocal:
216 case IST_CrackSlip:
217 case IST_EquivalentTime:
218 case IST_MoistureContent:
219 case IST_IncrementCreepModulus:
220 case IST_InternalSource:
221 return ISVT_SCALAR;
222
223 default:
224 return ISVT_UNDEFINED;
225 }
226}
227
228
230{
231 switch ( valType ) {
232 case ISVT_TENSOR_S3:
233 case ISVT_TENSOR_S3E:
234 case ISVT_TENSOR_G:
235 return 9;
236
237 case ISVT_VECTOR:
238 return 3;
239
240 case ISVT_SCALAR:
241 return 1;
242
243 default:
244 return 0;
245 }
246}
247
248
250{
251 if ( type == DisplacementVector || type == EigenVector || type == VelocityVector || type == DirectorField || type == MacroSlipVector || type == ResidualForce ) {
252 return ISVT_VECTOR;
253 } else if ( type == FluxVector || type == PressureVector || type == Temperature || type == Humidity || type == DeplanationFunction || type == Concentration ) {
254 return ISVT_SCALAR;
255 } else {
256 OOFEM_ERROR( "unsupported UnknownType %s", __UnknownTypeToString(type) );
257 }
258}
259
260
261ContextIOERR :: ContextIOERR(contextIOResultType e, const char *file, int line) :
262 error(e),
263 msg(nullptr),
264 file(file),
265 line(line)
266{
267 this->full_message = "ContextIOERR " + std::to_string(error) + " at line " + std::to_string(line) + " in file \"" + file + "\"";
268}
269
270ContextIOERR :: ContextIOERR(contextIOResultType e, const char *msg, const char *file, int line) :
271 error(e),
272 msg(msg),
273 file(file),
274 line(line)
275{
276 this->full_message = "ContextIOERR " + std::to_string(error) + " at line " + std::to_string(line) + " in file \"" + file + "\":" + this->msg;
277}
278
279
280void
281ContextIOERR :: print()
282{
283 if ( msg ) {
284 oofem_logger.writeELogMsg(Logger :: LOG_LEVEL_ERROR, NULL, file, line,
285 "ContextIOERR encountered, error code: %d\n%s", error, msg);
286 } else {
287 oofem_logger.writeELogMsg(Logger :: LOG_LEVEL_ERROR, NULL, file, line,
288 "ContextIOERR encountered, error code: %d", error);
289 }
290 OOFEM_EXIT(1);
291}
292
293/*
294 * The enum declaration and to_string conversion
295 * inspired by X-Macros technique, as described in Wikipedia entry on C preprocessor
296 * (http://en.wikipedia.org/wiki/C_preprocessor)
297 */
298
299#define ENUM_ITEM(element) case element: return # element;
300
301#define ENUM_ITEM_WITH_VALUE(element, val) case element: return # element;
302
303#define TO_STRING_BODY(enum_def) \
304 switch ( _value ) { \
305 enum_def \
306 default: return "Unknown"; \
307 }
308
312
316
317const char *__dofTypeToString(dofType _value) {
319}
320
324
328
329std :: string __DofIDItemToString(DofIDItem _value) {
330 if ( _value >= MaxDofID ) {
331 char tmp [ 1024 ];
332 sprintf(tmp, "X_%d", _value - MaxDofID + 1);
333 return tmp;
334 }
336}
337
341
345
349
353} // end namespace oofem
contextIOResultType error
std::string full_message
const char * file
#define TO_STRING_BODY(enum_def)
Definition cltypes.C:303
#define DofIDItem_DEF
Definition dofiditem.h:43
#define OOFEM_EXIT(code)
Definition error.h:52
#define OOFEM_ERROR(...)
Definition error.h:79
@ MaxDofID
Definition dofiditem.h:117
const char * __InternalStateTypeToString(InternalStateType _value)
Definition cltypes.C:309
const char * __dofTypeToString(dofType _value)
Definition cltypes.C:317
std::string __DofIDItemToString(DofIDItem _value)
Definition cltypes.C:329
@ Element_Geometry_Type_DEF
const char * __Element_Geometry_TypeToString(Element_Geometry_Type _value)
Definition cltypes.C:325
const char * __XFEMStateTypeToString(XFEMStateType _value)
Definition cltypes.C:350
const char * __CharTypeToString(CharType _value)
Definition cltypes.C:338
int giveInternalStateTypeSize(InternalStateValueType valType)
Definition cltypes.C:229
XFEMStateType
Definition xfemmanager.h:92
@ XFEMStateType_DEF
Definition xfemmanager.h:93
@ MeshPackageType_DEF
Logger oofem_logger(Logger ::LOG_LEVEL_INFO)
Definition logger.h:131
InternalStateValueType
Determines the type of internal variable.
@ ISVT_TENSOR_S3E
symmetric 3x3 tensor, packed with off diagonal components multiplied by 2 (engineering strain vector,...
@ ISVT_SCALAR
Scalar.
@ ISVT_UNDEFINED
Undefined.
@ ISVT_TENSOR_S3
Symmetric 3x3 tensor.
@ ISVT_VECTOR
Vector.
@ ISVT_TENSOR_G
General tensor.
dofType
Dof Type, determines the type of DOF created.
Definition doftype.h:48
@ dofType_DEF
Definition doftype.h:49
@ InternalStateType_DEF
const char * __UnknownTypeToString(UnknownType _value)
Definition cltypes.C:313
char cltypesGiveUnknownTypeModeKey(ValueModeType mode)
Definition cltypes.C:57
@ CharType_DEF
Definition chartype.h:142
const char * __domainTypeToString(domainType _value)
Definition cltypes.C:321
InternalStateValueType giveInternalStateValueType(InternalStateType type)
Definition cltypes.C:75
const char * __MeshPackageTypeToString(MeshPackageType _value)
Definition cltypes.C:346
@ UnknownType_DEF
Definition unknowntype.h:60
const char * __MaterialMappingAlgorithmTypeToString(MaterialMappingAlgorithmType _value)
Definition cltypes.C:342
@ domainType_DEF
Definition domaintype.h:69

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011