diff options
author | eschnett <> | 2001-03-01 12:40:00 +0000 |
---|---|---|
committer | eschnett <> | 2001-03-01 12:40:00 +0000 |
commit | ece47455bad491c45b3136362e9239f505de23b9 (patch) | |
tree | 0e121ebd44c2fbb7711943fcd8804e85626daca3 /Carpet/CarpetLib/src/gf.cc | |
parent | 310f0ea48d18866b773136aed11200b6eda6378b (diff) |
Initial revision
darcs-hash:20010301124010-f6438-fca5ed1e25f84efd816aa0d13fc23b58add7195d.gz
Diffstat (limited to 'Carpet/CarpetLib/src/gf.cc')
-rw-r--r-- | Carpet/CarpetLib/src/gf.cc | 95 |
1 files changed, 46 insertions, 49 deletions
diff --git a/Carpet/CarpetLib/src/gf.cc b/Carpet/CarpetLib/src/gf.cc index 69537d537..dcac9fccd 100644 --- a/Carpet/CarpetLib/src/gf.cc +++ b/Carpet/CarpetLib/src/gf.cc @@ -1,47 +1,41 @@ -// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gf.cc,v 1.21 2004/08/07 19:47:11 schnetter Exp $ +/*************************************************************************** + 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 -#include <assert.h> + $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gf.cc,v 1.1 2001/03/01 13:40:10 eschnett Exp $ -#include "cctk.h" + ***************************************************************************/ -#include "defs.hh" +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ -#include "gf.hh" +#include <cassert> -using namespace std; +#include "defs.hh" + +#if !defined(TMPL_IMPLICIT) || !defined(GF_HH) +# include "gf.hh" +#endif // Constructors template<class T,int D> -gf<T,D>::gf (const int varindex, const operator_type transport_operator, - th<D>& t, dh<D>& d, - const int tmin, const int tmax, const int prolongation_order_time, - const int vectorlength, const int vectorindex, - gf* const vectorleader) - : ggf<D>(varindex, transport_operator, - t, d, tmin, tmax, prolongation_order_time, - vectorlength, vectorindex, vectorleader) +gf<T,D>::gf (const string name, th<D>& t, dh<D>& d, + const int tmin, const int tmax) + : generic_gf<D>(name, t, d, tmin, tmax) { - // this->recompose (); - this->recompose_crop (); - for (int rl=0; rl<this->h.reflevels(); ++rl) { - this->recompose_allocate (rl); -#if 0 - for (comm_state<D> state; !state.done(); state.step()) { - this->recompose_fill (state, rl, false); - } -#endif - this->recompose_free (rl); -#if 0 - for (comm_state<D> state; !state.done(); state.step()) { - this->recompose_bnd_prolongate (state, rl, false); - } - for (comm_state<D> state; !state.done(); state.step()) { - this->recompose_sync (state, rl, false); - } -#endif - } // for rl + recompose(); } // Destructors @@ -53,39 +47,42 @@ gf<T,D>::~gf () { } // Access to the data template<class T,int D> const data<T,D>* gf<T,D>::operator() (int tl, int rl, int c, int ml) const { - assert (tl>=this->tmin && tl<=this->tmax); - assert (rl>=0 && rl<this->h.reflevels()); - assert (c>=0 && c<this->h.components(rl)); - assert (ml>=0 && ml<this->h.mglevels(rl,c)); - return (const data<T,D>*)this->storage.at(tl-this->tmin).at(rl).at(c).at(ml); + assert (tl>=tmin && tl<=tmax); + assert (rl>=0 && rl<h.reflevels()); + assert (c>=0 && c<h.components(rl)); + assert (ml>=0 && ml<h.mglevels(rl,c)); + return (const data<T,D>*)storage[tl-tmin][rl][c][ml]; } template<class T,int D> data<T,D>* gf<T,D>::operator() (int tl, int rl, int c, int ml) { - assert (tl>=this->tmin && tl<=this->tmax); - assert (rl>=0 && rl<this->h.reflevels()); - assert (c>=0 && c<this->h.components(rl)); - assert (ml>=0 && ml<this->h.mglevels(rl,c)); - return (data<T,D>*)this->storage.at(tl-this->tmin).at(rl).at(c).at(ml); + assert (tl>=tmin && tl<=tmax); + assert (rl>=0 && rl<h.reflevels()); + assert (c>=0 && c<h.components(rl)); + assert (ml>=0 && ml<h.mglevels(rl,c)); + return (data<T,D>*)storage[tl-tmin][rl][c][ml]; } // Output template<class T,int D> -ostream& gf<T,D>::output (ostream& os) const { - T Tdummy; - os << "gf<" << typestring(Tdummy) << "," << D << ">:" - << this->varindex << "[" << CCTK_VarName(this->varindex) << "]," - << "dt=[" << this->tmin << ":" << this->tmax<< "]"; +ostream& gf<T,D>::out (ostream& os) const { + os << "gf<" STR(T) "," << D << ">:\"" << name << "\"," + << "dt=[" << tmin << ":" << tmax<< "]"; return os; } +#if defined(TMPL_EXPLICIT) + #define INSTANTIATE(T) \ +template class gf<T,1>; \ +template class gf<T,2>; \ template class gf<T,3>; #include "instantiate" - #undef INSTANTIATE + +#endif |