LifeV
DOF.cpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file
29  @brief Degrees of freedom, the class that provides the localtoglobal table
30 
31  @author M.A. Fernandez & Luca Formaggia
32  @date 00-07-2002
33 
34  @contributor Vincent Martin
35  Mohamed Belhadj
36  Samuel Quinodoz <samuel.quinodoz@epfl.ch>
37  @mantainer Samuel Quinodoz <samuel.quinodoz@epfl.ch>
38  */
39 
40 
41 #include <lifev/core/fem/DOF.hpp>
42 
43 namespace LifeV
44 {
45 
46 // ===================================================
47 // Constructors & Destructor
48 // ===================================================
49 
50 DOF::DOF ( const DOFLocalPattern& fePattern) : M_elementDofPattern ( fePattern ), M_totalDof ( 0 ),
53 {
54  for ( UInt i = 0; i < 5; ++i )
55  {
56  M_dofPositionByEntity[ i ] = 0;
57  }
58 }
59 
60 DOF::DOF ( const DOF& dof2 ) : M_elementDofPattern ( dof2.M_elementDofPattern ), //, M_offset( dof2.M_offset ),
65 {
66  if ( &dof2 == this )
67  {
68  return ;
69  }
70 
71  for ( UInt i = 0; i < 5; ++i )
72  {
74  }
75 }
76 
77 // ===================================================
78 // Methods
79 // ===================================================
80 
81 ID DOF::localToGlobalMapByBdFacet (const ID& facetId, const ID& localDof ) const
82 {
83  ASSERT_PRE ( (M_localToGlobalByBdFacet.size() > 0) , "The local to global map by boundary facet is void");
84  return M_localToGlobalByBdFacet[facetId][localDof];
85 }
86 
87 
88 void DOF::showMe ( std::ostream& out, bool verbose ) const
89 {
90  out << " Degree of Freedom (DOF) Object" << std::endl;
91  out << " Total DOF Stored " << M_totalDof << std::endl;
92  out << " DOF's on Vertices from " << M_dofPositionByEntity[ 0 ] << " , to:" << M_dofPositionByEntity[ 1 ] << std::endl;
93  out << " DOF's on Edges from " << M_dofPositionByEntity[ 1 ] << " , to:" << M_dofPositionByEntity[ 2 ] << std::endl;
94  out << " DOF's on Faces from " << M_dofPositionByEntity[ 2 ] << " , to:" << M_dofPositionByEntity[ 3 ] << std::endl;
95  out << " DOF's on Volumes from " << M_dofPositionByEntity[ 3 ] << " , to:" << M_dofPositionByEntity[ 4 ] << std::endl;
96  if ( verbose )
97  {
98  out << "************************************************************" << std::endl;
99  out << " Local to Global DOF table" << std::endl;
100  out << "************************************************************" << std::endl;
101  out << "Element Id Loc. N. Global N. # Element Id Loc. N. Global N. " << std::endl;
102 
103 
104  for ( UInt i = 0; i < M_numElement; ++i )
105  {
106  for ( UInt j = 0; j < numLocalDof(); ++j )
107  {
108  out.width ( 10 );
109  out << i;
110  out.width ( 10 );
111  out << j;
112  out.width ( 10 );
113  out << localToGlobalMap ( i, j );
114  out << " # ";
115  if ( (i * numLocalDof() + j) % 2 != 0 )
116  {
117  out << std::endl;
118  }
119  }
120 
121  }
122  out << std::endl;
123 
124  }
125 
126 }
127 
128 void DOF::showMeByBdFacet (std::ostream& out, bool verbose) const
129 {
130  out << "--------------------------------------------------------------------------------" << std::endl;
131  out << " Degree of freedom by facet object " << std::endl;
132  out << "--------------------------------------------------------------------------------" << std::endl;
133 
134  out << " Number of local dof per boundary facet = " << M_localToGlobalByBdFacet[0].size() << std::endl;
135 
136  if (verbose)
137  {
138  out << "*********************************************************************************" << std::endl;
139  out << " Local-to-global DOF table (DOF grouped by boundary facet)" << std::endl;
140  out << "*********************************************************************************" << std::endl;
141  out << "=================================================================================" << std::endl;
142  out << "Facet ID Local DOF Global DOF " << std::endl;
143  out << "=================================================================================" << std::endl;
144 
145  for (UInt i = 0; i < M_localToGlobalByBdFacet.size(); ++i)
146  {
147  for (UInt j = 0; j < M_localToGlobalByBdFacet[i].size(); ++j)
148  {
149  out.width (12);
150  out << i;
151  out.width (12);
152  out << j;
153  out.width (12);
154  out << M_localToGlobalByBdFacet[i][j];
155  out << " # ";
156  if (j % 2 != 0)
157  {
158  out << std::endl;
159  }
160  } // for j
161  } //for i
162  } // if verbose
163 }
164 
165 //End of namespace LifeV
166 }
DOF(const DOFLocalPattern &fePattern)
Definition: DOF.cpp:50
UInt M_nbLocalFacets
Definition: DOF.hpp:253
UInt M_totalDof
Definition: DOF.hpp:245
const DOFLocalPattern & M_elementDofPattern
The pattern of the local degrees of freedom.
Definition: DOF.hpp:242
UInt M_numElement
Definition: DOF.hpp:248
void updateInverseJacobian(const UInt &iQuadPt)
UInt M_nbLocalRidges
Definition: DOF.hpp:252
DOF(const DOF &dof2)
Copy constructor.
Definition: DOF.cpp:60
const UInt & numLocalDof() const
The number of local DOF (nodes) in the finite element.
Definition: DOF.hpp:183
#define ASSERT_PRE(X, A)
Definition: LifeAssert.hpp:96
uint32_type ID
IDs.
Definition: LifeV.hpp:194
const ID & localToGlobalMap(const ID ElId, const ID localNode) const
Return the specified entries of the localToGlobal table.
Definition: DOF.hpp:195
DOFLocalPattern - A class to store the "couplings" between the basis functions.
void showMe(std::ostream &out=std::cout, bool verbose=false) const
Ouput.
Definition: DOF.cpp:88
ID localToGlobalMapByBdFacet(const ID &facetId, const ID &localDof) const
Definition: DOF.cpp:81
UInt M_dofPositionByEntity[5]
Definition: DOF.hpp:265
UInt M_nbLocalPeaks
Definition: DOF.hpp:251
facetToPointPtr_Type M_facetToPoint
Definition: DOF.hpp:262
void showMeByBdFacet(std::ostream &out=std::cout, bool verbose=false) const
Definition: DOF.cpp:128
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191