OOFEM 3.0
Loading...
Searching...
No Matches
generalboundarycondition.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
36#include "bcvaltype.h"
37#include "function.h"
38#include "timestep.h"
39#include "datastream.h"
40#include "contextioerr.h"
41#include "dynamicinputrecord.h"
42#include "domain.h"
43
44namespace oofem {
45GeneralBoundaryCondition :: GeneralBoundaryCondition(int n, Domain *d) : FEMComponent(n, d)
46{
47 timeFunction = 0;
49 set = 0;
50}
51
52
53Function *GeneralBoundaryCondition :: giveTimeFunction()
54// Returns the load-time function of the receiver. Reads its number in the
55// data file if has not been done yet.
56{
57 if ( !timeFunction ) {
58 OOFEM_ERROR("TimeFunction is not defined");
59 }
60
61 return domain->giveFunction(timeFunction);
62}
63
64
65void
86
87bool GeneralBoundaryCondition :: isImposed(TimeStep *tStep)
88{
89 // Returns a value of isImposedTimeFunction, indicating whether b.c. is imposed or not
90 // in given time (nonzero indicates imposed b.c.).
91
93 return ( domain->giveFunction(isImposedTimeFunction)->evaluate( tStep, VM_Total ) != 0. );
94 } else {
95 // zero value indicates default behavior -> b.c. is imposed
96 // anytime
97 return true;
98 }
99}
100
101
102void
103GeneralBoundaryCondition :: giveInputRecord(DynamicInputRecord &input)
104{
105 FEMComponent :: giveInputRecord(input);
107
108 if ( ( int ) this->giveBCValType() > 0 ) {
110 }
111
112 if ( this->giveDofIDs().giveSize() > 0 ) {
114 }
115
116 if ( this->isImposedTimeFunction > 0 ) {
118 }
119
120 if ( this->giveSetNumber() > 0 ) {
122 }
123}
124
125void
126GeneralBoundaryCondition :: saveContext(DataStream &stream, ContextMode mode)
127{
128 FEMComponent :: saveContext(stream, mode);
129
130 if ( mode & CM_Definition ) {
131 if ( !stream.write(timeFunction) ) {
133 }
134 if ( !stream.write(valType) ) {
136 }
138 if ( ( iores = dofs.storeYourself(stream) ) != CIO_OK ) {
139 THROW_CIOERR(iores);
140 }
141 if ( !stream.write(isImposedTimeFunction) ) {
143 }
144 if ( !stream.write(set) ) {
146 }
147 }
148}
149
150
151void
152GeneralBoundaryCondition :: restoreContext(DataStream &stream, ContextMode mode)
153{
154 FEMComponent :: restoreContext(stream, mode);
155
156 if ( mode & CM_Definition ) {
157 if ( !stream.read(timeFunction) ) {
159 }
160 int _val;
161 if ( !stream.read(_val) ) {
163 }
165 valType = (bcValType) _val;
166 if ( ( iores = dofs.restoreYourself(stream) ) != CIO_OK ) {
167 THROW_CIOERR(iores);
168 }
169 if ( !stream.read(isImposedTimeFunction) ) {
171 }
172 if ( !stream.read(set) ) {
174 }
175 }
176}
177} // end namespace oofem
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)
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition femcmpnn.h:79
FEMComponent(int n, Domain *d)
Definition femcmpnn.h:88
bcValType valType
Physical meaning of BC value.
int set
Set number for boundary condition to be applied to.
virtual const IntArray & giveDofIDs() const
IntArray dofs
Dofs that b.c. is applied to (relevant for Dirichlet type b.c.s).
int timeFunction
Associated load time function.
#define THROW_CIOERR(e)
#define CM_Definition
Definition contextmode.h:47
#define OOFEM_ERROR(...)
Definition error.h:79
#define _IFT_GeneralBoundaryCondition_set
#define _IFT_GeneralBoundaryCondition_timeFunct
#define _IFT_GeneralBoundaryCondition_valType
#define _IFT_GeneralBoundaryCondition_dofs
#define _IFT_GeneralBoundaryCondition_isImposedTimeFunct
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
long ContextMode
Definition contextmode.h:43
bcValType
Type determining the type of general boundary condition.
Definition bcvaltype.h:40
@ 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