OOFEM 3.0
Loading...
Searching...
No Matches
bctracker.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 "domain.h"
36#include "intarray.h"
37#include "element.h"
38#include "set.h"
39#include "load.h"
40#include "bodyload.h"
41#include "boundaryload.h"
42#include "nodalload.h"
43#include "activebc.h"
44#include "timestep.h"
45#ifdef __SM_MODULE
48#endif
49namespace oofem {
50
51BCTracker :: BCTracker(Domain* d) {
52 this->domain = d;
53 #ifdef _OPENMP
54 omp_init_lock(&initLock);
55 #endif
56}
57
58
59void
61 if ( initialized ) {
62 return; // already initialized
63 }
64 #ifdef _OPENMP
65 omp_set_lock(&initLock); // if not initialized yet; one thread can proceed with init; others have to wait until init completed
66 if ( this->initialized ) {
67 omp_unset_lock(&initLock);
68 return;
69 }
70 #endif
71
72 this->elemList.clear();
73 this->elemList.resize(domain->giveNumberOfElements());
74 for (int ie=0; ie<domain->giveNumberOfElements(); ie++) {
75 this->elemList[ie].clear();
76 }
77
78 int nbc = domain->giveNumberOfBoundaryConditions();
79 for ( int ibc = 1; ibc <= nbc; ++ibc ) {
80 GeneralBoundaryCondition *bc = domain->giveBc(ibc);
82 Load *load;
83
84 if ( ( abc = dynamic_cast< ActiveBoundaryCondition * >(bc) ) ) {
85 continue;
86 } else if ( bc->giveSetNumber() && ( load = dynamic_cast< Load * >(bc) )) {
87 BodyLoad *bodyLoad;
88 BoundaryLoad *bLoad;
89 Set *set = domain->giveSet( bc->giveSetNumber() );
90
91 if ( ( bodyLoad = dynamic_cast< BodyLoad * >(bc) ) ) { // Body load:
92 const IntArray &elements = set->giveElementList();
93 for ( int ielem = 1; ielem <= elements.giveSize(); ++ielem ) {
94 Entry entry (ibc, 0);
95 this->elemList[elements.at(ielem)-1].push_back(entry);
96 }
97 } else if ( ( bLoad = dynamic_cast< BoundaryLoad * >(bc) ) ) { // Boundary load:
98 const IntArray &boundaries = set->giveBoundaryList();
99 for ( int ibnd = 1; ibnd <= boundaries.giveSize() / 2; ++ibnd ) {
100 int eid = boundaries.at(ibnd * 2 - 1) ;
101 int bid = boundaries.at(ibnd * 2);
102 Entry entry (ibc, bid);
103 this->elemList[eid-1].push_back(entry);
104 }
105
107 const IntArray &edgeBoundaries = set->giveEdgeList();
108 for ( int ibnd = 1; ibnd <= edgeBoundaries.giveSize() / 2; ++ibnd ) {
109 int eid = edgeBoundaries.at(ibnd * 2 - 1) ;
110 int bid = edgeBoundaries.at(ibnd * 2);
111 Entry entry(ibc, bid);
112 this->elemList[eid-1].push_back(entry);
113 }
114 }
115#ifdef __SM_MODULE
116 else if ( ( load = dynamic_cast< StructuralTemperatureLoad * >(bc) ) || ( load = dynamic_cast< StructuralEigenstrainLoad * >(bc) )) { // Body load:
117 const IntArray &elements = set->giveElementList();
118 for ( int ielem = 1; ielem <= elements.giveSize(); ++ielem ) {
119 Entry entry (ibc, 0);
120 this->elemList[elements.at(ielem)-1].push_back(entry);
121 }
122 }
123#endif
124 }
125 }// end loop over BCs
126 this->initialized = true;
127 #ifdef _OPENMP
128 omp_unset_lock(&initLock);
129 #endif
130}
131
134 if (this->elemList.empty()) {
135 this->initialize();
136 }
137 return this->elemList.at(elem-1);
138}
139
140} // end namespace oofem
std::vector< entryListType > elemList
list keeping element entries
Definition bctracker.h:71
const entryListType & getElementRecords(int elem)
Definition bctracker.C:133
std::list< Entry > entryListType
Definition bctracker.h:67
void initialize()
Definition bctracker.C:60
Domain * domain
Domain link.
Definition bctracker.h:73
int & at(std::size_t i)
Definition intarray.h:104
int giveSize() const
Definition intarray.h:211
const IntArray & giveEdgeList()
Definition set.C:162
const IntArray & giveBoundaryList()
Definition set.C:160
const IntArray & giveElementList()
Definition set.C:158
Helper class storing a sigle record for component (element, node, etc).
Definition bctracker.h:59

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