src/Meshes/CartesianStencilSetup.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /***************************************************************************
00003  *
00004  * The IPPL Framework
00005  * 
00006  *
00007  * Visit http://people.web.psi.ch/adelmann/ for more details
00008  *
00009  ***************************************************************************/
00010 
00011 #ifndef CARTESIAN_STENCIL_SETUP_H
00012 #define CARTESIAN_STENCIL_SETUP_H
00013 
00014 // CartesianStencilSetup.h
00015 // Common stencil setup header for Cartesian and UniformCartesian classes
00016 
00017 //----------------------------------------------------------------------
00018 //
00019 // Define the operator class types for the stencils.
00020 //
00021 // These get plugged into UnaryElem as the operator to indicate
00022 // what kind of operation is to be done.
00023 //
00024 //----------------------------------------------------------------------
00025 template<unsigned Dim> struct Divergence {};
00026 template<unsigned Dim> struct Gradient   {};
00027 
00028 //----------------------------------------------------------------------
00029 //
00030 // Define the return types.
00031 //
00032 // These are the element by element return types.  They just encode 
00033 // the fact that divergence of a Vektor is a scalar, and gradient of
00034 // a scalar is a Vektor.  As such they are independent of centering
00035 // and use the tag base classes.
00036 //
00037 // These need to be filled out with specializations for Tenzors...
00038 // 
00039 //----------------------------------------------------------------------
00040 template<> struct PETEUnaryReturn< Divergence<1>, Vektor<double,1> > 
00041 { typedef double type; };
00042 template<> struct PETEUnaryReturn< Divergence<2>, Vektor<double,2> > 
00043 { typedef double type; };
00044 template<> struct PETEUnaryReturn< Divergence<3>, Vektor<double,3> > 
00045 { typedef double type; };
00046 
00047 template<> struct PETEUnaryReturn< Divergence<1>, Vektor<float,1> > 
00048 { typedef float type; };
00049 template<> struct PETEUnaryReturn< Divergence<2>, Vektor<float,2> > 
00050 { typedef float type; };
00051 template<> struct PETEUnaryReturn< Divergence<3>, Vektor<float,3> > 
00052 { typedef float type; };
00053 
00054 template<> struct PETEUnaryReturn< Gradient<1>, double > 
00055 { typedef Vektor<double,1> type; };
00056 template<> struct PETEUnaryReturn< Gradient<2>, double > 
00057 { typedef Vektor<double,2> type; };
00058 template<> struct PETEUnaryReturn< Gradient<3>, double > 
00059 { typedef Vektor<double,3> type; };
00060 
00061 template<> struct PETEUnaryReturn< Gradient<1>, float > 
00062 { typedef Vektor<float,1> type; };
00063 template<> struct PETEUnaryReturn< Gradient<2>, float > 
00064 { typedef Vektor<float,2> type; };
00065 template<> struct PETEUnaryReturn< Gradient<3>, float > 
00066 { typedef Vektor<float,3> type; };
00067 
00068 //----------------------------------------------------------------------
00069 //
00070 // Now derive from these general tags specific ones that include
00071 // the mesh and centerings.
00072 //
00073 // These define operator_type internally instead of using
00074 // the OperatorClass external polymorphism because that would require
00075 // partial specialization.
00076 //
00077 //----------------------------------------------------------------------
00078 
00079 template<unsigned Dim, class Mesh, class From, class To>
00080 struct CenteredDivergence
00081 {
00082   typedef Divergence<Dim> operator_type;
00083 };
00084 
00085 template<unsigned Dim, class Mesh, class From, class To>
00086 class CenteredGradient
00087 {
00088   typedef Gradient<Dim> operator_type;
00089 };
00090 
00091 #endif // CARTESIAN_STENCIL_SETUP_H
00092 
00093 /***************************************************************************
00094  * $RCSfile: CartesianStencilSetup.h,v $   $Author: adelmann $
00095  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:28 $
00096  * IPPL_VERSION_ID: $Id: CartesianStencilSetup.h,v 1.1.1.1 2003/01/23 07:40:28 adelmann Exp $ 
00097  ***************************************************************************/
00098 

Generated on Mon Jan 16 13:23:51 2006 for IPPL by  doxygen 1.4.6