00001 #ifdef CH_LANG_CC 00002 /* 00003 * _______ __ 00004 * / ___/ / ___ __ _ / / ___ 00005 * / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00006 * \___/_//_/\___/_/_/_/_.__/\___/ 00007 * Please refer to Copyright.txt, in Chombo's root directory. 00008 */ 00009 #endif 00010 00011 00012 // RegionGather 00013 // bvs, 05/26/06 00014 00015 #ifndef _REGIONGATHER_H_ 00016 #define _REGIONGATHER_H_ 00017 00018 #include "IntVect.H" 00019 #include "REAL.H" 00020 #include "LayoutData.H" 00021 #include "DisjointBoxLayout.H" 00022 #include "ProblemDomain.H" 00023 #include <list> 00024 #include "SPMD.H" 00025 #include "CH_Timer.H" 00026 #include "NamespaceHeader.H" 00027 00028 00029 /// return object for the regionGather function 00030 template <class T> 00031 class GatherObject 00032 { 00033 public: 00034 IntVect m_offset; 00035 T m_value; 00036 }; 00037 00038 00039 /// Data coordination class for the regionGather function 00040 /** 00041 Currently, this class does not handle periodic ProblemDomain. 00042 00043 00044 the radius is a distance cut-off for the gathering operation. An object T will 00045 be gathered from a neighbouring Box in the DisjointBoxLayout only if: 00046 00047 a = IntVect at center of box 1 00048 b = IntVect at center of box 2 00049 00050 abs(a[i]-b[i]) <= radius for all i 00051 */ 00052 class RegionGather 00053 { 00054 public: 00055 RegionGather(); 00056 00057 void define(const ProblemDomain& a_domain, 00058 const DisjointBoxLayout& a_layout, 00059 int radius); 00060 00061 void dump() const; 00062 00063 class Message 00064 { 00065 public: 00066 IntVect distance; 00067 int src, dest; 00068 DataIndex srcIndex; 00069 DataIndex destIndex; 00070 int procID; 00071 bool operator < (const RegionGather::Message& rhs) const; 00072 }; 00073 00074 00075 LayoutData<Vector<RegionGather::Message> > m_messages; 00076 LayoutData<Vector<RegionGather::Message> > m_local; 00077 00078 00079 }; 00080 00081 /// Function performs a distance cut-off gather operation 00082 /** 00083 the input a_local contains a value of T for every Box in the BoxLayout. 00084 00085 the output a_gatherObjects contains all the T objects within the constraints 00086 established by the RegionGather object, and the center seperation of their 00087 respective Boxes. 00088 */ 00089 template <class T> 00090 void regionGather(const LayoutData<T>& a_local, 00091 const RegionGather& a_copier, 00092 LayoutData<Vector<GatherObject<T> > >& a_gatherObjects); 00093 00094 00095 #include "RegionGatherI.H" 00096 00097 #include "NamespaceFooter.H" 00098 #endif