OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
connectivitytable.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 "connectivitytable.h"
36 #include "domain.h"
37 #include "element.h"
38 #include "dofmanager.h"
39 #include "intarray.h"
40 
41 namespace oofem {
42 
43 void
45 {
47 }
48 
49 void
51 //
52 // assembles table of nodal connectivities
53 //
54 {
55  int ndofMan = domain->giveNumberOfDofManagers();
56  int nelems = domain->giveNumberOfElements();
57  IntArray dofManConnectivity(ndofMan);
58 
59  if ( nodalConnectivityFlag ) {
60  return; // already initialized
61  }
62 
63 // OOFEM_LOG_INFO("ConnectivityTable: initializing\n");
64 
65  for ( auto &elem : domain->giveElements() ) {
66  int nnodes = elem->giveNumberOfDofManagers();
67  for ( int j = 1; j <= nnodes; j++ ) {
68  int jnode = elem->giveDofManager(j)->giveNumber();
69  dofManConnectivity.at(jnode)++;
70  }
71  }
72 
73  // allocate Nodal connectivity table for domain
74  nodalConnectivity.resize(ndofMan);
75  for ( int i = 0; i < ndofMan; i++ ) {
76  nodalConnectivity[i].resize( dofManConnectivity(i) );
77  }
78 
79  // build Nodal connectivity table for domain
80  dofManConnectivity.zero();
81 
82  for ( int i = 1; i <= nelems; i++ ) {
83  Element *ielem = domain->giveElement(i);
84  int nnodes = ielem->giveNumberOfDofManagers();
85  for ( int j = 1; j <= nnodes; j++ ) {
86  int jnode = ielem->giveDofManager(j)->giveNumber();
87  nodalConnectivity[jnode-1].at( ++dofManConnectivity.at(jnode) ) = i;
88  }
89  }
90 
92 }
93 
94 const IntArray *
96 {
97  if ( nodalConnectivityFlag == 0 ) {
99  }
100 
101  return &this->nodalConnectivity[dofman-1];
102 }
103 
104 
105 void
107 {
108  if ( nodalConnectivityFlag == 0 ) {
110  }
111 
112  answer.resize(0);
113 
114  for ( auto &el_num : elemList ) {
115  Element *ielem = domain->giveElement( el_num );
116  int nnode = ielem->giveNumberOfDofManagers();
117  for ( int j = 1; j <= nnode; j++ ) {
118  int jnode = ielem->giveDofManager(j)->giveNumber();
119  for ( auto &val : this->nodalConnectivity[jnode-1] ) {
120  answer.insertSortedOnce( val );
121  }
122  }
123  }
124 }
125 
126 
127 void
129 {
130  int nnodes = nodeList.giveSize();
131  if ( nodalConnectivityFlag == 0 ) {
133  }
134 
135  answer.resize(0);
136 
137  for ( int i = 1; i <= nnodes; i++ ) {
138  int inode = nodeList.at(i);
139  for ( auto &val : this->nodalConnectivity[inode-1] ) {
140  answer.insertSortedOnce( val );
141  }
142  }
143 }
144 } // end namespace oofem
std::vector< IntArray > nodalConnectivity
Nodal connectivity table for domain.
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
Definition: domain.h:432
void reset()
reset receiver to an initial state (will force table update, when needed next time) ...
void zero()
Sets all component to zero.
Definition: intarray.C:52
void instanciateConnectivityTable()
Builds connectivity table.
bool insertSortedOnce(int value, int allocChunk=0)
Inserts given value into a receiver, which is assumed to be sorted.
Definition: intarray.C:360
Abstract base class for all finite elements.
Definition: element.h:145
int giveNumberOfElements() const
Returns number of elements in domain.
Definition: domain.h:434
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
virtual int giveNumberOfDofManagers() const
Definition: element.h:656
Element * giveElement(int n)
Service for accessing particular domain fe element.
Definition: domain.C:160
Domain * domain
Pointer to domain to which receiver belongs to.
int nodalConnectivityFlag
Flag indicating assembled connectivity table for domain.
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
void giveElementNeighbourList(IntArray &answer, IntArray &elemList)
Returns list of neighboring elements to given elements (they are included too).
const IntArray * giveDofManConnectivityArray(int dofman)
void giveNodeNeighbourList(IntArray &answer, IntArray &nodeList)
Returns list of elements sharing given nodes.
std::vector< std::unique_ptr< Element > > & giveElements()
Definition: domain.h:279
int giveSize() const
Definition: intarray.h:203
the oofem namespace is to define a context or scope in which all oofem names are defined.
DofManager * giveDofManager(int i) const
Definition: element.C:514
int giveNumber() const
Definition: femcmpnn.h:107

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:28 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011