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


Main Page   Class Hierarchy   Compound List   File List  

GridDataBlock3.h

Go to the documentation of this file.
00001 #ifndef _included_GridDataBlock3_h
00002 #define _included_GridDataBlock3_h
00003 
00009 #include "GridDataBlockCommon.h"
00010 #include "GridFunctionVoid.h"
00011 
00012 #include "GridData3.h"
00013 
00014 #ifndef GridDataBlock
00015 #define GridDataBlock(dim)      name2(GridDataBlock,dim)
00016 #endif
00017 
00025 template <class Type>
00026 class GridDataBlock(3) {
00027   friend class GridFunction(3)<Type>;
00028 
00029   const int gfid;
00030 
00031   /**************************************************************/
00032   /* level, geometry & other specs */
00033   /**************************************************************/
00034 public:
00036   short timenum;  
00037   short levelnum;              /* levelnum */ 
00038 
00039   /**************************************************************/
00040 private:
00041   short myindex;
00043   short* sten_rad;       
00044 
00045   /**************************************************************/
00046   /* structure info */
00047   /**************************************************************/
00048   short ranks[3];             /* my ranks (if align != DAGH_All) */
00049   BBox merged_bbox;           /* merged bbox ... */
00050   BBox interior_bbox;           
00051   /**************************************************************/
00052 
00059   BBox prolongbbox[2*3]; 
00060   short prolongflag[2*3];
00061   
00065   BBoxList* bndrybboxlist[2*3];
00066   int bndryindex[2*3]; 
00067 
00069   int reuse;
00070 
00072   GridData(3)<Type> data;
00073 
00074   /**************************************************************/
00075 
00076   /**************************************************************/
00077   /* Interlevel communication */
00078   /**************************************************************/
00079   GDB_Interaction* gdb_parent_info;
00080   int gdb_parent_index;
00081   GDB_Interaction* gdb_child_info;
00082   int gdb_child_index;
00083   
00084   /**************************************************************/
00085   /* Detailed information for ghost communication */
00086   /**************************************************************/
00087   short comm_flag;
00088   int maxindex;
00089   GDB_Interaction*** gdb_write_info;   
00090   int** gdb_write_index;
00091   GDB_Interaction*** gdb_read_info; 
00092   int** gdb_read_index;   
00093   GridTableGhostRcv *gdb_data_rcv;
00094   /**************************************************************/
00095    
00096   /**************************************************************/
00098   GridTable &gtable;
00099   /**************************************************************/
00100 
00101   /**************************************************************/
00103   GridHierarchy &dagh;
00104   /**************************************************************/
00105 
00106 private:
00107    /**************************************************************/
00108    /* Disable the following */
00109    /**************************************************************/
00110    GridDataBlock(3)(const GridDataBlock(3)<Type>& other);
00111    GridDataBlock(3)<Type> const &operator=(const GridDataBlock(3)<Type>& 
00112                                            other);
00113 
00114 private:
00115    /**************************************************************/
00116    /* The constructor */
00117    /**************************************************************/
00118    GridDataBlock(3)(GridFunctionVoid& gf,
00119                         GridHierarchy& gh,
00120                         GridTable& gt,
00121                         const GhostInteraction& gi,
00122                         const int midx, 
00123                         const GridBox& gb,
00124                         const int time,
00125                         const int level,
00126                         const int bwidth,
00127                         BBoxList* bndrybbl,
00128                         BBoxList* prolongbbl,
00129                         const int extghwidth,
00130                         const short* olap,
00131                         const short *sten,
00132                         const int align,
00133                         const int mindex,
00134                         const int cflag,
00135                         const GridDataBlock(3)<Type>* gdbtmpl);
00136         
00137    /**************************************************************/
00138    /* The destructor */
00139    /**************************************************************/
00140    ~GridDataBlock(3)();
00141 
00142    /**************************************************************/
00143    /* Set up internals */
00144    /**************************************************************/
00145    void intersectgbl(GridFunctionVoid& gf, 
00146                      GridBoxList& gbl, 
00147                      const BBox& bbtest,
00148                      const int& level,
00149                      GridBoxList& resgbl,
00150                      const short* olap, 
00151                      const short* sten,
00152                      const int& align);
00153 
00154    void gdbSetUpLevelInteractionInfo(GridFunctionVoid& gf,
00155                                      const short* olap,
00156                                      const int& align);
00157 
00158    void gdbSetUpBoundaries(const int& bwidth,
00159                            BBoxList* bndrybbl,
00160                            BBoxList* prolongbbl,
00161                            const short* olap);
00162 
00163    void gdbSetUpGhostInteractionInfo(GridFunctionVoid& gf,
00164                                      const BBox& di_bbox,
00165                                      const BBox& dm_bbox,
00166                                      const GhostInteraction& gi,
00167                                      const short* olap,
00168                                      const short* dsten_rad,
00169                                      const int align);
00170      
00171    void gdbAddLevelInteractionInfo(GridFunctionVoid& gf, 
00172                                    GridBoxList& lgbl, 
00173                                    const int& level, 
00174                                    GDB_Interaction*& gdb_il_info, 
00175                                    int& mindex,
00176                                    const short* olap,
00177                                    const int& align);
00178    void gdbAddGhostInteractionInfo(const int axis, const int dir,
00179                                    const BBox& rb, const BBox& wb,
00180                                    const BBox& hisbb,
00181                                    const int owner, const int idx,
00182                                    BBox*** setup_write_info,
00183                                    BBox*** setup_read_info);
00184 
00185    /**************************************************************/
00186    /* Main setup */
00187    /**************************************************************/
00188    void gdbSetUpMain(const int extghwidth);
00189 
00190    /**************************************************************/
00191    /* Interlevel info */
00192    /**************************************************************/
00193 public:
00194    inline int has_parents() const { return (gdb_parent_index>0); }
00195    inline const int& parents() const { return (gdb_parent_index); }
00196    inline const GDB_Interaction* parentlist() const { return (gdb_parent_info); }
00197    inline GDB_Interaction* parentlist() { return (gdb_parent_info); }
00198    inline const BBox& parentbox(const int& j) { return (gdb_parent_info[j].bbox); }
00199    inline const int& parentidx(const int& j) { return (gdb_parent_info[j].idx); }
00200    
00201    inline int has_children() const { return (gdb_child_index>0); }
00202    inline const int& children() const { return (gdb_child_index); }
00203    inline const GDB_Interaction* childlist() const { return (gdb_child_info); }
00204    inline GDB_Interaction* childlist() { return (gdb_child_info); }
00205    inline const BBox& childbox(const int& j) { return (gdb_child_info[j].bbox); }
00206    inline const int& childidx(const int& j) { return (gdb_child_info[j].idx); }
00207 
00208    /**************************************************************/
00209    /* Ghost communications */
00210    /**************************************************************/
00211 private:
00212    int gdbWriteGhosts(const int proc,
00213                       const int time_value,
00214                       const int axis,
00215                       const int dir,
00216                       GridDataBucket<Type>& gdb,
00217                       const int at);
00218 
00219 public:
00220    inline GDB_Interaction** gdbReadInfo(const int proc)
00221      { return ( (gdb_read_info[proc]) ? gdb_read_info[proc] : 0 ); }
00222    inline GDB_Interaction** gdbWriteInfo(const int proc)
00223      { return ( (gdb_write_info[proc]) ? gdb_write_info[proc] : 0 ); }
00224    /**************************************************************/
00225    
00226    /**************************************************************/
00227    /* Data communications */
00228    /**************************************************************/
00229 private:
00230    void gdbWriteData(const int time_value, GridDataBucket<Type>& gdb, const int at);
00231    void gdbWriteData(const int time_value, const BBox& where, 
00232                      GridDataBucket<Type>& gdb, const int at);
00233    /**************************************************************/
00234 
00235    /**************************************************************/
00236    /* Bounding box access */
00237    /**************************************************************/
00238 public:
00239    inline const BBox& boundingbox() const { return (merged_bbox); }
00240    inline const BBox& interiorbox() const { return (interior_bbox); }
00241    inline const BBox& databox() const { return (griddata().bbox()); }  
00242 
00243    inline int has_externalboundaries() const { 
00244      for (register int r=0; r<2*3; r++) 
00245        if (bndryindex[r]>0) return 1; 
00246      return 0; 
00247    }
00248    inline int has_externalboundary(const int dir) const { return (bndryindex[dir]>0); }
00249    inline const int& externalboundaries(const int dir) const { return (bndryindex[dir]); }
00250    inline int externalboundaries(const int dir) { return (bndryindex[dir]); }
00251    inline const BBoxList* externalbndrylist(const int dir) const { return (bndrybboxlist[dir]); }
00252    inline BBoxList* externalbndrylist(const int dir) { return (bndrybboxlist[dir]); }
00253 
00254    inline int has_adaptiveboundaries() const { 
00255      for (register int r=0; r<2*3; r++) 
00256        if (prolongflag[r]==DAGHTrue) return 1; 
00257      return 0; 
00258    }
00259    inline int has_adaptiveboundary(const int dir) const { return (prolongflag[dir]==DAGHTrue); }
00260    inline const BBox& adaptivebndrybox(const int dir) const { return (prolongbbox[dir]); }
00261 
00262    void gdbPrintData(ostream& os) const;
00263    int MemoryUsage();
00264    /**********************************************************************/
00265 
00266    /**************************************************************/
00267    /* Data access */
00268    /**************************************************************/
00269 public:
00270    GridData(3)<Type> &griddata() { return (data); }
00271    const GridData(3)<Type> &griddata() const { return (data); }
00272    /**********************************************************************/
00273 
00274 #if (!defined(Want_c_files) && (defined(RS6000) || defined(SPX)))
00275    friend ostream& operator<< (ostream&, const GridDataBlock(3)<Type>&);
00276    friend ofstream& operator<< (ofstream&, const GridDataBlock(3)<Type>&);
00277    friend ifstream& operator>> (ifstream&, GridDataBlock(3)<Type>&);
00278    friend strstream& operator<< (strstream&, const GridDataBlock(3)<Type>&);
00279    friend strstream& operator>> (strstream&, GridDataBlock(3)<Type>&);  
00280 #endif
00281 
00282   };
00283 
00284 #if defined(Want_c_files) || (!defined(RS6000) && !defined(SPX))
00285 #include "GridDataBlock3.c"
00286 #endif
00287 
00288 #endif


Quickstart     Users Guide     Programmers Reference     Installation      Examples     Download



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