LifeV
LevelSetData.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 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 Contains the data container for the LevelSetSolver
30 
31  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
32  @date 10-11-2010
33 
34  @contributor Samuel Quinodoz <samuel.quinodoz@epfl.ch>
35  @mantainer Samuel Quinodoz <samuel.quinodoz@epfl.ch>
36 
37  */
38 
39 #ifndef DATALEVELSET_H
40 #define DATALEVELSET_H 1
41 
42 #include <lifev/core/LifeV.hpp>
43 
44 #include <lifev/core/fem/TimeData.hpp>
45 #include <lifev/core/fem/TimeAdvanceData.hpp>
46 
47 #include <boost/shared_ptr.hpp>
48 
49 namespace LifeV
50 {
51 
52 //! dataLevelSet - Container for the data for the level set solver
53 /*!
54 
55  There are two ways of filling this data container: either by reading a file
56  and using the setup method, or by setting the data one by one using the
57  setters defined in the class. Mixture of the two solutions are also possible.
58 
59  <b> Reading from a data file </b>
60 
61  If one read the data from a file, the following informations
62  can be provided:
63 
64  \verbatim
65  [section]
66 
67  [./time_discretization]
68 
69  #everything for the TimeData class
70 
71  [../]
72 
73  stabilization = ip #options: none, ip
74 
75  [./ip]
76 
77  coefficient = 0.5
78  treatment = implicit #options: implicit, semi-implicit, explicit
79 
80  [../]
81 
82  [../]
83  \endverbatim
84 
85  The code that one need then (usually in the main file) is simply
86 
87  \code
88 
89  GetPot dataFile( ... );
90 
91  DataLevelSet data_level_set;
92  data_level_set.setup(dataFile,"section");
93 
94  \endcode
95 
96  <b> Using the setters </b>
97 
98  This way allows you to define all the members
99  of the class. Simply use the setters defined.
100 
101  For the stabilization and its treatment, prefer
102  using the setters with the enumerated types, this makes
103  code more robust with respect to typos.
104 
105  <b> Mixing the two solutions </b>
106 
107  Mixing the two solutions might be a good idea is some cases,
108  for example to write the time discretization only once in a
109  data file for a problem that consists in coupling smaller
110  problems. Here, the idea would be to initialize this data
111  container with the dataFile (this will put default parameters
112  for the time discretization), create a TimeData (outside
113  DataLevelSet) and set this new TimeData in DataLevelSet. As
114  DataLevelSet will retain a pointer to the TimeData, any change
115  to it will be repercuted in the DataLevelSet. Then, only one
116  TimeData needs to be managed.
117 
118  Beware that, when mixing the two solutions, any call to the
119  setup will overwrite ALL the previous informations stored
120  in the DataLevelSet.
121 
122  @author Samuel Quinodoz
123  */
125 {
126 public:
127 
128  //! @name Public Types
129  //@{
130 
133 
136 
137  //! \enum Enumerated type for the stabilization
139  {
140  NONE, //!< No stabilization will be added
141  IP //!< The IP stabiilzation will be used
142  };
143 
144  //! \enum Enumerated type for the treatment of the stabilization (if IP is chosen)
146  {
147  IMPLICIT, //!< Fully implicit stabilization (standard procedure)
148  SEMI_IMPLICIT, //!< Semi-implicit, best choice for faster computations
149  EXPLICIT //!< Completly explicit, not very usefull but available.
150  };
151 
152  //@}
153 
154 
155  //! @name Constructor & Destructor
156  //@{
157 
158  //! Empty Constructor
159  DataLevelSet();
160 
161  //! Destructor
162  virtual ~DataLevelSet() {};
163 
164  //@}
165 
166 
167  //! @name Methods
168  //@{
169 
170  //! Fill the DataLevelSet with the informations of the GetPot object
171  /*!
172  Using this method overrides all the previously stored informations!
173  */
174  void setup ( const GetPot& dataFile, const std::string& section = "level-set");
175 
176  //! ShowMe method
177  void showMe (std::ostream& out = std::cout) const ;
178 
179  //@}
180 
181 
182  //! @name Set Methods
183  //@{
184 
185  //! Set data time container
186  /*!
187  * @param TimeData shared_ptr to TimeData container
188  */
189  void setTimeData ( const timePtr_Type timeData )
190  {
191  M_time = timeData;
192  }
193 
194  //! Set data time advance container
195  /*!
196  * @param timeAdvanceData shared_ptr to TimeAdvanceData container
197  */
198  void setTimeAdvanceData ( const timeAdvancePtr_Type timeAdvanceData )
199  {
200  M_timeAdvance = timeAdvanceData;
201  }
202 
203  //! Set the stabilization type
204  /*!
205  This set the stabilization to the one given in the string format.
206  Accepted possibilities are "none" and "ip".
207  @Warning: prefer using the other version of setStabilization
208  that is not sensible to typos.
209  */
210  void setStabilization (const std::string& stab);
211 
212  //! Set the stabilization type
213  inline void setStabilization (const stabilization_type& stab)
214  {
215  M_stabilization = stab;
216  }
217 
218  //! Set the treatment for the IP stabilization
219  /*!
220  This set the treatment of the ip stabilization to the one given in the string format.
221  Accepted possibilities are "implicit", "semi-implicit" and "explicit".
222  @Warning: prefer using the other version of setIPTreatment
223  that is not sensible to typos.
224  */
225  void setIPTreatment (const std::string& treat);
226 
227  //! Set the IP treatment
228  void setIPTreatment (const IPTreatment_type& treat)
229  {
230  M_IPTreatment = treat;
231  }
232 
233  //! Set the IP coefficient
234  inline void setIPCoef (const Real& coef)
235  {
236  M_IPCoef = coef;
237  };
238 
239  //@}
240 
241 
242  //! @name Get Methods
243  //@{
244 
245  //! Get data time container
246  /*!
247  * @return shared_ptr to TimeData container
248  */
250  {
251  return M_time;
252  }
253 
254  //! Get data time advance container
255  /*!
256  * @return shared_ptr to TimeAdvanceData container
257  */
259  {
260  return M_timeAdvance;
261  }
262 
263  //! Getter for the stabilization type
265  {
266  return M_stabilization;
267  };
268 
269  //! Getter for the IP treatment
271  {
272  return M_IPTreatment;
273  };
274 
275  //! Getter for the IP coefficient
276  inline Real IPCoef() const
277  {
278  return M_IPCoef;
279  };
280 
281  //@}
282 
283 private:
284 
285  // No copy
286  DataLevelSet (const DataLevelSet&);
287 
288  // Data for the time
291 
292  // Stabilization type
294 
295  // IP Stabilization treatment
297 
298  // Coefficient for the IP
300 
301 };
302 
303 
304 } // Namespace LifeV
305 
306 #endif /* DATALEVELSET_H */
Completly explicit, not very usefull but available.
Semi-implicit, best choice for faster computations.
void showMe(std::ostream &out=std::cout) const
ShowMe method.
Real IPCoef() const
Getter for the IP coefficient.
Fully implicit stabilization (standard procedure)
timeAdvancePtr_Type M_timeAdvance
stabilization_type M_stabilization
std::shared_ptr< time_Type > timePtr_Type
DataLevelSet()
Empty Constructor.
timeAdvancePtr_Type dataTimeAdvance() const
Get data time advance container.
TimeAdvanceData - Class for handling temporal discretization.
void setIPTreatment(const IPTreatment_type &treat)
Set the IP treatment.
void updateInverseJacobian(const UInt &iQuadPt)
IPTreatment_type M_IPTreatment
std::shared_ptr< timeAdvance_Type > timeAdvancePtr_Type
virtual ~DataLevelSet()
Destructor.
The IP stabiilzation will be used.
void setStabilization(const std::string &stab)
Set the stabilization type.
void setStabilization(const stabilization_type &stab)
Set the stabilization type.
void setTimeData(const timePtr_Type timeData)
Set data time container.
void setTimeAdvanceData(const timeAdvancePtr_Type timeAdvanceData)
Set data time advance container.
void setup(const GetPot &dataFile, const std::string &section="level-set")
Fill the DataLevelSet with the informations of the GetPot object.
stabilization_type stabilization() const
Getter for the stabilization type.
double Real
Generic real data.
Definition: LifeV.hpp:175
timePtr_Type dataTime() const
Get data time container.
void setIPCoef(const Real &coef)
Set the IP coefficient.
DataLevelSet(const DataLevelSet &)
TimeAdvanceData timeAdvance_Type
No stabilization will be added.
void setIPTreatment(const std::string &treat)
Set the treatment for the IP stabilization.
dataLevelSet - Container for the data for the level set solver
IPTreatment_type IPTreatment() const
Getter for the IP treatment.
TimeData - Class for handling temporal discretization.
Definition: TimeData.hpp:61