Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

distributor_p/sfcdstr.hh
Go to the documentation of this file.
00001 /* -*- c++ -*-
00002  * Creates a parallel mesh using space filling curves
00003  */
00004 
00005 #ifndef sfcdstr_hh
00006 #define sfcdstr_hh
00007 
00008 #include <memory>
00009 
00010 #include "basics.hh"
00011 #include "geometry/cell1D.hh"
00012 #include "geometry/cell2D.hh"
00013 #include "geometry/cell3D.hh"
00014 #include "geometry/mesh.hh"
00015 #include "toolbox_p/using_p.hh"
00016 #include "toolbox_p/communicators.hh"
00017 #include "geometry_p/mesh_p.hh"
00018 #include "sfc.hh"
00019 
00020 namespace parallel {
00021 
00022   // ******************************************** SFCDstr **
00023 
00032   class SFCDstr : public concepts::OutputOperator {
00033   private:
00034 
00036     template<class T>
00037     class ListElmSFC {
00038     private:
00040       ListElmSFC<T>* lnk_;
00042       T*          cell_;
00044       Real3d      c_;
00045 
00046     public:
00047       inline ListElmSFC(Real3d& c, T* cell, ListElmSFC<T>* lnk = 0)
00048   : lnk_(lnk), cell_(cell), c_(c) {};
00049 
00050       inline ListElmSFC<T>** linkp() {return &lnk_;};
00051       inline ListElmSFC<T>* link() const {return lnk_;}
00052       inline const Real3d& center() const {return c_;};
00053       inline T* cell() const {return cell_;};
00054     };
00055 
00061     void refine1_(Cell1* cell, uint lvl, ListHead<ListElmSFC<Cell1> >& lst);
00067     void refine2_(Cell2* cell, uint lvl, ListHead<ListElmSFC<Cell2> >& lst);
00073     void refine3_(Cell3* cell, uint lvl, ListHead<ListElmSFC<Cell3> >& lst);
00074 
00082     template<class T>
00083     void sortList_(ListElmSFC<T>** root, Real& d, Real3d& pmin, ushort ori);
00084 
00092     template<class T>
00093     void boundingBox_(ListHead<ListElmSFC<T> >& lst, Real3d* pmin,
00094           Real* d, uint* npnt);
00095 
00102     void markOwnCells1_(ListHead<ListElmSFC<Cell1> >& cells, uint* ncntr0,
00103             DynArray<uchar>& cellmap);
00111     void markOwnCells2_(ListHead<ListElmSFC<Cell2> >& cells, uint* ncntr0,
00112       uint* ncntr1, DynArray<uchar>& cellmap);
00121     void markOwnCells3_(ListHead<ListElmSFC<Cell3> >& cells, uint* ncntr0,
00122       uint* ncntr1, uint* ncntr2, DynArray<uchar>& cellmap);
00123 
00130     bool mapCount1_(Cell1* cell, uint lvl, DynArray<uchar>& cellmap);
00137     bool mapCount2_(Cell2* cell, uint lvl, DynArray<uchar>& cellmap);
00144     bool mapCount3_(Cell3* cell, uint lvl, DynArray<uchar>& cellmap);
00145 
00160     void newCells1A_(concepts::Edge1d* edg, uint lvl, uint* n,
00161          concepts::MapEdge1d* mapcln, DynArray<uchar>& cellmap,
00162          DynArray<concepts::Vertex*>& vtxmap,
00163          Array<auto_ptr<Connector0> >& cntr0,
00164          Array<auto_ptr<Connector1> >& cntr1,
00165          Array<auto_ptr<Cell1> >& cell1);
00166 
00184     void newCells2A_(concepts::Triangle2d* tri, uint lvl, uint* n,
00185          concepts::MappingTriangle2d* mapcln,
00186          DynArray<uchar>& cellmap,
00187          DynArray<concepts::Vertex*>& vtxmap,
00188          DynArray<concepts::Edge*>& edgmap,
00189          Array<auto_ptr<Connector0> >& cntr0,
00190          Array<auto_ptr<Connector1> >& cntr1,
00191          Array<auto_ptr<Connector2> >& cntr2,
00192          Array<auto_ptr<Cell2> >& cell2);
00193     void newCells2B_(concepts::Quad2d* quad, uint lvl, uint* n,
00194          concepts::MappingQuad2d* mapcln,
00195          DynArray<uchar>& cellmap,
00196          DynArray<concepts::Vertex*>& vtxmap,
00197          DynArray<concepts::Edge*>& edgmap,
00198          Array<auto_ptr<Connector0> >& cntr0,
00199          Array<auto_ptr<Connector1> >& cntr1,
00200          Array<auto_ptr<Connector2> >& cntr2,
00201          Array<auto_ptr<Cell2> >& cell2);
00202     void newCells2C_(concepts::Triangle3d* tri, uint lvl, uint* n,
00203          concepts::MapTriangle3d* mapcln,
00204          DynArray<uchar>& cellmap,
00205          DynArray<concepts::Vertex*>& vtxmap,
00206          DynArray<concepts::Edge*>& edgmap,
00207          Array<auto_ptr<Connector0> >& cntr0,
00208          Array<auto_ptr<Connector1> >& cntr1,
00209          Array<auto_ptr<Connector2> >& cntr2,
00210          Array<auto_ptr<Cell2> >& cell2);
00211 
00232     void newCells3A_(concepts::Hexahedron3d* hex, uint lvl, uint* n,
00233          concepts::MapHexahedron3d* mapcln,
00234          DynArray<uchar>& cellmap,
00235          DynArray<concepts::Vertex*>& vtxmap,
00236          DynArray<concepts::Edge*>& edgmap,
00237          DynArray<Connector2*>& fcemap,
00238          Array<auto_ptr<Connector0> >& cntr0,
00239          Array<auto_ptr<Connector1> >& cntr1,
00240          Array<auto_ptr<Connector2> >& cntr2,
00241          Array<auto_ptr<Connector3> >& cntr3,
00242          Array<auto_ptr<Cell3> >& cell3);
00243 
00245     const Communicator& com_;
00247     uint maxpnt_;
00249     SFC  &sfc_;  
00250 
00251   public:
00257     SFCDstr(uint maxpnt, SFC& sfc, const Communicator& com);
00258     ~SFCDstr();
00259 
00261     Mesh* distribute(concepts::Mesh& msh, uint lvl);
00262     Mesh1* distribute1(concepts::Mesh1& msh, uint lvl);
00263     Mesh2* distribute2(concepts::Mesh2& msh, uint lvl);
00264     Mesh3* distribute3(concepts::Mesh3& msh, uint lvl);
00265 
00266     inline const Communicator& comm() const {return com_;};
00267 
00268   protected:
00269     std::ostream& info(std::ostream& os) const;
00270   };
00271 
00272 } // namespace parallel
00273 
00274 #endif // sfcdstr_hh

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)