OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
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 - 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 "pfemnumberingschemes.h"
36 
37 namespace oofem {
40  , neq(0)
41  , pres_neq(0)
42  , isInitialized(false)
43 { }
44 
46 { }
47 
48 void
50 {
51  isInitialized = true;
52  int inode;
53  int nnode = domain->giveNumberOfDofManagers();
54  DofManager *idofman;
55 
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 
71 void
73 {
74  neq = 0;
75  pres_neq = 0;
76 }
77 
78 int
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 
92 int
94 {
95  return neq;
96 }
97 
98 
99 int
101 {
102  return neq;
103 }
104 
105 int
107 {
108  return -1 * pres_neq;
109 }
110 
111 
114  , numEqs(0)
115  , prescribed(prescribed)
116 { }
117 
119 { }
120 
121 int
123 {
124  DofIDItem id = dof->giveDofID();
125  if ( id == V_u || id == V_v || id == V_w ) {
127  }
128 
129  return 0;
130 }
131 
132 Dof *
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 
160  , neq(0)
161 { }
162 
164 { }
165 
166 void
168 {
170 }
171 
172 int
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 
192 int
194 {
195  return neq;
196 }
197 } // end namespace oofem
virtual ~PressureNumberingScheme()
Destructor.
Class and object Domain.
Definition: domain.h:115
int giveGlobalNumber() const
Definition: dofmanager.h:501
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
Definition: domain.h:432
int pres_neq
Last given number of prescribed equation.
bool isInitialized
Flag controlling wether the numbering has been initialized or not.
virtual ~AuxVelocityNumberingScheme()
Destructor.
virtual int giveRequiredNumberOfDomainEquation() const
Returns required number of domain equation.
Base class for dof managers.
Definition: dofmanager.h:113
virtual int __giveEquationNumber() const =0
Returns equation number of receiver, usually assigned by emodel.
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
Definition: domain.C:1067
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
virtual int __givePrescribedEquationNumber()=0
Returns prescribed equation number of receiver.
bool prescribed
prescribed equations or not
virtual int giveTotalNumberOfEquations() const
Returns total number of equations.
virtual void reset()
Resets the numbering in order to start numbering again from 1.
DofIDItem
Type representing particular dof type.
Definition: dofiditem.h:86
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
DofIDItem giveDofID() const
Returns DofID value of receiver, which determines type of of unknown connected to receiver (e...
Definition: dof.h:276
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
virtual int giveRequiredNumberOfDomainEquation() const
Returns required number of domain equation.
virtual int giveDofEquationNumber(Dof *dof) const
Returns the equation number for corresponding DOF.
int giveDofManNumber() const
Definition: dof.C:72
Dof * giveDofToEquationNumber(Domain *d, int equationNumber)
Returns Dof with passed equation number.
virtual ~VelocityNumberingScheme()
Destructor.
virtual int giveDofEquationNumber(Dof *dof) const
Returns the equation number for corresponding DOF.
virtual void init()
Initializes the receiver, if necessary.
virtual int giveTotalNumberOfPrescribedEquations() const
Returns total number of prescribed equations.
int neq
Last given number of equation.
IntArray nodalPressureEquationNumbers
Container storing particular equation numbers for each node.
virtual int giveDofEquationNumber(Dof *dof) const
Returns the equation number for corresponding DOF.
Domain * giveDomain() const
Definition: femcmpnn.h:100
DofManager * giveDofManager() const
Definition: dof.h:123
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
Class representing solution step.
Definition: timestep.h:80
VelocityNumberingScheme(bool prescribed)
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:30 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011