LifeV
MultiscaleModel.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 Multiscale Physical Model
30  *
31  * @date 12-03-2009
32  * @author Cristiano Malossi <cristiano.malossi@epfl.ch>
33  *
34  * @maintainer Cristiano Malossi <cristiano.malossi@epfl.ch>
35  */
36 
37 #include <lifev/multiscale/models/MultiscaleModel.hpp>
38 
39 namespace LifeV
40 {
41 namespace Multiscale
42 {
43 
45 
46 // ===================================================
47 // Constructors & Destructor
48 // ===================================================
50  M_ID (),
51  M_type (),
52  M_couplings (),
53  M_modelName (),
54  M_boundaryFlags (),
55  M_globalData (),
56  M_geometryScale (),
59  M_comm ()
60 {
61 
62 #ifdef HAVE_LIFEV_DEBUG
63  debugStream ( 8100 ) << "MultiscaleModel::MultiscaleModel() \n";
64 #endif
65 
66  //Initialization of geometry arrays
67  for ( UInt i ( 0 ); i < nDimensions; ++i )
68  {
69  M_geometryScale[i] = 1.;
70  M_geometryRotate[i] = 0.;
71  M_geometryTranslate[i] = 0.;
72  }
73 }
74 
75 // ===================================================
76 // Multiscale PhysicalModel Virtual Methods
77 // ===================================================
78 void
79 MultiscaleModel::setupData ( const std::string& fileName )
80 {
81 
82 #ifdef HAVE_LIFEV_DEBUG
83  debugStream ( 8100 ) << "MultiscaleModel::SetupData( fileName ) \n";
84 #endif
85 
86  GetPot dataFile ( fileName );
87 
88  // Read modelName
89  M_modelName = dataFile ( "Multiscale/modelName", "modelName" );
90 
91  // Read flags
92  UInt componentSize = dataFile.vector_variable_size ( "Multiscale/couplingFlags" );
93  M_boundaryFlags.reserve ( componentSize );
94  for ( UInt j ( 0 ); j < componentSize; ++j )
95  {
96  M_boundaryFlags.push_back ( dataFile ( "Multiscale/couplingFlags", 0, j ) );
97  }
98 }
99 
100 void
102 {
103  std::cout << "Model id = " << M_ID << std::endl
104  << "Model name = " << M_modelName << std::endl
105  << "Model type = " << enum2String ( M_type, multiscaleModelsMap ) << std::endl;
106 
107  std::cout << "Couplings number = " << couplingsNumber() << std::endl;
108  std::cout << "Couplings ID(s) = ";
109  for ( UInt i ( 0 ); i < couplingsNumber(); ++i )
110  {
111  std::cout << M_couplings[i]->ID() << " ";
112  }
113  std::cout << std::endl;
114  std::cout << "Couplings type(s) = ";
115  for ( UInt i ( 0 ); i < couplingsNumber(); ++i )
116  {
117  std::cout << enum2String ( M_couplings[i]->type(), multiscaleCouplingsMap ) << " ";
118  }
119  std::cout << std::endl;
120  std::cout << "Flags list = ";
121  for ( UInt i ( 0 ); i < couplingsNumber(); ++i )
122  {
123  std::cout << M_boundaryFlags[i] << " ";
124  }
125  std::cout << std::endl << std::endl;
126 
127  std::cout << "Geometry scale = ";
128  for ( UInt i ( 0 ); i < nDimensions; ++i )
129  {
130  std::cout << M_geometryScale[i] << " ";
131  }
132  std::cout << std::endl;
133  std::cout << "Geometry rotate = ";
134  for ( UInt i ( 0 ); i < nDimensions; ++i )
135  {
136  std::cout << M_geometryRotate[i] << " ";
137  }
138  std::cout << std::endl;
139  std::cout << "Geometry translate = ";
140  for ( UInt i ( 0 ); i < nDimensions; ++i )
141  {
142  std::cout << M_geometryTranslate[i] << " ";
143  }
144  std::cout << std::endl << std::endl;
145 }
146 
147 // ===================================================
148 // Set Methods
149 // ===================================================
150 void
151 MultiscaleModel::setGeometry ( const std::array< Real, NDIM >& scale,
152  const std::array< Real, NDIM >& rotate,
153  const std::array< Real, NDIM >& translate )
154 {
155 
156 #ifdef HAVE_LIFEV_DEBUG
157  debugStream ( 8100 ) << "MultiscaleModel::SetGeometry( scale, rotate, translate ) \n";
158 #endif
159 
160  M_geometryScale = scale;
161  M_geometryRotate = rotate;
162  M_geometryTranslate = translate;
163 }
164 
165 // ===================================================
166 // Get Methods
167 // ===================================================
168 UInt
170 {
171  for ( UInt localID ( 0 ); localID < couplingsNumber(); ++localID )
172  if ( M_couplings[localID]->ID() == ID )
173  {
174  return localID;
175  }
176 
177  return 0;
178 }
179 
180 } // Namespace multiscale
181 } // Namespace LifeV
virtual void setupData(const std::string &fileName)
Setup the data of the model.
UInt couplingLocalID(const UInt &ID) const
Get the coupling local ID through global ID.
MultiscaleModel()
The main constructor.
void setGeometry(const std::array< Real, NDIM > &scale, const std::array< Real, NDIM > &rotate, const std::array< Real, NDIM > &translate)
Scale, rotate and translate the Model in the 3D space.
void updateInverseJacobian(const UInt &iQuadPt)
#define NDIM
Definition: LifeV.hpp:265
multiscaleCouplingsContainer_Type M_couplings
virtual void showMe()
Display some information about the model.
multiscaleIDContainer_Type M_boundaryFlags
UInt couplingsNumber() const
Get the number of couplings connecting the model.
const UInt nDimensions(NDIM)
std::map< std::string, models_Type > multiscaleModelsMap
MultiscaleModel - The Multiscale Physical Model.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191