uniformlyRefinedMesh2.hh

Go to the documentation of this file.
1 
8 #ifndef uniformlyRefinedMesh2_hh
9 #define uniformlyRefinedMesh2_hh
10 
11 #include "geometry/mesh.hh"
12 #include <vector>
13 
14 namespace concepts {
15 
22  class UniformlyRefinedMesh2 : public Mesh2 {
23  public:
28  UniformlyRefinedMesh2(Mesh2& coarseMesh, uint level);
32  virtual uint ncell() const { return cell_.size(); }
34  virtual Scan2* scan() { return new S(cell_); }
35  private:
37  class S : public Scan<Cell2> {
38  public:
39  inline S(std::vector<Cell2*>& cell) :
40  idx_(cell.begin()), cell_(cell) {}
41  inline S(const S& scan) : idx_(scan.idx_), cell_(scan.cell_) {}
42  inline bool eos() const { return idx_ == cell_.end(); }
43  inline Cell2& operator++(int) { return *(*idx_++); }
44  inline Scan2* clone() const { return new S(*this); }
45  private:
46  std::vector<Cell2*>::iterator idx_;
47  std::vector<Cell2*>& cell_;
48  };
49  void addCell(Cell2* cell, uint level);
50  std::vector<Cell2*> cell_;
51  };
52 
53 } // namespace concepts
54 
55 #endif //uniformlyRefinedMesh2_hh
A scanner for a 2D mesh.
Definition: mesh.hh:44
std::vector< Cell2 * >::iterator idx_
virtual Scan2 * scan()
Returns a scanner over the cells of the mesh.
void addCell(Cell2 *cell, uint level)
Cell2 & operator++(int)
Returns the next cell.
virtual uint ncell() const
Returns the number of cells in the mesh.
An abstract class for scanning a mesh (a set of cells) or a space (a set of elements).
An abstract class for 2D meshes.
Definition: mesh.hh:103
Two dimensional cell.
Definition: cell.hh:89
Wrapper class refining an existing 2d mesh uniformly.
UniformlyRefinedMesh2(Mesh2 &coarseMesh, uint level)
Constructor.
Scanner class for UniformlyRefindeMesh2.
S(std::vector< Cell2 * > &cell)
virtual ~UniformlyRefinedMesh2()
Destructor.
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich