LifeV
BCInterfaceData3D.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 File containing the BCInterfaceData3D class
30  *
31  * @date 17-07-2009
32  * @author Cristiano Malossi <cristiano.malossi@epfl.ch>
33  *
34  * @maintainer Cristiano Malossi <cristiano.malossi@epfl.ch>
35  */
36 
37 #include <lifev/bc_interface/3D/bc/BCInterfaceData3D.hpp>
38 
39 namespace LifeV
40 {
41 
42 // ===================================================
43 // Constructors
44 // ===================================================
49  M_baseRobinBeta (),
53  M_name (),
54  M_type (),
55  M_mode (),
57  M_mapType (),
58  M_mapMode ()
59 {
60  //Set mapType
61  M_mapType["Essential"] = Essential;
62  M_mapType["EssentialEdges"] = EssentialEdges;
63  M_mapType["EssentialVertices"] = EssentialVertices;
64  M_mapType["Natural"] = Natural;
65  M_mapType["Robin"] = Robin;
66  M_mapType["Flux"] = Flux;
67  M_mapType["Resistance"] = Resistance;
68 
69  //Set mapMode
70  M_mapMode["Scalar"] = Scalar;
71  M_mapMode["Full"] = Full;
72  M_mapMode["Component"] = Component;
73  M_mapMode["Normal"] = Normal;
74  M_mapMode["Tangential"] = Tangential;
75  M_mapMode["Directional"] = Directional;
76 }
77 
86  M_name ( data.M_name ),
87  M_type ( data.M_type ),
88  M_mode ( data.M_mode ),
92 {
93 }
94 
95 // ===================================================
96 // Operators
97 // ===================================================
100 {
101  if ( this != &data )
102  {
103  BCInterfaceData::operator= ( data );
104  M_baseRobinAlpha = data.M_baseRobinAlpha;
106  M_baseRobinBeta = data.M_baseRobinBeta;
108  M_baseDirectional = data.M_baseDirectional;
110  M_name = data.M_name;
111  M_type = data.M_type;
112  M_mode = data.M_mode;
114  M_mapType = data.M_mapType;
115  M_mapMode = data.M_mapMode;
116  }
117 
118  return *this;
119 }
120 
121 // ===================================================
122 // Methods
123 // ===================================================
124 void
125 BCInterfaceData3D::readBC ( const std::string& fileName, const std::string& dataSection, const std::string& name )
126 {
127  // Call to the base class
128  dataContainer_Type::readBC ( fileName, dataSection, name );
129 
130  // Read 3D data
131  GetPot dataFile ( fileName );
132 
133  M_name = name;
134 
135  readFlag ( dataFile, ( dataSection + name + "/flag" ).c_str() );
136  readType ( dataFile, ( dataSection + name + "/type" ).c_str() );
137  readMode ( dataFile, ( dataSection + name + "/mode" ).c_str() );
138  readComponentsVector ( dataFile, ( dataSection + name + "/component" ).c_str() );
139 
140  // Read base
141  if ( M_type == Robin )
142  {
143  readBase ( dataFile, dataSection + name + "/RobinAlpha/", M_baseRobinAlpha, M_baseStringRobinAlpha );
144  readBase ( dataFile, dataSection + name + "/RobinBeta/", M_baseRobinBeta, M_baseStringRobinBeta );
145  }
146  if ( M_mode == Directional )
147  {
148  readBase ( dataFile, dataSection + name + "/Directional/", M_baseDirectional, M_baseStringDirectional );
149  }
150 }
151 
152 void
153 BCInterfaceData3D::showMe ( std::ostream& output ) const
154 {
155  // Call to the base class
156  dataContainer_Type::showMe ( output );
157 
158  // Show 3D data
159  output << "Type = " << M_type << std::endl;
160  output << "Mode = " << M_mode << std::endl;
161  output << "Components Vector = ";
162  for ( UInt i (0); i < static_cast<UInt> ( M_componentsVector.size() ); ++i )
163  {
164  output << M_componentsVector[i] << " ";
165  }
166  output << "\n";
167 }
168 
169 // ===================================================
170 // Private Methods
171 // ===================================================
172 void
173 BCInterfaceData3D::readComponentsVector ( const GetPot& dataFile, const char* component )
174 {
175  UInt componentSize = dataFile.vector_variable_size ( component );
176 
177  M_componentsVector.resize ( componentSize );
178  for ( UInt j ( 0 ); j < componentSize; ++j )
179  {
180  M_componentsVector[j] = dataFile ( component, 0, j );
181  }
182 }
183 
184 } // Namespace LifeV
BCInterfaceData - The BCInterface data container.
void readBC(const std::string &fileName, const std::string &dataSection, const std::string &name)
Read parameters for all kind of BC.
void updateInverseJacobian(const UInt &iQuadPt)
bcComponentsVec_Type M_componentsVector
BCInterfaceData3D - The BCInterface3D data container.
void readComponentsVector(const GetPot &dataFile, const char *component)
void showMe(std::ostream &output=std::cout) const
Display general information about the content of the class.
BCInterfaceData3D(const BCInterfaceData3D &data)
Copy constructor.
GetPot(const STRING_VECTOR &FileNameList)
Definition: GetPot.hpp:645
BCInterfaceData3D & operator=(const BCInterfaceData3D &data)
Operator =.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
BCInterfaceData()
Constructor.
unsigned vector_variable_size(const char *VarName) const
Definition: GetPot.hpp:2291