AMROC Main     Blockstructured Adaptive Mesh Refinement in object-oriented C++


Main Page   Class Hierarchy   Compound List   File List  

DAGHDistribution.h

Go to the documentation of this file.
00001 #ifndef _included_DAGHDistribution_h
00002 #define _included_DAGHDistribution_h
00003 
00009 #include "DAGHParams.h"
00010 #include "DAGHDefaults.h"
00011 
00012 #include "List.h"
00013 #include "GridUnit.h"
00014 #include "GridUnitList.h"
00015 
00016 /************************************************************************/
00017 /* Pluggable Work function prototype */
00018 /************************************************************************/
00019 typedef unsigned long (*WorkFunc) (const unsigned long *numelems, 
00020                                    const int *level);
00021 /************************************************************************/
00022 
00023 class DAGHSpan 
00024   {
00025    dMapIndex min;
00026    dMapIndex max;
00027 
00028 public:   
00029    inline DAGHSpan() {}
00030 
00031    inline DAGHSpan(dMapIndex const &lmin, dMapIndex const &lmax)
00032         : min(lmin), max(lmax) { }
00033 
00034    inline DAGHSpan(const DAGHSpan& other)
00035         : min(other.min), max(other.max) { }
00036 
00037    inline int contains(dMapIndex const index) const 
00038         { return (index >= min && index <= max); }
00039 
00040    inline const DAGHSpan& operator = (const DAGHSpan& other)
00041       { min = other.min; max = other.max; return *this; }
00042   };
00043 
00048 class DAGHDistribution
00049   {
00051     int type;   
00052 
00053     //List<DAGHSpan> localspans; /* Local index spans */
00054    
00056     BBox* boxes; 
00057 
00059     WorkFunc wfunc; 
00060 
00061 public:
00062    inline DAGHDistribution(const int disttype) 
00063         : type(disttype) , boxes(0), wfunc(0) { }
00064 
00065    DAGHDistribution(const int disttype, BBoxList& bbl);
00066 
00067    inline ~DAGHDistribution() { if (boxes) delete [] boxes; }
00068 
00069    void partition(GridUnitList*& globallist, 
00070                   GridUnitList*& locallist, 
00071                   const int np, const int me, 
00072                   const int minw, const short* olap);
00073 
00074    void partition(const BBox& wbbox, BBox& mybbox, 
00075                   const int np, const int me);
00076 
00077    //int islocal(dMapIndex const &idx);
00078 
00079    inline int dist() const { return type; }
00080 
00081    inline void set_dist(const int disttype)
00082         { type = disttype; }
00083 
00084    void set_dist(const int disttype, BBoxList& bbl);
00085 
00086    inline void set_workfunc( void *workfunc )
00087         { wfunc = (WorkFunc) workfunc; }
00088 
00089    unsigned long get_load( GridUnitList &list,  const short* olap );
00090 
00091 private:
00092    void partitionComposite(GridUnitList*& globallist, 
00093                            GridUnitList*& locallist, 
00094                            const int np, const int me, 
00095                            const int minw, const short* olap);
00096 
00097    void partitionBlockOne(const int axis,
00098                           GridUnitList*& globallist, 
00099                           GridUnitList*& locallist, 
00100                           const int np, const int me, 
00101                           const int minw, const short* olap);
00102 
00103    void partitionBlockTwo(const int axis1, const int axis2,
00104                           GridUnitList*& globallist, 
00105                           GridUnitList*& locallist, 
00106                           const int np, const int me, 
00107                           const int minw, const short* olap);
00108 
00109    void partitionBlockAll(GridUnitList*& globallist, 
00110                           GridUnitList*& locallist, 
00111                           const int np, const int me, 
00112                           const int minw, const short* olap);
00113 
00114    void partitionUserDef(GridUnitList*& globallist, 
00115                          GridUnitList*& locallist, 
00116                          const int np, const int me, 
00117                          const int minw, const short* olap);
00118   };
00119 
00120 #endif


Quickstart     Users Guide     Programmers Reference     Installation      Examples     Download



AMROC Main      Home      Contact
last update: 06/01/04