diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2009-09-03 16:19:15 -0500 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2011-12-14 16:42:31 +0000 |
commit | 11c4d98017cbb86d08e15fd1b549180184b58a26 (patch) | |
tree | 2546a154c6f7bc0bec87de7316125ae7d1453569 /Carpet/CarpetLib/src/gdata.hh | |
parent | f520477b1c14e02f1495cfa8d3e09f4e21ab34d0 (diff) |
Import Carpet
Ignore-this: 309b4dd613f4af2b84aa5d6743fdb6b3
Diffstat (limited to 'Carpet/CarpetLib/src/gdata.hh')
-rw-r--r-- | Carpet/CarpetLib/src/gdata.hh | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/Carpet/CarpetLib/src/gdata.hh b/Carpet/CarpetLib/src/gdata.hh index 09622fb34..4b62cf564 100644 --- a/Carpet/CarpetLib/src/gdata.hh +++ b/Carpet/CarpetLib/src/gdata.hh @@ -24,14 +24,19 @@ using namespace std; // A generic data storage without type information class gdata { + + static list<gdata*> allgdata; + list<gdata*>::iterator allgdatai; protected: // should be readonly // Fields void * _storage; // A copy of the storage pointer - + +public: const int varindex; // Cactus variable index, or -1 +protected: centering cent; operator_type transport_operator; @@ -47,8 +52,6 @@ protected: // should be readonly bool comm_active; // a communication is going on MPI_Request request; // outstanding MPI request - int tag; // MPI tag for this object - private: // Forbid copying and passing by value gdata (gdata const &); @@ -59,8 +62,7 @@ public: // Constructors gdata (const int varindex, const centering cent = error_centered, - const operator_type transport_operator = op_error, - const int tag = -1); + const operator_type transport_operator = op_error); // Destructors virtual ~gdata (); @@ -69,8 +71,7 @@ public: virtual gdata* make_typed (const int varindex, const centering cent = error_centered, - const operator_type transport_operator = op_error, - const int tag = -1) const = 0; + const operator_type transport_operator = op_error) const = 0; // Storage management virtual void allocate (const ibbox& extent, const int proc, @@ -148,7 +149,9 @@ public: void copy_from (comm_state & state, gdata const * src, - ibbox const & box); + ibbox const & box, + int dstproc, + int srcproc); void transfer_from (comm_state & state, @@ -156,18 +159,21 @@ public: vector<CCTK_REAL> const & times, ibbox const & dstbox, ibbox const & srcbox, + int dstproc, + int srcproc, CCTK_REAL time, int order_space, int order_time); protected: + static void find_source_timelevel (vector <CCTK_REAL> const & times, CCTK_REAL time, int order_time, + operator_type transport_operator, int & timelevel0, - int & ntimelevels) - const; + int & ntimelevels); private: virtual @@ -186,8 +192,25 @@ private: int order_time) = 0; +public: + virtual size_t memory () const CCTK_ATTRIBUTE_PURE = 0; + static size_t allmemory () CCTK_ATTRIBUTE_PURE; + virtual ostream& output (ostream& os) const = 0; }; +inline size_t memoryof (gdata const & d) CCTK_ATTRIBUTE_PURE; +inline size_t memoryof (gdata const & d) +{ + return d.memory (); +} + +inline ostream& operator<< (ostream& os, const gdata& d) +{ + return d.output(os); +} + + + #endif // GDATA_HH |