LifeV
DOFInterface.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 Base Class for interfacing dofs between two meshes
30 
31  @author M.A. Fernandez and V. Martin
32  @date 00-11-2002
33 
34  @contributor Samuel Quinodoz <samuel.quinodoz@epfl.ch>
35  @mantainer Samuel Quinodoz <samuel.quinodoz@epfl.ch>
36 
37  This file contains the class which may be used to update and hold the connections between the dof
38  on two matching meshes.
39  */
40 
41 #include <lifev/core/fem/DOFInterface.hpp>
42 
43 namespace LifeV
44 {
45 
46 // ===================================================
47 // Constructors & Destructor
48 // ===================================================
49 
51 {}
52 
53 // ===================================================
54 // Methods
55 // ===================================================
56 
57 
58 ID DOFInterface::getInterfaceDof ( const ID& i ) const
59 {
60  std::map<ID, ID>::const_iterator it = M_localDofMap.find ( i );
61  if ( it == M_localDofMap.end() )
62  {
63  std::cout << i << " : " << std::flush;
64  ERROR_MSG ( "DOFInterface::getInterfaceDof : DOF number not found" );
65  }
66  return it->second;
67 }
68 
69 bool DOFInterface::isMyInterfaceDof ( const ID& i ) const
70 {
71  std::map<ID, ID>::const_iterator it = M_localDofMap.find ( i );
72  return ( it != M_localDofMap.end() );
73 }
74 
75 std::ostream& DOFInterface::showMe ( bool verbose, std::ostream& out ) const
76 {
77  out << "------------------------------" << std::endl;
78  out << "\tNumber of DOF connections (M_localDofMap):" << M_localDofMap.size() << std::endl;
79  if ( verbose )
80  {
81  UInt count ( 0 ), lines ( 10 );
82  out << "List of connections between DOF: (global, local)";
83  for ( std::map<ID, ID>::const_iterator it = M_localDofMap.begin(); it != M_localDofMap.end(); ++it )
84  {
85  if ( count++ % lines == 0 )
86  {
87  out << std::endl;
88  }
89  out << "(" << it->first << "," << it->second << ")\t";
90  }
91  out << std::endl;
92  }
93  out << "------------------------------" << std::endl;
94  return out;
95 }
96 
97 void DOFInterface::buildInverse ( const DOFInterface& dofBase)
98 {
99  for ( std::map<ID, ID>::const_iterator it = dofBase.M_localDofMap.begin(); it != dofBase.M_localDofMap.end(); ++it )
100  {
101  M_localDofMap[it->second] = it->first;
102  }
103 
104 }
105 
106 // ===================================================
107 // Set Methods
108 // ===================================================
109 
110 void DOFInterface::set (const ID& key, const ID& value)
111 {
112  M_localDofMap.find (key)->second = value;
113 }
114 
115 // ===================================================
116 // Get Methods
117 // ===================================================
118 
120 {
121  return M_localDofMap.size();
122 }
123 
124 
125 }
ID getInterfaceDof(const ID &i) const
This method returns the corresponding dof number of the mesh2 at the interface for a specific dof num...
void buildInverse(const DOFInterface &dofBase)
Makes this DOFInterface to be the inverse map as the one defined by dofBase.
DOFInterface()
Default Constructor.
bool isMyInterfaceDof(const ID &i) const
This method says whether a specific dof number at the interface in mesh1 is on this processor...
void updateInverseJacobian(const UInt &iQuadPt)
void set(const ID &key, const ID &value)
Set value to be associated to key.
size_t nbInterfaceDof() const
This method returns the number of dof that live on the interface.
#define ERROR_MSG(A)
Definition: LifeAssert.hpp:69
uint32_type ID
IDs.
Definition: LifeV.hpp:194
std::ostream & showMe(bool verbose=false, std::ostream &out=std::cout) const
output
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191