Commit b450ab23 authored by gsell's avatar gsell
Browse files

cleanup: macro UNDEFINED in ippl

parent cf771f18
......@@ -173,31 +173,6 @@ FUNC(const PETE_TUTree<OpParens<TP>,A>& lhs, const std::complex<double>& rhs)\
assign(lhs,PETE_Scalar<std::complex<double>>(rhs),OP(),ExprTag<true>()); \
}
#ifdef UNDEFINED
template<class LHS> \
inline void \
FUNC(const PETE_Expr<LHS>& lhs, double rhs) \
{ \
assign(lhs.PETE_unwrap(),PETE_Scalar<double>(rhs),OP(),ExprTag<true>()); \
} \
\
template<class LHS> \
inline void \
FUNC(const PETE_Expr<LHS>& lhs, float rhs) \
{ \
assign(lhs.PETE_unwrap(),PETE_Scalar<float>(rhs),OP(),ExprTag<true>()); \
} \
\
template<class LHS> \
inline void \
FUNC(const PETE_Expr<LHS>& lhs, int rhs) \
{ \
assign(lhs.PETE_unwrap(),PETE_Scalar<int>(rhs),OP(),ExprTag<true>()); \
}
#endif
ASSIGNMENT_OPERATORS(assign,OpAssign)
ASSIGNMENT_OPERATORS(operator<<,OpAssign)
ASSIGNMENT_OPERATORS(operator+=,OpAddAssign)
......
......@@ -120,23 +120,6 @@ Index::intersect(const Index& rhs) const
ret.Stride = 1;
ret.BaseFirst = BaseFirst + f - lf;
ret.Base = Base;
#ifdef UNDEFINED
Index test = general_intersect(rhs);
cout << "inter: First Length Stride BaseFirst Base " << endl;
cout << "*this= " << First << "," << Length << "," << Stride << "," << BaseFirst << "," << Base << endl;
cout << "rhs = " << rhs.First << "," << rhs.Length << "," << rhs.Stride << "," << rhs.BaseFirst << "," << rhs.Base << endl;
cout << "ret = " << ret.First << "," << ret.Length << "," << ret.Stride << "," << ret.BaseFirst << "," << ret.Base << endl;
cout << "test = " << test.First << "," << test.Length << "," << test.Stride << "," << test.BaseFirst << "," << test.Base << endl;
PAssert_EQ( ret.Length, test.Length );
if ( ret.Length > 0 ) {
PAssert_EQ( ret.First , test.First );
PAssert_EQ( ret.Stride , test.Stride );
PAssert_EQ( ret.BaseFirst, test.BaseFirst );
PAssert_EQ( ret.Base, test.Base );
}
#endif // UNDEFINED
}
else
ret = general_intersect(rhs);
......
......@@ -312,197 +312,6 @@ std::ostream& operator<<(std::ostream& out, const Cartesian<Dim,MFLOAT>& mesh)
//
//----------------------------------------------------------------------
#ifdef UNDEFINED
//
// T1: The element type for the Field
// T2: The data type for the Cartesian mesh (for storing spacings, etc.)
// Dim: the dimension of the Field and the Mesh.
//
template<class T1, class T2, unsigned Dim>
// Return a PETE_Expr wrapper on a StencilElem.
inline PETE_Expr<StencilElem<
// The iterator for the expression element
Field<T1,Dim,Cartesian<Dim,T2>,Vert>::iterator,
// The operator for the expression element.
CenteredDivergence<Dim,Cartesian<Dim,T2>,Vert,Cell>
> >
Div( Field< T1 , Dim , Cartesian<Dim,T2> , Vert >& x)
{
// Some typedefs to make the return expression easier.
typedef Field<T1,Dim,Cartesian<Dim,T2>,Vert>::iterator A;
typedef CenteredDivergence<Dim,Cartesian<Dim,T2>,Vert,Cell> Op_t;
typedef StencilElem<A,Op_t> Elem_t;
// Return the expression element.
return PETE_Expr<Elem_t>( Elem_t(x.begin() ) );
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// NOTE: this all doesn't work now because the mesh classes are
// no longer static, so things like Mesh::Dvc are wrong. For new Cartesian
// class, rather than this UniformCartesian class, Dvc is also now an array
// of arrays instead of just an array. Steve K. says he will rework all this
// later. For now, the non-stencil-expression version of Div(), etc.
// are okay. Comment out everything between "REIMPLEMENT..."
// --Tim Williams 2/25/97
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/* REIMPLEMENT THIS LATER (BEGIN COMMENTED-OUT REGION)
//----------------------------------------------------------------------
//
// Next are the elementwise 'apply' functions for Vert->Cell.
// These need to be specialized on dimension, but they are still
// for arbitrary element type.
//
// For each of these:
//
// A: The iterator type.
// a: The instance of the iterator being passed in.
// T2: The base type for the Mesh data.
//
//----------------------------------------------------------------------
template<class A, class T2>
inline
UnaryReturn<Divergence<1>, A::return_type>::type
apply(CenteredDivergence<1,Cartesian<1,T2>,Vert,Cell>, A a, int i,int,int)
{
typedef Cartesian<1,T2> Mesh;
return
dot(a.offset( i ),Mesh::Dvc[0]) +
dot(a.offset(i+1),Mesh::Dvc[1]);
}
template<class A, class T2>
inline
UnaryReturn<Divergence<2>, A::return_type>::type
apply(CenteredDivergence<2,Cartesian<2,T2>,Vert,Cell>, A a, int i,int j,int)
{
typedef Cartesian<2,T2> Mesh;
return
dot(a.offset( i , j ),Mesh::Dvc[0]) +
dot(a.offset(i+1, j ),Mesh::Dvc[1]) +
dot(a.offset( i ,j+1),Mesh::Dvc[2]) +
dot(a.offset(i+1,j+1),Mesh::Dvc[3]);
}
template<class A, class T2>
inline
UnaryReturn<Divergence<3>, A::return_type>::type
apply(CenteredDivergence<3,Cartesian<3,T2>,Vert,Cell>, A a, int i,int j,int k)
{
typedef Cartesian<3,T2> Mesh;
return
dot(a.offset( i , j , k ),Mesh::Dvc[0]) +
dot(a.offset(i+1, j , k ),Mesh::Dvc[1]) +
dot(a.offset( i ,j+1, k ),Mesh::Dvc[2]) +
dot(a.offset(i+1,j+1, k ),Mesh::Dvc[3]) +
dot(a.offset( i , j ,k+1),Mesh::Dvc[4]) +
dot(a.offset(i+1, j ,k+1),Mesh::Dvc[5]) +
dot(a.offset( i ,j+1,k+1),Mesh::Dvc[6]) +
dot(a.offset(i+1,j+1,k+1),Mesh::Dvc[7]);
}
//----------------------------------------------------------------------
//
// Divergence Cell->Vert
//
// First is the user function for any dimension and element types.
// it returns a stencil element type.
//
//----------------------------------------------------------------------
//
// T1: The element type for the Field.
// T2: The base type for the mesh.
// Dim: The dimension of the Field and the mesh.
//
template<class T1, class T2, unsigned Dim>
// Return a PETE_Expr wrapped around a StencilElem.
inline PETE_Expr<StencilElem<
// The iterator for the expression.
Field<T1,Dim,Cartesian<Dim,T2>,Cell>::iterator,
// The operator tag.
CenteredDivergence<Dim,Cartesian<Dim,T2>,Cell,Vert>
> >
// The function signature is way down here.
Div( Field< T1 , Dim , Cartesian<Dim,T2> , Cell >& x)
{
// Some typedefs to make this a little easier to read.
typedef CenteredDivergence<Dim,Cartesian<Dim,T2>,Cell,Vert> Op_t;
typedef Field<T1,Dim,Cartesian<Dim,T2>,Cell>::iterator A;
typedef StencilElem<A,Op_t> Elem_t;
// Build and return the expression element.
return PETE_Expr<Elem_t>( Elem_t(x.begin() ) );
}
//----------------------------------------------------------------------
//
// Next are the elementwise 'apply' functions for Cell->Vert.
// These need to be specialized on dimension, but they are still
// for arbitrary element type.
//
// For each of these:
//
// A: The iterator type.
// a: The instance of the iterator being passed in.
// T2: The base type for the Mesh data.
//
//----------------------------------------------------------------------
template<class A, class T2>
inline
UnaryReturn<Divergence<1>, A::return_type>::type
apply(CenteredDivergence<1,Cartesian<1,T2>,Cell,Vert>, A a)
{
typedef Cartesian<1,T2> Mesh;
return
dot(a.offset(-1),Mesh::Dvc[0]) +
dot(a.offset( 0),Mesh::Dvc[1]);
}
template<class A, class T2>
inline
UnaryReturn<Divergence<1>, A::return_type>::type
apply(CenteredDivergence<1,Cartesian<1,T2>,Cell,Vert>, A a,int i,int,int)
{
typedef Cartesian<1,T2> Mesh;
return
dot(a.offset(i-1),Mesh::Dvc[0]) +
dot(a.offset( i ),Mesh::Dvc[1]);
}
template<class A, class T2>
inline
UnaryReturn<Divergence<2>, A::return_type>::type
apply(CenteredDivergence<2,Cartesian<2,T2>,Cell,Vert>, A a, int i,int j,int)
{
typedef Cartesian<2,T2> Mesh;
return
dot(a.offset(i-1,j-1),Mesh::Dvc[0]) +
dot(a.offset( i ,j-1),Mesh::Dvc[1]) +
dot(a.offset(i-1, j ),Mesh::Dvc[2]) +
dot(a.offset( i , j ),Mesh::Dvc[3]);
}
template<class A, class T2>
inline
UnaryReturn<Divergence<3>, A::return_type>::type
apply(CenteredDivergence<3,Cartesian<3,T2>,Cell,Vert>, A a, int i,int j,int k)
{
typedef Cartesian<3,T2> Mesh;
return
dot(a.offset(i-1,j-1,k-1),Mesh::Dvc[0]) +
dot(a.offset( i ,j-1,k-1),Mesh::Dvc[1]) +
dot(a.offset(i-1, j ,k-1),Mesh::Dvc[2]) +
dot(a.offset( i , j ,k-1),Mesh::Dvc[3]) +
dot(a.offset(i-1,j-1, k ),Mesh::Dvc[4]) +
dot(a.offset( i ,j-1, k ),Mesh::Dvc[5]) +
dot(a.offset(i-1, j , k ),Mesh::Dvc[6]) +
dot(a.offset( i , j , k ),Mesh::Dvc[7]);
}
REIMPLEMENT THIS LATER (BEGIN COMMENTED-OUT END) */
#endif
////////////////////////////////////////////////////////////////////////
//
// Here are the old style definitions.
......
......@@ -295,196 +295,6 @@ Inform& operator<<(Inform& out, const UniformCartesian<Dim,MFLOAT>& mesh)
// it returns a unary element type.
//
//----------------------------------------------------------------------
#ifdef UNDEFINED
//
// T1: The element type for the Field
// T2: The data type for the UniformCartesian mesh
// Dim: the dimension of the Field and the Mesh.
//
template<class T1, class T2, unsigned Dim>
// Return a PETE_Expr wrapper on a StencilElem.
inline PETE_Expr<StencilElem<
// The iterator for the expression element
Field<T1,Dim,UniformCartesian<Dim,T2>,Vert>::iterator,
// The operator for the expression element.
CenteredDivergence<Dim,UniformCartesian<Dim,T2>,Vert,Cell>
> >
Div( Field< T1 , Dim , UniformCartesian<Dim,T2> , Vert >& x)
{
// Some typedefs to make the return expression easier.
typedef Field<T1,Dim,UniformCartesian<Dim,T2>,Vert>::iterator A;
typedef CenteredDivergence<Dim,UniformCartesian<Dim,T2>,Vert,Cell> Op_t;
typedef StencilElem<A,Op_t> Elem_t;
// Return the expression element.
return PETE_Expr<Elem_t>( Elem_t(x.begin() ) );
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// NOTE: this all doesn't work now because the mesh classes are
// no longer static, so things like Mesh::Dvc are wrong. For new Cartesian
// class, rather than this UniformCartesian class, Dvc is also now an array
// of arrays instead of just an array. Steve K. says he will rework all this
// later. For now, the non-stencil-expression version of Div(), etc.
// are okay. Comment out everything between "REIMPLEMENT..."
// --Tim Williams 2/25/97
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/* REIMPLEMENT THIS LATER (BEGIN COMMENTED-OUT REGION)
//----------------------------------------------------------------------
//
// Next are the elementwise 'apply' functions for Vert->Cell.
// These need to be specialized on dimension, but they are still
// for arbitrary element type.
//
// For each of these:
//
// A: The iterator type.
// a: The instance of the iterator being passed in.
// T2: The base type for the Mesh data.
//
//----------------------------------------------------------------------
template<class A, class T2>
inline
UnaryReturn<Divergence<1>, A::return_type>::type
apply(CenteredDivergence<1,UniformCartesian<1,T2>,Vert,Cell>, A a, int i,int,int)
{
typedef UniformCartesian<1,T2> Mesh;
return
dot(a.offset( i ),Mesh::Dvc[0]) +
dot(a.offset(i+1),Mesh::Dvc[1]);
}
template<class A, class T2>
inline
UnaryReturn<Divergence<2>, A::return_type>::type
apply(CenteredDivergence<2,UniformCartesian<2,T2>,Vert,Cell>, A a, int i,int j,int)
{
typedef UniformCartesian<2,T2> Mesh;
return
dot(a.offset( i , j ),Mesh::Dvc[0]) +
dot(a.offset(i+1, j ),Mesh::Dvc[1]) +
dot(a.offset( i ,j+1),Mesh::Dvc[2]) +
dot(a.offset(i+1,j+1),Mesh::Dvc[3]);
}
template<class A, class T2>
inline
UnaryReturn<Divergence<3>, A::return_type>::type
apply(CenteredDivergence<3,UniformCartesian<3,T2>,Vert,Cell>, A a, int i,int j,int k)
{
typedef UniformCartesian<3,T2> Mesh;
return
dot(a.offset( i , j , k ),Mesh::Dvc[0]) +
dot(a.offset(i+1, j , k ),Mesh::Dvc[1]) +
dot(a.offset( i ,j+1, k ),Mesh::Dvc[2]) +
dot(a.offset(i+1,j+1, k ),Mesh::Dvc[3]) +
dot(a.offset( i , j ,k+1),Mesh::Dvc[4]) +
dot(a.offset(i+1, j ,k+1),Mesh::Dvc[5]) +
dot(a.offset( i ,j+1,k+1),Mesh::Dvc[6]) +
dot(a.offset(i+1,j+1,k+1),Mesh::Dvc[7]);
}
//----------------------------------------------------------------------
//
// Divergence Cell->Vert
//
// First is the user function for any dimension and element types.
// it returns a stencil element type.
//
//----------------------------------------------------------------------
//
// T1: The element type for the Field.
// T2: The base type for the mesh.
// Dim: The dimension of the Field and the mesh.
//
template<class T1, class T2, unsigned Dim>
// Return a PETE_Expr wrapped around a StencilElem.
inline PETE_Expr<StencilElem<
// The iterator for the expression.
Field<T1,Dim,UniformCartesian<Dim,T2>,Cell>::iterator,
// The operator tag.
CenteredDivergence<Dim,UniformCartesian<Dim,T2>,Cell,Vert>
> >
// The function signature is way down here.
Div( Field< T1 , Dim , UniformCartesian<Dim,T2> , Cell >& x)
{
// Some typedefs to make this a little easier to read.
typedef CenteredDivergence<Dim,UniformCartesian<Dim,T2>,Cell,Vert> Op_t;
typedef Field<T1,Dim,UniformCartesian<Dim,T2>,Cell>::iterator A;
typedef StencilElem<A,Op_t> Elem_t;
// Build and return the expression element.
return PETE_Expr<Elem_t>( Elem_t(x.begin() ) );
}
//----------------------------------------------------------------------
//
// Next are the elementwise 'apply' functions for Cell->Vert.
// These need to be specialized on dimension, but they are still
// for arbitrary element type.
//
// For each of these:
//
// A: The iterator type.
// a: The instance of the iterator being passed in.
// T2: The base type for the Mesh data.
//
//----------------------------------------------------------------------
template<class A, class T2>
inline
UnaryReturn<Divergence<1>, A::return_type>::type
apply(CenteredDivergence<1,UniformCartesian<1,T2>,Cell,Vert>, A a)
{
typedef UniformCartesian<1,T2> Mesh;
return
dot(a.offset(-1),Mesh::Dvc[0]) +
dot(a.offset( 0),Mesh::Dvc[1]);
}
template<class A, class T2>
inline
UnaryReturn<Divergence<1>, A::return_type>::type
apply(CenteredDivergence<1,UniformCartesian<1,T2>,Cell,Vert>, A a,int i,int,int)
{
typedef UniformCartesian<1,T2> Mesh;
return
dot(a.offset(i-1),Mesh::Dvc[0]) +
dot(a.offset( i ),Mesh::Dvc[1]);
}
template<class A, class T2>
inline
UnaryReturn<Divergence<2>, A::return_type>::type
apply(CenteredDivergence<2,UniformCartesian<2,T2>,Cell,Vert>, A a, int i,int j,int)
{
typedef UniformCartesian<2,T2> Mesh;
return
dot(a.offset(i-1,j-1),Mesh::Dvc[0]) +
dot(a.offset( i ,j-1),Mesh::Dvc[1]) +
dot(a.offset(i-1, j ),Mesh::Dvc[2]) +
dot(a.offset( i , j ),Mesh::Dvc[3]);
}
template<class A, class T2>
inline
UnaryReturn<Divergence<3>, A::return_type>::type
apply(CenteredDivergence<3,UniformCartesian<3,T2>,Cell,Vert>, A a, int i,int j,int k)
{
typedef UniformCartesian<3,T2> Mesh;
return
dot(a.offset(i-1,j-1,k-1),Mesh::Dvc[0]) +
dot(a.offset( i ,j-1,k-1),Mesh::Dvc[1]) +
dot(a.offset(i-1, j ,k-1),Mesh::Dvc[2]) +
dot(a.offset( i , j ,k-1),Mesh::Dvc[3]) +
dot(a.offset(i-1,j-1, k ),Mesh::Dvc[4]) +
dot(a.offset( i ,j-1, k ),Mesh::Dvc[5]) +
dot(a.offset(i-1, j , k ),Mesh::Dvc[6]) +
dot(a.offset( i , j , k ),Mesh::Dvc[7]);
}
REIMPLEMENT THIS LATER (BEGIN COMMENTED-OUT END) */
#endif
////////////////////////////////////////////////////////////////////////
//
......@@ -863,4 +673,4 @@ Average(Field<T1,3U,UniformCartesian<3U,MFLOAT>,Vert>& x,
* $RCSfile: UniformCartesian.h,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:28 $
* IPPL_VERSION_ID: $Id: UniformCartesian.h,v 1.1.1.1 2003/01/23 07:40:28 adelmann Exp $
***************************************************************************/
\ No newline at end of file
***************************************************************************/
......@@ -47,42 +47,5 @@ public:
X* release() const { X *p=px; ((my_auto_ptr<X>*)(this))->px=0; return p; }
};
#ifdef UNDEFINED
template<class X>
class my_auto_ptr
{
bool owner;
X* px;
public:
my_auto_ptr()
: owner(false), px(0) {}
my_auto_ptr(X* p)
: owner(p), px(p) {}
my_auto_ptr(const my_auto_ptr<X>& r)
: owner(r.owner), px(r.release()) {}
my_auto_ptr& operator=(const my_auto_ptr<X>& r)
{
if (&r != this)
{
if (owner)
delete px;
owner = r.owner;
px = r.release();
}
return *this;
}
~my_auto_ptr() { if (owner) delete px; }
X& operator*() const { return *px; }
X* operator->() const { return px; }
X* get() const { return px; }
X* release() const { ((my_auto_ptr<X>*)(this))->owner = false; return px;}
};
#endif // UNDEFINED
#endif // MY_AUTO_PTR_H
/***************************************************************************
* $RCSfile: my_auto_ptr.h,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:34 $
* IPPL_VERSION_ID: $Id: my_auto_ptr.h,v 1.1.1.1 2003/01/23 07:40:34 adelmann Exp $
***************************************************************************/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment