aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/operator_prototypes.hh
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2007-01-12 20:58:00 +0000
committerErik Schnetter <schnetter@cct.lsu.edu>2007-01-12 20:58:00 +0000
commitc23315efb5b4fea80c92f747173e47a7d29d644d (patch)
treed56de98cca60845ae083fe3d397843dda6102160 /Carpet/CarpetLib/src/operator_prototypes.hh
parent3c4993dd3e36426d62cbf8e574cba9ec6cf2ec89 (diff)
CarpetLib: Reorganise prolongation and restriction operators
Reorganise prolongation and restriction operators. This is a major implementation change. Most operators are now written as C++ templates instead of as Fortran 77 code. This simplifies the code, since C++ routines can be called more easily, and they also have access to CarpetLib's high-level data structures. Previously, the operators combined temporal and spatial interpolation. Now, time interpolation and space interpolation are handled separately. This may be less efficient, but simplifies the code significantly, since there are now N+M instead of N*M routines, for N time interpolation and M space interpolation methods. Remove the minmod prolongation operator, which was previously disabled. Add support for cell centering, using a method described by Simon Hern, and suggested for Carpet by Ian Hawke. darcs-hash:20070112205812-dae7b-5329795aa698e7bbc3671b1504134885dd830238.gz
Diffstat (limited to 'Carpet/CarpetLib/src/operator_prototypes.hh')
-rw-r--r--Carpet/CarpetLib/src/operator_prototypes.hh171
1 files changed, 171 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/operator_prototypes.hh b/Carpet/CarpetLib/src/operator_prototypes.hh
new file mode 100644
index 000000000..05079ff22
--- /dev/null
+++ b/Carpet/CarpetLib/src/operator_prototypes.hh
@@ -0,0 +1,171 @@
+#ifndef OPERATOR_PROTOTYPES
+#define OPERATOR_PROTOTYPES
+
+#include <cstdlib>
+
+#include <cctk.h>
+
+#include <vect.hh>
+#include <bbox.hh>
+
+
+
+namespace CarpetLib {
+
+ using namespace std;
+
+
+
+ static inline
+ size_t
+ index3 (size_t const i, size_t const j, size_t const k,
+ size_t const exti, size_t const extj, size_t const extk)
+ {
+#ifndef CARPET_OPTIMISE
+ assert (static_cast <ptrdiff_t> (i) >= 0 and i < exti);
+ assert (static_cast <ptrdiff_t> (j) >= 0 and j < extj);
+ assert (static_cast <ptrdiff_t> (k) >= 0 and k < extk);
+#endif
+
+ return i + exti * (j + extj * k);
+ }
+
+
+
+ static int const dim3 = 3;
+
+ typedef vect <bool, dim3> bvect3;
+ typedef vect <int, dim3> ivect3;
+ typedef bbox <int, dim3> ibbox3;
+
+ static int const reffact2 = 2;
+
+
+
+ template <typename T>
+ void
+ copy_3d (T const * restrict const src,
+ ivect3 const & srcext,
+ T * restrict const dst,
+ ivect3 const & dstext,
+ ibbox3 const & srcbbox,
+ ibbox3 const & dstbbox,
+ ibbox3 const & regbbox);
+
+
+
+ template <typename T>
+ void
+ prolongate_3d_o1_rf2 (T const * restrict const src,
+ ivect3 const & srcext,
+ T * restrict const dst,
+ ivect3 const & dstext,
+ ibbox3 const & srcbbox,
+ ibbox3 const & dstbbox,
+ ibbox3 const & regbbox);
+
+ template <typename T>
+ void
+ prolongate_3d_o3_rf2 (T const * restrict const src,
+ ivect3 const & srcext,
+ T * restrict const dst,
+ ivect3 const & dstext,
+ ibbox3 const & srcbbox,
+ ibbox3 const & dstbbox,
+ ibbox3 const & regbbox);
+
+ template <typename T>
+ void
+ prolongate_3d_o5_rf2 (T const * restrict const src,
+ ivect3 const & srcext,
+ T * restrict const dst,
+ ivect3 const & dstext,
+ ibbox3 const & srcbbox,
+ ibbox3 const & dstbbox,
+ ibbox3 const & regbbox);
+
+
+
+ template <typename T>
+ void
+ restrict_3d_rf2 (T const * restrict const src,
+ ivect3 const & srcext,
+ T * restrict const dst,
+ ivect3 const & dstext,
+ ibbox3 const & srcbbox,
+ ibbox3 const & dstbbox,
+ ibbox3 const & regbbox);
+
+
+
+ template <typename T>
+ void
+ interpolate_3d_2tl (T const * restrict const src1,
+ CCTK_REAL const t1,
+ T const * restrict const src2,
+ CCTK_REAL const t2,
+ ivect3 const & srcext,
+ T * restrict const dst,
+ CCTK_REAL const t,
+ ivect3 const & dstext,
+ ibbox3 const & srcbbox,
+ ibbox3 const & dstbbox,
+ ibbox3 const & regbbox);
+
+ template <typename T>
+ void
+ interpolate_3d_3tl (T const * restrict const src1,
+ CCTK_REAL const t1,
+ T const * restrict const src2,
+ CCTK_REAL const t2,
+ T const * restrict const src3,
+ CCTK_REAL const t3,
+ ivect3 const & srcext,
+ T * restrict const dst,
+ CCTK_REAL const t,
+ ivect3 const & dstext,
+ ibbox3 const & srcbbox,
+ ibbox3 const & dstbbox,
+ ibbox3 const & regbbox);
+
+
+
+ template <typename T>
+ void
+ prolongate_3d_cc_rf2_std2prim (T const * restrict const src,
+ ivect3 const & srcext,
+ T * restrict const dst,
+ ivect3 const & dstext,
+ ibbox3 const & srcbbox,
+ ibbox3 const & dstbbox,
+ ibbox3 const & regbbox);
+
+ template <typename T>
+ void
+ prolongate_3d_cc_rf2_prim2std (T const * restrict const src,
+ ivect3 const & srcext,
+ T * restrict const dst,
+ ivect3 const & dstext,
+ ibbox3 const & srcbbox,
+ ibbox3 const & dstbbox,
+ ibbox3 const & regbbox);
+
+
+
+ template <typename T>
+ void
+ restrict_3d_cc_rf2 (T const * restrict const src,
+ ivect3 const & srcext,
+ T * restrict const dst,
+ ivect3 const & dstext,
+ ibbox3 const & srcbbox,
+ ibbox3 const & dstbbox,
+ ibbox3 const & regbbox);
+
+
+
+} // namespace CarpetLib
+
+
+
+#endif // #ifndef OPERATOR_PROTOTYPES