OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
CartesianStencilSetup.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  * The IPPL Framework
5  *
6  *
7  * Visit http://people.web.psi.ch/adelmann/ for more details
8  *
9  ***************************************************************************/
10 
11 #ifndef CARTESIAN_STENCIL_SETUP_H
12 #define CARTESIAN_STENCIL_SETUP_H
13 
14 // CartesianStencilSetup.h
15 // Common stencil setup header for Cartesian and UniformCartesian classes
16 
17 //----------------------------------------------------------------------
18 //
19 // Define the operator class types for the stencils.
20 //
21 // These get plugged into UnaryElem as the operator to indicate
22 // what kind of operation is to be done.
23 //
24 //----------------------------------------------------------------------
25 template<unsigned Dim> struct Divergence {};
26 template<unsigned Dim> struct Gradient {};
27 
28 //----------------------------------------------------------------------
29 //
30 // Define the return types.
31 //
32 // These are the element by element return types. They just encode
33 // the fact that divergence of a Vektor is a scalar, and gradient of
34 // a scalar is a Vektor. As such they are independent of centering
35 // and use the tag base classes.
36 //
37 // These need to be filled out with specializations for Tenzors...
38 //
39 //----------------------------------------------------------------------
40 template<> struct PETEUnaryReturn< Divergence<1>, Vektor<double,1> >
41 { typedef double type; };
42 template<> struct PETEUnaryReturn< Divergence<2>, Vektor<double,2> >
43 { typedef double type; };
44 template<> struct PETEUnaryReturn< Divergence<3>, Vektor<double,3> >
45 { typedef double type; };
46 
47 template<> struct PETEUnaryReturn< Divergence<1>, Vektor<float,1> >
48 { typedef float type; };
49 template<> struct PETEUnaryReturn< Divergence<2>, Vektor<float,2> >
50 { typedef float type; };
51 template<> struct PETEUnaryReturn< Divergence<3>, Vektor<float,3> >
52 { typedef float type; };
53 
54 template<> struct PETEUnaryReturn< Gradient<1>, double >
55 { typedef Vektor<double,1> type; };
56 template<> struct PETEUnaryReturn< Gradient<2>, double >
57 { typedef Vektor<double,2> type; };
58 template<> struct PETEUnaryReturn< Gradient<3>, double >
59 { typedef Vektor<double,3> type; };
60 
61 template<> struct PETEUnaryReturn< Gradient<1>, float >
62 { typedef Vektor<float,1> type; };
63 template<> struct PETEUnaryReturn< Gradient<2>, float >
64 { typedef Vektor<float,2> type; };
65 template<> struct PETEUnaryReturn< Gradient<3>, float >
66 { typedef Vektor<float,3> type; };
67 
68 //----------------------------------------------------------------------
69 //
70 // Now derive from these general tags specific ones that include
71 // the mesh and centerings.
72 //
73 // These define operator_type internally instead of using
74 // the OperatorClass external polymorphism because that would require
75 // partial specialization.
76 //
77 //----------------------------------------------------------------------
78 
79 template<unsigned Dim, class Mesh, class From, class To>
81 {
83 };
84 
85 template<unsigned Dim, class Mesh, class From, class To>
87 {
89 };
90 
91 #endif // CARTESIAN_STENCIL_SETUP_H
92 
93 /***************************************************************************
94  * $RCSfile: CartesianStencilSetup.h,v $ $Author: adelmann $
95  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:28 $
96  * IPPL_VERSION_ID: $Id: CartesianStencilSetup.h,v 1.1.1.1 2003/01/23 07:40:28 adelmann Exp $
97  ***************************************************************************/
98 
Definition: TSVMeta.h:24
Divergence< Dim > operator_type
Gradient< Dim > operator_type