OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
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 - 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 
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 
44 namespace oofem {
46 {
47  timeFunction = 0;
49  set = 0;
50 }
51 
52 
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 
62 }
63 
64 
67 {
68  IRResultType result; // Required by IR_GIVE_FIELD macro
69 
71  if ( timeFunction <= 0 ) {
72  OOFEM_WARNING("bad TimeFunction id");
73  return IRRT_BAD_FORMAT;
74  }
75 
76  int val = 0;
78  valType = ( bcValType ) val;
79 
80  dofs.clear();
82 
85 
86  set = 0;
88 
89  return IRRT_OK;
90 }
91 
93 {
94  // Returns a value of isImposedTimeFunction, indicating whether b.c. is imposed or not
95  // in given time (nonzero indicates imposed b.c.).
96 
97  if ( isImposedTimeFunction ) {
99  } else {
100  // zero value indicates default behavior -> b.c. is imposed
101  // anytime
102  return true;
103  }
104 }
105 
106 
107 void
109 {
112 
113  if ( ( int ) this->giveBCValType() > 0 ) {
115  }
116 
117  if ( this->giveDofIDs().giveSize() > 0 ) {
119  }
120 
121  if ( this->isImposedTimeFunction > 0 ) {
123  }
124 
125  if ( this->giveSetNumber() > 0 ) {
127  }
128 }
129 
132 {
133  if ( mode & CM_Definition ) {
134  if ( !stream.write(timeFunction) ) {
136  }
137  }
138 
139  return CIO_OK;
140 }
141 
142 
145 {
146  if ( mode & CM_Definition ) {
147  if ( !stream.read(timeFunction) ) {
149  }
150  }
151 
152  return CIO_OK;
153 }
154 } // end namespace oofem
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
virtual bool isImposed(TimeStep *tStep)
Returns nonzero if receiver representing BC is imposed at given time, otherwise returns zero...
void setField(int item, InputFieldType id)
#define _IFT_GeneralBoundaryCondition_valType
Class and object Domain.
Definition: domain.h:115
#define _IFT_GeneralBoundaryCondition_dofs
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition: femcmpnn.h:82
bcValType
Type determining the type of general boundary condition.
Definition: bcvaltype.h:40
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
virtual const IntArray & giveDofIDs() const
Array with default dofs which b.c.
General IO error.
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Definition: femcmpnn.C:77
virtual int read(int *data, int count)=0
Reads count integer values into array pointed by data.
#define THROW_CIOERR(e)
Definition: contextioerr.h:61
#define _IFT_GeneralBoundaryCondition_timeFunct
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual int write(const int *data, int count)=0
Writes count integer values from array pointed by data.
int giveSetNumber()
Gives the set number which boundary condition is applied to.
#define OOFEM_ERROR(...)
Definition: error.h:61
void clear()
Clears the array (zero size).
Definition: intarray.h:177
bcValType valType
Physical meaning of BC value.
#define _IFT_GeneralBoundaryCondition_isImposedTimeFunct
int timeFunction
Associated load time function.
IntArray dofs
Dofs that b.c. is applied to (relevant for Dirichlet type b.c.s).
double giveIntrinsicTime()
Returns intrinsic time, e.g. time in which constitutive model is evaluated.
Definition: timestep.h:148
Function * giveFunction(int n)
Service for accessing particular domain load time function.
Definition: domain.C:268
Abstract base class representing a function with vector input and output.
Definition: function.h:88
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
int isImposedTimeFunction
Zero by default - the BC is than always imposed.
Class representing the general Input Record.
Definition: inputrecord.h:101
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
#define CM_Definition
Definition: contextmode.h:47
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
the oofem namespace is to define a context or scope in which all oofem names are defined.
#define _IFT_GeneralBoundaryCondition_set
virtual bcValType giveBCValType() const
Returns receiver load type.
#define IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
virtual double evaluateAtTime(double t)
Returns the value of the function at given time.
Definition: function.C:76
#define OOFEM_WARNING(...)
Definition: error.h:62
Class representing solution step.
Definition: timestep.h:80
The top abstract class of all classes constituting the finite element mesh.
Definition: femcmpnn.h:76
GeneralBoundaryCondition(int n, Domain *d)
Constructor.

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