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
mesh1d.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 -*- 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-11-09
7 
8  Copyright (C) 2005,2006 EPFL
9  Copyright (C) 2007-2010 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 __Mesh1D_H
31 #define __Mesh1D_H 1
32 
33 
34 #include <iomanip>
35 #include <fstream>
36 #include <cstdlib>
37 
38 #include <boost/archive/binary_iarchive.hpp>
39 #include <boost/archive/binary_oarchive.hpp>
40 
41 #include <boost/shared_ptr.hpp>
42 #include <boost/foreach.hpp>
43 #include <boost/multi_array.hpp>
44 #include <boost/multi_index_container.hpp>
45 #include <boost/multi_index/member.hpp>
46 #include <boost/multi_index/mem_fun.hpp>
47 #include <boost/multi_index/ordered_index.hpp>
48 #include <boost/numeric/ublas/io.hpp>
49 
50 
51 
52 #include <feel/feelcore/feel.hpp>
54 
56 
57 #include <feel/feelmesh/geoelement.hpp>
58 
60 #include <feel/feelmesh/faces.hpp>
61 #include <feel/feelmesh/points.hpp>
62 
63 namespace Feel
64 {
80 template<typename Shape>
81 class Mesh1D
82  :
83  public VisitableBase<>,
84  public MeshBase,
85  public Elements<Shape>,
86  public Points<Shape::nRealDim>,
87  public Faces<typename Shape::template shape<0,Shape::nOrder,Shape::nRealDim>::type,
88  typename Elements<Shape>::element_type>
89 {
90  // check at compilation time that the shape has indeed dimension 1
91  BOOST_STATIC_ASSERT( Shape::nDim == 1 );
92 
93 public:
94 
95 
99 
100  static const uint16_type nDim = Shape::nRealDim;
101  static const uint16_type nRealDim = Shape::nRealDim;
102 
103  typedef typename VisitableBase<>::return_type return_type;
104 
105  typedef VisitableBase<> super_visitable;
106  typedef MeshBase super;
107 
108  typedef Elements<Shape> super_elements;
109  typedef typename super_elements::elements_type elements_type;
110  typedef typename super_elements::element_type element_type;
111  typedef typename super_elements::element_iterator element_iterator;
112  typedef typename super_elements::element_const_iterator element_const_iterator;
113  typedef typename super_elements::update_element_neighbor_type update_element_neighbor_type;
114 
115  typedef Points<nRealDim> super_points;
116  typedef typename super_points::points_type points_type;
117  typedef typename super_points::point_type point_type;
118 
119  typedef Faces<typename Shape::template shape<0,Shape::nOrder,Shape::nRealDim>::type,typename super_elements::element_type> super_faces;
120  typedef typename super_faces::face_iterator face_iterator;
121  typedef typename super_faces::face_const_iterator face_const_iterator;
122  typedef typename super_faces::faces_type faces_type;
123  typedef typename super_faces::face_type face_type;
124  typedef face_type edge_type;
125 
126  typedef super_faces super_edges;
127  typedef typename super_edges::marker_face_iterator marker_edge_iterator;
128  typedef typename super_edges::marker_face_const_iterator marker_edge_const_iterator;
129  typedef typename super_edges::location_face_iterator location_edge_iterator;
130  typedef typename super_edges::location_face_const_iterator location_edge_const_iterator;
131 
132  typedef Mesh1D<Shape> self_type;
133  typedef boost::shared_ptr<self_type> self_ptrtype;
134 
135  typedef typename element_type::vertex_permutation_type vertex_permutation_type;
136  typedef typename element_type::edge_permutation_type edge_permutation_type;
137 
138  typedef typename super::face_processor_type face_processor_type;
139 
140 
142 
146 
150  Mesh1D( WorldComm const& worldComm = Environment::worldComm() )
151  :
152  super_visitable(),
153  super( worldComm ),
154  super_elements( worldComm ),
155  super_points( worldComm ),
156  super_faces( worldComm )
157  {}
158 
162  Mesh1D( Mesh1D const & m )
163  :
164  super_visitable(),
165  super( m ),
166  super_elements( m ),
167  super_points( m ),
168  super_faces( m )
169  {}
170 
175  {}
176 
178 
182 
183  Mesh1D& operator=( Mesh1D const& m )
184  {
185  if ( this != &m )
186  {
187  super::operator=( m );
191  }
192 
193  return *this;
194  }
195 
196 
198 
202 
206  bool isEmpty() const
207  {
208  return ( super_elements::isEmpty() &&
211  }
212 
213 
218  {
219  return this->elements().size();
220  }
221 
226  {
227  return super_elements::element_type::numLocalFaces;
228  }
229 
234  {
235  return super_elements::element_type::numLocalVertices;
236  }
237 
242  {
243  return this->faces().size();
244  }
245 
246 
251  {
252  return this->points().size();
253  }
254 
256 
260 
261 
263 
267 
268  virtual void setWorldComm( WorldComm const& _worldComm )
269  {
270  this->setWorldCommMeshBase( _worldComm );
271  this->setWorldCommElements( _worldComm );
272  this->setWorldCommFaces( _worldComm );
273  this->setWorldCommPoints( _worldComm );
274  }
275 
280  virtual void clear()
281  {
282  this->elements().clear();
283  this->points().clear();
284  this->faces().clear();
285  FEELPP_ASSERT( isEmpty() ).error( "all mesh containers should be empty after a clear." );
286  }
287 
288 
289 
290  FEELPP_DEFINE_VISITABLE();
292 
293 
294 
295 protected:
296 
301  void renumber()
302  {
303  FEELPP_ASSERT( 0 ).error( "invalid call" );
304  }
305 
306 
311  {
312  // no-op
313  }
314 
319  {
320  // no-op
321  }
322 
323 private:
324 
325  friend class boost::serialization::access;
326  template<class Archive>
327  void serialize( Archive & ar, const unsigned int version )
328  {
329  ar & boost::serialization::base_object<super>( *this );
330  DVLOG(2) << "Serializing points\n";
331  ar & boost::serialization::base_object<super_points>( *this );
332  DVLOG(2) << "Serializing faces\n";
333  ar & boost::serialization::base_object<super_faces>( *this );
334  DVLOG(2) << "Serializing elements\n";
335  ar & boost::serialization::base_object<super_elements>( *this );
336  }
337 
338 
339 };
340 
341 
342 
343 
344 } // Feel
345 
346 #endif /* __Mesh1D_H */

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