Blockstructured Adaptive Mesh Refinement in object-oriented C++
00001 00006 #include "CommRcvServer.h" 00007 00008 /*************************************************************************/ 00009 /* class GridTableGhostRcv */ 00010 /*************************************************************************/ 00011 GridTableGhostRcv::GridTableGhostRcv(GridTable& GT, 00012 const unsigned tag, 00013 const unsigned size, 00014 const int src) 00015 : comm_service(GT.gfid,tag,src), Table(GT), Request(0), Size(size), 00016 rcvflag(DAGHFalse) 00017 { 00018 if (req() == 0) { 00019 setreq(Id, Tag, Src); 00020 return; 00021 } 00022 Request = new char[Size]; 00023 assert (Request != 0); 00024 } 00025 00026 void GridTableGhostRcv::callrecv( const MPI_Status & MS ) 00027 { 00028 rcvflag = DAGHTrue; 00029 if (Request) rcv_update(Request); 00030 Request = (char *) NULL; 00031 Request = new char[Size]; 00032 assert (Request != 0); 00033 } 00034 00035 void GridTableGhostRcv::postrcv(void) 00036 { 00037 #ifdef DAGH_NO_MPI 00038 #else 00039 00040 if (!Request) return; 00041 if (*req() != MPI_REQUEST_NULL) return; 00042 00043 #ifdef DEBUG_PRINT_COMM 00044 ( comm_service::log() << "GridTableGhostRcv::postrcv " 00045 << "(" << comm_service::proc_me() << ") " 00046 << "MPI_Irecv: " 00047 << "Tag: " << Tag << " " 00048 << "Size: " << Size << " " 00049 << "From: " << Src << " " 00050 << endl ).flush(); 00051 #endif 00052 00053 int R = MPI_Irecv(Request,Size,MPI_BYTE, 00054 Src,Tag,comm_service::comm(Id),req()); 00055 00056 if ( MPI_SUCCESS != R ) 00057 comm_service::error_die("GridTableGhostRcv::postrcv","MPI_Irecv",R); 00058 00059 #endif 00060 00061 rcvflag = DAGHFalse; 00062 } 00063 00064 void GridTableGhostRcv::callrecvNpost( const MPI_Status & MS ) 00065 { 00066 rcvflag = DAGHTrue; 00067 if (Request) rcv_update(Request); 00068 Request = (char *) NULL; 00069 Request = new char[Size]; 00070 assert (Request != 0); 00071 00072 #ifdef DAGH_NO_MPI 00073 #else 00074 00075 assert (*req() == MPI_REQUEST_NULL); 00076 #ifdef DEBUG_PRINT_COMM 00077 ( comm_service::log() << "GridTableGhostRcv::postrcv " 00078 << "(" << comm_service::proc_me() << ") " 00079 << "MPI_Irecv: " 00080 << "Tag: " << Tag << " " 00081 << "Size: " << Size << " " 00082 << "From: " << Src << " " 00083 << endl ).flush(); 00084 #endif 00085 00086 int R = MPI_Irecv(Request,Size,MPI_BYTE, 00087 Src,Tag,comm_service::comm(Id),req()); 00088 00089 if ( MPI_SUCCESS != R ) 00090 comm_service::error_die("GridTableGhostRcv::callrecv","MPI_Irecv",R); 00091 00092 #endif 00093 00094 rcvflag = DAGHFalse; 00095 } 00096 00097 void GridTableGhostRcv::rcv_update(void *Rcv) 00098 { 00099 GridDataBucketVoid *rcvbkt = new GridDataBucketVoid(Rcv); 00100 00101 #ifdef DEBUG_PRINT_COMM 00102 ( comm_service::log() << "GridTableGhostRcv::rcv_update " 00103 << "(" << comm_service::proc_me() << ") " 00104 << "Recieved { " 00105 << *rcvbkt->head() 00106 << " }" 00107 << endl ).flush(); 00108 #endif 00109 00110 struct gdhdr *gdh == rcvbkt->head(); 00111 List<GridDataBucketVoid*>& lgdbkt = Table.ghosts(gdh->time,gdh->level); 00112 lgdbkt.add(rcvbkt->alias()); 00113 rcvbkt->free(); 00114 } 00115 00116 const char * GridTableGhostRcv::name( void ) const 00117 { 00118 static const char Name[] = "GridTableGhostRcv" ; 00119 return Name ; 00120 }
Quickstart Users Guide Programmers Reference Installation Examples Download
AMROC Main Home Contactlast update: 06/01/04