sfcdstr.hh

Go to the documentation of this file.
1 
6 #ifndef sfcdstr_hh
7 #define sfcdstr_hh
8 
9 #include <memory>
10 
11 #include "basics.hh"
12 #include "geometry/cell1D.hh"
13 #include "geometry/cell2D.hh"
14 #include "geometry/cell3D.hh"
15 #include "geometry/mesh.hh"
16 #include "toolbox_p/using_p.hh"
18 #include "geometry_p/mesh_p.hh"
19 #include "sfc.hh"
20 
21 namespace parallel {
22 
23  // ******************************************** SFCDstr **
24 
33  class SFCDstr : public concepts::OutputOperator {
34  private:
35 
37  template<class T>
38  class ListElmSFC {
39  private:
41  ListElmSFC<T>* lnk_;
43  T* cell_;
45  Real3d c_;
46 
47  public:
48  inline ListElmSFC(Real3d& c, T* cell, ListElmSFC<T>* lnk = 0)
49  : lnk_(lnk), cell_(cell), c_(c) {};
50 
51  inline ListElmSFC<T>** linkp() {return &lnk_;};
52  inline ListElmSFC<T>* link() const {return lnk_;}
53  inline const Real3d& center() const {return c_;};
54  inline T* cell() const {return cell_;};
55  };
56 
62  void refine1_(Cell1* cell, uint lvl, ListHead<ListElmSFC<Cell1> >& lst);
68  void refine2_(Cell2* cell, uint lvl, ListHead<ListElmSFC<Cell2> >& lst);
74  void refine3_(Cell3* cell, uint lvl, ListHead<ListElmSFC<Cell3> >& lst);
75 
83  template<class T>
84  void sortList_(ListElmSFC<T>** root, Real& d, Real3d& pmin, ushort ori);
85 
93  template<class T>
94  void boundingBox_(ListHead<ListElmSFC<T> >& lst, Real3d* pmin,
95  Real* d, uint* npnt);
96 
103  void markOwnCells1_(ListHead<ListElmSFC<Cell1> >& cells, uint* ncntr0,
104  DynArray<uchar>& cellmap);
112  void markOwnCells2_(ListHead<ListElmSFC<Cell2> >& cells, uint* ncntr0,
113  uint* ncntr1, DynArray<uchar>& cellmap);
122  void markOwnCells3_(ListHead<ListElmSFC<Cell3> >& cells, uint* ncntr0,
123  uint* ncntr1, uint* ncntr2, DynArray<uchar>& cellmap);
124 
131  bool mapCount1_(Cell1* cell, uint lvl, DynArray<uchar>& cellmap);
138  bool mapCount2_(Cell2* cell, uint lvl, DynArray<uchar>& cellmap);
145  bool mapCount3_(Cell3* cell, uint lvl, DynArray<uchar>& cellmap);
146 
161  void newCells1A_(concepts::Edge1d* edg, uint lvl, uint* n,
162  concepts::MapEdge1d* mapcln, DynArray<uchar>& cellmap,
163  DynArray<concepts::Vertex*>& vtxmap,
164  Array<unique_ptr<Connector0> >& cntr0,
165  Array<unique_ptr<Connector1> >& cntr1,
166  Array<unique_ptr<Cell1> >& cell1);
167 
185  void newCells2A_(concepts::Triangle2d* tri, uint lvl, uint* n,
187  DynArray<uchar>& cellmap,
188  DynArray<concepts::Vertex*>& vtxmap,
189  DynArray<concepts::Edge*>& edgmap,
190  Array<unique_ptr<Connector0> >& cntr0,
191  Array<unique_ptr<Connector1> >& cntr1,
192  Array<unique_ptr<Connector2> >& cntr2,
193  Array<unique_ptr<Cell2> >& cell2);
194  void newCells2B_(concepts::Quad2d* quad, uint lvl, uint* n,
195  concepts::MappingQuad2d* mapcln,
196  DynArray<uchar>& cellmap,
197  DynArray<concepts::Vertex*>& vtxmap,
198  DynArray<concepts::Edge*>& edgmap,
199  Array<unique_ptr<Connector0> >& cntr0,
200  Array<unique_ptr<Connector1> >& cntr1,
201  Array<unique_ptr<Connector2> >& cntr2,
202  Array<unique_ptr<Cell2> >& cell2);
203  void newCells2C_(concepts::Triangle3d* tri, uint lvl, uint* n,
204  concepts::MapTriangle3d* mapcln,
205  DynArray<uchar>& cellmap,
206  DynArray<concepts::Vertex*>& vtxmap,
207  DynArray<concepts::Edge*>& edgmap,
208  Array<unique_ptr<Connector0> >& cntr0,
209  Array<unique_ptr<Connector1> >& cntr1,
210  Array<unique_ptr<Connector2> >& cntr2,
211  Array<unique_ptr<Cell2> >& cell2);
212 
233  void newCells3A_(concepts::Hexahedron3d* hex, uint lvl, uint* n,
235  DynArray<uchar>& cellmap,
236  DynArray<concepts::Vertex*>& vtxmap,
237  DynArray<concepts::Edge*>& edgmap,
238  DynArray<Connector2*>& fcemap,
239  Array<unique_ptr<Connector0> >& cntr0,
240  Array<unique_ptr<Connector1> >& cntr1,
241  Array<unique_ptr<Connector2> >& cntr2,
242  Array<unique_ptr<Connector3> >& cntr3,
243  Array<unique_ptr<Cell3> >& cell3);
244 
246  const Communicator& com_;
248  uint maxpnt_;
250  SFC &sfc_;
251 
252  public:
258  SFCDstr(uint maxpnt, SFC& sfc, const Communicator& com);
259  ~SFCDstr();
260 
262  Mesh* distribute(concepts::Mesh& msh, uint lvl);
263  Mesh1* distribute1(concepts::Mesh1& msh, uint lvl);
264  Mesh2* distribute2(concepts::Mesh2& msh, uint lvl);
265  Mesh3* distribute3(concepts::Mesh3& msh, uint lvl);
266 
267  inline const Communicator& comm() const {return com_;};
268 
269  protected:
270  std::ostream& info(std::ostream& os) const;
271  };
272 
273 } // namespace parallel
274 
275 #endif // sfcdstr_hh
A 2D cell: quadrilateral.
Definition: cell2D.hh:378
A 3D element map for a triangle.
An abstract class for 3D meshes.
Definition: mesh.hh:112
A 3D cell: hexahedron.
Definition: cell3D.hh:317
A 2D element map for a triangle.
Definition: elementMaps.hh:520
A 1D cell: edge.
Definition: cell1D.hh:83
A 2D cell: triangle.
Definition: cell2D.hh:31
Point< Real, 3 > Real3d
An abstract class for 1D meshes.
Definition: mesh.hh:94
A 3D element map for a hexahedron.
A 1D element map for an edge.
Definition: elementMaps.hh:47
An abstract class for 2D meshes.
Definition: mesh.hh:103
unsigned short ushort
Abbreviation for unsigned short.
Definition: typedefs.hh:48
A 2D element map for a quadrilateral.
Definition: elementMaps.hh:667
An abstract class for meshes.
Definition: mesh.hh:76
A 3D cell: triangle.
Definition: cell2D.hh:719
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Class providing an output operator.
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich