OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
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 - 2013 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"
38 #include "internalstatevaluetype.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 
56 namespace oofem {
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  return 0;
74 }
75 
76 
78 {
79  switch ( type ) {
80  case IST_StrainTensor:
81  case IST_StrainTensorTemp:
82  case IST_DeviatoricStrain:
83  case IST_PlasticStrainTensor:
84  case IST_ThermalStrainTensor:
85  case IST_ElasticStrainTensor:
86  case IST_CylindricalStrainTensor:
87  case IST_CreepStrainTensor:
88  case IST_ShellStrainTensor:
89  case IST_CurvatureTensor:
90  case IST_CurvatureTensorTemp:
91  case IST_EigenStrainTensor:
92  return ISVT_TENSOR_S3E;
93 
94  case IST_StressTensor:
95  case IST_StressTensorTemp:
96  case IST_CylindricalStressTensor:
97  case IST_DeviatoricStress:
98  case IST_CauchyStressTensor:
99 
100  case IST_ShellForceTensor:
101  case IST_ShellForceTensorTemp:
102  case IST_ShellMomentTensor:
103  case IST_MomentTensor:
104  case IST_MomentTensorTemp:
105 
107  case IST_AutogenousShrinkageTensor:
108  case IST_DryingShrinkageTensor:
109  case IST_TotalShrinkageTensor:
110 
111  // Damage tensors
112  case IST_DamageTensor:
113  case IST_DamageTensorTemp:
114  case IST_DamageInvTensor:
115  case IST_DamageInvTensorTemp:
116  case IST_PrincipalDamageTensor:
117  case IST_PrincipalDamageTempTensor:
118  return ISVT_TENSOR_S3;
119 
120  case IST_DeformationGradientTensor:
121  case IST_FirstPKStressTensor:
122  //case IST_MaterialOrientation:
123  return ISVT_TENSOR_G;
124 
125  case IST_BeamForceMomentTensor:
126  case IST_BeamStrainCurvatureTensor:
127  case IST_PrincipalStressTensor:
128  case IST_PrincipalStressTempTensor:
129  case IST_PrincipalStrainTensor:
130  case IST_PrincipalStrainTempTensor:
131  case IST_PrincipalPlasticStrainTensor:
132  case IST_DisplacementVector:
133  case IST_DisplacementVectorTemp:
134  case IST_CrackState:
135  case IST_CrackStateTemp:
136  case IST_MicroplaneDamageValues:
137  case IST_Velocity:
138  case IST_MaterialOrientation_x:
139  case IST_MaterialOrientation_y:
140  case IST_MaterialOrientation_z:
141  case IST_TemperatureFlow:
142  case IST_MassConcentrationFlow_1:
143  case IST_HumidityFlow:
144  case IST_CrackDirs:
145  case IST_CrackStatuses:
146  case IST_CrackVector:
147  case IST_2ndCrackVector:
148  case IST_3rdCrackVector:
149  case IST_InterfaceFirstPKTraction:
150  case IST_InterfaceTraction:
151  case IST_InterfaceJump:
152  case IST_InterfaceNormal:
153  case IST_PrincStressVector1:
154  case IST_PrincStressVector2:
155  case IST_PrincStressVector3:
156  return ISVT_VECTOR;
157 
158  case IST_MaxEquivalentStrainLevel:
159  case IST_ErrorIndicatorLevel:
160  case IST_InternalStressError:
161  case IST_PrimaryUnknownError:
162  case IST_RelMeshDensity:
163  case IST_Temperature:
164  case IST_MassConcentration_1:
165  case IST_HydrationDegree:
166  case IST_Humidity:
167  case IST_Pressure:
168  case IST_VOFFraction:
169  case IST_Density:
170  case IST_MaterialInterfaceVal:
171  case IST_MaterialNumber:
172  case IST_ElementNumber:
173  case IST_BoneVolumeFraction:
174  case IST_PlasStrainEnerDens:
175  case IST_ElasStrainEnerDens:
176  case IST_TotalStrainEnerDens:
177  case IST_DamageScalar:
178  case IST_CrackedFlag:
179  case IST_CumPlasticStrain:
180  case IST_CumPlasticStrain_2:
181  case IST_StressWorkDensity:
182  case IST_DissWorkDensity:
183  case IST_FreeEnergyDensity:
184  case IST_ThermalConductivityIsotropic:
185  case IST_HeatCapacity:
186  case IST_AverageTemperature:
187  case IST_YoungModulusVirginPaste:
188  case IST_PoissonRatioVirginPaste:
189  case IST_YoungModulusConcrete:
190  case IST_PoissonRatioConcrete:
191  case IST_VolumetricPlasticStrain:
192  case IST_Viscosity:
193  case IST_DeviatoricStrainMeasure:
194  case IST_DeviatoricStressMeasure:
195  case IST_vonMisesStress:
196  case IST_XFEMEnrichment:
197  case IST_XFEMNumIntersecPoints:
198  case IST_XFEMLevelSetPhi:
199  case IST_Maturity:
200  case IST_CrossSectionNumber:
201  case IST_CrackWidth:
202  case IST_2ndCrackWidth:
203  case IST_3rdCrackWidth:
204  case IST_TensileStrength:
205  case IST_ResidualTensileStrength:
206  case IST_CrackIndex:
207  case IST_FiberStressNL:
208  case IST_FiberStressLocal:
209  return ISVT_SCALAR;
210 
211  default:
212  return ISVT_UNDEFINED;
213  }
214 }
215 
216 
218 {
219  switch ( valType ) {
220  case ISVT_TENSOR_S3:
221  case ISVT_TENSOR_S3E:
222  case ISVT_TENSOR_G:
223  return 9;
224 
225  case ISVT_VECTOR:
226  return 3;
227 
228  case ISVT_SCALAR:
229  return 1;
230 
231  default:
232  return 0;
233  }
234 }
235 
236 
238 {
239  if ( type == DisplacementVector || type == EigenVector || type == VelocityVector || type == DirectorField ) {
240  return ISVT_VECTOR;
241  } else if ( type == FluxVector || type == PressureVector || type == Temperature || type == Humidity || type == DeplanationFunction ) {
242  return ISVT_SCALAR;
243  } else {
244  OOFEM_ERROR( "unsupported UnknownType %s", __UnknownTypeToString(type) );
245  return ISVT_SCALAR; // To make compiler happy.
246  }
247 }
248 
249 
250 ContextIOERR :: ContextIOERR(contextIOResultType e, const char *file, int line)
251 {
252  error = e;
253  this->file = file;
254  this->line = line;
255  this->msg = NULL;
256 }
257 
259 {
260  error = e;
261  this->file = file;
262  this->line = line;
263  this->msg = msg;
264 }
265 
267 
268 
269 void
271 {
272  if ( msg ) {
274  "ContextIOERR encountered, error code: %d\n%s", error, msg);
275  } else {
277  "ContextIOERR encountered, error code: %d", error);
278  }
279  OOFEM_EXIT(1);
280 }
281 
282 /*
283  * The enum declaration and to_string conversion
284  * inspired by X-Macros technique, as described in Wikipedia entry on C preprocessor
285  * (http://en.wikipedia.org/wiki/C_preprocessor)
286  */
287 
288 #define ENUM_ITEM(element) case element: return # element;
289 
290 #define ENUM_ITEM_WITH_VALUE(element, val) case element: return # element;
291 
292 #define TO_STRING_BODY(enum_def) \
293  switch ( _value ) { \
294  enum_def \
295  default: return "Unknown"; \
296  }
297 
300 }
301 
302 const char *__UnknownTypeToString(UnknownType _value) {
304 }
305 
306 const char *__dofTypeToString(dofType _value) {
308 }
309 
310 const char *__domainTypeToString(domainType _value) {
312 }
313 
316 }
317 
320 }
321 
324 }
325 
328 }
329 
330 std :: string __DofIDItemToString(DofIDItem _value) {
331  if ( _value >= MaxDofID ) {
332  char tmp [ 1024 ];
333  sprintf(tmp, "X_%d", _value - MaxDofID + 1);
334  return tmp;
335  }
337 }
338 
339 const char *__CharTypeToString(CharType _value) {
341 }
342 
345 }
346 
349 }
350 
353 }
354 } // end namespace oofem
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
const char * file
Definition: contextioerr.h:49
const char * msg
Definition: contextioerr.h:49
Element_Geometry_Type
Enumerative type used to classify element geometry Possible values are: EGT_point - point in space EG...
contextIOResultType error
Definition: contextioerr.h:48
ContextIOERR(contextIOResultType e, const char *file, int line)
Definition: cltypes.C:250
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
const char * __MatResponseModeToString(MatResponseMode _value)
Definition: cltypes.C:326
dofType
Dof Type, determines the type of DOF created.
Definition: doftype.h:48
InternalStateValueType
Determines the type of internal variable.
symmetric 3x3 tensor, packed with off diagonal components multiplied by 2 (engineering strain vector...
MaterialMode
Type representing material mode of integration point.
Definition: materialmode.h:89
MatResponseMode
Describes the character of characteristic material matrix.
const char * __UnknownTypeToString(UnknownType _value)
Definition: cltypes.C:302
int giveInternalStateTypeSize(InternalStateValueType valType)
Definition: cltypes.C:217
void writeELogMsg(logLevelType level, const char *_func, const char *_file, int _line, const char *format,...)
Writes extended log message with file and line info.
Definition: logger.C:265
const char * __MaterialModeToString(MaterialMode _value)
Definition: cltypes.C:314
const char * __domainTypeToString(domainType _value)
Definition: cltypes.C:310
#define OOFEM_ERROR(...)
Definition: error.h:61
#define DofIDItem_DEF
Definition: dofiditem.h:43
DofIDItem
Type representing particular dof type.
Definition: dofiditem.h:86
UnknownType
Type representing particular unknown (its physical meaning).
Definition: unknowntype.h:55
const char * __CharTypeToString(CharType _value)
Definition: cltypes.C:339
const char * __MeshPackageTypeToString(MeshPackageType _value)
Definition: cltypes.C:347
MaterialMappingAlgorithmType
Enumerative type used to classify supported MaterialMappingAlgorithms.
Logger oofem_logger(Logger::LOG_LEVEL_INFO)
Definition: logger.h:115
const char * __MaterialMappingAlgorithmTypeToString(MaterialMappingAlgorithmType _value)
Definition: cltypes.C:343
Symmetric 3x3 tensor.
const char * __XFEMStateTypeToString(XFEMStateType _value)
Definition: cltypes.C:351
#define OOFEM_EXIT(code)
Cause oofem program termination by calling exit.
Definition: error.h:50
CharType
Definition: chartype.h:87
XFEMStateType
Definition: xfemmanager.h:92
const char * __Element_Geometry_TypeToString(Element_Geometry_Type _value)
Definition: cltypes.C:318
std::string __DofIDItemToString(DofIDItem _value)
Definition: cltypes.C:330
MeshPackageType
Enumerative type used to classify supported mesh packages.
const char * __InternalStateTypeToString(InternalStateType _value)
Definition: cltypes.C:298
InternalStateValueType giveInternalStateValueType(InternalStateType type)
Definition: cltypes.C:77
char cltypesGiveUnknownTypeModeKey(ValueModeType mode)
Definition: cltypes.C:57
domainType
Definition: domaintype.h:72
the oofem namespace is to define a context or scope in which all oofem names are defined.
const char * __dofTypeToString(dofType _value)
Definition: cltypes.C:306
#define TO_STRING_BODY(enum_def)
Definition: cltypes.C:292
const char * __ValueModeTypeToString(ValueModeType _value)
Definition: cltypes.C:322

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:27 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011