OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
variablecrosssection.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 "../sm/CrossSections/variablecrosssection.h"
36 #include "../sm/Materials/structuralmaterial.h"
37 #include "../sm/Materials/structuralms.h"
38 #include "gausspoint.h"
39 #include "floatarray.h"
40 #include "classfactory.h"
41 #include "dynamicinputrecord.h"
42 #include "scalarfunction.h"
43 #include "function.h"
44 
45 #include <string>
46 #include <sstream>
47 
48 namespace oofem {
49 REGISTER_CrossSection(VariableCrossSection);
50 
51 
54 //
55 // instanciates receiver from input record
56 //
57 {
58  IRResultType result; // Required by IR_GIVE_FIELD macro
59 
62  }
63 
66  }
67 
70  }
71 
74  }
75 
78  }
79 
82  }
83 
86  }
87 
90  }
91 
94  }
95 
98  }
99 
102  }
103 
105 
106  directorxExpr.setValue(0.0);
109  }
110 
111  directoryExpr.setValue(0.0);
114  }
115 
116  directorzExpr.setValue(1.0);
119  }
120 
121  // will read density and other inheritted parameters as constants
122  // NOTE: do not call SimpleCrossSection here (as the parameter names are same, but different type is used here!!!!)
124 
125 }
126 
127 
129 {
131 
147 }
148 
149 void
151 {
152  if ( aProperty == CS_Thickness ) {
153  * expr = & thicknessExpr;
154  } else if ( aProperty == CS_Width ) {
155  * expr = & widthExpr;
156  } else if ( aProperty == CS_Area ) {
157  * expr = & areaExpr;
158  } else if ( aProperty == CS_TorsionMomentX ) {
159  * expr = & ixExpr;
160  } else if ( aProperty == CS_InertiaMomentY ) {
161  * expr = & iyExpr;
162  } else if ( aProperty == CS_InertiaMomentZ ) {
163  * expr = & izExpr;
164  } else if ( aProperty == CS_ShearAreaY ) {
165  * expr = & shearAreayExpr;
166  } else if ( aProperty == CS_ShearAreaZ ) {
167  * expr = & shearAreazExpr;
168  } else if ( aProperty == CS_DrillingStiffness ) {
169  * expr = & drillingStiffnessExpr;
170  } else if ( aProperty == CS_RelDrillingStiffness ) {
171  * expr = & relDrillingStiffnessExpr;
172  } else if ( aProperty == CS_DrillingType ) {
173  * expr = & drillingTypeExpr;
174  } else if ( aProperty == CS_DirectorVectorX ) {
175  * expr = & directorxExpr;
176  } else if ( aProperty == CS_DirectorVectorY ) {
177  * expr = & directoryExpr;
178  } else if ( aProperty == CS_DirectorVectorZ ) {
179  * expr = & directorzExpr;
180  } else {
181  OOFEM_ERROR("called with unknown ID %d", this->giveNumber(), aProperty);
182  }
183 }
184 
185 
186 
187 double
189 {
190  return this->give(aProperty, gpx->giveNaturalCoordinates(), gpx->giveElement(), true);
191 }
192 
193 
194 double
195 VariableCrossSection :: give(CrossSectionProperty aProperty, const FloatArray &coords, Element *elem, bool local)
196 {
197  double value = 0.0;
198  const ScalarFunction *expr;
199 
200  if ( propertyDictionary.includes(aProperty) ) {
201  value = propertyDictionary.at(aProperty);
202  } else {
203  this->giveExpression(& expr, aProperty);
204 
205  FloatArray c;
206  if ( this->localFormulationFlag ) {
207  if ( local ) {
208  c = coords;
209  } else {
210  // convert given coords into local cs
211  if ( !elem->computeLocalCoordinates(c, coords) ) {
212  OOFEM_ERROR( "computeLocalCoordinates failed (element %d)", elem->giveNumber() );
213  }
214  }
215  } else { // global coordinates needed
216  if ( local ) {
217  // convert given coords into global cs
218  if ( !elem->computeGlobalCoordinates(c, coords) ) {
219  OOFEM_ERROR( "computeGlobalCoordinates failed (element %d)", elem->giveNumber() );
220  }
221  } else {
222  c = coords;
223  }
224  }
225  // evaluate the expression
226  value = expr->eval( { { "x", c } }, this->giveDomain() );
227  }
228 
229  return value;
230 }
231 } // end namespace oofem
Relative penalty stiffness for drilling DOFs.
Definition: crosssection.h:69
Shear area in z direction.
Definition: crosssection.h:67
void setField(int item, InputFieldType id)
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: crosssection.C:67
#define _IFT_SimpleCrossSection_ik
Torsion moment x.
double eval(const std::map< std::string, FunctionArgument >valDict, Domain *d, GaussPoint *gp=NULL, double param=0.) const
Evaluates the receiver.
virtual double give(CrossSectionProperty a, GaussPoint *gp)
Returns the value of cross section property at given point.
Director vector component in y-axis.
Definition: crosssection.h:75
#define _IFT_SimpleCrossSection_iz
Inertia moment z.
double & at(int aKey)
Returns the value of the pair which key is aKey.
Definition: dictionary.C:106
#define _IFT_SimpleCrossSection_shearareaz
Shear area z direction.
ScalarFunction iyExpr
Expression for cross section inertia moment $I_y$.
ScalarFunction directoryExpr
Expression for director vector component in y-axis.
#define _IFT_SimpleCrossSection_area
ScalarFunction shearAreayExpr
Expression for cross section beam shear area $A_y$.
#define _IFT_SimpleCrossSection_drillType
Type of artificially added stiffnes for drilling DOFs.
bool includes(int aKey)
Checks if dictionary includes given key.
Definition: dictionary.C:126
#define _IFT_SimpleCrossSection_iy
Inertia moment y.
ScalarFunction thicknessExpr
Expression for cross section thickness.
#define _IFT_SimpleCrossSection_MaterialNumber
Material number for the bulk material.
virtual bool hasField(InputFieldType id)=0
Returns true if record contains field identified by idString keyword.
REGISTER_CrossSection(EmptyCS)
Penalty stiffness for drilling DOFs.
Definition: crosssection.h:68
Abstract base class for all finite elements.
Definition: element.h:145
Moment of inertia around z-axis.
Definition: crosssection.h:64
Element * giveElement()
Returns corresponding element to receiver.
Definition: gausspoint.h:188
CrossSectionProperty
List of properties possibly stored in a cross section.
Definition: crosssection.h:58
#define _IFT_SimpleCrossSection_width
ScalarFunction widthExpr
Expression for cross section width.
#define _IFT_SimpleCrossSection_directorz
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Definition: crosssection.C:82
ScalarFunction ixExpr
Expression for cross section torsion moment $I_x$.
void setValue(double val)
Sets receiver to be a constant scalar function defined by given value.
#define _IFT_SimpleCrossSection_directorx
ScalarFunction directorzExpr
Expression for director vector component in z-axis.
#define _IFT_SimpleCrossSection_directory
Dictionary propertyDictionary
Dictionary for storing cross section parameters (like dimensions).
Definition: crosssection.h:115
Director vector component in z-axis.
Definition: crosssection.h:76
#define OOFEM_ERROR(...)
Definition: error.h:61
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver acording to object description stored in input record.
Moment of inertia around x-axis.
Definition: crosssection.h:65
ScalarFunction shearAreazExpr
Expression for cross section beam shear area $A_z$.
bool localFormulationFlag
if set to true, all expressions are in element local cs, otherwise are expressed in global cs ...
ScalarFunction relDrillingStiffnessExpr
Expression for cross section relative drilling stiffness.
void giveExpression(const ScalarFunction **expr, CrossSectionProperty aProperty) const
Class representing vector of real numbers.
Definition: floatarray.h:82
Shear area in y direction.
Definition: crosssection.h:66
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
Implementation of Scalar function.
#define _IFT_SimpleCrossSection_relDrillStiffness
Relative penalty term for drilling stiffness.
Class representing the general Input Record.
Definition: inputrecord.h:101
ScalarFunction drillingTypeExpr
Expression for type of artificially added stiffness.
Class representing the a dynamic Input Record.
ScalarFunction directorxExpr
Expression for director vector component in x-axis.
virtual bool computeLocalCoordinates(FloatArray &answer, const FloatArray &gcoords)
Computes the element local coordinates from given global coordinates.
Definition: element.C:1222
ScalarFunction areaExpr
Expression for cross section area.
Domain * giveDomain() const
Definition: femcmpnn.h:100
Type of artificially added drilling stiffness for drilling DOFs.
Definition: crosssection.h:70
ScalarFunction izExpr
Expression for cross section inertia moment $I_z$.
#define _IFT_SimpleCrossSection_shearareay
Shear area y direction.
#define _IFT_SimpleCrossSection_thick
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
the oofem namespace is to define a context or scope in which all oofem names are defined.
int giveNumber() const
Definition: femcmpnn.h:107
ScalarFunction drillingStiffnessExpr
Expression for cross section beam drilling stiffness.
Director vector component in x-axis.
Definition: crosssection.h:74
Moment of inertia around y-axis.
Definition: crosssection.h:63
Class representing integration point in finite element program.
Definition: gausspoint.h:93
virtual int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
Computes the global coordinates from given element&#39;s local coordinates.
Definition: element.C:1207
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
const FloatArray & giveNaturalCoordinates()
Returns coordinate array of receiver.
Definition: gausspoint.h:138
#define _IFT_SimpleCrossSection_drillStiffness
Penalty term for drilling stiffness.

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:32 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011