OOFEM 3.0
Loading...
Searching...
No Matches
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 - 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 "simpleslavedof.h"
36#include "dofmanager.h"
37#include "domain.h"
38#include "datastream.h"
40#include "contextioerr.h"
41
42namespace oofem {
43SimpleSlaveDof :: SimpleSlaveDof(DofManager *aNode, int master, DofIDItem id) : Dof(aNode, id)
44{
45 masterDofMngr = master;
46 masterDofIndx = -1;
47}
48
49
50SimpleSlaveDof :: SimpleSlaveDof(DofManager *aNode, DofIDItem id) : Dof(aNode, id)
51{
52 masterDofMngr = -1;
53 masterDofIndx = -1;
54}
55
56
57Dof *SimpleSlaveDof :: giveMasterDof() const
58{
59 // returns reference to master dof
60 // checks dof compatibility and slave to slave references
61
62 return dofManager->giveDomain()->giveDofManager(masterDofMngr)->giveDofWithID(this->dofID);
63}
64
65BoundaryCondition *SimpleSlaveDof :: giveBc()
66// Returns the boundary condition the receiver is subjected to.
67{
68 return this->giveMasterDof()->giveBc();
69}
70
71
72int SimpleSlaveDof :: __giveEquationNumber() const
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
81int SimpleSlaveDof :: __givePrescribedEquationNumber()
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{
87 return this->giveMasterDof()->__givePrescribedEquationNumber();
88}
89
90InitialCondition *SimpleSlaveDof :: giveIc()
91// Returns the initial condition on the receiver. Not used.
92{
93 return this->giveMasterDof()->giveIc();
94}
95
96
97double SimpleSlaveDof :: giveUnknown(ValueModeType mode, TimeStep *tStep)
98{
99 return this->giveMasterDof()->giveUnknown(mode, tStep);
100}
101
102double SimpleSlaveDof :: giveUnknown(PrimaryField &field, ValueModeType mode, TimeStep *tStep)
103{
104 return this->giveMasterDof()->giveUnknown(field, mode, tStep);
105}
106
107
108bool SimpleSlaveDof :: hasBc(TimeStep *tStep)
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
116bool SimpleSlaveDof :: hasIc()
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
124bool SimpleSlaveDof :: hasIcOn(ValueModeType u)
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
131int SimpleSlaveDof :: giveBcId()
132{
133 return this->giveMasterDof()->giveBcId();
134}
135
136int SimpleSlaveDof :: giveIcId()
137{
138 return this->giveMasterDof()->giveIcId();
139}
140
141
142double
143SimpleSlaveDof :: giveBcValue(ValueModeType mode, TimeStep *tStep)
144{
145 return this->giveMasterDof()->giveBcValue(mode, tStep);
146}
147
148
149void SimpleSlaveDof :: saveContext(DataStream &stream, ContextMode mode)
150{
151 Dof :: saveContext(stream, mode);
152
153 if ( mode & CM_Definition ) {
154
155 if ( mode & CM_DefinitionGlobal ) {
156 int _masterGlobNum = dofManager->giveDomain()->giveDofManager(masterDofMngr)->giveGlobalNumber();
157 if ( !stream.write(_masterGlobNum) ) {
159 }
160 } else {
161 if ( !stream.write(masterDofMngr) ) {
163 }
164 }
165 }
166}
167
168
169void SimpleSlaveDof :: restoreContext(DataStream &stream, ContextMode mode)
170{
171 Dof :: restoreContext(stream, mode);
172
173 if ( mode & CM_Definition ) {
174 if ( !stream.read(masterDofMngr) ) {
176 }
177 }
178
179 this->masterDofIndx = -1;
180}
181
182void
183SimpleSlaveDof :: updateLocalNumbering(EntityRenumberingFunctor &f)
184{
186}
187} // 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.
DofIDItem dofID
Physical meaning of DOF.
Definition dof.h:99
Dof(DofManager *aNode, DofIDItem id=Undef)
Definition dof.C:50
DofManager * dofManager
Link to related DofManager.
Definition dof.h:97
Dof * giveMasterDof() const
Returns reference to master dof.
int masterDofMngr
Number of DofManager containing master dof (Master DofManager).
int masterDofIndx
Number of master dof in master dofManager.
#define THROW_CIOERR(e)
#define CM_DefinitionGlobal
Definition contextmode.h:48
#define CM_Definition
Definition contextmode.h:47
long ContextMode
Definition contextmode.h:43
@ 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