OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
quasicontinuumnumberingscheme.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 <algorithm>
37 
38 namespace oofem {
41  , neq(0)
42  , pres_neq(0)
43  , isInitialized(false)
44 { }
45 
47 {
48  delete equationMap;
49 }
50 
51 void
52 QuasicontinuumNumberingscheme :: init(Domain *domain, std :: vector< bool >activatedNodeList, TimeStep *tStep)
53 {
54  isInitialized = true;
55  /*
56  * // compute list of selected nodes numbers
57  * int noActovedNodes = std::count_if(activatedNodeList.begin(), activatedNodeList.end(), [](bool i){return i;});
58  * this->selectedNodes.resize(noActovedNodes);
59  * selectedNodes.zero();
60  * int k = 0;
61  * for (int i=1; i<=(int)activatedNodeList.size(); i++) {
62  * if (activatedNodeList[i-1]) {
63  * k++;
64  * selectedNodes.at(k) = i;
65  * }
66  * }
67  */
68  this->selectedNodes.resize( activatedNodeList.size() );
70  for ( int i = 1; i <= ( int ) activatedNodeList.size(); i++ ) {
71  if ( activatedNodeList [ i - 1 ] ) {
72  selectedNodes.at(i) = 1;
73  }
74  }
75 
76 
77  //int nnode = domain->giveNumberOfDofManagers();
78  //int nnode = 0;
79  DofManager *idofman;
80 
81  // this->dofEquationNumbers.resize(nnode);
82 
83  equationMap = new std :: map< int, std :: map< int, int > >();
84 
85 
86  for ( int inode = 1; inode <= selectedNodes.giveSize(); inode++ ) {
87  if ( selectedNodes.at(inode) == 1 ) {
88  std :: map< int, int > *dof2EquationMap = new std :: map< int, int >();
89  idofman = domain->giveDofManager(inode);
90  IntArray dofIDArray;
91  idofman->giveCompleteMasterDofIDArray(dofIDArray);
92  if ( !idofman->hasAnySlaveDofs() ) {
93  for ( int k = 1; k <= dofIDArray.giveSize(); k++ ) {
94  if ( idofman->giveDofWithID( dofIDArray.at(k) )->hasBc(tStep) ) {
95  ( * dof2EquationMap ) [ dofIDArray.at(k) ] = --pres_neq;
96  } else {
97  ( * dof2EquationMap ) [ dofIDArray.at(k) ] = ++neq;
98  }
99  }
100  } else {
101  /*
102  * IntArray masterDofIDArray, masterDofMans;
103  * //idofman->giveMasterDofIDArray({D_u, D_v},masterDofIDArray);
104  * idofman->giveMasterDofMans(masterDofMans);
105  * DofManager *mdofman;
106  * for (int m = 1; m <= masterDofMans.giveSize(); m++ ) {
107  * mdofman = domain->giveDofManager(masterDofMans.at(m));
108  * mdofman->giveCompleteMasterDofIDArray(dofIDArray);
109  * for (int k = 1; k <= dofIDArray.giveSize(); k++) {
110  * if(mdofman->giveDofWithID(dofIDArray.at(k))->hasBc(tStep)) {
111  * ( *dof2EquationMap ) [ dofIDArray.at(k) ] = --pres_neq;
112  * } else {
113  * ( *dof2EquationMap ) [ dofIDArray.at(k) ] = ++neq;
114  * }
115  * }
116  * }
117  */
118  }
119 
120  ( * this->equationMap ) [ inode ] = * dof2EquationMap;
121  delete dof2EquationMap;
122  }
123  }
124 }
125 
126 void
128 {
129  neq = 0;
130  pres_neq = 0;
131 }
132 
133 int
135 {
136  //std::map<int,int> map = (equationMap->find(dof->giveDofManNumber())->second)->find((int)dof->giveDofID)->second;
137 
138 
139  int dofEqNum = 0;
140 
141  if ( selectedNodes.at( dof->giveDofManNumber() ) == 1 ) {
142  dofEqNum = ( equationMap->find( dof->giveDofManNumber() )->second ).find( dof->giveDofID() )->second;
143  } else {
144  dofEqNum = 0;
145  }
146 
147  //this->nodalEquationNumbers.at( dof->giveDofManNumber() );
148  if ( dofEqNum < 0 ) {
149  dofEqNum = 0;
150  }
151 
152  return dofEqNum;
153 }
154 
155 
156 int
158 {
159  return neq;
160 }
161 
162 
163 int
165 {
166  return neq;
167 }
168 
169 int
171 {
172  return -1 * pres_neq;
173 }
174 } // end namespace oofem
Class and object Domain.
Definition: domain.h:115
int pres_neq
Last given number of prescribed equation.
void zero()
Sets all component to zero.
Definition: intarray.C:52
Base class for dof managers.
Definition: dofmanager.h:113
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
std::map< int, std::map< int, int > > * equationMap
map form dofid to equation number
int neq
Last given number of equation.
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
virtual int giveRequiredNumberOfDomainEquation() const
Returns required number of domain equation.
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
int giveDofManNumber() const
Definition: dof.C:72
virtual int giveDofEquationNumber(Dof *dof) const
Returns the equation number for corresponding DOF.
virtual int giveTotalNumberOfPrescribedEquations() const
Returns total number of prescribed equations.
virtual void init()
Initializes the receiver, if necessary.
virtual int giveTotalNumberOfEquations() const
Returns total number of equations.
bool isInitialized
Flag controlling wether the numbering has been initialized or not.
virtual void reset()
Resets the numbering in order to start numbering again from 1.
int giveSize() const
Definition: intarray.h:203
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

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