OPAL (Object Oriented Parallel Accelerator Library) 2022.1
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//----------------------------------------------------------------------
25template<unsigned Dim> struct Divergence {};
26template<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//----------------------------------------------------------------------
40template<> struct PETEUnaryReturn< Divergence<1>, Vektor<double,1> >
41{ typedef double type; };
42template<> struct PETEUnaryReturn< Divergence<2>, Vektor<double,2> >
43{ typedef double type; };
44template<> struct PETEUnaryReturn< Divergence<3>, Vektor<double,3> >
45{ typedef double type; };
46
47template<> struct PETEUnaryReturn< Divergence<1>, Vektor<float,1> >
48{ typedef float type; };
49template<> struct PETEUnaryReturn< Divergence<2>, Vektor<float,2> >
50{ typedef float type; };
51template<> struct PETEUnaryReturn< Divergence<3>, Vektor<float,3> >
52{ typedef float type; };
53
54template<> struct PETEUnaryReturn< Gradient<1>, double >
56template<> struct PETEUnaryReturn< Gradient<2>, double >
58template<> struct PETEUnaryReturn< Gradient<3>, double >
60
61template<> struct PETEUnaryReturn< Gradient<1>, float >
62{ typedef Vektor<float,1> type; };
63template<> struct PETEUnaryReturn< Gradient<2>, float >
64{ typedef Vektor<float,2> type; };
65template<> 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
79template<unsigned Dim, class Mesh, class From, class To>
81{
83};
84
85template<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: Vektor.h:32
Divergence< Dim > operator_type
Gradient< Dim > operator_type