OOFEM 3.0
Loading...
Searching...
No Matches
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 - 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#include <algorithm>
37
38namespace oofem {
39QuasicontinuumNumberingscheme :: QuasicontinuumNumberingscheme() :
41 , neq(0)
42 , pres_neq(0)
43 , isInitialized(false)
44{ }
45
46void
47QuasicontinuumNumberingscheme :: init2(Domain *domain, std :: vector< bool >activatedNodeList, TimeStep *tStep)
48{
49 isInitialized = true;
50 /*
51 * // compute list of selected nodes numbers
52 * int noActovedNodes = std::count_if(activatedNodeList.begin(), activatedNodeList.end(), [](bool i){return i;});
53 * this->selectedNodes.resize(noActovedNodes);
54 * selectedNodes.zero();
55 * int k = 0;
56 * for (int i=1; i<=(int)activatedNodeList.size(); i++) {
57 * if (activatedNodeList[i-1]) {
58 * k++;
59 * selectedNodes.at(k) = i;
60 * }
61 * }
62 */
63 this->selectedNodes.resize( activatedNodeList.size() );
64 selectedNodes.zero();
65 for ( int i = 0; i < ( int ) activatedNodeList.size(); i++ ) {
66 if ( activatedNodeList [ i ] ) {
67 selectedNodes[i] = 1;
68 }
69 }
70
71
72 //int nnode = domain->giveNumberOfDofManagers();
73 //int nnode = 0;
74 // this->dofEquationNumbers.resize(nnode);
75
76 equationMap.clear();
77
78 for ( int inode = 1; inode <= selectedNodes.giveSize(); inode++ ) {
79 if ( selectedNodes.at(inode) == 1 ) {
80 std :: map< int, int > dof2EquationMap;
81 auto idofman = domain->giveDofManager(inode);
82 IntArray dofIDArray;
83 idofman->giveCompleteMasterDofIDArray(dofIDArray);
84 if ( !idofman->hasAnySlaveDofs() ) {
85 for ( auto &dofid : dofIDArray ) {
86 if ( idofman->giveDofWithID( dofid )->hasBc(tStep) ) {
87 dof2EquationMap [ dofid ] = --pres_neq;
88 } else {
89 dof2EquationMap [ dofid ] = ++neq;
90 }
91 }
92 } else {
93#if 0
94 IntArray masterDofIDArray, masterDofMans;
95 //idofman->giveMasterDofIDArray({D_u, D_v},masterDofIDArray);
96 idofman->giveMasterDofMans(masterDofMans);
97 for (int m = 1; m <= masterDofMans.giveSize(); m++ ) {
98 auto mdofman = domain->giveDofManager(masterDofMans.at(m));
99 mdofman->giveCompleteMasterDofIDArray(dofIDArray);
100 for ( auto &dofid : dofIDArray ) {
101 if(mdofman->giveDofWithID(dofid)->hasBc(tStep)) {
102 dof2EquationMap [ dofid ] = --pres_neq;
103 } else {
104 dof2EquationMap [ dofid ] = ++neq;
105 }
106 }
107 }
108#endif
109 }
110
111 this->equationMap.insert( {inode, std::move(dof2EquationMap)} );
112 }
113 }
114}
115
116void
117QuasicontinuumNumberingscheme :: reset()
118{
119 neq = 0;
120 pres_neq = 0;
121}
122
123int
124QuasicontinuumNumberingscheme :: giveDofEquationNumber(Dof *dof) const
125{
126 int dofEqNum = 0;
127
128 if ( selectedNodes.at( dof->giveDofManNumber() ) == 1 ) {
129 dofEqNum = ( equationMap.find( dof->giveDofManNumber() )->second ).find( dof->giveDofID() )->second;
130 } else {
131 dofEqNum = 0;
132 }
133
134 //this->nodalEquationNumbers.at( dof->giveDofManNumber() );
135 if ( dofEqNum < 0 ) {
136 dofEqNum = 0;
137 }
138
139 return dofEqNum;
140}
141
142
143int
144QuasicontinuumNumberingscheme :: giveTotalNumberOfEquations() const
145{
146 return neq;
147}
148
149
150int
151QuasicontinuumNumberingscheme :: giveRequiredNumberOfDomainEquation() const
152{
153 return neq;
154}
155
156int
157QuasicontinuumNumberingscheme :: giveTotalNumberOfPrescribedEquations() const
158{
159 return -1 * pres_neq;
160}
161} // end namespace oofem
DofIDItem giveDofID() const
Definition dof.h:276
int giveDofManNumber() const
Definition dof.C:72
int & at(std::size_t i)
Definition intarray.h:104
int giveSize() const
Definition intarray.h:211
bool isInitialized
Flag controlling wether the numbering has been initialized or not.
std::map< int, std::map< int, int > > equationMap
map form dofid to equation number
int pres_neq
Last given number of prescribed equation.

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