aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/gdata.hh
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2012-01-11 16:00:56 -0500
committerBarry Wardell <barry.wardell@gmail.com>2012-09-11 18:15:41 +0100
commite18cbfdb7272168dc7ecd765c3c7e7ce752a1f98 (patch)
tree313601349b2627deaaae1a6de742cab7aa3b21c6 /Carpet/CarpetLib/src/gdata.hh
parent603b8b1ce46ccd507475ef04282fbe020d947521 (diff)
CarpetLib: Extend operator API to allow hyperslabbing
Extend API of grid operators and of gdata::copy_from, gdata::transfer_from to allow hyperslabbing Implement hyperslabbing in copy_3d.cc
Diffstat (limited to 'Carpet/CarpetLib/src/gdata.hh')
-rw-r--r--Carpet/CarpetLib/src/gdata.hh35
1 files changed, 32 insertions, 3 deletions
diff --git a/Carpet/CarpetLib/src/gdata.hh b/Carpet/CarpetLib/src/gdata.hh
index a06509bd7..6877b4974 100644
--- a/Carpet/CarpetLib/src/gdata.hh
+++ b/Carpet/CarpetLib/src/gdata.hh
@@ -22,6 +22,28 @@ using namespace std;
+// Slabbing description
+template <typename T, int D>
+struct slab {
+ vect<T,D> offset; // dst[ipos] = src[ipos + offset * box.stride];
+};
+typedef slab<int,dim> islab;
+
+template <typename T, int D>
+ostream& operator<< (ostream& os, slab<T,D> const & slabinfo);
+
+template <typename T, int D>
+MPI_Datatype mpi_datatype (slab<T,D> const &)
+ CCTK_ATTRIBUTE_CONST;
+namespace dist {
+ template<> inline MPI_Datatype mpi_datatype<islab> ()
+ CCTK_ATTRIBUTE_CONST;
+ template<> inline MPI_Datatype mpi_datatype<islab> ()
+ { islab dummy; return mpi_datatype(dummy); }
+}
+
+
+
// A generic data storage without type information
class gdata {
@@ -154,7 +176,9 @@ public:
void
copy_from (comm_state & state,
gdata const * src,
- ibbox const & box,
+ ibbox const & dstbox,
+ ibbox const & srcbox,
+ islab const * restrict const slabinfo,
int dstproc,
int srcproc);
@@ -164,6 +188,7 @@ public:
vector<CCTK_REAL> const & times,
ibbox const & dstbox,
ibbox const & srcbox,
+ islab const * restrict const slabinfo,
int dstproc,
int srcproc,
CCTK_REAL time,
@@ -183,14 +208,18 @@ private:
virtual
void
copy_from_innerloop (gdata const * gsrc,
- ibbox const & box)
+ ibbox const & dstbox,
+ ibbox const & srcbox,
+ islab const * slabinfo)
= 0;
virtual
void
transfer_from_innerloop (vector <gdata const *> const & gsrcs,
vector <CCTK_REAL> const & times,
- ibbox const & box,
+ ibbox const & dstbox,
+ ibbox const & srcbox,
+ islab const * restrict const slabinfo,
CCTK_REAL time,
int order_space,
int order_time)