aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2001-06-15 15:53:09 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2001-06-15 15:53:09 +0000
commit31c4622d97f90cc8de2bbc49af1db22c5cd5708a (patch)
tree0fdb760b0a506dbdf2c4cceb3666c466b58e4967 /src
parent9221cc246d8e5908691672d182e216e06ce99e9f (diff)
s/fp/fpt/
other cleanups and conversions to new C++ style git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@26 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src')
-rw-r--r--src/jtutil/array.hh87
1 files changed, 44 insertions, 43 deletions
diff --git a/src/jtutil/array.hh b/src/jtutil/array.hh
index 0e678a5..7bdddf1 100644
--- a/src/jtutil/array.hh
+++ b/src/jtutil/array.hh
@@ -10,7 +10,8 @@
//
// prerequisites:
// <assert.h>
-// <jt/stdc.h>
+// "jt/stdc.h"
+// "jt/util++.h" // jtutil::how_many_in_range()
//
//
@@ -43,26 +44,26 @@
//*****************************************************************************
-template <class fp>
+template <class fpt>
class array1d
{
public:
// array info
int min_i() const { return min_i_; }
int max_i() const { return max_i_; }
- int N_i() const { return HOW_MANY_IN_RANGE(min_i_, max_i_); }
+ int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
bool is_valid_subscript(int i) const { return is_valid_i(i); }
// normal-use access functions
// ... rvalue
- fp operator()(int i) const
+ fpt operator()(int i) const
{
assert( is_valid_subscript(i) );
return array_[i - min_i_];
}
// ... lvalue
- fp& operator()(int i)
+ fpt& operator()(int i)
{
assert( is_valid_subscript(i) );
return array_[i - min_i_];
@@ -71,10 +72,10 @@ public:
// get access to internal 0-origin 1D storage array
// (low-level, dangerous, use with caution!)
int N_array() const { return N_i(); }
- fp *restrict get_array() const { return array_; }
+ fpt* get_array() const { return array_; }
// constructor, destructor
- // newly-constructed array elements are initialized to fp(0)
+ // newly-constructed array elements are initialized to fpt(0)
array1d(int min_i_in, int max_i_in);
~array1d();
@@ -82,14 +83,14 @@ private:
// we forbid copying and passing by value
// by declaring the copy constructor and assignment operator
// private, but never defining them
- array1d(const array1d<fp> &rhs);
- array1d<fp>& operator=(const array1d<fp>& rhs);
+ array1d(const array1d<fpt>& rhs);
+ array1d<fpt>& operator=(const array1d<fpt>& rhs);
private:
// note we declare the array pointer first in the class
// ==> it's probably at 0 offset
// ==> we may get slightly faster array access
- fp *restrict array_; // --> new-allocated 1D storage array
+ fpt* array_; // --> new-allocated 1D storage array
// min/max array bounds
const int min_i_, max_i_;
@@ -97,7 +98,7 @@ private:
//*****************************************************************************
-template <class fp>
+template <class fpt>
class array2d
{
public:
@@ -106,8 +107,8 @@ public:
int max_i() const { return max_i_; }
int min_j() const { return min_j_; }
int max_j() const { return max_j_; }
- int N_i() const { return HOW_MANY_IN_RANGE(min_i_, max_i_); }
- int N_j() const { return HOW_MANY_IN_RANGE(min_j_, max_j_); }
+ int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
+ int N_j() const { return jtutil::how_many_in_range(min_j_, max_j_); }
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
bool is_valid_j(int j) const { return (j >= min_j_) && (j <= max_j_); }
bool is_valid_subscript(int i, int j)
@@ -135,19 +136,19 @@ public:
// normal-use access functions
// ... rvalue
- fp operator()(int i, int j) const
+ fpt operator()(int i, int j) const
{ return array_[ subscript(i,j) ]; }
// ... lvalue
- fp& operator()(int i, int j)
+ fpt& operator()(int i, int j)
{ return array_[ subscript(i,j) ]; }
// get access to internal 0-origin 1D storage array
// (low-level, dangerous, use with caution!)
int N_array() const { return N_array_; }
- fp *restrict get_array() const { return array_; }
+ fpt* get_array() const { return array_; }
// constructor, destructor
- // newly-constructed array elements are initialized to fp(0)
+ // newly-constructed array elements are initialized to fpt(0)
array2d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in);
~array2d();
@@ -156,14 +157,14 @@ private:
// we forbid copying and passing by value
// by declaring the copy constructor and assignment operator
// private, but never defining them
- array2d(const array2d<fp> &rhs);
- array2d<fp>& operator=(const array2d<fp>& rhs);
+ array2d(const array2d<fpt>& rhs);
+ array2d<fpt>& operator=(const array2d<fpt>& rhs);
private:
// note we declare the array pointer first in the class
// ==> it's probably at 0 offset
// ==> we may get slightly faster array access
- fp *restrict array_; // --> new-allocated 1D storage array
+ fpt* array_; // --> new-allocated 1D storage array
int N_array_;
// subscripting info
@@ -176,7 +177,7 @@ private:
//*****************************************************************************
-template <class fp>
+template <class fpt>
class array3d
{
public:
@@ -187,9 +188,9 @@ public:
int max_j() const { return max_j_; }
int min_k() const { return min_k_; }
int max_k() const { return max_k_; }
- int N_i() const { return HOW_MANY_IN_RANGE(min_i_, max_i_); }
- int N_j() const { return HOW_MANY_IN_RANGE(min_j_, max_j_); }
- int N_k() const { return HOW_MANY_IN_RANGE(min_k_, max_k_); }
+ int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
+ int N_j() const { return jtutil::how_many_in_range(min_j_, max_j_); }
+ int N_k() const { return jtutil::how_many_in_range(min_k_, max_k_); }
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
bool is_valid_j(int j) const { return (j >= min_j_) && (j <= max_j_); }
bool is_valid_k(int k) const { return (k >= min_k_) && (k <= max_k_); }
@@ -219,19 +220,19 @@ public:
// normal-use access functions
// ... rvalue
- fp operator()(int i, int j, int k) const
+ fpt operator()(int i, int j, int k) const
{ return array_[ subscript(i,j,k) ]; }
// ... lvalue
- fp& operator()(int i, int j, int k)
+ fpt& operator()(int i, int j, int k)
{ return array_[ subscript(i,j,k) ]; }
// get access to internal 0-origin 1D storage array
// (low-level, dangerous, use with caution!)
int N_array() const { return N_array_; }
- fp *restrict get_array() const { return array_; }
+ fpt* get_array() const { return array_; }
// constructor, destructor
- // newly-constructed array elements are initialized to fp(0)
+ // newly-constructed array elements are initialized to fpt(0)
array3d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
int min_k_in, int max_k_in);
@@ -241,14 +242,14 @@ private:
// we forbid copying and passing by value
// by declaring the copy constructor and assignment operator
// private, but never defining them
- array3d(const array3d<fp> &rhs);
- array3d<fp>& operator=(const array3d<fp>& rhs);
+ array3d(const array3d<fpt>& rhs);
+ array3d<fpt>& operator=(const array3d<fpt>& rhs);
private:
// note we declare the array pointer first in the class
// ==> it's probably at 0 offset
// ==> we may get slightly faster array access
- fp *restrict array_; // --> new-allocated 1D storage array
+ fpt* array_; // --> new-allocated 1D storage array
int N_array_;
// subscripting info
@@ -262,7 +263,7 @@ private:
//*****************************************************************************
-template <class fp>
+template <class fpt>
class array4d
{
public:
@@ -275,10 +276,10 @@ public:
int max_k() const { return max_k_; }
int min_l() const { return min_l_; }
int max_l() const { return max_l_; }
- int N_i() const { return HOW_MANY_IN_RANGE(min_i_, max_i_); }
- int N_j() const { return HOW_MANY_IN_RANGE(min_j_, max_j_); }
- int N_k() const { return HOW_MANY_IN_RANGE(min_k_, max_k_); }
- int N_l() const { return HOW_MANY_IN_RANGE(min_l_, max_l_); }
+ int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
+ int N_j() const { return jtutil::how_many_in_range(min_j_, max_j_); }
+ int N_k() const { return jtutil::how_many_in_range(min_k_, max_k_); }
+ int N_l() const { return jtutil::how_many_in_range(min_l_, max_l_); }
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
bool is_valid_j(int j) const { return (j >= min_j_) && (j <= max_j_); }
bool is_valid_k(int k) const { return (k >= min_k_) && (k <= max_k_); }
@@ -312,19 +313,19 @@ public:
// normal-use access functions
// ... rvalue
- fp operator()(int i, int j, int k, int l) const
+ fpt operator()(int i, int j, int k, int l) const
{ return array_[ subscript(i,j,k,l) ]; }
// ... lvalue
- fp& operator()(int i, int j, int k, int l)
+ fpt& operator()(int i, int j, int k, int l)
{ return array_[ subscript(i,j,k,l) ]; }
// get access to internal 0-origin 1D storage array
// (low-level, dangerous, use with caution!)
int N_array() const { return N_array_; }
- fp *restrict get_array() const { return array_; }
+ fpt* get_array() const { return array_; }
// constructor, destructor
- // newly-constructed array elements are initialized to fp(0)
+ // newly-constructed array elements are initialized to fpt(0)
array4d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
int min_k_in, int max_k_in,
@@ -335,14 +336,14 @@ private:
// we forbid copying and passing by value
// by declaring the copy constructor and assignment operator
// private, but never defining them
- array4d(const array4d<fp> &rhs);
- array4d<fp>& operator=(const array4d<fp>& rhs);
+ array4d(const array4d<fpt>& rhs);
+ array4d<fpt>& operator=(const array4d<fpt>& rhs);
private:
// note we declare the array pointer first in the class
// ==> it's probably at 0 offset
// ==> we may get slightly faster array access
- fp *restrict array_; // --> new-allocated 1D storage array
+ fpt* array_; // --> new-allocated 1D storage array
int N_array_;
// subscripting info