LifeV
DarcyData.hpp
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 the LifeV library
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
21  License along with this library; if not, see <http://www.gnu.org/licenses/>
22 
23 
24 *******************************************************************************
25 */
26 //@HEADER
27 
28 /*!
29  * @file
30  @brief This file contains the data for all the Darcy solver
31 
32  @date 05/2010
33  @author A. Fumagalli <alessio.fumagalli@mail.polimi.it>
34 
35  @contributor M. Kern <michel.kern@inria.fr>
36  @maintainer M. Kern <michel.kern@inria.fr>
37  */
38 
39 #ifndef _DATADARCY_HPP_
40 #define _DATADARCY_HPP_ 1
41 
42 
43 #include <Teuchos_XMLParameterListHelpers.hpp>
44 #include <Teuchos_RCP.hpp>
45 
46 
47 #include <lifev/core/mesh/MeshData.hpp>
48 
49 #include <lifev/core/fem/TimeData.hpp>
50 #include <lifev/core/fem/TimeAdvanceData.hpp>
51 
52 // LifeV namespace
53 namespace LifeV
54 {
55 
56 //! @class DarcyData This class contain the basic data for the Darcy solver.
57 /*!
58  In particular it stores the data as GetPot object, the data for the mesh and the data for the time schemes.
59 */
60 template < typename MeshType >
61 class DarcyData
62 {
63 public:
64 
65  // Policies.
66  //! @name Public Types
67  //@{
68 
69  //! Typedef for the mesh template.
70  typedef MeshType mesh_Type;
71 
72  //! Typedef for the GetPot data.
73  typedef GetPot data_Type;
74 
75  //! Shared pointer for the data.
77 
78  //! Teuchos parameter list.
80 
81  //! Shared pointer for the Teuchos parameter list.
83 
84  //! Typedef for the time data.
85  typedef TimeData timeData_Type;
86 
87  //! Shared pointer for the time data.
89 
90  //! Typedef for the time advance data.
91  typedef TimeAdvanceData timeAdvanceData_Type;
92 
93  //! Shared pointer for the time advance data.
95 
96  //! Typedef for the mesh data.
98 
99  //! Shared pointer for the mesh data.
101 
102  //! Self typedef.
104 
105  //@}
106 
107  // Constructors.
108  //! @name Constructors
109  //@{
110 
111  //! Empty Constructor.
113  M_verbose (0)
114  {}
115 
116  //! Constructor using a data file.
117  /*!
118  @param dataFile GetPot data file for set-up the problem.
119  @param section the section for the Darcy data.
120  */
121  DarcyData ( const data_Type& dataFile,
122  const std::string& section = "darcy" );
123 
124  // Methods.
125  //! @name Methods
126  //@{
127 
128  //! External set-up.
129  /*!
130  @param dataFile The data file with all the data.
131  @param section The global section.
132  */
133  void setup ( const data_Type& dataFile,
134  const std::string& section = "darcy" );
135 
136  //@}
137 
138  // Set methods
139  //! @name Set methods
140  //@{
141 
142  //! Set Teuchos parameter list for linear algebra.
143  /*!
144  @param paramList Teuchos RCP with the parameter list.
145  @param linearSolver Section of the linear solver in the paramList.
146  @param precond Section of the preconditioner in the paramList.
147  */
148  void setLinearAlgebraList ( const paramListPtr_Type& linearAlgebraList,
149  const std::string& linearSolver = "Linear Solver",
150  const std::string& precond = "Preconditioner" )
151  {
152  M_linearAlgebraList = linearAlgebraList;
153  M_linearSolverSection = linearSolver;
154  M_precondSection = precond;
155  } // setLinearAlgebraList
156 
157  //! Set data time container.
158  /*!
159  @param timeData Boost shared_ptr to timeData container
160  */
161  void setTimeData ( const timeDataPtr_Type& timeData )
162  {
163  M_time = timeData;
164  } // setTimeData
165 
166  //! Set mesh container.
167  /*!
168  @param meshData Boost shared_ptr to meshData container
169  */
170  void setMeshData ( const meshDataPtr_Type& meshData )
171  {
172  M_mesh = meshData;
173  } // setMeshData
174 
175  // Get methods.
176  //! @name Get methods
177  //@{
178 
179  //! Get the level of verbosity of the problem.
180  UInt verbose () const
181  {
182  return M_verbose;
183  } // verbose
184 
185  //! Get the main section of the data file.
186  std::string section () const
187  {
188  return M_section;
189  } // section
190 
191  //! Get the data file of the problem.
192  /*!
193  @return shared_ptr to data container.
194  */
195  const dataPtr_Type& dataFilePtr () const
196  {
197  return M_data;
198  } // dataFilePtr
199 
200  //! Get the data file of the problem.
201  /*!
202  @return shared_ptr to data container.
203  */
205  {
206  return M_data;
207  } // dataFilePtr
208 
209  //! Get data time container.
210  /*!
211  @return shared_ptr to TimeData container.
212  */
214  {
215  return M_time;
216  } // dataTimePtr
217 
218  //! Get data time container.
219  /*!
220  @return shared_ptr to TimeData container.
221  */
223  {
224  return M_time;
225  } // dataTimePtr
226 
227  //! Get data time advance container.
228  /*!
229  @return shared_ptr to TimeAdvanceData container.
230  */
232  {
233  return M_timeAdvance;
234  }
235 
236  //! Get data time advance container.
237  /*!
238  @return shared_ptr to TimeAdvanceData container.
239  */
241  {
242  return M_timeAdvance;
243  }
244 
245  //! Get mesh container
246  /*!
247  @return shared_ptr to meshData container.
248  */
250  {
251  return M_mesh;
252  } // meshDataPtr
253 
254  //! Get mesh container
255  /*!
256  @return shared_ptr to meshData container.
257  */
259  {
260  return M_mesh;
261  } // meshDataPtr
262 
263  //! Get Teuchos parameter list for the linear solver.
264  /*!
265  @return Teuchos RCP with the parameter list for the linear solver.
266  */
268  {
269  ASSERT ( M_linearAlgebraList.get(), "Parameter list not set." );
270  return M_linearAlgebraList->sublist ( M_linearSolverSection );
271  } // linearSolverList
272 
273  //! Get Teuchos parameter list for the preconditioner.
274  /*!
275  @return Teuchos RCP with the parameter list for the preconditioner.
276  */
278  {
279  ASSERT ( M_linearAlgebraList.get(), "Parameter list not set." );
280  return M_linearAlgebraList->sublist ( M_precondSection );
281  } // preconditionerList
282 
283  //@}
284 
285 private:
286 
287  //! @name Private Constructors
288  //@{
289 
290  //! Inhibited copy constructor.
291  DarcyData ( const darcyData_Type& );
292 
293  //@}
294 
295  //! @name Private Operators
296  //@{
297 
298  //! Inhibited assign operator.
300 
301  //@}
302 
303  //! Inhibited assign operator.
304 
305  //! Data GetPot.
307 
308  //! Section in GetPot file.
310 
311  //! Data container for time.
313 
314  //! Data container for time advance.
316 
317  //! Data container for mesh.
319 
320  //! Teuchos paramter list for linear algebra.
322 
323  //! Section in the parameter list for linear solver.
325 
326  //! Section in the parameter list for preconditioner.
328 
329  //! Output verbose.
331 
332 };
333 
334 // ===================================================
335 // Constructors
336 // ===================================================
337 
338 // External set up method
339 template < typename MeshType >
340 void
341 DarcyData < MeshType >::
342 setup ( const data_Type& dataFile, const std::string& section )
343 {
344  M_section = section;
345 
346  // If data has not been set
347  if ( !M_data.get() )
348  {
349  M_data.reset ( new data_Type ( dataFile ) );
350  }
351 
352  // If data time has not been set
353  if ( !M_time.get() )
354  {
355  M_time.reset ( new timeData_Type ( dataFile, M_section + "/time_discretization" ) );
356  }
357 
358  // If data time has not been set
359  if ( !M_timeAdvance.get() )
360  {
361  M_timeAdvance.reset ( new timeAdvanceData_Type ( dataFile, M_section + "/time_discretization" ) );
362  }
363 
364  // If data mesh has not been set
365  if ( !M_mesh.get() )
366  {
367  M_mesh.reset ( new meshData_Type ( dataFile, M_section + "/space_discretization" ) );
368  }
369 
370  // Miscellaneous
371  M_verbose = dataFile ( ( M_section + "/miscellaneous/verbose" ).data(), 1 );
372 } // setup
373 
374 } // Namespace LifeV
375 
376 #endif // _DATADARCY_HPP_
377 
378 // -*- mode: c++ -*-
std::string section() const
Get the main section of the data file.
Definition: DarcyData.hpp:186
timeAdvanceDataPtr_Type & dataTimeAdvancePtr()
Get data time advance container.
Definition: DarcyData.hpp:240
TimeData timeData_Type
Typedef for the time data.
Definition: DarcyData.hpp:85
std::shared_ptr< meshData_Type > meshDataPtr_Type
Shared pointer for the mesh data.
Definition: DarcyData.hpp:100
UInt verbose() const
Get the level of verbosity of the problem.
Definition: DarcyData.hpp:180
dataPtr_Type M_data
Inhibited assign operator.
Definition: DarcyData.hpp:306
std::string M_precondSection
Section in the parameter list for preconditioner.
Definition: DarcyData.hpp:327
DarcyData()
Empty Constructor.
Definition: DarcyData.hpp:112
void setTimeData(const timeDataPtr_Type &timeData)
Set data time container.
Definition: DarcyData.hpp:161
meshDataPtr_Type M_mesh
Data container for mesh.
Definition: DarcyData.hpp:318
std::shared_ptr< data_Type > dataPtr_Type
Shared pointer for the data.
Definition: DarcyData.hpp:76
const dataPtr_Type & dataFilePtr() const
Get the data file of the problem.
Definition: DarcyData.hpp:195
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
std::string M_section
Section in GetPot file.
Definition: DarcyData.hpp:309
const paramList_Type & linearSolverList() const
Get Teuchos parameter list for the linear solver.
Definition: DarcyData.hpp:267
UInt M_verbose
Output verbose.
Definition: DarcyData.hpp:330
dataPtr_Type & dataFilePtr()
Get the data file of the problem.
Definition: DarcyData.hpp:204
void setMeshData(const meshDataPtr_Type &meshData)
Set mesh container.
Definition: DarcyData.hpp:170
const paramList_Type & preconditionerList() const
Get Teuchos parameter list for the preconditioner.
Definition: DarcyData.hpp:277
timeAdvanceDataPtr_Type M_timeAdvance
Data container for time advance.
Definition: DarcyData.hpp:315
DarcyData< mesh_Type > darcyData_Type
Self typedef.
Definition: DarcyData.hpp:103
MeshData - class for handling spatial discretization.
Definition: MeshData.hpp:72
timeDataPtr_Type & dataTimePtr()
Get data time container.
Definition: DarcyData.hpp:222
paramListPtr_Type M_linearAlgebraList
Teuchos paramter list for linear algebra.
Definition: DarcyData.hpp:321
darcyData_Type & operator=(const darcyData_Type &)
Inhibited assign operator.
meshDataPtr_Type & meshDataPtr()
Get mesh container.
Definition: DarcyData.hpp:258
std::shared_ptr< timeData_Type > timeDataPtr_Type
Shared pointer for the time data.
Definition: DarcyData.hpp:88
const meshDataPtr_Type & meshDataPtr() const
Get mesh container.
Definition: DarcyData.hpp:249
std::shared_ptr< timeAdvanceData_Type > timeAdvanceDataPtr_Type
Shared pointer for the time advance data.
Definition: DarcyData.hpp:94
Teuchos::RCP< paramList_Type > paramListPtr_Type
Shared pointer for the Teuchos parameter list.
Definition: DarcyData.hpp:82
std::string M_linearSolverSection
Section in the parameter list for linear solver.
Definition: DarcyData.hpp:324
DarcyData(const darcyData_Type &)
Inhibited copy constructor.
contain the basic data for the Darcy solver.
Definition: DarcyData.hpp:61
TimeAdvanceData timeAdvanceData_Type
Typedef for the time advance data.
Definition: DarcyData.hpp:91
MeshData meshData_Type
Typedef for the mesh data.
Definition: DarcyData.hpp:97
MeshType mesh_Type
Typedef for the mesh template.
Definition: DarcyData.hpp:70
const timeDataPtr_Type & dataTimePtr() const
Get data time container.
Definition: DarcyData.hpp:213
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
const timeAdvanceDataPtr_Type & dataTimeAdvancePtr() const
Get data time advance container.
Definition: DarcyData.hpp:231
timeDataPtr_Type M_time
Data container for time.
Definition: DarcyData.hpp:312
GetPot data_Type
Typedef for the GetPot data.
Definition: DarcyData.hpp:73
Teuchos::ParameterList paramList_Type
Teuchos parameter list.
Definition: DarcyData.hpp:79