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


Main Page   Class Hierarchy   Compound List   File List  

GridBox.h

Go to the documentation of this file.
00001 #ifndef _included_GridBox_h
00002 #define _included_GridBox_h
00003 
00009 #include "DAGHParams.h"
00010 #include "BBox.h"
00011 
00012 #define GridBoxNULL ((GridBox *) NULL)
00013 
00020 class GridBox 
00021 {
00022   friend ostream& operator<<(ostream&, const GridBox&);
00023   friend ofstream& operator<<(ofstream&, const GridBox&);
00024   friend ifstream& operator>>(ifstream&, GridBox&);
00025   friend strstream& operator<<(strstream&, const GridBox&);
00026   friend strstream& operator>>(strstream&, GridBox&);
00027   friend class GridBoxList;
00028   
00030   short int owner;    
00032   short int index;
00033  
00035   BBox bbox; 
00036 
00037  public:
00038   /* Constructors, Destructor */
00039   inline GridBox(void) : owner(DAGHNoBody), index(DAGHNull) {}
00040   
00041   inline GridBox(const int own, const int idx, const BBox& bb)
00042     : owner(own), index(idx), bbox(bb) { }
00043 
00044    inline GridBox(GridBox const &other)
00045      : owner(other.owner), index(other.index), bbox(other.bbox) { }
00046 
00047    inline ~GridBox(void) {}
00048 
00049    inline GridBox const &operator= (GridBox const &other)
00050      { owner=other.owner; index=other.index;
00051        bbox=other.bbox; return (*this); }
00052 
00053    /* Define the comparison operators == and != */ 
00054    inline int operator == (GridBox const &other) const
00055      { return((index == other.index) && (owner == other.owner) && bbox == other.bbox); }
00056    inline int operator != (GridBox const &other) const 
00057      { return(!(*this == other)); } 
00058 
00059    inline void SetGridBox(const int own, const int idx, const BBox& bb)
00060      { owner=own; index=idx; bbox=bb; }
00061 
00062    /* Simple Query funtions */
00063    inline int gbOwner(void) const { return (owner); }
00064    inline int gbIndex(void) const { return (index); }
00065    inline int gbRank(void) const { return (bbox.rank); }
00066    inline void gbSetIndex(const int idx) { index = idx; }
00067    inline void gbSetOwner(const int p) { owner = p; }
00068    inline void gbSetBBox(const BBox& bb) { bbox = bb; }
00069 
00070    inline const BBox& gbBBox(void) const { return bbox; }
00071    BBox gbBBox(const int olap, const int extgh=0) const;
00072    BBox gbBBox(const short* olap, const int extgh=0) const;
00073 
00074   };
00075 
00076 ostream&  operator << (ostream& os, const GridBox& gb);
00077 ofstream& operator << (ofstream& ofs, const GridBox& gb);
00078 ifstream& operator >> (ifstream& ifs, GridBox& gb);
00079 strstream& operator << (strstream& ofs, const GridBox& gb);
00080 strstream& operator >> (strstream& ifs, GridBox& gb);
00081 
00082 #endif
00083 
00084 
00085 


Quickstart     Users Guide     Programmers Reference     Installation      Examples     Download



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