OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
simpleslavedof.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 "simpleslavedof.h"
36 #include "dofmanager.h"
37 #include "domain.h"
38 #include "datastream.h"
40 #include "contextioerr.h"
41 
42 namespace oofem {
43 SimpleSlaveDof :: SimpleSlaveDof(DofManager *aNode, int master, DofIDItem id) : Dof(aNode, id)
44 {
45  masterDofMngr = master;
46  masterDofIndx = -1;
47 }
48 
49 
51 {
52  masterDofMngr = -1;
53  masterDofIndx = -1;
54 }
55 
56 
58 {
59  // returns reference to master dof
60  // checks dof compatibility and slave to slave references
61 
63 }
64 
66 // Returns the boundary condition the receiver is subjected to.
67 {
68  return this->giveMasterDof()->giveBc();
69 }
70 
71 
73 // Returns the number of the equation in the governing system of equations that corres-
74 // ponds to the receiver. The equation number is 0 if the receiver is
75 // subjected to a boundary condition, else it is n+1, where n is the
76 // equation number of the most recently numbered degree of freedom.
77 {
78  return this->giveMasterDof()->__giveEquationNumber();
79 }
80 
82 // Returns the number of the equation in the governing system of equations that corres-
83 // ponds to the receiver. The equation number is 0 if the receiver is
84 // subjected to a boundary condition, else it is n+1, where n is the
85 // equation number of the most recently numbered degree of freedom.
86 {
88 }
89 
91 // Returns the initial condition on the receiver. Not used.
92 {
93  return this->giveMasterDof()->giveIc();
94 }
95 
96 
98 {
99  return this->giveMasterDof()->giveUnknown(mode, tStep);
100 }
101 
103 {
104  return this->giveMasterDof()->giveUnknown(field, mode, tStep);
105 }
106 
107 
109 // Returns True if the receiver is subjected to a boundary condition, else
110 // returns False. If necessary, reads the answer in the data file.
111 {
112  return this->giveMasterDof()->hasBc(tStep);
113 }
114 
115 
117 // Returns True if the receiver is subjected to an initial condition,
118 // else returns False.
119 {
120  return this->giveMasterDof()->hasIc();
121 }
122 
123 
125 // Returns True if the unknown 'u' (e.g., the displacement 'd') of the
126 // receiver is subjected to an initial condition, else returns False.
127 {
128  return this->giveMasterDof()->hasIcOn(u);
129 }
130 
132 {
133  return this->giveMasterDof()->giveBcId();
134 }
135 
137 {
138  return this->giveMasterDof()->giveIcId();
139 }
140 
141 
142 double
144 {
145  return this->giveMasterDof()->giveBcValue(mode, tStep);
146 }
147 
148 
150 //
151 // saves full node context (saves state variables, that completely describe
152 // current state)
153 //
154 {
155  contextIOResultType iores;
156  if ( ( iores = Dof :: saveContext(stream, mode, obj) ) != CIO_OK ) {
157  THROW_CIOERR(iores);
158  }
159 
160  if ( mode & CM_Definition ) {
161 
162  if ( mode & CM_DefinitionGlobal ) {
164  if ( !stream.write(_masterGlobNum) ) {
166  }
167  } else {
168  if ( !stream.write(masterDofMngr) ) {
170  }
171  }
172  }
173 
174  return CIO_OK;
175 }
176 
177 
179 //
180 // restores full node context (saves state variables, that completely describe
181 // current state)
182 //
183 {
184  contextIOResultType iores;
185 
186  if ( ( iores = Dof :: restoreContext(stream, mode, obj) ) != CIO_OK ) {
187  THROW_CIOERR(iores);
188  }
189 
190  if ( mode & CM_Definition ) {
191  if ( !stream.read(masterDofMngr) ) {
193  }
194  }
195 
196  this->masterDofIndx = -1;
197 
198 
199  return CIO_OK;
200 }
201 
202 void
204 {
206 }
207 } // end namespace oofem
virtual bool hasIc()=0
Test if Dof has initial condition.
virtual int giveIcId()=0
Returns the id of associated initial condition, if there is any.
Class implementing general initial condition.
int giveGlobalNumber() const
Definition: dofmanager.h:501
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Abstract class representing field of primary variables (those, which are unknown and are typically as...
Definition: primaryfield.h:104
virtual int giveIcId()
Returns the id of associated initial condition, if there is any.
virtual bool hasIc()
Test if Dof has initial condition.
BoundaryCondition * giveBc()
Returns boundary condition of dof if it is prescribed.
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
SimpleSlaveDof(DofManager *aNode, int master, DofIDItem id)
Constructor.
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
InitialCondition * giveIc()
Returns initial condition of dof if it is prescribed.
virtual double giveBcValue(ValueModeType mode, TimeStep *tStep)
Returns value of boundary condition of dof if it is prescribed.
virtual double giveUnknown(ValueModeType mode, TimeStep *tStep)=0
The key method of class Dof.
virtual int giveBcId()
Returns the id of associated boundary condition, if there is any.
virtual int __givePrescribedEquationNumber()
Returns prescribed equation number corresponding to receiver.
virtual int __giveEquationNumber() const
Returns equation number corresponding to receiver.
Base class for dof managers.
Definition: dofmanager.h:113
virtual InitialCondition * giveIc()
Returns initial condition of dof if it is prescribed.
Definition: dof.h:453
General IO error.
virtual int __giveEquationNumber() const =0
Returns equation number of receiver, usually assigned by emodel.
virtual int read(int *data, int count)=0
Reads count integer values into array pointed by data.
virtual int __givePrescribedEquationNumber()=0
Returns prescribed equation number of receiver.
#define THROW_CIOERR(e)
Definition: contextioerr.h:61
virtual BoundaryCondition * giveBc()
Returns boundary condition of dof if it is prescribed.
Definition: dof.h:448
virtual int write(const int *data, int count)=0
Writes count integer values from array pointed by data.
virtual int giveBcId()=0
Returns the id of associated boundary condition, if there is any.
Class implementing Dirichlet boundary condition on DOF (primary boundary condition).
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
DofIDItem
Type representing particular dof type.
Definition: dofiditem.h:86
DofManager * dofManager
Link to related DofManager.
Definition: dof.h:97
virtual bool hasIcOn(ValueModeType u)=0
Test if Dof has initial condition of required ValueModeType.
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Definition: dof.C:136
DofIDItem dofID
Physical meaning of DOF.
Definition: dof.h:99
#define CM_DefinitionGlobal
Definition: contextmode.h:48
int masterDofMngr
Number of DofManager containing master dof (Master DofManager)
virtual double giveUnknown(ValueModeType, TimeStep *)
The key method of class Dof.
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
Definition: dof.C:148
Dof * giveDofWithID(int dofID) const
Returns DOF with given dofID; issues error if not present.
Definition: dofmanager.C:119
virtual double giveBcValue(ValueModeType mode, TimeStep *tStep)
Returns value of boundary condition of dof if it is prescribed.
Definition: dof.C:120
int masterDofIndx
Number of master dof in master dofManager.
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
Dof * giveMasterDof() const
Returns reference to master dof.
#define CM_Definition
Definition: contextmode.h:47
virtual bool hasBc(TimeStep *tStep)=0
Test if Dof has active boundary condition.
Domain * giveDomain() const
Definition: femcmpnn.h:100
virtual bool hasIcOn(ValueModeType)
Test if Dof has initial condition of required ValueModeType.
the oofem namespace is to define a context or scope in which all oofem names are defined.
Abstract class Dof represents Degree Of Freedom in finite element mesh.
Definition: dof.h:93
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
Definition: domain.C:314
virtual void updateLocalNumbering(EntityRenumberingFunctor &f)
Local renumbering support.
Class representing solution step.
Definition: timestep.h:80
virtual bool hasBc(TimeStep *tStep)
Test if Dof has active boundary condition.

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