OOFEM 3.0
Loading...
Searching...
No Matches
pfemnumberingschemes.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
37namespace oofem {
38PressureNumberingScheme :: PressureNumberingScheme() :
40 , neq(0)
41 , pres_neq(0)
42 , isInitialized(false)
43{ }
44
45PressureNumberingScheme :: ~PressureNumberingScheme()
46{ }
47
48void
49PressureNumberingScheme :: init(Domain *domain, TimeStep *tStep)
50{
51 isInitialized = true;
52 int inode;
53 int nnode = domain->giveNumberOfDofManagers();
54 DofManager *idofman;
55
56 this->nodalPressureEquationNumbers.resize(nnode);
57 for ( inode = 1; inode <= nnode; inode++ ) {
58 idofman = domain->giveDofManager(inode);
59 for ( Dof *jDof: *idofman ) {
60 if ( jDof->giveDofID() == P_f ) {
61 if ( jDof->hasBc(tStep) ) {
62 this->nodalPressureEquationNumbers.at(inode) = --pres_neq;
63 } else {
64 this->nodalPressureEquationNumbers.at(inode) = ++neq;
65 }
66 }
67 }
68 }
69}
70
71void
72PressureNumberingScheme :: reset()
73{
74 neq = 0;
75 pres_neq = 0;
76}
77
78int
79PressureNumberingScheme :: giveDofEquationNumber(Dof *dof) const
80{
81 int dofEqNum = 0;
82 DofIDItem id = dof->giveDofID();
83 if ( id == P_f ) {
84 dofEqNum = this->nodalPressureEquationNumbers.at( dof->giveDofManNumber() );
85 if ( dofEqNum < 0 )
86 dofEqNum = 0;
87 }
88 return dofEqNum;
89}
90
91
92int
93PressureNumberingScheme :: giveTotalNumberOfEquations() const
94{
95 return neq;
96}
97
98
99int
100PressureNumberingScheme :: giveRequiredNumberOfDomainEquation() const
101{
102 return neq;
103}
104
105int
106PressureNumberingScheme :: giveTotalNumberOfPrescribedEquations() const
107{
108 return -1 * pres_neq;
109}
110
111
112VelocityNumberingScheme :: VelocityNumberingScheme(bool prescribed) :
114 , numEqs(0)
116{ }
117
118VelocityNumberingScheme :: ~VelocityNumberingScheme()
119{ }
120
121int
122VelocityNumberingScheme :: giveDofEquationNumber(Dof *dof) const
123{
124 DofIDItem id = dof->giveDofID();
125 if ( id == V_u || id == V_v || id == V_w ) {
127 }
128
129 return 0;
130}
131
132Dof *
133VelocityNumberingScheme :: giveDofToEquationNumber(Domain *d, int equationNumber)
134{
135 bool found = false;
136 Dof *foundDof = NULL;
137 for ( int i = 1; i <= d->giveNumberOfDofManagers(); i++ ) {
138 DofManager *dman = d->giveDofManager(i);
139 for ( Dof *dof : *dman ) {//= d->giveDofManager(i)->giveDof(j);
140 DofIDItem id = dof->giveDofID();
141 if ( id == V_u || id == V_v || id == V_w ) {
142 if ( dof->__giveEquationNumber() == equationNumber ) {
143 foundDof = dof;
144 found = true;
145 break;
146 }
147 }
148 }
149
150 if ( found ) {
151 break;
152 }
153 }
154
155 return foundDof;
156}
157
158AuxVelocityNumberingScheme :: AuxVelocityNumberingScheme() :
160 , neq(0)
161{ }
162
163AuxVelocityNumberingScheme :: ~AuxVelocityNumberingScheme()
164{ }
165
166void
167AuxVelocityNumberingScheme :: init(Domain *domain)
168{
169 neq = domain->giveNumberOfSpatialDimensions() * domain->giveNumberOfDofManagers();
170}
171
172int
173AuxVelocityNumberingScheme :: giveDofEquationNumber(Dof *dof) const
174{
175 DofIDItem type = dof->giveDofID();
176 int c;
177 int n = dof->giveDofManager()->giveGlobalNumber();
178
179 if ( type == V_u ) {
180 c = 1;
181 } else if ( type == V_v ) {
182 c = 2;
183 } else if ( type == V_w ) {
184 c = 3;
185 } else {
186 return 0;
187 }
188
189 return dof->giveDofManager()->giveDomain()->giveNumberOfSpatialDimensions() * ( n - 1 ) + c;
190}
191
192int
193AuxVelocityNumberingScheme :: giveRequiredNumberOfDomainEquation() const
194{
195 return neq;
196}
197} // end namespace oofem
int giveGlobalNumber() const
Definition dofmanager.h:515
DofIDItem giveDofID() const
Definition dof.h:276
virtual int __giveEquationNumber() const =0
DofManager * giveDofManager() const
Definition dof.h:123
virtual int __givePrescribedEquationNumber()=0
int giveDofManNumber() const
Definition dof.C:72
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
Definition domain.h:461
DofManager * giveDofManager(int n)
Definition domain.C:317
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
Definition domain.C:1137
Domain * giveDomain() const
Definition femcmpnn.h:97
bool isInitialized
Flag controlling wether the numbering has been initialized or not.
int pres_neq
Last given number of prescribed equation.
IntArray nodalPressureEquationNumbers
Container storing particular equation numbers for each node.
int neq
Last given number of equation.
bool prescribed
prescribed equations or not
int numEqs
Last given equation number.

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