LifeV
BCInterfaceData1D.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 BCInterfaceData1D 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/1D/bc/BCInterfaceData1D.hpp>
38 
39 namespace LifeV
40 {
41 
42 // ===================================================
43 // Constructors
44 // ===================================================
47  M_line (),
48  M_quantity (),
49  M_resistance (),
50  M_capacitance (),
51  M_mapSide (),
52  M_mapQuantity (),
53  M_mapLine ()
54 {
55  //Set mapSide
56  M_mapSide["left"] = OneDFSI::left;
57  M_mapSide["right"] = OneDFSI::right;
58 
59  //Set mapQuantity
60  M_mapQuantity["A"] = OneDFSI::A;
61  M_mapQuantity["Q"] = OneDFSI::Q;
62  M_mapQuantity["W1"] = OneDFSI::W1;
63  M_mapQuantity["W2"] = OneDFSI::W2;
64  M_mapQuantity["P"] = OneDFSI::P;
65  M_mapQuantity["S"] = OneDFSI::S;
66 
67  //Set mapLine
68  M_mapLine["first"] = OneDFSI::first;
69  M_mapLine["second"] = OneDFSI::second;
70 }
71 
74  M_line ( data.M_line ),
75  M_quantity ( data.M_quantity ),
81 {
82 }
83 
84 // ===================================================
85 // Operators
86 // ===================================================
89 {
90  if ( this != &data )
91  {
92  BCInterfaceData::operator= ( data );
93  M_line = data.M_line;
94  M_quantity = data.M_quantity;
97  M_mapSide = data.M_mapSide;
98  M_mapQuantity = data.M_mapQuantity;
99  M_mapLine = data.M_mapLine;
100  }
101 
102  return *this;
103 }
104 
105 // ===================================================
106 // Methods
107 // ===================================================
108 void
109 BCInterfaceData1D::readBC ( const std::string& fileName, const std::string& dataSection, const std::string& name )
110 {
111  // Call to the base class
112  dataContainer_Type::readBC ( fileName, dataSection, name );
113 
114  // Read 3D data
115  GetPot dataFile ( fileName );
116 
117  readSide ( dataFile, ( dataSection + name + "/side" ).c_str() );
118  readQuantity ( dataFile, ( dataSection + name + "/quantity" ).c_str() );
119  readLine ( dataFile, ( dataSection + name + "/line" ).c_str() );
120  readResistance ( dataFile, ( dataSection + name + "/resistance" ).c_str() );
121  readCapacitance ( dataFile, ( dataSection + name + "/capacitance" ).c_str() );
122 }
123 
124 void
125 BCInterfaceData1D::showMe ( std::ostream& output ) const
126 {
127  // Call to the base class
128  dataContainer_Type::showMe ( output );
129 
130  // Show 1D data
131  output << "Line = " << M_line << std::endl;
132  output << "Quantity = " << M_quantity << std::endl;
133  output << "Resistance = ";
134  for ( UInt i (0); i < static_cast<UInt> ( M_resistance.size() ); ++i )
135  {
136  output << M_resistance[i] << " ";
137  }
138  output << "\n";
139  output << "Capacitance = " << M_capacitance << std::endl;
140 }
141 
142 // ===================================================
143 // Private Methods
144 // ===================================================
145 void
146 BCInterfaceData1D::readResistance ( const GetPot& dataFile, const char* resistance )
147 {
148  UInt resistanceSize = dataFile.vector_variable_size ( resistance );
149 
150  M_resistance.resize ( resistanceSize );
151  for ( UInt j ( 0 ); j < resistanceSize; ++j )
152  {
153  M_resistance[j] = dataFile ( resistance, 0, j );
154  }
155 }
156 
157 } // Namespace LifeV
BCInterfaceData - The BCInterface data container.
OneDFSI::bcLine_Type M_line
void updateInverseJacobian(const UInt &iQuadPt)
OneDFSI::bcType_Type M_quantity
BCInterfaceData1D(const BCInterfaceData1D &data)
Copy constructor.
void readBC(const std::string &fileName, const std::string &dataSection, const std::string &name)
Read parameters for all kind of BC.
BCInterfaceData1D - The BCInterface1D data container.
void showMe(std::ostream &output=std::cout) const
Display general information about the content of the class.
resistanceContainer_Type M_resistance
BCInterfaceData1D & operator=(const BCInterfaceData1D &data)
Operator =.
void readResistance(const GetPot &dataFile, const char *resistance)
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