Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
exporterexodus.hpp
Go to the documentation of this file.
1 /* -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*-
2 
3  This file is part of the Feel library
4 
5  Author(s): Christophe Prud'homme <prudhomme@unistra.fr>
6  Date: 2013-04-25
7 
8  Copyright (C) 2013 Université de Strasbourg
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 2.1 of the License, or (at your option) any later version.
14 
15  This library 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, write to the Free Software
22  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
29 #ifndef __ExporterExodus_H
30 #define __ExporterExodus_H 1
31 
32 #include <iostream>
33 #include <fstream>
34 
35 
36 #include <boost/lambda/lambda.hpp>
37 #include <boost/filesystem/path.hpp>
38 #include <boost/filesystem/operations.hpp>
39 
40 #include <feel/feelfilters/exporter.hpp>
42 
43 namespace Feel
44 {
45 namespace fs = boost::filesystem;
46 
54 template<typename MeshType, int N>
56  :
57 public Exporter<MeshType, N>
58 {
60 public:
61 
62 
66 
67  typedef MeshType mesh_type;
68 
69  typedef typename super::timeset_type timeset_type;
70  typedef typename super::timeset_ptrtype timeset_ptrtype;
71  typedef typename super::timeset_iterator timeset_iterator;
72  typedef typename super::timeset_const_iterator timeset_const_iterator;
73 
75 
122  ExporterExodus( WorldComm const& worldComm = Environment::worldComm() );
123  ExporterExodus( std::string const& __p = "default", int freq = 1, WorldComm const& worldComm = Environment::worldComm() );
124  ExporterExodus( po::variables_map const& vm=Environment::vm(), std::string const& exp_prefix = "", WorldComm const& worldComm = Environment::worldComm() );
125 
126  ExporterExodus( ExporterExodus const & __ex );
127 
128  ~ExporterExodus();
129 
130 
132 
136 
137 
139 
143 
147  std::string const& elementType() const
148  {
149  return M_element_type;
150  }
151 
152 
154 
158 
159  Exporter<MeshType,N>* setOptions( po::variables_map const& vm, std::string const& exp_prefix = "" ) FEELPP_DEPRECATED
160  {
161  super::setOptions( exp_prefix );
162 
163  return this;
164  }
165 
166  Exporter<MeshType,N>* setOptions( std::string const& exp_prefix = "" )
167  {
168  super::setOptions( exp_prefix );
169 
170  return this;
171  }
172 
173 
175 
179 
183  void save() const;
184 
185  void visit( mesh_type* mesh );
186 
188 
189 
190 
191 protected:
192 
193 private:
194 
198  void init();
199 
200 
201 private:
202 
203  mutable std::string M_filename;
204  std::string M_element_type;
205 };
206 
207 template<typename MeshType, int N>
208 ExporterExodus<MeshType,N>::ExporterExodus( WorldComm const& worldComm )
209 :
210 super( worldComm ),
211 M_element_type()
212 
213 {
214  init();
215 }
216 template<typename MeshType, int N>
217 ExporterExodus<MeshType,N>::ExporterExodus( std::string const& __p, int freq, WorldComm const& worldComm )
218  :
219  super( "exodus", __p, freq, worldComm ),
220  M_element_type()
221 {
222  init();
223 }
224 template<typename MeshType, int N>
225 ExporterExodus<MeshType,N>::ExporterExodus( po::variables_map const& vm, std::string const& exp_prefix, WorldComm const& worldComm )
226  :
227  super( vm, exp_prefix, worldComm )
228 {
229  init();
230 }
231 
232 template<typename MeshType, int N>
233 ExporterExodus<MeshType,N>::ExporterExodus( ExporterExodus const & __ex )
234  :
235  super( __ex ),
236  M_element_type( __ex.M_element_type )
237 {
238 }
239 
240 template<typename MeshType, int N>
241 ExporterExodus<MeshType,N>::~ExporterExodus()
242 {}
243 
244 template<typename MeshType, int N>
245 void
246 ExporterExodus<MeshType,N>::init()
247 {
248  if ( mesh_type::nDim == 1 )
249  if ( mesh_type::Shape == SHAPE_LINE )
250  M_element_type = ( mesh_type::nOrder == 1 )?"bar2":"bar3";
251 
252  if ( mesh_type::nDim == 2 )
253  {
254  if ( mesh_type::Shape == SHAPE_TRIANGLE )
255  M_element_type = ( mesh_type::nOrder == 1 )?"tria3":"tria6";
256 
257  else if ( mesh_type::Shape == SHAPE_QUAD )
258  M_element_type = ( mesh_type::nOrder == 1 )?"quad4":"quad8";
259  }
260 
261  if ( mesh_type::nDim == 3 )
262  {
263  if ( mesh_type::Shape == SHAPE_TETRA )
264  M_element_type = ( mesh_type::nOrder == 1 )?"tetra4":"tetra10";
265 
266  else if ( mesh_type::Shape == SHAPE_HEXA )
267  M_element_type = ( mesh_type::nOrder == 1 )?"hexa8":"hexa20";
268  }
269 }
270 template<typename MeshType, int N>
271 void
273 {
274  if ( !this->worldComm().isActive() ) return;
275 
276 }
277 
278 
279 template<typename MeshType, int N>
280 void
282 {
283 }
284 
285 } // Feel
286 
287 
288 #endif /* __ExporterExodus_H */

Generated on Sun Oct 20 2013 08:24:57 for Feel++ by doxygen 1.8.4