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
exportergmsh.hpp
1 /* -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2 
3  This file is part of the Feel library
4 
5  Author(s): Christophe Prud'homme <christophe.prudhomme@feelpp.org>
6  Date: 2005-03-30
7 
8  Copyright (C) 2005-2006 EPFL
9  Copyright (C) 2007 Université Joseph Fourier (Grenoble I)
10 
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Lesser General Public
13  License as published by the Free Software Foundation; either
14  version 3.0 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public
22  License along with this library; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
30 #ifndef __ExporterGmsh_H
31 #define __ExporterGmsh_H 1
32 
33 #include <iostream>
34 #include <fstream>
35 
36 
37 #include <boost/lambda/lambda.hpp>
38 
39 #include <feel/feelcore/debug.hpp>
40 
41 #include <feel/feelfilters/exporter.hpp>
42 
43 namespace Feel
44 {
45 extern const char* FEELPP_GMSH_FORMAT_VERSION;
53 template<typename MeshType, int N>
55  :
56 public Exporter<MeshType,N>
57 {
58 public:
59 
60 
64 
65  typedef MeshType mesh_type;
66  typedef boost::shared_ptr<mesh_type> mesh_ptrtype;
67  typedef typename mesh_type::point_const_iterator point_const_iterator;
68 
70  typedef typename mesh_type::value_type value_type;
71  typedef typename super::timeset_type timeset_type;
72  typedef typename super::timeset_ptrtype timeset_ptrtype;
73  typedef typename super::timeset_iterator timeset_iterator;
74  typedef typename super::timeset_const_iterator timeset_const_iterator;
75 
76  typedef typename timeset_type::step_type step_type;
77  typedef typename timeset_type::step_ptrtype step_ptrtype;
78  typedef typename timeset_type::step_const_iterator step_const_iterator;
79 
80  typedef typename matrix_node<value_type>::type matrix_node_type;
82 
86 
87  ExporterGmsh( std::string const& __p = "default", int freq = 1, WorldComm const& worldComm = Environment::worldComm() );
88 
89  ExporterGmsh( po::variables_map const& vm, std::string const& exp_prefix = "", WorldComm const& worldComm = Environment::worldComm() );
90 
91  ExporterGmsh( ExporterGmsh const & __ex );
92 
93  ~ExporterGmsh();
94 
96 
100 
101 
103 
107 
108 
110 
114 
115  Exporter<MeshType,N>* setOptions( std::string const& exp_prefix = "" )
116  {
117  super::setOptions( exp_prefix );
118 
119  return this;
120  }
121  Exporter<MeshType,N>* setOptions( po::variables_map const& vm, std::string const& exp_prefix = "" ) FEELPP_DEPRECATED
122  {
123  super::setOptions( exp_prefix );
124 
125  return this;
126  }
127 
129 
133 
137  void save() const;
138 
142  void visit( mesh_type* mesh );
143 
147  void saveMesh( std::string const& filename, mesh_ptrtype mesh, bool parametric = false ) const;
148 
149  void gmshSaveAscii() const;
150 
151  void gmshSaveFormat( std::ostream& out, std::string const& version = FEELPP_GMSH_FORMAT_VERSION ) const;
152 
153  void gmshSavePhysicalNames( std::ostream& out, mesh_ptrtype mesh ) const;
154 
155  void gmshSaveNodesStart( std::ostream& out, mesh_ptrtype mesh, size_type nGlobPt, bool parametric = false ) const;
156  void gmshSaveNodes( std::ostream& out, mesh_ptrtype mesh, size_type indexPtStart, bool parametric = false ) const;
157  void gmshSaveNodesEnd( std::ostream& out, mesh_ptrtype mesh, bool parametric = false ) const;
158 
159  void gmshSaveElementsStart( std::ostream& out,size_type nGlobElt ) const;
160  void gmshSaveElements( std::ostream& out, mesh_ptrtype __mesh, size_type indexEltStart, size_type indexPtStart ) const;
161  void gmshSaveElementsEnd( std::ostream& out ) const;
162 
163  void gmshSaveNodeData( std::ostream& out, step_ptrtype __step ) const;
164 
165  void gmshSaveElementNodeData( std::ostream& out, step_ptrtype __step ) const;
166 
167 
168  void gmshSaveOneElementAsMesh( std::string const& filename, typename mesh_type::element_type::super const& elt ) const;
169 
171 
172 private:
173 
174  boost::tuple<size_type,size_type > numberOfGlobalPtAndIndex( mesh_ptrtype mesh ) const;
175 
176  boost::tuple<size_type,size_type> numberOfGlobalEltAndIndex( mesh_ptrtype mesh ) const;
177 
178 };
179 
180 } // Feel
181 
182 //#if !defined( FEELPP_INSTANTIATION_MODE )
184 //#endif // FEELPP_INSTANTIATION_MODE
185 
186 #endif /* __ExporterGmsh_H */
187 

Generated on Fri Oct 25 2013 14:24:08 for Feel++ by doxygen 1.8.4