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


Main Page   Class Hierarchy   Compound List   File List  

GridBox.C

Go to the documentation of this file.
00001 
00006 #include "GridBox.h"
00007 
00008 #ifdef DEBUG_PRINT
00009 #include "CommServer.h"
00010 #endif
00011 
00012 /**************************************************************************/
00013 BBox GridBox::gbBBox(const int olap, const int extgh) const
00014 { 
00015   if (bbox.empty()) return (BBox::_empty_bbox);
00016   else 
00017     return ( (olap==0 && extgh==0) ? bbox : 
00018              (extgh==0) ? growupper(bbox,olap) : 
00019                           grow(growupper(bbox,olap),extgh) );
00020 }
00021 
00022 BBox GridBox::gbBBox(const short* olap, const int extgh) const
00023 { 
00024   if (bbox.empty()) return (BBox::_empty_bbox);
00025   else 
00026     return ( (olap==0 && extgh==0) ? bbox : 
00027              (extgh==0) ? growupperbydim(bbox,olap) : 
00028                           grow(growupperbydim(bbox,olap),extgh) );
00029 }
00030 
00031 /**************************************************************************/
00032 
00033 
00034 /**************************************************************************/
00035 /* operator <<
00036    Overloaded stream output operators
00037 */
00038 /**************************************************************************/
00039 ostream& operator << (ostream& os, const GridBox& gb)
00040   {
00041 
00042    if (&gb == (GridBox *)NULL) return os;
00043 
00044    os << "Owner: " << gb.owner << " ";
00045    os << "Idx: " << gb.index << " ";
00046    os << gb.gbBBox() <<  "\n";
00047    return os;
00048   }
00049 /**************************************************************************/
00050 
00051 /**************************************************************************/
00052 /* operator <<
00053    Overloaded binary input/output operators
00054 */
00055 /**************************************************************************/
00056 ofstream& operator << (ofstream& ofs, const GridBox& gb)
00057   {
00058 
00059    if (&gb == (GridBox *)NULL) return ofs;
00060 
00061    ofs.write((char*)&gb,sizeof(GridBox));
00062 
00063    return ofs;
00064   }
00065 
00066 ifstream&  operator >> (ifstream& ifs, GridBox& gb)
00067   {
00068 
00069    if (&gb == (GridBox *)NULL) return ifs;
00070 
00071    ifs.read((char*)&gb,sizeof(GridBox));
00072 
00073    return ifs;
00074   }
00075 
00076 strstream& operator << (strstream& ofs, const GridBox& gb)
00077   {
00078 
00079    if (&gb == (GridBox *)NULL) return ofs;
00080 
00081    ofs.write((char*)&gb,sizeof(GridBox));
00082 
00083    return ofs;
00084   }
00085 
00086 strstream&  operator >> (strstream& ifs, GridBox& gb)
00087   {
00088 
00089    if (&gb == (GridBox *)NULL) return ifs;
00090 
00091    ifs.read((char*)&gb,sizeof(GridBox));
00092 
00093    return ifs;
00094   }


Quickstart     Users Guide     Programmers Reference     Installation      Examples     Download



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