mutableMesh.hh

Go to the documentation of this file.
1 
7 #ifndef mutableMesh_hh
8 #define mutableMesh_hh
9 
10 #include "toolbox/multiArray.hh"
11 #include "toolbox/sequence.hh"
12 #include "toolbox/set.hh"
13 #include "mesh.hh"
14 
15 namespace concepts {
16 
17  // ******************************************************* MutableMeshBase **
18 
23  public:
25  virtual ~MutableMeshBase();
26 
27  virtual void addCell(Cell* cell, bool holding = true) = 0;
28 
34  Edge* ownEdge(Vertex* vtx1, Vertex* vtx2);
35 
37  return ownConnectors0_; }
39  return ownConnectors1_; }
41  return ownConnectors2_; }
43  return ownConnectors3_; }
44  protected:
54 
55  void addCell_(Cell* cell, bool holding = true);
56 
61  void replaceCell_(Cell* cell, bool holding = true);
62  };
63 
64  // ********************************************************** MutableMesh1 **
65 
74  class MutableMesh1 : public Mesh1, public MutableMeshBase {
75  public:
76  MutableMesh1() : ncell_(0) {}
77  virtual ~MutableMesh1();
78  inline uint ncell() const { return ncell_; }
79  inline Scan1* scan() { return new PStlVectorScan<Cell1>(cells_); }
80 
84  virtual void addCell(Cell* cell, bool holding = true);
85 
90  void replaceCell(Cell1* cell, bool holding = true);
91 
92  inline const Sequence<Cell1*>& cells() const { return cells_; }
93 
94  protected:
95  virtual std::ostream& info(std::ostream& os) const;
96 
97  private:
99  uint ncell_;
102  };
103 
104  // ********************************************************* buildEdgeMesh **
105 
132  void buildEdgeMesh(Scan2* sc, const concepts::Set<uint> attrib,
133  MutableMeshBase& emsh);
134 
135  // ********************************************************** MutableMesh2 **
136 
142  class MutableMesh2 : public Mesh2, public MutableMeshBase {
143  public:
145  virtual ~MutableMesh2();
146  inline uint ncell() const { return ncell_; }
147  inline Scan2* scan() { return new PStlVectorScan<Cell2>(cells_); }
148 
152  virtual void addCell(Cell* cell, bool holding = true);
153 
158  void replaceCell(Cell2* cell, bool holding = true);
159 
161  Cell2* lastCell() const {
162  if (ncell_)
163  return cells_[ncell_-1];
164  return 0;
165  }
166 
170  void addMesh(Mesh2& msh);
171 
177  void connectOppositeEdges(const Edge2d* edge1, const Edge2d* edge2,
178  const Attribute attrib = Attribute(),
179  const Quad2dSubdivision* strategy = 0);
180 
193  const Sequence<Edge2d*> edges2,
194  const Attribute attrib = Attribute(),
195  const Quad2dSubdivision* strategy = 0);
196 
197  protected:
198  virtual std::ostream& info(std::ostream& os) const;
199  private:
201  uint ncell_;
204  };
205 
206  // ******************************************************* ConnectTwoMeshes2 **
207 
212  public:
226  Mesh2withBoundary& mesh2, const Sequence<uint> edges2,
227  const Attribute attrib = Attribute());
228  virtual ~ConnectTwoMeshes() {}
229  };
230 
231 } // namespace concepts
232 
233 #endif // mutableMesh_hh
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Scan2 * scan()
Returns a scanner over the cells of the mesh.
Definition: mutableMesh.hh:147
Class for holding a general mutable mesh of line elements where cells can be added.
Definition: mutableMesh.hh:74
Cell2 * lastCell() const
Return the latest added cell.
Definition: mutableMesh.hh:161
Sequence< Connector2 * > ownConnectors2_
Definition: mutableMesh.hh:50
void buildEdgeMesh(Scan2 *sc, const concepts::Set< uint > attrib, MutableMeshBase &emsh)
Construct a mesh of edges of a 2D mesh w.r.t.
Sequence< Connector3 * > ownConnectors3_
Definition: mutableMesh.hh:51
void replaceCell(Cell1 *cell, bool holding=true)
Replaces by cell the cell with the same connector.
uint ncell() const
Returns the number of cells in the mesh.
Definition: mutableMesh.hh:146
A cell in a mesh consist of topological information (neighbours, connectivity, orientation) and geome...
Definition: cell.hh:39
A scanner for a 2D mesh.
Definition: mesh.hh:44
Class for holding a general mutable mesh of 2D cell where cells and other 2D meshes can be added.
Definition: mutableMesh.hh:142
Sequence< const Cell * > ownCells_
Stored cells.
Definition: mutableMesh.hh:46
ConnectTwoMeshes(Mesh2withBoundary &mesh1, const Sequence< uint > edges1, Mesh2withBoundary &mesh2, const Sequence< uint > edges2, const Attribute attrib=Attribute())
Constructor.
Edge * ownEdge(Vertex *vtx1, Vertex *vtx2)
Returns the own edge with the two vertices.
A 1D cell: edge in 2D.
Definition: cell1D.hh:189
Scanner for a STL container std::vector of pointers.
Base class for mesh classes in 2D which defines its outer boundary and inner boundaries.
Definition: mesh.hh:152
Connected mesh of two given meshes where edges on both outer boundaries are connected.
Definition: mutableMesh.hh:211
Sequence< Cell2 * > cells_
Cells of the mesh.
Definition: mutableMesh.hh:203
Sequence< Cell1 * > cells_
Cells.
Definition: mutableMesh.hh:101
void addMesh(Mesh2 &msh)
Adds cells of another mesh.
Base class for mutable meshes.
Definition: mutableMesh.hh:22
An abstract class for 1D meshes.
Definition: mesh.hh:94
One dimensional cell.
Definition: cell.hh:75
A vertex in the topology.
Definition: topology.hh:40
void replaceCell(Cell2 *cell, bool holding=true)
Replaces by cell the cell with the same connector.
Container typename for multidimensional Array which is based on std::map.
Definition: multiArray.hh:33
void connectOppositeEdges(const Edge2d *edge1, const Edge2d *edge2, const Attribute attrib=Attribute(), const Quad2dSubdivision *strategy=0)
Adds a quadrilateral connecting the two edges.
Sequence< Connector1 * > ownConnectors1_
Definition: mutableMesh.hh:49
An abstract class for 2D meshes.
Definition: mesh.hh:103
Sequence with operations, output operator, and method of the particular element types.
Definition: sequence.hh:39
const Sequence< Connector1 * > & ownConnectors1() const
Definition: mutableMesh.hh:38
Two dimensional cell.
Definition: cell.hh:89
MultiArray< 2, Edge * > mapEdges_
Maps from vertices to connectors.
Definition: mutableMesh.hh:53
void replaceCell_(Cell *cell, bool holding=true)
Replaces by cell the cell with the same connector.
uint ncell_
Number of cells.
Definition: mutableMesh.hh:201
Interface for geometrical subdivision strategies for quadrilaterals.
Definition: cell2D.hh:283
Scan1 * scan()
Returns a scanner over the cells of the mesh.
Definition: mutableMesh.hh:79
const Sequence< Cell1 * > & cells() const
Definition: mutableMesh.hh:92
const Sequence< Connector2 * > & ownConnectors2() const
Definition: mutableMesh.hh:40
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual void addCell(Cell *cell, bool holding=true)
Adds a cell to the mesh, which is by default hold and will be deleted by its destructor.
void addCell_(Cell *cell, bool holding=true)
A scanner for a 1D mesh.
Definition: mesh.hh:36
An edge in the topology.
Definition: topology.hh:73
uint ncell_
Number of cells.
Definition: mutableMesh.hh:99
const Sequence< Connector0 * > & ownConnectors0() const
Definition: mutableMesh.hh:36
Sequence< Connector0 * > ownConnectors0_
Stored connectors.
Definition: mutableMesh.hh:48
virtual void addCell(Cell *cell, bool holding=true)
Adds a cell to the mesh, which is by default hold by this object and will be deleted by its destructo...
virtual void addCell(Cell *cell, bool holding=true)=0
uint ncell() const
Returns the number of cells in the mesh.
Definition: mutableMesh.hh:78
const Sequence< Connector3 * > & ownConnectors3() const
Definition: mutableMesh.hh:42
Attributes for elements of the topology.
Definition: connector.hh:22
void connectOppositeEdges(const Sequence< Edge2d * > edges1, const Sequence< Edge2d * > edges2, const Attribute attrib=Attribute(), const Quad2dSubdivision *strategy=0)
Adds quadrilateral connecting respective two edges of the two sequences (with same number of edges).
Base class for mesh classes in 2D which defines its outer boundary and inner boundaries.
Definition: mesh.hh:124
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