OOFEM 3.0
Loading...
Searching...
No Matches
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 - 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 "crosssection.h"
36#include "dictionary.h"
37#include "dynamicinputrecord.h"
38#include "gausspoint.h"
39#include "material.h"
40#include "contextioerr.h"
41#include "datastream.h"
43
44namespace oofem {
45
46CrossSection :: CrossSection(int n, Domain* d) : FEMComponent(n, d), propertyDictionary(), setNumber(0)
47{
48}
49
50CrossSection :: ~CrossSection()
51{
52}
53
54int
55CrossSection :: setupIntegrationPoints(IntegrationRule &irule, int npoints, Element *element)
56{
57 return irule.setUpIntegrationPoints( element->giveIntegrationDomain(), npoints, element->giveMaterialMode() );
58}
59
60
61int
62CrossSection :: setupIntegrationPoints(IntegrationRule &irule, int npointsXY, int npointsZ, Element *element)
63{
64 return irule.setUpIntegrationPoints( element->giveIntegrationDomain(), npointsXY, npointsZ, element->giveMaterialMode() );
65}
66
67void
68CrossSection :: initializeFrom(InputRecord &ir)
69{
70 // Read set number the cross section is applied to
71 this->setNumber = 0;
73}
74
75void
76CrossSection :: giveInputRecord(DynamicInputRecord &input)
77{
78 FEMComponent :: giveInputRecord(input);
80}
81
82int
83CrossSection :: giveIPValue(FloatArray &answer, GaussPoint *ip, InternalStateType type, TimeStep *tStep)
84{
85 if ( type == IST_CrossSectionNumber ) {
86 answer.resize(1);
87 answer.at(1) = this->giveNumber();
88 return 1;
89 }
90 return this->giveMaterial(ip)->giveIPValue(answer, ip, type, tStep);
91}
92
93
94void
95CrossSection :: printYourself()
96// Prints the receiver on screen.
97{
98 printf("Cross Section with properties : \n");
99 propertyDictionary.printYourself();
100}
101
102
103void
104CrossSection :: saveIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
105{
106 Material *mat = this->giveMaterial(gp);
107 mat->saveIPContext(stream, mode, gp);
108}
109
110
111void
112CrossSection :: restoreIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
113{
114 Material *mat = this->giveMaterial(gp);
115 mat->restoreIPContext(stream, mode, gp);
116}
117
118bool
119CrossSection :: hasProperty(CrossSectionProperty aProperty)
120{
121 return propertyDictionary.includes(aProperty);
122}
123
124double
125CrossSection :: give(CrossSectionProperty aProperty, GaussPoint *gp) const
126// Returns the value of the property aProperty of the receiver.
127{
128 if ( propertyDictionary.includes(aProperty) ) {
129 return propertyDictionary.at(aProperty);
130 } else {
131 OOFEM_ERROR("Undefined property ID %d", aProperty);
132 }
133
134 //return 0.0;
135}
136
137double
138CrossSection :: give(CrossSectionProperty aProperty, const FloatArray &coords, Element *elem, bool local) const
139// Returns the value of the property aProperty of the receiver.
140{
141 if ( propertyDictionary.includes(aProperty) ) {
142 return propertyDictionary.at(aProperty);
143 } else {
144 OOFEM_ERROR("Undefined property ID %d", aProperty);
145 }
146
147 // return 0.0;
148}
149
150
151double
152CrossSection :: predictRelativeComputationalCost(GaussPoint *gp)
153{
154 return this->giveRelativeSelfComputationalCost() * this->giveMaterial(gp)->predictRelativeComputationalCost(gp);
155}
156
157
158void CrossSection :: saveContext(DataStream &stream, ContextMode mode)
159{
160 FEMComponent :: saveContext(stream, mode);
161
162 if ( ( mode & CM_Definition ) ) {
163 propertyDictionary.saveContext (stream) ;
164
165 if ( !stream.write(setNumber) ) {
167 }
168 }
169}
170
171
172void CrossSection :: restoreContext(DataStream &stream, ContextMode mode)
173{
174 FEMComponent :: restoreContext(stream, mode);
175
176 if ( mode & CM_Definition ) {
177 propertyDictionary.restoreContext(stream);
178
179 if ( !stream.read(setNumber) ) {
181 }
182 }
183}
184
185} // end namespace oofem
virtual Material * giveMaterial(IntegrationPoint *ip) const =0
hidden by virtual oofem::Material* TransportCrossSection::giveMaterial() const
virtual double giveRelativeSelfComputationalCost()
Dictionary propertyDictionary
virtual int read(int *data, std::size_t count)=0
Reads count integer values into array pointed by data.
virtual int write(const int *data, std::size_t count)=0
Writes count integer values from array pointed by data.
void setField(int item, InputFieldType id)
virtual MaterialMode giveMaterialMode()
Definition element.h:738
virtual integrationDomain giveIntegrationDomain() const
Definition element.C:1693
int giveNumber() const
Definition femcmpnn.h:104
FEMComponent(int n, Domain *d)
Definition femcmpnn.h:88
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
int setUpIntegrationPoints(integrationDomain intdomain, int nPoints, MaterialMode matMode)
virtual void restoreIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
Definition material.C:182
virtual void saveIPContext(DataStream &stream, ContextMode mode, GaussPoint *gp)
Definition material.C:169
#define THROW_CIOERR(e)
#define CM_Definition
Definition contextmode.h:47
#define _IFT_CrossSection_SetNumber
#define OOFEM_ERROR(...)
Definition error.h:79
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
long ContextMode
Definition contextmode.h:43
CrossSectionProperty
List of properties possibly stored in a cross section.
@ CIO_IOERR
General IO error.

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