aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/gdata.hh
diff options
context:
space:
mode:
authorschnetter <>2003-01-03 14:49:00 +0000
committerschnetter <>2003-01-03 14:49:00 +0000
commitd5cb73a42d61d3565e6ef52bac69e7ab84a7a821 (patch)
treee6ca1fea7027d660f952c5611d8caa6941723f0f /Carpet/CarpetLib/src/gdata.hh
parent58469c24e957c469d88961e2fe3029f9e4891f3a (diff)
Removed the "dimgeneric_*" data types from CarpetLib. They were never
Removed the "dimgeneric_*" data types from CarpetLib. They were never really used anyway. Changed "th" into "th<D>". Renamed "generic_*" to "g*". Propagated these changes to all other places. darcs-hash:20030103144936-07bb3-c4d74d2d94a56a898f9bb735666eefc01e2610e2.gz
Diffstat (limited to 'Carpet/CarpetLib/src/gdata.hh')
-rw-r--r--Carpet/CarpetLib/src/gdata.hh72
1 files changed, 42 insertions, 30 deletions
diff --git a/Carpet/CarpetLib/src/gdata.hh b/Carpet/CarpetLib/src/gdata.hh
index 66eeb00dd..238cd124a 100644
--- a/Carpet/CarpetLib/src/gdata.hh
+++ b/Carpet/CarpetLib/src/gdata.hh
@@ -1,22 +1,4 @@
-/***************************************************************************
- gdata.hh - description
- -------------------
- begin : Wed Jul 19 2000
- copyright : (C) 2000 by Erik Schnetter
- email : schnetter@astro.psu.edu
-
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gdata.hh,v 1.15 2002/09/25 15:49:16 schnetter Exp $
-
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gdata.hh,v 1.16 2003/01/03 15:49:36 schnetter Exp $
#ifndef GDATA_HH
#define GDATA_HH
@@ -30,7 +12,6 @@
#include "cctk.h"
#include "defs.hh"
-#include "dgdata.hh"
#include "dist.hh"
#include "bbox.hh"
#include "vect.hh"
@@ -41,7 +22,7 @@ using namespace std;
// A generic data storage without type information
template<int D>
-class generic_data: public dimgeneric_data {
+class gdata {
// Types
typedef vect<int,D> ivect;
@@ -50,6 +31,12 @@ class generic_data: public dimgeneric_data {
protected: // should be readonly
// Fields
+ bool _has_storage; // has storage associated (on some processor)
+ bool _owns_storage; // owns the storage
+ int _size; // size
+
+ int _proc; // stored on processor
+
ivect _shape, _stride; // shape and index order
ibbox _extent; // bbox for all data
@@ -57,16 +44,19 @@ protected: // should be readonly
public:
// Constructors
- generic_data ();
+ gdata ();
// Destructors
- virtual ~generic_data ();
+ virtual ~gdata ();
// Pseudo constructors
- virtual generic_data<D>* make_typed () const = 0;
-
+ virtual gdata<D>* make_typed () const = 0;
+
+ // Processor management
+ virtual void change_processor (const int newproc, void* const mem=0) = 0;
+
// Storage management
- virtual void transfer_from (generic_data<D>* src) = 0;
+ virtual void transfer_from (gdata<D>* src) = 0;
virtual void allocate (const ibbox& extent, const int proc,
void* const mem=0) = 0;
@@ -74,6 +64,28 @@ public:
// Accessors
+ bool has_storage () const {
+ return _has_storage;
+ }
+ bool owns_storage () const {
+ assert (_has_storage);
+ return _owns_storage;
+ }
+
+ virtual const void* storage () const = 0;
+
+ virtual void* storage () = 0;
+
+ int size () const {
+ assert (_has_storage);
+ return _size;
+ }
+
+ int proc () const {
+ assert (_has_storage);
+ return _proc;
+ }
+
const ivect& shape () const {
assert (_has_storage);
return _shape;
@@ -99,17 +111,17 @@ public:
}
// Data manipulators
- void copy_from (const generic_data* src, const ibbox& box);
- void interpolate_from (const vector<const generic_data*> srcs,
+ void copy_from (const gdata* src, const ibbox& box);
+ void interpolate_from (const vector<const gdata*> srcs,
const vector<CCTK_REAL> times,
const ibbox& box, const CCTK_REAL time,
const int order_space,
const int order_time);
protected:
virtual void
- copy_from_innerloop (const generic_data* src, const ibbox& box) = 0;
+ copy_from_innerloop (const gdata* src, const ibbox& box) = 0;
virtual void
- interpolate_from_innerloop (const vector<const generic_data*> srcs,
+ interpolate_from_innerloop (const vector<const gdata*> srcs,
const vector<CCTK_REAL> times,
const ibbox& box, const CCTK_REAL time,
const int order_space,