Class documentation of Concepts

Loading...
Searching...
No Matches
meshImport2D.hh
Go to the documentation of this file.
1
8#ifndef meshImport2D_hh
9#define meshImport2D_hh
10
11#include <vector>
12#include <map>
13#include "mesh.hh"
14#include "meshImport.hh"
15#include "toolbox/array.hh"
16#include "toolbox/multiArray.hh"
17
18namespace concepts {
19
20 // ****************************************************** Import2dMeshBase **
21
32 class Import2dMeshBase : public Mesh2, public ImportMesh {
33 public:
34 Import2dMeshBase(const std::string coord, const std::string elms,
35 const uint idxStart = 1);
36 virtual ~Import2dMeshBase();
37 virtual uint ncell() const { return cell_.size(); }
38 virtual Scan2* scan();
39 protected:
40 virtual std::ostream& info(std::ostream& os) const;
41
43 class S;
44
46 std::vector<Cell2*> cell_;
47
49 const std::string coord_, elms_;
50
52 std::vector<Real3d> vertices_;
53 uint dim_;
54
56 std::vector<Connector2*> cntr2_;
60
62 virtual void createEntity_(const MultiIndex<1>& idx)
64 virtual void createEntity_(const MultiIndex<2>& idx)
66 virtual void createEntity_(const MultiIndex<3>& idx);
67 virtual void createEntity_(const MultiIndex<4>& idx);
68
70 virtual void createCell_(const MultiIndex<3>& idx);
71 virtual void createCell_(const MultiIndex<4>& idx);
72
74 virtual void readVertices_();
75 uint readVertexLine_(const std::string& i, uint* idx, Real3d* coord) const;
76
78 void attributes_(const std::string boundary);
80 void import_();
81 };
82
84 class Import2dMeshBase::S : public Scan<Cell2> {
85 public:
86 inline S(std::vector<Cell2*>& cell) :
87 idx_(cell.begin()), cell_(cell) {}
88 inline S(const S& scan) : idx_(scan.idx_), cell_(scan.cell_) {}
89 inline bool eos() const { return idx_ == cell_.end(); }
90 inline Cell2& operator++(int) { return *(*idx_++); }
91 inline Scan2* clone() const { return new S(*this); }
92 private:
93 std::vector<Cell2*>::iterator idx_;
94 std::vector<Cell2*>& cell_;
95 };
96
97 // ********************************************************** Import2dMesh **
98
100 public:
133 Import2dMesh(const std::string coord, const std::string elms,
134 const std::string boundary, const uint idxStart = 1);
135
163 Import2dMesh(const std::string coord, const std::string elms,
164 const uint idxStart = 1);
165 virtual ~Import2dMesh() {}
166 protected:
167 virtual std::ostream& info(std::ostream& os) const;
168 };
169
170} // namespace concepts
171
172#endif // meshImport2D_hh
Two dimensional cell.
Definition cell.hh:89
Scanner class for Import2dMesh.
Scan2 * clone() const
Returns a clone of the scanner.
Cell2 & operator++(int)
Returns the next cell.
bool eos() const
Returns true if the end of the scanned set is reached.
std::vector< Connector2 * > cntr2_
List of entities.
void attributes_(const std::string boundary)
Reads attributes from file boundary.
std::vector< Cell2 * > cell_
List of cells.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
void import_()
Reads and builds the mesh.
const std::string coord_
File names of coordinates and cell files.
MultiArray< 3, Triangle * > Tri_
Array of the entities.
std::vector< Real3d > vertices_
Coordinates of the vertices.
virtual void createEntity_(const MultiIndex< 3 > &idx)
virtual Scan2 * scan()
virtual uint ncell() const
Returns the number of cells in the mesh.
virtual void readVertices_()
reads the coordinates of the vertices
virtual void createEntity_(const MultiIndex< 1 > &idx)
Creation of topological entities.
virtual void createCell_(const MultiIndex< 3 > &idx)
Creation of geometrical cells with element mapping.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Import2dMesh(const std::string coord, const std::string elms, const uint idxStart=1)
Import2dMesh(const std::string coord, const std::string elms, const std::string boundary, const uint idxStart=1)
virtual void createEntity_(const MultiIndex< 1 > &idx)
Creation of topological entities Vertex and Edge.
A scanner for a 2D mesh.
Definition mesh.hh:44
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320