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
mesh0d.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: 2011-08-24
7 
8  Copyright (C) 2011 Université Joseph Fourier (Grenoble I)
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 3.0 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 __Mesh0d_H
30 #define __Mesh0d_H 1
31 
32 
33 #include <iomanip>
34 #include <fstream>
35 #include <cstdlib>
36 
37 #include <boost/archive/binary_iarchive.hpp>
38 #include <boost/archive/binary_oarchive.hpp>
39 
40 #include <boost/shared_ptr.hpp>
41 #include <boost/foreach.hpp>
42 #include <boost/multi_array.hpp>
43 #include <boost/multi_index_container.hpp>
44 #include <boost/multi_index/member.hpp>
45 #include <boost/multi_index/mem_fun.hpp>
46 #include <boost/multi_index/ordered_index.hpp>
47 #include <boost/numeric/ublas/io.hpp>
48 
49 
50 
51 #include <feel/feelcore/feel.hpp>
53 
55 
56 #include <feel/feelmesh/geoelement.hpp>
57 
59 #include <feel/feelmesh/points.hpp>
60 
61 namespace Feel
62 {
75 template<typename Shape>
76 class Mesh0D
77  :
78 public VisitableBase<>,
79 public MeshBase,
80 public Elements<Shape>,
81 public Points<Shape::nRealDim>
82 {
83  // check at compilation time that the shape has indeed dimension 1
84  BOOST_STATIC_ASSERT( Shape::nDim == 1 );
85 
86 public:
87 
88 
92 
93  static const uint16_type nDim = Shape::nRealDim;
94  static const uint16_type nRealDim = Shape::nRealDim;
95 
96  typedef typename VisitableBase<>::return_type return_type;
97 
98  typedef VisitableBase<> super_visitable;
99  typedef MeshBase super;
100 
101  typedef Elements<Shape> super_elements;
102  typedef typename super_elements::elements_type elements_type;
103  typedef typename super_elements::element_type element_type;
104  typedef typename super_elements::element_iterator element_iterator;
105  typedef typename super_elements::element_const_iterator element_const_iterator;
106  typedef typename super_elements::update_element_neighbor_type update_element_neighbor_type;
107 
108  typedef super_elements super_faces;
109  typedef elements_type faces_type;
110 
111  typedef Points<nRealDim> super_points;
112  typedef typename super_points::points_type points_type;
113  typedef typename super_points::point_type point_type;
114 
115  typedef Mesh0D<Shape> self_type;
116  typedef boost::shared_ptr<self_type> self_ptrtype;
117 
119 
123 
127  Mesh0D( WorldComm const& worldComm = Environment::worldComm() )
128  :
129  super_visitable(),
130  super( worldComm ),
131  super_elements( worldComm ),
132  super_points( worldComm )
133  {}
134 
135 
139  Mesh0D( Mesh0D const & m )
140  :
141  super_visitable(),
142  super( m ),
143  super_elements( m ),
144  super_points( m )
145  {}
146 
151  {}
152 
154 
158 
159  Mesh0D& operator=( Mesh0D const& m )
160  {
161  if ( this != &m )
162  {
163  super::operator=( m );
166  }
167 
168  return *this;
169  }
170 
171 
173 
177 
181  bool isEmpty() const
182  {
183  return ( super_elements::isEmpty() &&
185  }
186 
187 
192  {
193  return this->elements().size();
194  }
195 
200  {
201  return super_elements::element_type::numLocalFaces;
202  }
203 
208  {
209  return super_elements::element_type::numLocalVertices;
210  }
211 
216  {
217  return 0;
218  }
219 
220 
225  {
226  return this->points().size();
227  }
228 
230 
234 
235 
237 
241 
242 
247  virtual void clear()
248  {
249  this->elements().clear();
250  this->points().clear();
251  FEELPP_ASSERT( isEmpty() ).error( "all mesh containers should be empty after a clear." );
252  }
253 
254 
255 
256  FEELPP_DEFINE_VISITABLE();
258 
259 
260 
261 protected:
262 
267  void renumber()
268  {
269  FEELPP_ASSERT( 0 ).error( "invalid call" );
270  }
271 
272 
277  {
278  // no-op
279  }
280 
285  {
286  // no-op
287  }
288 private:
289 
290  friend class boost::serialization::access;
291  template<class Archive>
292  void serialize( Archive & ar, const unsigned int version )
293  {
294  ar & boost::serialization::base_object<super_elements>( *this );
295  ar & boost::serialization::base_object<super_points>( *this );
296  }
297 
298 
299 
300 };
301 
302 
303 
304 
305 } // Feel
306 
307 #endif /* __Mesh0D_H */

Generated on Sun Oct 20 2013 08:25:01 for Feel++ by doxygen 1.8.4