LifeV
MeshData.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 a class for handling spatial discretization.
30 
31  @author M.A. Fernandez
32  @date 01-2003
33  @author Cristiano Malossi<cristiano.malossi@epfl.ch>
34  @date 06-2009
35  @author Gilles Fourestey
36  @date 06-2010
37  @contributor Lucia Mirabella <lucia.mirabell@gmail.com>
38  @maintainer Lucia Mirabella <lucia.mirabell@gmail.com>
39 
40  */
41 
42 #include <lifev/core/LifeV.hpp>
43 #include <lifev/core/mesh/MeshData.hpp>
44 
45 namespace LifeV
46 {
47 
48 // ===================================================
49 // Constructors & Destructor
50 // ===================================================
52  M_meshDir ( "./" ),
53  M_meshFile ( "mesh.mesh" ),
54  M_meshType ( "structured" ),
55  M_order ( "P1" ),
56  M_verbose ( false )
57 {}
58 
59 MeshData::MeshData ( const GetPot& dataFile, const std::string& section ) :
60  M_meshDir (),
61  M_meshFile (),
62  M_meshType (),
63  M_order (),
64  M_verbose ()
65 {
66  setup ( dataFile, section );
67 }
68 
69 MeshData::MeshData ( const MeshData& meshData ) :
70  M_meshDir ( meshData.M_meshDir ),
71  M_meshFile ( meshData.M_meshFile ),
72  M_meshType ( meshData.M_meshType ),
73  M_order ( meshData.M_order ),
74  M_verbose ( meshData.M_verbose )
75 {}
76 
77 // ===================================================
78 // Methods
79 // ===================================================
80 void
81 MeshData::setup ( const GetPot& dataFile, const std::string& section )
82 {
83  M_meshDir = dataFile ( ( section + "/mesh_dir" ).data(), "./" );
84  M_meshFile = dataFile ( ( section + "/mesh_file" ).data(), "mesh.mesh" );
85  M_meshType = dataFile ( ( section + "/mesh_type" ).data(), "structured" );
86  M_order = dataFile ( ( section + "/mesh_order" ).data(), "P1" );
87  M_verbose = dataFile ( ( section + "/verbose" ).data(), false );
88 }
89 
90 void
91 MeshData::setup ( const Teuchos::ParameterList& meshParameters )
92 {
93  Teuchos::ParameterList defaultParameters;
94  defaultParameters.set ("mesh_dir", "./");
95  defaultParameters.set ("mesh_file", "mesh.mesh");
96  defaultParameters.set ("mesh_type", ".mesh");
97  defaultParameters.set ("order", "P1");
98  defaultParameters.set ("verbose", false);
99  defaultParameters.setParameters (meshParameters);
100 
101  M_meshDir = defaultParameters.get<std::string> ("mesh_dir");
102  M_meshFile = defaultParameters.get<std::string> ("mesh_file");
103  M_meshType = defaultParameters.get<std::string> ("mesh_type");
104  M_order = defaultParameters.get<std::string> ("order");
105  M_verbose = defaultParameters.get<bool> ("verbose");
106 }
107 
108 void MeshData::showMe ( std::ostream& output ) const
109 {
110  output << "\n*** MeshData: values for user-defined data\n\n";
111 
112  output << "mesh_dir = " << M_meshDir << std::endl;
113  output << "mesh_file = " << M_meshFile << std::endl;
114  output << "mesh_type = " << M_meshType << std::endl;
115  output << "mesh_order = " << M_order << std::endl;
116 }
117 
118 }
MeshData(const MeshData &meshData)
Copy constructor.
Definition: MeshData.cpp:69
bool M_verbose
verbose output?
Definition: MeshData.hpp:186
std::string M_meshDir
mesh directory
Definition: MeshData.hpp:181
MeshData(const GetPot &dataFile, const std::string &section="space_discretization")
Constructor.
Definition: MeshData.cpp:59
std::string M_meshType
mesh type
Definition: MeshData.hpp:183
MeshData - class for handling spatial discretization.
Definition: MeshData.hpp:72
void setup(const GetPot &dataFile, const std::string &section)
Read the dataFile and set all the members.
Definition: MeshData.cpp:81
MeshData()
Empty Constructor.
Definition: MeshData.cpp:51
virtual void showMe(std::ostream &output=std::cout) const
Display the values.
Definition: MeshData.cpp:108
std::string M_order
mesh type
Definition: MeshData.hpp:184
void setup(const Teuchos::ParameterList &meshParameters)
Set all members using a Teuchos ParameterList.
Definition: MeshData.cpp:91
std::string M_meshFile
mesh file
Definition: MeshData.hpp:182