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