OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
crosssection.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 "crosssection.h"
36 #include "dictionary.h"
37 #include "dynamicinputrecord.h"
38 #include "gausspoint.h"
39 #include "material.h"
40 #include "contextioerr.h"
41 #include "gaussintegrationrule.h"
42 
43 namespace oofem {
44 
45 CrossSection :: CrossSection(int n, Domain* d) : FEMComponent(n, d), propertyDictionary(), setNumber(0)
46 {
47 }
48 
50 {
51 }
52 
53 int
55 {
56  return irule.setUpIntegrationPoints( element->giveIntegrationDomain(), npoints, element->giveMaterialMode() );
57 }
58 
59 
60 int
61 CrossSection :: setupIntegrationPoints(IntegrationRule &irule, int npointsXY, int npointsZ, Element *element)
62 {
63  return irule.setUpIntegrationPoints( element->giveIntegrationDomain(), npointsXY, npointsZ, element->giveMaterialMode() );
64 }
65 
68 //
69 // instanciates receiver from input record
70 //
71 {
72  IRResultType result; // Required by IR_GIVE_FIELD macro
73 
74  // Read set number the cross section is applied to
75  this->setNumber = 0;
77 
78  return IRRT_OK;
79 }
80 
81 void
83 {
86 }
87 
88 int
90 {
91  if ( type == IST_CrossSectionNumber ) {
92  answer.resize(1);
93  answer.at(1) = this->giveNumber();
94  return 1;
95  }
96  return ip->giveMaterial()->giveIPValue(answer, ip, type, tStep);
97 }
98 
99 
100 void
102 // Prints the receiver on screen.
103 {
104  printf("Cross Section with properties : \n");
106 }
107 
108 
111 //
112 // saves full material context (saves state variables, that completely describe
113 // current state)
114 //
115 {
116  contextIOResultType iores;
117  Material *mat = this->giveMaterial(gp);
118 
119  if ( ( iores = mat->saveIPContext(stream, mode, gp) ) != CIO_OK ) {
120  THROW_CIOERR(iores);
121  }
122 
123  return CIO_OK;
124 }
125 
126 
129 //
130 // restores full material context (saves state variables, that completely describe
131 // current state)
132 //
133 {
134  contextIOResultType iores;
135  Material *mat = this->giveMaterial(gp);
136 
137  if ( ( iores = mat->restoreIPContext(stream, mode, gp) ) != CIO_OK ) {
138  THROW_CIOERR(iores);
139  }
140 
141  return CIO_OK;
142 }
143 
144 bool
146 {
147  return propertyDictionary.includes(aProperty);
148 }
149 
150 double
152 // Returns the value of the property aProperty of the receiver.
153 {
154  if ( propertyDictionary.includes(aProperty) ) {
155  return propertyDictionary.at(aProperty);
156  } else {
157  OOFEM_ERROR("Undefined property ID %d", aProperty);
158  }
159 
160  return 0.0;
161 }
162 
163 double
164 CrossSection :: give(CrossSectionProperty aProperty, const FloatArray &coords, Element *elem, bool local)
165 // Returns the value of the property aProperty of the receiver.
166 {
167  if ( propertyDictionary.includes(aProperty) ) {
168  return propertyDictionary.at(aProperty);
169  } else {
170  OOFEM_ERROR("Undefined property ID %d", aProperty);
171  }
172 
173  return 0.0;
174 }
175 
176 
177 double
179 {
181 }
182 
183 } // end namespace oofem
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
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
void printYourself()
Prints the receiver on screen.
Definition: dictionary.C:145
Class and object Domain.
Definition: domain.h:115
#define _IFT_CrossSection_SetNumber
Definition: crosssection.h:50
virtual contextIOResultType saveIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
Stores integration point state to output stream.
Definition: material.C:173
double & at(int aKey)
Returns the value of the pair which key is aKey.
Definition: dictionary.C:106
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
bool includes(int aKey)
Checks if dictionary includes given key.
Definition: dictionary.C:126
virtual double giveRelativeSelfComputationalCost()
Returns the weight representing relative computational cost of receiver The reference element is inte...
Definition: crosssection.h:260
virtual contextIOResultType restoreIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
Reads integration point state to output stream.
Definition: crosssection.C:128
Abstract base class for all finite elements.
Definition: element.h:145
virtual MaterialMode giveMaterialMode()
Returns material mode for receiver integration points.
Definition: element.h:691
virtual contextIOResultType restoreIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
Reads integration point state to output stream.
Definition: material.C:204
CrossSectionProperty
List of properties possibly stored in a cross section.
Definition: crosssection.h:58
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Definition: crosssection.C:82
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Definition: femcmpnn.C:77
#define THROW_CIOERR(e)
Definition: contextioerr.h:61
Abstract base class representing integration rule.
Dictionary propertyDictionary
Dictionary for storing cross section parameters (like dimensions).
Definition: crosssection.h:115
virtual ~CrossSection()
Destructor.
Definition: crosssection.C:49
#define OOFEM_ERROR(...)
Definition: error.h:61
virtual double predictRelativeComputationalCost(GaussPoint *gp)
Returns the weight representing relative computational cost of receiver The reference material model ...
Definition: material.h:304
Material * giveMaterial()
Returns reference to material associated to related element of receiver.
Definition: gausspoint.h:197
Abstract base class for all material models.
Definition: material.h:95
virtual contextIOResultType saveIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
Stores integration point state to output stream.
Definition: crosssection.C:110
virtual int setupIntegrationPoints(IntegrationRule &irule, int npoints, Element *element)
Sets up integration rule for the given element.
Definition: crosssection.C:54
virtual integrationDomain giveIntegrationDomain() const
Returns integration domain for receiver, used to initialize integration point over receiver volume...
Definition: element.C:1521
Class representing vector of real numbers.
Definition: floatarray.h:82
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
virtual double give(CrossSectionProperty a, GaussPoint *gp)
Returns the value of cross section property at given point.
Definition: crosssection.C:151
virtual int giveIPValue(FloatArray &answer, GaussPoint *ip, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in Reduced form.
Definition: crosssection.C:89
virtual bool hasProperty(CrossSectionProperty a)
Returns true if the dictionary contains the requested property.
Definition: crosssection.C:145
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual double predictRelativeComputationalCost(GaussPoint *ip)
Returns the weight representing relative computational cost of receiver The reference cross section i...
Definition: crosssection.C:178
CrossSection(int n, Domain *d)
Constructor.
Definition: crosssection.C:45
Class representing the a dynamic Input Record.
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
int setUpIntegrationPoints(integrationDomain intdomain, int nPoints, MaterialMode matMode)
Initializes the receiver.
#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
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in Reduced form.
Definition: material.C:142
The top abstract class of all classes constituting the finite element mesh.
Definition: femcmpnn.h:76
virtual void printYourself()
Prints receiver state on stdout. Useful for debugging.
Definition: crosssection.C:101
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631
virtual Material * giveMaterial(IntegrationPoint *ip)=0
Returns the material associated with the GP.

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