diff options
32 files changed, 332 insertions, 656 deletions
diff --git a/Carpet/Carpet/src/SetupGH.cc b/Carpet/Carpet/src/SetupGH.cc index deb688e84..f50f0e3fb 100644 --- a/Carpet/Carpet/src/SetupGH.cc +++ b/Carpet/Carpet/src/SetupGH.cc @@ -19,7 +19,7 @@ #include "carpet.hh" extern "C" { - static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/SetupGH.cc,v 1.35 2003/01/03 14:11:56 schnetter Exp $"; + static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/SetupGH.cc,v 1.36 2003/01/03 15:49:36 schnetter Exp $"; CCTK_FILEVERSION(Carpet_Carpet_SetupGH_cc); } @@ -163,7 +163,7 @@ namespace Carpet { baseext); // Allocate time hierarchy - tt = new th(hh, 1.0); + tt = new th<dim>(hh, 1.0); // Allocate data hierarchy dd = new dh<dim>(*hh, lghosts, ughosts, prolongation_order_space); @@ -240,7 +240,7 @@ namespace Carpet { multigrid_factor, vertex_centered, arrext); - arrdata[group].tt = new th(arrdata[group].hh, 1.0); + arrdata[group].tt = new th<dim>(arrdata[group].hh, 1.0); vect<int,dim> alghosts(0), aughosts(0); for (int d=0; d<gp.dim; ++d) { diff --git a/Carpet/Carpet/src/carpet_public.hh b/Carpet/Carpet/src/carpet_public.hh index 4b59b0b56..f88e873f7 100644 --- a/Carpet/Carpet/src/carpet_public.hh +++ b/Carpet/Carpet/src/carpet_public.hh @@ -1,4 +1,4 @@ -// $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/carpet_public.hh,v 1.22 2003/01/03 14:11:56 schnetter Exp $ +// $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/carpet_public.hh,v 1.23 2003/01/03 15:49:36 schnetter Exp $ // It is assumed that the number of components of all arrays is equal // to the number of components of the grid functions, and that their @@ -80,7 +80,7 @@ namespace Carpet { // The grid hierarchy extern gh<dim>* hh; - extern th* tt; + extern th<dim>* tt; extern dh<dim>* dd; // Data for everything @@ -88,9 +88,9 @@ namespace Carpet { // points to hh etc. for GF, and is unique for SCALAR and ARRAY cGroupDynamicData info; gh<dim>* hh; - th* tt; + th<dim>* tt; dh<dim>* dd; - vector<generic_gf<dim>*> data; // [var] + vector<ggf<dim>*> data; // [var] bool do_transfer; // prolongate and restrict }; extern vector<arrdesc> arrdata; // [group] diff --git a/Carpet/Carpet/src/variables.cc b/Carpet/Carpet/src/variables.cc index 5440c8d95..4152cd0f4 100644 --- a/Carpet/Carpet/src/variables.cc +++ b/Carpet/Carpet/src/variables.cc @@ -6,7 +6,7 @@ #include "carpet.hh" extern "C" { - static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/variables.cc,v 1.11 2002/10/24 10:39:39 schnetter Exp $"; + static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/variables.cc,v 1.12 2003/01/03 15:49:36 schnetter Exp $"; CCTK_FILEVERSION(Carpet_Carpet_variables_cc); } @@ -62,7 +62,7 @@ namespace Carpet { // The grid hierarchy gh<dim>* hh; - th* tt; + th<dim>* tt; dh<dim>* dd; // Data for everything diff --git a/Carpet/CarpetIOASCII/src/ioascii.cc b/Carpet/CarpetIOASCII/src/ioascii.cc index ae8d22531..d6a62755d 100644 --- a/Carpet/CarpetIOASCII/src/ioascii.cc +++ b/Carpet/CarpetIOASCII/src/ioascii.cc @@ -30,7 +30,7 @@ #include "ioascii.hh" extern "C" { - static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/src/ioascii.cc,v 1.42 2002/10/24 12:00:35 schnetter Exp $"; + static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/src/ioascii.cc,v 1.43 2003/01/03 15:49:36 schnetter Exp $"; CCTK_FILEVERSION(Carpet_CarpetIOASCII_ioascii_cc); } @@ -54,7 +54,7 @@ namespace CarpetIOASCII { template<int D,int DD> void WriteASCII (ostream& os, - const generic_data<D>* const gfdata, + const gdata<D>* const gfdata, const bbox<int,D>& gfext, const int vi, const int time, @@ -361,13 +361,13 @@ namespace CarpetIOASCII { // level BEGIN_COMPONENT_LOOP(cgh) { - const generic_gf<dim>* ff = 0; + const ggf<dim>* ff = 0; assert (var < (int)arrdata[group].data.size()); - ff = (generic_gf<dim>*)arrdata[group].data[var]; + ff = (ggf<dim>*)arrdata[group].data[var]; - const generic_data<dim>* const data - = (*ff) (tl, reflevel, component, mglevel); + const gdata<dim>* const data + = (*ff) (tl, reflevel, component, mglevel); bbox<int,dim> ext = data->extent(); vect<int,dim> lo = ext.lower(); @@ -694,7 +694,7 @@ namespace CarpetIOASCII { // Output template<int D,int DD> void WriteASCII (ostream& os, - const generic_data<D>* const gfdata, + const gdata<D>* const gfdata, const bbox<int,D>& gfext, const int vi, const int time, @@ -786,7 +786,7 @@ namespace CarpetIOASCII { } else { // copy to processor 0 and output there - generic_data<D>* const tmp = gfdata->make_typed(); + gdata<D>* const tmp = gfdata->make_typed(); tmp->allocate(gfdata->extent(), 0); tmp->copy_from (gfdata, gfdata->extent()); WriteASCII (os, tmp, gfext, vi, time, org, dirs, tl, rl, c, ml, @@ -807,7 +807,7 @@ namespace CarpetIOASCII { template void WriteASCII (ostream& os, - const generic_data<3>* const gfdata, + const gdata<3>* const gfdata, const bbox<int,3>& gfext, const int vi, const int time, @@ -823,7 +823,7 @@ namespace CarpetIOASCII { template void WriteASCII (ostream& os, - const generic_data<3>* const gfdata, + const gdata<3>* const gfdata, const bbox<int,3>& gfext, const int vi, const int time, @@ -839,7 +839,7 @@ namespace CarpetIOASCII { template void WriteASCII (ostream& os, - const generic_data<3>* const gfdata, + const gdata<3>* const gfdata, const bbox<int,3>& gfext, const int vi, const int time, diff --git a/Carpet/CarpetLib/src/bbox.cc b/Carpet/CarpetLib/src/bbox.cc index ee97d7e00..4a4bfcea6 100644 --- a/Carpet/CarpetLib/src/bbox.cc +++ b/Carpet/CarpetLib/src/bbox.cc @@ -1,22 +1,4 @@ -/*************************************************************************** - bbox.cc - Bounding boxes - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bbox.cc,v 1.10 2002/08/30 16:03:19 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/bbox.cc,v 1.11 2003/01/03 15:49:36 schnetter Exp $ #include <assert.h> diff --git a/Carpet/CarpetLib/src/bbox.hh b/Carpet/CarpetLib/src/bbox.hh index b47f4b68f..565e2648f 100644 --- a/Carpet/CarpetLib/src/bbox.hh +++ b/Carpet/CarpetLib/src/bbox.hh @@ -1,22 +1,4 @@ -/*************************************************************************** - bbox.hh - Bounding boxes - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bbox.hh,v 1.10 2002/05/05 22:16:58 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/bbox.hh,v 1.11 2003/01/03 15:49:36 schnetter Exp $ #ifndef BBOX_HH #define BBOX_HH diff --git a/Carpet/CarpetLib/src/bboxset.cc b/Carpet/CarpetLib/src/bboxset.cc index 909c61d3a..8de16a015 100644 --- a/Carpet/CarpetLib/src/bboxset.cc +++ b/Carpet/CarpetLib/src/bboxset.cc @@ -1,22 +1,4 @@ -/*************************************************************************** - bboxset.cc - Sets of bounding boxes - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bboxset.cc,v 1.10 2002/05/05 22:16:58 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/bboxset.cc,v 1.11 2003/01/03 15:49:36 schnetter Exp $ #include <assert.h> diff --git a/Carpet/CarpetLib/src/bboxset.hh b/Carpet/CarpetLib/src/bboxset.hh index 9d43d8c82..b6e79d8fb 100644 --- a/Carpet/CarpetLib/src/bboxset.hh +++ b/Carpet/CarpetLib/src/bboxset.hh @@ -1,22 +1,4 @@ -/*************************************************************************** - bboxset.hh - Sets of bounding boxes - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bboxset.hh,v 1.9 2002/12/12 16:49:55 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/bboxset.hh,v 1.10 2003/01/03 15:49:36 schnetter Exp $ #ifndef BBOXSET_HH #define BBOXSET_HH diff --git a/Carpet/CarpetLib/src/data.cc b/Carpet/CarpetLib/src/data.cc index 9f086fcb7..94f9ce109 100644 --- a/Carpet/CarpetLib/src/data.cc +++ b/Carpet/CarpetLib/src/data.cc @@ -1,22 +1,4 @@ -/*************************************************************************** - data.cc - Data storage - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/data.cc,v 1.23 2003/01/03 13:19:58 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/data.cc,v 1.24 2003/01/03 15:49:36 schnetter Exp $ #include <assert.h> @@ -102,7 +84,7 @@ void data<T,D>::free () { } template<class T, int D> -void data<T,D>::transfer_from (generic_data<D>* gsrc) { +void data<T,D>::transfer_from (gdata<D>* gsrc) { data* src = (data*)gsrc; assert (!_storage); *this = *src; @@ -166,7 +148,7 @@ void data<T,D>::change_processor (const int newproc, void* const mem) { // Data manipulators template<class T, int D> void data<T,D> -::copy_from_innerloop (const generic_data<D>* gsrc, const ibbox& box) +::copy_from_innerloop (const gdata<D>* gsrc, const ibbox& box) { const data* src = (const data*)gsrc; assert (has_storage() && src->has_storage()); @@ -196,7 +178,7 @@ void data<T,D> template<class T, int D> void data<T,D> -::interpolate_from_innerloop (const vector<const generic_data<D>*> gsrcs, +::interpolate_from_innerloop (const vector<const gdata<D>*> gsrcs, const vector<CCTK_REAL> times, const ibbox& box, const CCTK_REAL time, const int order_space, @@ -244,7 +226,7 @@ extern "C" { template<> void data<CCTK_REAL8,3> -::copy_from_innerloop (const generic_data<3>* gsrc, const ibbox& box) +::copy_from_innerloop (const gdata<3>* gsrc, const ibbox& box) { const data* src = (const data*)gsrc; assert (has_storage() && src->has_storage()); @@ -377,7 +359,7 @@ extern "C" { template<> void data<CCTK_REAL8,3> -::interpolate_from_innerloop (const vector<const generic_data<3>*> gsrcs, +::interpolate_from_innerloop (const vector<const gdata<3>*> gsrcs, const vector<CCTK_REAL> times, const ibbox& box, const CCTK_REAL time, const int order_space, @@ -539,7 +521,8 @@ void data<CCTK_REAL8,3> // Output template<class T,int D> ostream& data<T,D>::output (ostream& os) const { - os << "data<T," << D << ">:" + T Tdummy; + os << "data<" << typestring(Tdummy) << "," << D << ">:" << "extent=" << extent() << "," << "stride=" << stride() << ",size=" << size(); return os; diff --git a/Carpet/CarpetLib/src/data.hh b/Carpet/CarpetLib/src/data.hh index 468b7cced..84ac8309d 100644 --- a/Carpet/CarpetLib/src/data.hh +++ b/Carpet/CarpetLib/src/data.hh @@ -1,22 +1,4 @@ -/*************************************************************************** - data.hh - Data storage - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/data.hh,v 1.11 2002/09/25 15:49:15 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/data.hh,v 1.12 2003/01/03 15:49:36 schnetter Exp $ #ifndef DATA_HH #define DATA_HH @@ -40,7 +22,7 @@ using namespace std; // A real data storage template<class T,int D> -class data: public generic_data<D> { +class data: public gdata<D> { // Types typedef vect<int,D> ivect; @@ -65,7 +47,7 @@ public: virtual void allocate (const ibbox& extent, const int proc, void* const mem=0); virtual void free (); - virtual void transfer_from (generic_data<D>* gsrc); + virtual void transfer_from (gdata<D>* gsrc); // Processor management virtual void change_processor (const int newproc, void* const mem=0); @@ -93,9 +75,9 @@ public: } // Data manipulators - void copy_from_innerloop (const generic_data<D>* gsrc, + void copy_from_innerloop (const gdata<D>* gsrc, const ibbox& box); - void interpolate_from_innerloop (const vector<const generic_data<D>*> gsrcs, + void interpolate_from_innerloop (const vector<const gdata<D>*> gsrcs, const vector<CCTK_REAL> times, const ibbox& box, const CCTK_REAL time, const int order_space, diff --git a/Carpet/CarpetLib/src/defs.cc b/Carpet/CarpetLib/src/defs.cc index a40170a54..e3aeb3526 100644 --- a/Carpet/CarpetLib/src/defs.cc +++ b/Carpet/CarpetLib/src/defs.cc @@ -1,22 +1,4 @@ -/*************************************************************************** - defs.cc - Commonly used definitions - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/defs.cc,v 1.12 2002/08/30 16:03:20 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/defs.cc,v 1.13 2003/01/03 15:49:36 schnetter Exp $ #include <assert.h> #include <ctype.h> diff --git a/Carpet/CarpetLib/src/defs.hh b/Carpet/CarpetLib/src/defs.hh index 4cab69f3f..4e3cab8d8 100644 --- a/Carpet/CarpetLib/src/defs.hh +++ b/Carpet/CarpetLib/src/defs.hh @@ -1,22 +1,4 @@ -/*************************************************************************** - defs.hh - Commonly used definitions - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/defs.hh,v 1.9 2002/12/31 13:29:07 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/defs.hh,v 1.10 2003/01/03 15:49:36 schnetter Exp $ #ifndef DEFS_HH #define DEFS_HH @@ -51,16 +33,18 @@ inline T square (const T& x) { return x*x; } // Another useful helper template<class T> -inline T ipow (const T& x, const int y) { +inline T ipow (T x, int y) { if (y<0) { - return T(1)/ipow(x,-y); - } else if (y==0) { - return T(1); - } else if (y%2) { - return x * ipow(x*x,y/2); - } else { - return ipow(x*x,y/2); + y = -y; + x = T(1)/x; } + T res = T(1); + while (y>0) { + if (y%2) res *= x; + x *= x; + y /= 2; + } + return res; } diff --git a/Carpet/CarpetLib/src/dh.cc b/Carpet/CarpetLib/src/dh.cc index 3023b9c31..6d9b6e065 100644 --- a/Carpet/CarpetLib/src/dh.cc +++ b/Carpet/CarpetLib/src/dh.cc @@ -1,23 +1,4 @@ -/*************************************************************************** - dh.cc - Data Hierarchy - A grid hierarchy plus ghost zones - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/dh.cc,v 1.23 2002/12/12 16:49:55 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/dh.cc,v 1.24 2003/01/03 15:49:36 schnetter Exp $ #include <assert.h> @@ -39,9 +20,9 @@ using namespace std; template<int D> dh<D>::dh (gh<D>& h, const ivect& lghosts, const ivect& ughosts, int prolongation_order_space) - : dimgeneric_dh(prolongation_order_space), - h(h), - lghosts(lghosts), ughosts(ughosts) + : h(h), + lghosts(lghosts), ughosts(ughosts), + prolongation_order_space(prolongation_order_space) { assert (all(lghosts>=0 && ughosts>=0)); h.add(this); @@ -57,6 +38,13 @@ dh<D>::~dh () h.remove(this); } +// Helpers +template<int D> +int dh<D>::prolongation_stencil_size () const { + assert (prolongation_order_space>=0); + return prolongation_order_space/2; +} + // Modifiers template<int D> void dh<D>::recompose () { @@ -346,7 +334,7 @@ void dh<D>::recompose () { } } // if output_bboxes - for (typename list<generic_gf<D>*>::iterator f=gfs.begin(); + for (typename list<ggf<D>*>::iterator f=gfs.begin(); f!=gfs.end(); ++f) { (*f)->recompose(); } @@ -356,13 +344,13 @@ void dh<D>::recompose () { // Grid function management template<int D> -void dh<D>::add (generic_gf<D>* f) { +void dh<D>::add (ggf<D>* f) { CHECKPOINT; gfs.push_back(f); } template<int D> -void dh<D>::remove (generic_gf<D>* f) { +void dh<D>::remove (ggf<D>* f) { CHECKPOINT; gfs.remove(f); } @@ -376,7 +364,7 @@ void dh<D>::output (ostream& os) const { << "ghosts=[" << lghosts << "," << ughosts << "]," << "gfs={"; int cnt=0; - for (typename list<generic_gf<D>*>::const_iterator f = gfs.begin(); + for (typename list<ggf<D>*>::const_iterator f = gfs.begin(); f != gfs.end(); ++f) { if (cnt++) os << ","; (*f)->output(os); diff --git a/Carpet/CarpetLib/src/dh.hh b/Carpet/CarpetLib/src/dh.hh index 0c9884d88..06d4f65b0 100644 --- a/Carpet/CarpetLib/src/dh.hh +++ b/Carpet/CarpetLib/src/dh.hh @@ -1,23 +1,4 @@ -/*************************************************************************** - dh.hh - Data Hierarchy - A grid hierarchy plus ghost zones - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/dh.hh,v 1.11 2002/10/14 20:40:39 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/dh.hh,v 1.12 2003/01/03 15:49:36 schnetter Exp $ #ifndef DH_HH #define DH_HH @@ -32,7 +13,6 @@ #include "bbox.hh" #include "bboxset.hh" #include "defs.hh" -#include "dgdh.hh" #include "gh.hh" #include "vect.hh" @@ -41,13 +21,18 @@ using namespace std; // Forward declaration -template<int D> class generic_gf; +template<int D> class ggf; +template<int D> class dh; + +// Output +template<int D> +ostream& operator<< (ostream& os, const dh<D>& d); // A data hierarchy (grid hierarchy plus ghost zones) template<int D> -class dh: public dimgeneric_dh { +class dh { // Types typedef vect<int,D> ivect; @@ -105,10 +90,12 @@ public: // should be readonly gh<D>& h; // hierarchy ivect lghosts, ughosts; // ghost zones + int prolongation_order_space; // order of spatial prolongation operator + rboxes boxes; rbases bases; - list<generic_gf<D>*> gfs; // list of all grid functions + list<ggf<D>*> gfs; // list of all grid functions public: @@ -119,12 +106,15 @@ public: // Destructors virtual ~dh (); + // Helpers + int prolongation_stencil_size () const; + // Modifiers void recompose (); // Grid function management - void add (generic_gf<D>* f); - void remove (generic_gf<D>* f); + void add (ggf<D>* f); + void remove (ggf<D>* f); // Output virtual void output (ostream& os) const; @@ -132,4 +122,12 @@ public: +template<int D> +inline ostream& operator<< (ostream& os, const dh<D>& d) { + d.output(os); + return os; +} + + + #endif // DH_HH diff --git a/Carpet/CarpetLib/src/dist.cc b/Carpet/CarpetLib/src/dist.cc index d3a242beb..89c17935a 100644 --- a/Carpet/CarpetLib/src/dist.cc +++ b/Carpet/CarpetLib/src/dist.cc @@ -1,22 +1,4 @@ -/*************************************************************************** - dist.cc - Helpers for distributed computing - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/dist.cc,v 1.5 2002/05/05 22:17:01 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/dist.cc,v 1.6 2003/01/03 15:49:36 schnetter Exp $ #include <assert.h> diff --git a/Carpet/CarpetLib/src/dist.hh b/Carpet/CarpetLib/src/dist.hh index 5bcdebf03..10d4a3cfc 100644 --- a/Carpet/CarpetLib/src/dist.hh +++ b/Carpet/CarpetLib/src/dist.hh @@ -1,22 +1,4 @@ -/*************************************************************************** - dist.hh - Helpers for distributed computing - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/dist.hh,v 1.7 2002/12/31 13:29:07 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/dist.hh,v 1.8 2003/01/03 15:49:36 schnetter Exp $ #ifndef DIST_HH #define DIST_HH diff --git a/Carpet/CarpetLib/src/gdata.cc b/Carpet/CarpetLib/src/gdata.cc index 76184b3d1..86f5f89c3 100644 --- a/Carpet/CarpetLib/src/gdata.cc +++ b/Carpet/CarpetLib/src/gdata.cc @@ -1,22 +1,4 @@ -/*************************************************************************** - gdata.cc - 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.cc,v 1.20 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.cc,v 1.21 2003/01/03 15:49:36 schnetter Exp $ #include <assert.h> @@ -37,18 +19,19 @@ using namespace std; // Constructors template<int D> -generic_data<D>::generic_data () +gdata<D>::gdata () + : _has_storage(false) { } // Destructors template<int D> -generic_data<D>::~generic_data () { } +gdata<D>::~gdata () { } // Data manipulators template<int D> -void generic_data<D>::copy_from (const generic_data* src, const ibbox& box) +void gdata<D>::copy_from (const gdata* src, const ibbox& box) { assert (has_storage() && src->has_storage()); assert (all(box.lower()>=extent().lower() @@ -72,7 +55,7 @@ void generic_data<D>::copy_from (const generic_data* src, const ibbox& box) } else { // copy to different processor - generic_data* const tmp = make_typed(); + gdata* const tmp = make_typed(); tmp->allocate (box, src->proc()); tmp->copy_from (src, box); tmp->change_processor (proc()); @@ -85,8 +68,8 @@ void generic_data<D>::copy_from (const generic_data* src, const ibbox& box) template<int D> -void generic_data<D> -::interpolate_from (const vector<const generic_data*> srcs, +void gdata<D> +::interpolate_from (const vector<const gdata*> srcs, const vector<CCTK_REAL> times, const ibbox& box, const CCTK_REAL time, const int order_space, @@ -117,7 +100,7 @@ void generic_data<D> } else { // interpolate from other processor - generic_data* const tmp = make_typed(); + gdata* const tmp = make_typed(); tmp->allocate (box, srcs[0]->proc()); tmp->interpolate_from (srcs, times, box, time, order_space, order_time); tmp->change_processor (proc()); @@ -129,4 +112,4 @@ void generic_data<D> -template class generic_data<3>; +template class gdata<3>; 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, diff --git a/Carpet/CarpetLib/src/gf.cc b/Carpet/CarpetLib/src/gf.cc index a7af97844..157e2ba36 100644 --- a/Carpet/CarpetLib/src/gf.cc +++ b/Carpet/CarpetLib/src/gf.cc @@ -1,23 +1,4 @@ -/*************************************************************************** - gf.cc - Grid Function - data for every element of a data hierarchy - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gf.cc,v 1.9 2002/05/05 22:17:02 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/gf.cc,v 1.10 2003/01/03 15:49:36 schnetter Exp $ #include <assert.h> @@ -31,9 +12,9 @@ using namespace std; // Constructors template<class T,int D> -gf<T,D>::gf (const string name, th& t, dh<D>& d, +gf<T,D>::gf (const string name, th<D>& t, dh<D>& d, const int tmin, const int tmax, const int prolongation_order_time) - : generic_gf<D>(name, t, d, tmin, tmax, prolongation_order_time) + : ggf<D>(name, t, d, tmin, tmax, prolongation_order_time) { recompose(); } @@ -68,7 +49,8 @@ data<T,D>* gf<T,D>::operator() (int tl, int rl, int c, int ml) { // Output template<class T,int D> ostream& gf<T,D>::output (ostream& os) const { - os << "gf<T," << D << ">:\"" << name << "\"," + T Tdummy; + os << "gf<" << typestring(Tdummy) << "," << D << ">:\"" << name << "\"," << "dt=[" << tmin << ":" << tmax<< "]"; return os; } diff --git a/Carpet/CarpetLib/src/gf.hh b/Carpet/CarpetLib/src/gf.hh index 80645dd88..eb4f0454c 100644 --- a/Carpet/CarpetLib/src/gf.hh +++ b/Carpet/CarpetLib/src/gf.hh @@ -1,23 +1,4 @@ -/*************************************************************************** - gf.hh - Grid Function - data for every element of a data hierarchy - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gf.hh,v 1.6 2002/05/05 22:17:02 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/gf.hh,v 1.7 2003/01/03 15:49:36 schnetter Exp $ #ifndef GF_HH #define GF_HH @@ -43,7 +24,7 @@ using namespace std; // A real grid function template<class T,int D> -class gf: public generic_gf<D> { +class gf: public ggf<D> { // Types typedef vect<int,D> ivect; @@ -61,7 +42,7 @@ class gf: public generic_gf<D> { public: // Constructors - gf (const string name, th& t, dh<D>& d, + gf (const string name, th<D>& t, dh<D>& d, const int tmin, const int tmax, const int prolongation_order_time); // Destructors @@ -73,7 +54,7 @@ public: protected: - virtual generic_data<D>* typed_data() { return new data<T,D>; } + virtual gdata<D>* typed_data() { return new data<T,D>; } diff --git a/Carpet/CarpetLib/src/ggf.cc b/Carpet/CarpetLib/src/ggf.cc index ae733aa35..fcc9e546b 100644 --- a/Carpet/CarpetLib/src/ggf.cc +++ b/Carpet/CarpetLib/src/ggf.cc @@ -1,23 +1,4 @@ -/*************************************************************************** - ggf.cc - Generic Grid Function - grid function without type information - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/ggf.cc,v 1.19 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/ggf.cc,v 1.20 2003/01/03 15:49:36 schnetter Exp $ #include <assert.h> #include <stdlib.h> @@ -39,10 +20,12 @@ using namespace std; // Constructors template<int D> -generic_gf<D>::generic_gf (const string name, th& t, dh<D>& d, - const int tmin, const int tmax, - const int prolongation_order_time) - : dimgeneric_gf(name, t, tmin, tmax, prolongation_order_time), +ggf<D>::ggf (const string name, th<D>& t, dh<D>& d, + const int tmin, const int tmax, + const int prolongation_order_time) + : name(name), t(t), + tmin(tmin), tmax(tmax), + prolongation_order_time(prolongation_order_time), h(d.h), d(d), storage(tmax-tmin+1) { @@ -55,13 +38,13 @@ generic_gf<D>::generic_gf (const string name, th& t, dh<D>& d, // Destructors template<int D> -generic_gf<D>::~generic_gf () { +ggf<D>::~ggf () { d.remove(this); } // Comparison template<int D> -bool generic_gf<D>::operator== (const generic_gf<D>& f) const { +bool ggf<D>::operator== (const ggf<D>& f) const { return this == &f; } @@ -69,7 +52,7 @@ bool generic_gf<D>::operator== (const generic_gf<D>& f) const { // Modifiers template<int D> -void generic_gf<D>::recompose () { +void ggf<D>::recompose () { // Retain storage that might be needed fdata oldstorage = storage; @@ -159,11 +142,11 @@ void generic_gf<D>::recompose () { // Cycle the time levels by rotating the data sets template<int D> -void generic_gf<D>::cycle (int rl, int c, int ml) { +void ggf<D>::cycle (int rl, int c, int ml) { assert (rl>=0 && rl<h.reflevels()); assert (c>=0 && c<h.components(rl)); assert (ml>=0 && ml<h.mglevels(rl,c)); - generic_data<D>* tmpdata = storage[tmin-tmin][rl][c][ml]; + gdata<D>* tmpdata = storage[tmin-tmin][rl][c][ml]; for (int tl=tmin; tl<=tmax-1; ++tl) { storage[tl-tmin][rl][c][ml] = storage[tl+1-tmin][rl][c][ml]; } @@ -172,7 +155,7 @@ void generic_gf<D>::cycle (int rl, int c, int ml) { // Flip the time levels by exchanging the data sets template<int D> -void generic_gf<D>::flip (int rl, int c, int ml) { +void ggf<D>::flip (int rl, int c, int ml) { assert (rl>=0 && rl<h.reflevels()); assert (c>=0 && c<h.components(rl)); assert (ml>=0 && ml<h.mglevels(rl,c)); @@ -180,7 +163,7 @@ void generic_gf<D>::flip (int rl, int c, int ml) { const int tl1 = tmin + t; const int tl2 = tmax - t; assert (tl1 < tl2); - generic_data<D>* tmpdata = storage[tl1-tmin][rl][c][ml]; + gdata<D>* tmpdata = storage[tl1-tmin][rl][c][ml]; storage[tl1-tmin][rl][c][ml] = storage[tl2-tmin][rl][c][ml]; storage[tl2-tmin][rl][c][ml] = tmpdata; } @@ -188,7 +171,7 @@ void generic_gf<D>::flip (int rl, int c, int ml) { // Copy data from current time level to all previous levels template<int D> -void generic_gf<D>::copytoprevs (int rl, int c, int ml) { +void ggf<D>::copytoprevs (int rl, int c, int ml) { assert (rl>=0 && rl<h.reflevels()); assert (c>=0 && c<h.components(rl)); assert (ml>=0 && ml<h.mglevels(rl,c)); @@ -206,10 +189,10 @@ void generic_gf<D>::copytoprevs (int rl, int c, int ml) { // Copy a region template<int D> -void generic_gf<D>::copycat (int tl1, int rl1, int c1, int ml1, - const ibbox dh<D>::dboxes::* recv_list, - int tl2, int rl2, int ml2, - const ibbox dh<D>::dboxes::* send_list) +void ggf<D>::copycat (int tl1, int rl1, int c1, int ml1, + const ibbox dh<D>::dboxes::* recv_list, + int tl2, int rl2, int ml2, + const ibbox dh<D>::dboxes::* send_list) { assert (tl1>=tmin && tl1<=tmax); assert (rl1>=0 && rl1<h.reflevels()); @@ -230,10 +213,10 @@ void generic_gf<D>::copycat (int tl1, int rl1, int c1, int ml1, // Copy regions template<int D> -void generic_gf<D>::copycat (int tl1, int rl1, int c1, int ml1, - const iblist dh<D>::dboxes::* recv_list, - int tl2, int rl2, int ml2, - const iblist dh<D>::dboxes::* send_list) +void ggf<D>::copycat (int tl1, int rl1, int c1, int ml1, + const iblist dh<D>::dboxes::* recv_list, + int tl2, int rl2, int ml2, + const iblist dh<D>::dboxes::* send_list) { assert (tl1>=tmin && tl1<=tmax); assert (rl1>=0 && rl1<h.reflevels()); @@ -258,10 +241,10 @@ void generic_gf<D>::copycat (int tl1, int rl1, int c1, int ml1, // Copy regions template<int D> -void generic_gf<D>::copycat (int tl1, int rl1, int c1, int ml1, - const iblistvect dh<D>::dboxes::* recv_listvect, - int tl2, int rl2, int ml2, - const iblistvect dh<D>::dboxes::* send_listvect) +void ggf<D>::copycat (int tl1, int rl1, int c1, int ml1, + const iblistvect dh<D>::dboxes::* recv_listvect, + int tl2, int rl2, int ml2, + const iblistvect dh<D>::dboxes::* send_listvect) { assert (tl1>=tmin && tl1<=tmax); assert (rl1>=0 && rl1<h.reflevels()); @@ -288,11 +271,11 @@ void generic_gf<D>::copycat (int tl1, int rl1, int c1, int ml1, // Interpolate a region template<int D> -void generic_gf<D>::intercat (int tl1, int rl1, int c1, int ml1, - const ibbox dh<D>::dboxes::* recv_list, - const vector<int> tl2s, int rl2, int ml2, - const ibbox dh<D>::dboxes::* send_list, - CCTK_REAL time) +void ggf<D>::intercat (int tl1, int rl1, int c1, int ml1, + const ibbox dh<D>::dboxes::* recv_list, + const vector<int> tl2s, int rl2, int ml2, + const ibbox dh<D>::dboxes::* send_list, + CCTK_REAL time) { assert (tl1>=tmin && tl1<=tmax); assert (rl1>=0 && rl1<h.reflevels()); @@ -305,7 +288,7 @@ void generic_gf<D>::intercat (int tl1, int rl1, int c1, int ml1, const int c2=c1; assert (ml2>=0 && ml2<h.mglevels(rl2,c2)); - vector<const generic_data<D>*> gsrcs(tl2s.size()); + vector<const gdata<D>*> gsrcs(tl2s.size()); vector<CCTK_REAL> times(tl2s.size()); for (int i=0; i<(int)gsrcs.size(); ++i) { assert (rl2<(int)storage[tl2s[i]-tmin].size()); @@ -328,11 +311,11 @@ void generic_gf<D>::intercat (int tl1, int rl1, int c1, int ml1, // Interpolate regions template<int D> -void generic_gf<D>::intercat (int tl1, int rl1, int c1, int ml1, - const iblist dh<D>::dboxes::* recv_list, - const vector<int> tl2s, int rl2, int ml2, - const iblist dh<D>::dboxes::* send_list, - const CCTK_REAL time) +void ggf<D>::intercat (int tl1, int rl1, int c1, int ml1, + const iblist dh<D>::dboxes::* recv_list, + const vector<int> tl2s, int rl2, int ml2, + const iblist dh<D>::dboxes::* send_list, + const CCTK_REAL time) { assert (tl1>=tmin && tl1<=tmax); assert (rl1>=0 && rl1<h.reflevels()); @@ -345,7 +328,7 @@ void generic_gf<D>::intercat (int tl1, int rl1, int c1, int ml1, const int c2=c1; assert (ml2>=0 && ml2<h.mglevels(rl2,c2)); - vector<const generic_data<D>*> gsrcs(tl2s.size()); + vector<const gdata<D>*> gsrcs(tl2s.size()); vector<CCTK_REAL> times(tl2s.size()); for (int i=0; i<(int)gsrcs.size(); ++i) { assert (rl2<(int)storage[tl2s[i]-tmin].size()); @@ -372,11 +355,11 @@ void generic_gf<D>::intercat (int tl1, int rl1, int c1, int ml1, // Interpolate regions template<int D> -void generic_gf<D>::intercat (int tl1, int rl1, int c1, int ml1, - const iblistvect dh<D>::dboxes::* recv_listvect, - const vector<int> tl2s, int rl2, int ml2, - const iblistvect dh<D>::dboxes::* send_listvect, - const CCTK_REAL time) +void ggf<D>::intercat (int tl1, int rl1, int c1, int ml1, + const iblistvect dh<D>::dboxes::* recv_listvect, + const vector<int> tl2s, int rl2, int ml2, + const iblistvect dh<D>::dboxes::* send_listvect, + const CCTK_REAL time) { assert (tl1>=tmin && tl1<=tmax); assert (rl1>=0 && rl1<h.reflevels()); @@ -390,7 +373,7 @@ void generic_gf<D>::intercat (int tl1, int rl1, int c1, int ml1, for (int c2=0; c2<h.components(rl2); ++c2) { assert (ml2>=0 && ml2<h.mglevels(rl2,c2)); - vector<const generic_data<D>*> gsrcs(tl2s.size()); + vector<const gdata<D>*> gsrcs(tl2s.size()); vector<CCTK_REAL> times(tl2s.size()); for (int i=0; i<(int)gsrcs.size(); ++i) { assert (rl2<(int)storage[tl2s[i]-tmin].size()); @@ -420,7 +403,7 @@ void generic_gf<D>::intercat (int tl1, int rl1, int c1, int ml1, // Copy a component from the next time level template<int D> -void generic_gf<D>::copy (int tl, int rl, int c, int ml) +void ggf<D>::copy (int tl, int rl, int c, int ml) { // Copy copycat (tl ,rl,c,ml, &dh<D>::dboxes::exterior, @@ -429,7 +412,7 @@ void generic_gf<D>::copy (int tl, int rl, int c, int ml) // Synchronise the boundaries a component template<int D> -void generic_gf<D>::sync (int tl, int rl, int c, int ml) +void ggf<D>::sync (int tl, int rl, int c, int ml) { // Copy copycat (tl,rl,c,ml, &dh<D>::dboxes::recv_sync, @@ -438,8 +421,8 @@ void generic_gf<D>::sync (int tl, int rl, int c, int ml) // Prolongate the boundaries of a component template<int D> -void generic_gf<D>::ref_bnd_prolongate (int tl, int rl, int c, int ml, - CCTK_REAL time) +void ggf<D>::ref_bnd_prolongate (int tl, int rl, int c, int ml, + CCTK_REAL time) { // Interpolate assert (rl>=1); @@ -455,8 +438,8 @@ void generic_gf<D>::ref_bnd_prolongate (int tl, int rl, int c, int ml, // Restrict a multigrid level template<int D> -void generic_gf<D>::mg_restrict (int tl, int rl, int c, int ml, - CCTK_REAL time) +void ggf<D>::mg_restrict (int tl, int rl, int c, int ml, + CCTK_REAL time) { // Require same times assert (t.get_time(rl,ml) == t.get_time(rl,ml-1)); @@ -468,8 +451,8 @@ void generic_gf<D>::mg_restrict (int tl, int rl, int c, int ml, // Prolongate a multigrid level template<int D> -void generic_gf<D>::mg_prolongate (int tl, int rl, int c, int ml, - CCTK_REAL time) +void ggf<D>::mg_prolongate (int tl, int rl, int c, int ml, + CCTK_REAL time) { // Require same times assert (t.get_time(rl,ml) == t.get_time(rl,ml+1)); @@ -481,8 +464,8 @@ void generic_gf<D>::mg_prolongate (int tl, int rl, int c, int ml, // Restrict a refinement level template<int D> -void generic_gf<D>::ref_restrict (int tl, int rl, int c, int ml, - CCTK_REAL time) +void ggf<D>::ref_restrict (int tl, int rl, int c, int ml, + CCTK_REAL time) { // Require same times // SHH: removed assert and added warning @@ -498,8 +481,8 @@ void generic_gf<D>::ref_restrict (int tl, int rl, int c, int ml, // Prolongate a refinement level template<int D> -void generic_gf<D>::ref_prolongate (int tl, int rl, int c, int ml, - CCTK_REAL time) +void ggf<D>::ref_prolongate (int tl, int rl, int c, int ml, + CCTK_REAL time) { assert (rl>=1); vector<int> tl2s; @@ -514,4 +497,4 @@ void generic_gf<D>::ref_prolongate (int tl, int rl, int c, int ml, -template class generic_gf<3>; +template class ggf<3>; diff --git a/Carpet/CarpetLib/src/ggf.hh b/Carpet/CarpetLib/src/ggf.hh index 66012e469..6c467632e 100644 --- a/Carpet/CarpetLib/src/ggf.hh +++ b/Carpet/CarpetLib/src/ggf.hh @@ -1,23 +1,4 @@ -/*************************************************************************** - ggf.hh - Generic Grid Function - grid function without type information - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/ggf.hh,v 1.12 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/ggf.hh,v 1.13 2003/01/03 15:49:36 schnetter Exp $ #ifndef GGF_HH #define GGF_HH @@ -31,7 +12,6 @@ #include "cctk.h" #include "defs.hh" -#include "dggf.hh" #include "dh.hh" #include "gdata.hh" #include "gh.hh" @@ -42,17 +22,17 @@ using namespace std; // Forward declaration -template<int D> class generic_gf; +template<int D> class ggf; // Output template<int D> -ostream& operator<< (ostream& os, const generic_gf<D>& f); +ostream& operator<< (ostream& os, const ggf<D>& f); // A generic grid function without type information template<int D> -class generic_gf: public dimgeneric_gf { +class ggf { // Types @@ -62,16 +42,21 @@ class generic_gf: public dimgeneric_gf { typedef list<ibbox> iblist; typedef vector<iblist> iblistvect; - typedef generic_data<D>* tdata; // data ... - typedef vector<tdata> mdata; // ... for each multigrid level - typedef vector<mdata> cdata; // ... for each component - typedef vector<cdata> rdata; // ... for each refinement level - typedef vector<rdata> fdata; // ... for each time level + typedef gdata<D>* tdata; // data ... + typedef vector<tdata> mdata; // ... for each multigrid level + typedef vector<mdata> cdata; // ... for each component + typedef vector<cdata> rdata; // ... for each refinement level + typedef vector<rdata> fdata; // ... for each time level public: // should be readonly // Fields + string name; + th<D> &t; // time hierarchy + int tmin, tmax; // timelevels + int prolongation_order_time; // order of temporal prolongation operator + gh<D> &h; // grid hierarchy dh<D> &d; // data hierarchy @@ -81,15 +66,15 @@ protected: public: // Constructors - generic_gf (const string name, th& t, dh<D>& d, - const int tmin, const int tmax, - const int prolongation_order_time); + ggf (const string name, th<D>& t, dh<D>& d, + const int tmin, const int tmax, + const int prolongation_order_time); // Destructors - virtual ~generic_gf (); + virtual ~ggf (); // Comparison - bool operator== (const generic_gf<D>& f) const; + bool operator== (const ggf<D>& f) const; @@ -110,7 +95,7 @@ public: protected: - virtual generic_data<D>* typed_data() = 0; + virtual gdata<D>* typed_data() = 0; @@ -191,10 +176,9 @@ public: // Access to the data - virtual const generic_data<D>* operator() (int tl, int rl, int c, int ml) - const = 0; + virtual const gdata<D>* operator() (int tl, int rl, int c, int ml) const = 0; - virtual generic_data<D>* operator() (int tl, int rl, int c, int ml) = 0; + virtual gdata<D>* operator() (int tl, int rl, int c, int ml) = 0; @@ -205,7 +189,7 @@ public: template<int D> -inline ostream& operator<< (ostream& os, const generic_gf<D>& f) { +inline ostream& operator<< (ostream& os, const ggf<D>& f) { return f.output(os); } diff --git a/Carpet/CarpetLib/src/gh.cc b/Carpet/CarpetLib/src/gh.cc index 54b591611..76f8ea7e1 100644 --- a/Carpet/CarpetLib/src/gh.cc +++ b/Carpet/CarpetLib/src/gh.cc @@ -1,24 +1,4 @@ -/*************************************************************************** - gh.cc - Grid Hierarchy - bounding boxes for each multigrid level of each - component of each refinement level - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gh.cc,v 1.17 2002/10/12 13:02:25 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/gh.cc,v 1.18 2003/01/03 15:49:36 schnetter Exp $ #include <assert.h> #include <stdlib.h> @@ -39,7 +19,8 @@ template<int D> gh<D>::gh (const int reffact, const centering refcent, const int mgfact, const centering mgcent, const ibbox& baseextent) - : dimgeneric_gh (reffact, refcent, mgfact, mgcent), + : reffact(reffact), refcent(refcent), + mgfact(mgfact), mgcent(mgcent), baseextent(baseextent) { } @@ -142,7 +123,7 @@ void gh<D>::recompose (const rexts& exts, const rbnds& outer_bounds, // Recompose the other hierarchies - for (typename list<th*>::iterator t=ths.begin(); t!=ths.end(); ++t) { + for (typename list<th<D>*>::iterator t=ths.begin(); t!=ths.end(); ++t) { (*t)->recompose(); } @@ -228,6 +209,19 @@ int gh<D>::local_components (const int rl) const { +// Time hierarchy management +template<int D> +void gh<D>::add (th<D>* t) { + ths.push_back(t); +} + +template<int D> +void gh<D>::remove (th<D>* t) { + ths.remove(t); +} + + + // Data hierarchy management template<int D> void gh<D>::add (dh<D>* d) { diff --git a/Carpet/CarpetLib/src/gh.hh b/Carpet/CarpetLib/src/gh.hh index eee1721fa..3a2fb649c 100644 --- a/Carpet/CarpetLib/src/gh.hh +++ b/Carpet/CarpetLib/src/gh.hh @@ -1,24 +1,4 @@ -/*************************************************************************** - gh.hh - Grid Hierarchy - bounding boxes for each multigrid level of each - component of each refinement level - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gh.hh,v 1.11 2002/10/12 13:02:25 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/gh.hh,v 1.12 2003/01/03 15:49:36 schnetter Exp $ #ifndef GH_HH #define GH_HH @@ -31,7 +11,6 @@ #include "bbox.hh" #include "defs.hh" -#include "dggh.hh" #include "dist.hh" #include "vect.hh" @@ -41,14 +20,19 @@ using namespace std; // Forward declaration template<int D> class dh; +template<int D> class th; template<int D> class gh; +// Output +template<int D> +ostream& operator<< (ostream& os, const gh<D>& h); + // A refinement hierarchy, where higher levels are finer than the base // level. The extents do not include ghost zones. template<int D> -class gh: public dimgeneric_gh { +class gh { public: @@ -70,6 +54,15 @@ public: public: // should be readonly + // Fields + int reffact; // refinement factor + centering refcent; // vertex or cell centered + + int mgfact; // default multigrid factor + centering mgcent; // default (vertex or cell centered) + + list<th<D>*> ths; // list of all time hierarchies + ibbox baseextent; // bounds (inclusive) of base level vector<vector<ibbox> > bases; // [rl][ml] @@ -138,6 +131,10 @@ public: int local_components (const int rl) const; + // Time hierarchy management + void add (th<D>* t); + void remove (th<D>* t); + // Data hierarchy management void add (dh<D>* d); void remove (dh<D>* d); @@ -148,4 +145,12 @@ public: +template<int D> +inline ostream& operator<< (ostream& os, const gh<D>& h) { + h.output(os); + return os; +} + + + #endif // GH_HH diff --git a/Carpet/CarpetLib/src/instantiate b/Carpet/CarpetLib/src/instantiate index 2bc9e7049..c3d24d53f 100644 --- a/Carpet/CarpetLib/src/instantiate +++ b/Carpet/CarpetLib/src/instantiate @@ -1,7 +1,7 @@ // Instantiate templates for all available types -*-C++-*- // (C) 2001 Erik Schnetter <schnetter@uni-tuebingen.de> -// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/instantiate,v 1.4 2002/01/04 18:21:58 schnetter Exp $ +// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/instantiate,v 1.5 2003/01/03 15:49:36 schnetter Exp $ // Usage: // Define the macro INSTANTIATE(T) to instantiate for the type T, @@ -28,9 +28,11 @@ #endif #ifdef CARPET_ALL_INT +# undef CARPET_INT1 # undef CARPET_INT2 # undef CARPET_INT4 # undef CARPET_INT8 +# define CARPET_INT1 # define CARPET_INT2 # define CARPET_INT4 # define CARPET_INT8 @@ -63,6 +65,10 @@ #endif #ifdef CARPET_INT +# ifdef CCTK_INTEGER_PRECISION_1 +# undef CARPET_INT1 +# define CARPET_INT1 +# endif # ifdef CCTK_INTEGER_PRECISION_2 # undef CARPET_INT2 # define CARPET_INT2 @@ -120,6 +126,11 @@ INSTANTIATE(CCTK_BYTE) #endif +#ifdef CARPET_INT1 +# ifdef CCTK_INT1 +INSTANTIATE(CCTK_INT1) +# endif +#endif #ifdef CARPET_INT2 # ifdef CCTK_INT2 INSTANTIATE(CCTK_INT2) diff --git a/Carpet/CarpetLib/src/make.code.defn b/Carpet/CarpetLib/src/make.code.defn index b4f538fc2..c6e1b111e 100644 --- a/Carpet/CarpetLib/src/make.code.defn +++ b/Carpet/CarpetLib/src/make.code.defn @@ -1,15 +1,11 @@ # Main make.code.defn file for thorn CarpetLib -*-Makefile-*- -# $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/make.code.defn,v 1.6 2001/07/02 13:22:14 schnetter Exp $ +# $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/make.code.defn,v 1.7 2003/01/03 15:49:36 schnetter Exp $ # Source files in this directory SRCS = bbox.cc \ bboxset.cc \ data.cc \ defs.cc \ - dgdata.cc \ - dgdh.cc \ - dggf.cc \ - dggh.cc \ dh.cc \ dist.cc \ gdata.cc \ @@ -26,7 +22,6 @@ SRCS = bbox.cc \ prolongate_3d_real8_3tl.F77 \ prolongate_3d_real8_3tl_o3.F77 \ restrict_3d_real8.F77 -# Note: skipping io.cc # Subdirectories containing source files SUBDIRS = diff --git a/Carpet/CarpetLib/src/th.cc b/Carpet/CarpetLib/src/th.cc index b9a42c4c4..f03bbc7c8 100644 --- a/Carpet/CarpetLib/src/th.cc +++ b/Carpet/CarpetLib/src/th.cc @@ -1,23 +1,4 @@ -/*************************************************************************** - th.cc - Time Hierarchy - information about time levels - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/th.cc,v 1.9 2002/09/25 19:54:08 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/th.cc,v 1.10 2003/01/03 15:49:36 schnetter Exp $ #include <assert.h> #include <math.h> @@ -27,7 +8,7 @@ #include "cctk.h" #include "defs.hh" -#include "dggh.hh" +#include "gh.hh" #include "th.hh" @@ -36,18 +17,21 @@ using namespace std; // Constructors -th::th (dimgeneric_gh* h, const CCTK_REAL basedelta) +template<int D> +th<D>::th (gh<D>* h, const CCTK_REAL basedelta) : h(h), delta(basedelta) { h->add(this); } // Destructors -th::~th () { +template<int D> +th<D>::~th () { h->remove(this); } // Modifiers -void th::recompose () { +template<int D> +void th<D>::recompose () { times.resize(h->reflevels()); deltas.resize(h->reflevels()); for (int rl=0; rl<h->reflevels(); ++rl) { @@ -78,8 +62,9 @@ void th::recompose () { // Output -void th::output (ostream& os) const { - os << "th:" +template<int D> +void th<D>::output (ostream& os) const { + os << "th<" << D << ">:" << "times={"; for (int rl=0; rl<h->reflevels(); ++rl) { for (int ml=0; ml<h->mglevels(rl,0); ++ml) { @@ -90,3 +75,7 @@ void th::output (ostream& os) const { } os << "}"; } + + + +template class th<3>; diff --git a/Carpet/CarpetLib/src/th.hh b/Carpet/CarpetLib/src/th.hh index 61d489d6a..85d028ac3 100644 --- a/Carpet/CarpetLib/src/th.hh +++ b/Carpet/CarpetLib/src/th.hh @@ -1,23 +1,4 @@ -/*************************************************************************** - th.hh - Time Hierarchy - information about time levels - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/th.hh,v 1.8 2002/09/25 15:49:17 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/th.hh,v 1.9 2003/01/03 15:49:36 schnetter Exp $ #ifndef TH_HH #define TH_HH @@ -30,27 +11,29 @@ #include "cctk.h" #include "defs.hh" -#include "dggh.hh" +#include "gh.hh" using namespace std; // Forward declaration -class th; +template<int D> class th; // Output -ostream& operator<< (ostream& os, const th& t); +template<int D> +ostream& operator<< (ostream& os, const th<D>& t); // The time hierarchy (information about the current time) +template<int D> class th { public: // should be readonly // Fields - dimgeneric_gh *h; // hierarchy + gh<D> *h; // hierarchy private: @@ -61,7 +44,7 @@ private: public: // Constructors - th (dimgeneric_gh* h, const CCTK_REAL basedelta); + th (gh<D>* h, const CCTK_REAL basedelta); // Destructors ~th (); @@ -110,7 +93,8 @@ public: -inline ostream& operator<< (ostream& os, const th& t) { +template<int D> +inline ostream& operator<< (ostream& os, const th<D>& t) { t.output(os); return os; } diff --git a/Carpet/CarpetLib/src/vect.cc b/Carpet/CarpetLib/src/vect.cc index 9fea98e59..608b065c9 100644 --- a/Carpet/CarpetLib/src/vect.cc +++ b/Carpet/CarpetLib/src/vect.cc @@ -1,22 +1,4 @@ -/*************************************************************************** - vect.cc - Small inline vectors - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/vect.cc,v 1.8 2002/05/05 22:17:03 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/vect.cc,v 1.9 2003/01/03 15:49:36 schnetter Exp $ #include <assert.h> diff --git a/Carpet/CarpetLib/src/vect.hh b/Carpet/CarpetLib/src/vect.hh index d08f93b2a..f41971ae5 100644 --- a/Carpet/CarpetLib/src/vect.hh +++ b/Carpet/CarpetLib/src/vect.hh @@ -1,22 +1,4 @@ -/*************************************************************************** - vect.hh - Small inline vectors - ------------------- - begin : Sun Jun 11 2000 - copyright : (C) 2000 by Erik Schnetter - email : schnetter@astro.psu.edu - - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/vect.hh,v 1.12 2002/12/12 14:36:44 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/vect.hh,v 1.13 2003/01/03 15:49:36 schnetter Exp $ #ifndef VECT_HH #define VECT_HH diff --git a/Carpet/CarpetSlab/src/slab.cc b/Carpet/CarpetSlab/src/slab.cc index 3f3983e2f..f11cfa4f0 100644 --- a/Carpet/CarpetSlab/src/slab.cc +++ b/Carpet/CarpetSlab/src/slab.cc @@ -1,4 +1,4 @@ -// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetSlab/src/slab.cc,v 1.1 2002/10/24 10:53:48 schnetter Exp $ +// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetSlab/src/slab.cc,v 1.2 2003/01/03 15:49:36 schnetter Exp $ #include <alloca.h> #include <assert.h> @@ -20,7 +20,7 @@ #include "slab.hh" extern "C" { - static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetSlab/src/slab.cc,v 1.1 2002/10/24 10:53:48 schnetter Exp $"; + static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetSlab/src/slab.cc,v 1.2 2003/01/03 15:49:36 schnetter Exp $"; CCTK_FILEVERSION(Carpet_CarpetSlab_slab_cc); } @@ -111,7 +111,7 @@ namespace CarpetSlab { // Get insider information about variable const gh<dim>* myhh; const dh<dim>* mydd; - const generic_gf<dim>* myff; + const ggf<dim>* myff; assert (group < (int)arrdata.size()); myhh = arrdata[group].hh; assert (myhh); @@ -147,7 +147,7 @@ namespace CarpetSlab { component = 0; // Get sample data - const generic_data<dim>* mydata; + const gdata<dim>* mydata; mydata = (*myff)(tl, reflevel, component, mglevel); // Stride of data in memory @@ -177,7 +177,7 @@ namespace CarpetSlab { // Create collector data object void* myhdata = rank==collect_proc ? hdata : 0; - generic_data<dim>* const alldata = mydata->make_typed(); + gdata<dim>* const alldata = mydata->make_typed(); alldata->allocate (hextent, collect_proc, myhdata); // Done with the temporary stuff @@ -216,7 +216,7 @@ namespace CarpetSlab { if (proc != collect_proc) { void* myhdata = rank==proc ? hdata : 0; - generic_data<dim>* const tmpdata = mydata->make_typed(); + gdata<dim>* const tmpdata = mydata->make_typed(); tmpdata->allocate (alldata->extent(), proc, myhdata); tmpdata->copy_from (alldata, alldata->extent()); delete tmpdata; diff --git a/CarpetAttic/CarpetIOFlexIO/src/ioflexio.cc b/CarpetAttic/CarpetIOFlexIO/src/ioflexio.cc index 176e82f11..ed9392624 100644 --- a/CarpetAttic/CarpetIOFlexIO/src/ioflexio.cc +++ b/CarpetAttic/CarpetIOFlexIO/src/ioflexio.cc @@ -34,7 +34,7 @@ #include "ioflexio.hh" extern "C" { - static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIO/src/ioflexio.cc,v 1.20 2002/10/24 12:00:32 schnetter Exp $"; + static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIO/src/ioflexio.cc,v 1.21 2003/01/03 15:49:36 schnetter Exp $"; CCTK_FILEVERSION(Carpet_CarpetIOFlexIO_ioflexio_cc); } @@ -256,12 +256,12 @@ namespace CarpetIOFlexIO { // Traverse all components on this refinement and multigrid level BEGIN_COMPONENT_LOOP(cgh) { - const generic_gf<dim>* ff = 0; + const ggf<dim>* ff = 0; assert (var < (int)arrdata[group].data.size()); - ff = (generic_gf<dim>*)arrdata[group].data[var]; + ff = (ggf<dim>*)arrdata[group].data[var]; - const generic_data<dim>* const data + const gdata<dim>* const data = (*ff) (tl, reflevel, component, mglevel); // Make temporary copy on processor 0 @@ -284,7 +284,7 @@ namespace CarpetIOFlexIO { ext = bbox<int,dim>(lo,hi,str); - generic_data<dim>* const tmp = data->make_typed (); + gdata<dim>* const tmp = data->make_typed (); tmp->allocate (ext, 0); tmp->copy_from (data, ext); @@ -565,12 +565,12 @@ namespace CarpetIOFlexIO { // level BEGIN_COMPONENT_LOOP(cgh) { - generic_gf<dim>* ff = 0; + ggf<dim>* ff = 0; assert (var < (int)arrdata[group].data.size()); - ff = (generic_gf<dim>*)arrdata[group].data[var]; + ff = (ggf<dim>*)arrdata[group].data[var]; - generic_data<dim>* const data + gdata<dim>* const data = (*ff) (tl, reflevel, component, mglevel); // Create temporary data storage on processor 0 @@ -579,7 +579,7 @@ namespace CarpetIOFlexIO { const vect<int,dim> ub = lb + (vect<int,dim>(amr_dims) - 1) * str; const bbox<int,dim> ext(lb,ub,str); - generic_data<dim>* const tmp = data->make_typed (); + gdata<dim>* const tmp = data->make_typed (); if (CCTK_MyProc(cgh)==0) { tmp->allocate (ext, 0, amrgrid->data); |