edgeMeshes.hh

Go to the documentation of this file.
1 
6 #ifndef edgeMeshes_hh
7 #define edgeMeshes_hh
8 
9 #include "toolbox/array.hh"
10 #include "toolbox/sequence.hh"
11 #include "cell1D.hh"
12 #include "elementMaps.hh"
13 #include "mesh.hh"
14 #include "topology.hh"
15 
16 namespace concepts {
17 
18  // ************************************************************** EdgeMesh **
19 
27  class EdgeMesh : public Mesh1 {
28  public:
37  EdgeMesh(const uint n, bool closed,
38  const Sequence<MappingEdge2d*>& maps,
39  Attribute attrib = Attribute(),
41 
47  EdgeMesh(const MappingEdge2d* map, Attribute attrib = Attribute());
48 
49  virtual ~EdgeMesh();
50 
51  inline uint ncell() const { return ncell_; }
52  inline Scan1* scan() { return new S(&cell_); }
53 
54  inline const Sequence<Edge2d*>& cells() const { return cell_; }
55 
56  protected:
57  virtual std::ostream& info(std::ostream& os) const;
58 
59  const uint n_;
60  uint ncell_;
61 
64 
67  private:
70 
72  class S : public Scan<Cell1> {
73  uint idx_;
75  public:
76  inline S(Sequence<Edge2d*>* cell) : idx_(0), cell_(cell) {}
77  inline S(const S &scan) : idx_(scan.idx_), cell_(scan.cell_) {}
78 
79  inline bool eos() const { return idx_ == cell_->size(); }
80  inline Edge2d& operator++(int) { return *(*cell_)[idx_++]; }
81 
82  inline Scan1* clone() const { return new S(*this); }
83  };
84 
85  };
86 
87  // ********************************************************* CircleBoundary **
88 
89  class CircleBoundary : public Mesh1, public InnerOuterBoundary2d {
90  public:
91  CircleBoundary(const Real2d center, const uint n, const Real r,
92  const uint attrib = 0, const Real phi0 = 0);
93  virtual ~CircleBoundary();
94 
95  inline uint ncell() const { return ncell_; }
96  inline Scan1* scan() { return new S(&this->outerBoundary_); }
97 
98  const Sequence<Edge2d*>& cells() const { return this->outerBoundary_; }
99 
100  virtual std::ostream& info(std::ostream& os) const;
101  private:
103  class S : public Scan<Cell1> {
104  uint idx_;
106  public:
107  inline S(Sequence<Edge2d*>* cell) : idx_(0),
108  cell_(cell) {}
109  inline S(const S &scan) : idx_(scan.idx_),
110  cell_(scan.cell_) {}
111 
112  inline bool eos() const { return idx_ == cell_->size(); }
113  inline Cell1& operator++(int) { return *(*cell_)[idx_++]; }
114 
115  inline Scan1* clone() const { return new S(*this); }
116  };
117 
118  uint ncell_;
119 
122  };
123 
124  // ********************************************** StraightPeriodicBoundary **
125 
127  public:
128  StraightPeriodicBoundary(const Real2d first, const Real2d last,
129  const uint n, const uint attrib = 0);
131 
132  inline uint ncell() const { return ncell_; }
133  inline Scan1* scan() { return new S(&this->outerBoundary_); }
134 
135  const Sequence<Edge2d*>& cells() const { return this->outerBoundary_; }
136 
137  virtual std::ostream& info(std::ostream& os) const;
138  private:
140  class S : public Scan<Cell1> {
141  uint idx_;
143  public:
144  inline S(Sequence<Edge2d*>* cell) : idx_(0),
145  cell_(cell) {}
146  inline S(const S &scan) : idx_(scan.idx_),
147  cell_(scan.cell_) {}
148 
149  inline bool eos() const { return idx_ == cell_->size(); }
150  inline Cell1& operator++(int) { return *(*cell_)[idx_++]; }
151 
152  inline Scan1* clone() const { return new S(*this); }
153  };
154 
155  uint ncell_;
156 
159  };
160 
161 
162 } // namespace concepts
163 
164 #endif // edgeMeshes_hh
165 
Sequence< Edge2d * > * cell_
Definition: edgeMeshes.hh:105
S(Sequence< Edge2d * > *cell)
Definition: edgeMeshes.hh:107
bool eos() const
Definition: edgeMeshes.hh:79
Array< Vertex * > vtx_
Definition: edgeMeshes.hh:120
Array< Edge * > edg_
Definition: edgeMeshes.hh:121
uint ncell() const
Returns the number of cells in the mesh.
Definition: edgeMeshes.hh:132
Scan1 * scan()
Returns a scanner over the cells of the mesh.
Definition: edgeMeshes.hh:133
Sequence< Edge2d * > outerBoundary_
Outer boundary given by edges in 2D.
Definition: mesh.hh:139
Cell1 & operator++(int)
Returns the next cell.
Definition: edgeMeshes.hh:113
A 1D cell: edge in 2D.
Definition: cell1D.hh:189
S(Sequence< Edge2d * > *cell)
Definition: edgeMeshes.hh:144
Scan1 * scan()
Returns a scanner over the cells of the mesh.
Definition: edgeMeshes.hh:96
Scan1 * clone() const
Definition: edgeMeshes.hh:82
const Sequence< Edge2d * > & cells() const
Definition: edgeMeshes.hh:98
An abstract class for 1D meshes.
Definition: mesh.hh:94
One dimensional cell.
Definition: cell.hh:75
const Sequence< Edge2d * > & cells() const
Definition: edgeMeshes.hh:54
Array< Edge * > edg_
Definition: edgeMeshes.hh:69
S(Sequence< Edge2d * > *cell)
Definition: edgeMeshes.hh:76
Edge2d & operator++(int)
Returns the next cell.
Definition: edgeMeshes.hh:80
uint ncell() const
Returns the number of cells in the mesh.
Definition: edgeMeshes.hh:95
An array of objects.
Definition: bilinearForm.hh:23
Array< MappingEdge2d * > edges_
Edge parametrisation.
Definition: edgeMeshes.hh:63
scanner over the cells
Definition: edgeMeshes.hh:72
S(const S &scan)
Definition: edgeMeshes.hh:77
An abstract class for scanning a mesh (a set of cells) or a space (a set of elements).
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Sequence with operations, output operator, and method of the particular element types.
Definition: sequence.hh:39
Cell1 & operator++(int)
Returns the next cell.
Definition: edgeMeshes.hh:150
const Sequence< Edge2d * > & cells() const
Definition: edgeMeshes.hh:135
StraightPeriodicBoundary(const Real2d first, const Real2d last, const uint n, const uint attrib=0)
EdgeMesh(const uint n, bool closed, const Sequence< MappingEdge2d * > &maps, Attribute attrib=Attribute(), Sequence< Attribute > vattrib=Sequence< Attribute >())
Constructor for edges forming a chain.
EdgeMesh(const MappingEdge2d *map, Attribute attrib=Attribute())
Constructor for a single edge.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
A 2D element map for an edge.
Definition: elementMaps.hh:84
Array< Vertex * > vtx_
Definition: edgeMeshes.hh:68
Scan1 * scan()
Returns a scanner over the cells of the mesh.
Definition: edgeMeshes.hh:52
Sequence< Edge2d * > * cell_
Definition: edgeMeshes.hh:74
A scanner for a 1D mesh.
Definition: mesh.hh:36
uint ncell() const
Returns the number of cells in the mesh.
Definition: edgeMeshes.hh:51
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Sequence< Edge2d * > cell_
Cells.
Definition: edgeMeshes.hh:66
scanner over the cells
Definition: edgeMeshes.hh:103
Attributes for elements of the topology.
Definition: connector.hh:22
Base class for edge meshes.
Definition: edgeMeshes.hh:27
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
Base class for mesh classes in 2D which defines its outer boundary and inner boundaries.
Definition: mesh.hh:124
CircleBoundary(const Real2d center, const uint n, const Real r, const uint attrib=0, const Real phi0=0)
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