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


Main Page   Class Hierarchy   Compound List   File List  

GridTable.C

Go to the documentation of this file.
00001 
00006 #include "GridTable.h"
00007 
00008 
00009 List<GridDataBucketVoid*>* GridTable::_nulldata = (List<GridDataBucketVoid*>*) NULL;
00010 
00011 
00012 /**************************************************************************/
00013 /* Reset */
00014 /**************************************************************************/
00015 void GridTable::resettable()
00016 {
00017   register int i = 0;
00018   if(_data) for (i=0;i<numtsteps;i++)
00019     if (!_data[i].isempty())
00020       _data[i].empty();
00021 
00022   const int cnt = numtsteps*numlevels;
00023   if(_ghosts) for (i=0;i<cnt;i++)
00024     if (!_ghosts[i].isempty()) 
00025       _ghosts[i].empty();
00026 }
00027 
00028 /**************************************************************************/
00029 /* Sends */
00030 /**************************************************************************/
00031 int GridTable::send(const unsigned tag, 
00032                     GridDataBucketVoid* gdbkt, 
00033                     const int dest)
00034   {
00035 #ifdef DAGH_NO_MPI
00036 #else
00037    const int me = comm_service::proc_me();
00038 
00039 #ifdef DEBUG_PRINT_COMM
00040    ( comm_service::log() << "GridTable::send: (" << me << ")"
00041                          << "Sending { " 
00042                          << "(" << gfid << ")"
00043                          << *((GridDataBucketVoid *) gdbkt)->head() 
00044                          << "(" << dest << ")"
00045                          << " }"
00046                          << endl ).flush();
00047 #endif
00048 
00049    void *package = 0; unsigned size;
00050    gdbkt->pack(package,size);
00051 
00052 #ifdef DEBUG_PRINT_COMM
00053    ( comm_service::log() << "GridTable::send: (" << me << ")"
00054                          << "MPI_Isend { " 
00055                          << "(Tag:" << tag << ")" 
00056                          << "(Size:" << size << ")" 
00057                          << "(Dest:" << dest << ")"
00058                          << " }"
00059                          << endl ).flush();
00060 #endif 
00061 
00062    MPI_Request req ;
00063    int R = MPI_Isend( package, size, MPI_BYTE , dest,
00064                       tag, comm_service::comm(gfid) , &req );
00065    if ( MPI_SUCCESS != R ) 
00066      comm_service::error_die( "GridTable::write" , "MPI_Isend" , R );
00067 
00068    R = comm_service::serve( req );
00069    if ( MPI_SUCCESS != R ) {
00070      ( comm_service::log() << "GridTable::send: (" << me << ")"
00071        << "Sending { " 
00072        << "(" << gfid << ")"
00073        << *((GridDataBucketVoid *) gdbkt)->head() 
00074        << "(" << dest << ")"
00075        << " }"
00076        << endl ).flush();
00077      ( comm_service::log() << "GridTable::send: (" << me << ")"
00078        << "MPI_Isend { " 
00079        << "(Tag:" << tag << ")" 
00080        << "(Size:" << size << ")" 
00081        << "(Dest:" << dest << ")"
00082        << " }"
00083        << endl ).flush();
00084      
00085      comm_service::error_die( "GridTable::write" , 
00086                               "comm_service::serve" , R );
00087    }
00088 
00089    gdbkt->free();
00090    gdbkt = 0;
00091 #endif
00092    return DAGH_OK;
00093   }
00094 
00095 
00096 /**************************************************************************/
00097 /* Overloaded stream output */
00098 /**************************************************************************/
00099 ostream& operator<<(ostream& os, const GridTable& gt)
00100   {
00101    if (&gt == GridTableNULL) return os;
00102 
00103    os << "GridTable: " << "(" << gt.gfid << ") "
00104       << "[NumTimeSteps: " << gt.numtsteps << "] "
00105       << "[NumLevels: " << gt.numlevels << "] "
00106       << endl;
00107 
00108    return os;
00109   }


Quickstart     Users Guide     Programmers Reference     Installation      Examples     Download



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