Proto  3.2
Proto_MBLevelOp.H
Go to the documentation of this file.
1 #pragma once
2 #ifndef _PROTO_MB_OP_
3 #define _PROTO_MB_OP_
4 
5 #include "Proto_MBLevelBoxData.H"
6 #include "Proto_MBLevelMap.H"
7 #include "Proto_MBBoxOp.H"
8 
9 namespace Proto {
10 
11 /// Level-Scope Operator
12 /**
13  MBLevelOp contains the necessary tools to apply a user-defined descendent of
14  MBBoxOp on a mapped multiblock level
15 
16  \tparam OpType A MBBoxOp class
17  \tparam MAP A MBMapOp class
18  \tparam T Datatype of the data holder (e.g. int, double, etc.)
19  \tparam BCType A LevelBC class
20  \tparam MEM Proto::MemType of the data holder
21 */
22 template<template<typename, typename, MemType> class OPType,
23  typename MAP,
24  typename T,
25  template<typename, unsigned int, typename, MemType, Centering> class BCType = NullBC,
27 class MBLevelOp
28 {
29  public:
30  typedef OPType<T, MAP, MEM> OP;
31  typedef BCType<T,OP::numState(), MAP, MEM, PR_CELL> BC;
36 
37  static constexpr unsigned int numState() { return OP::numState(); }
38  static constexpr unsigned int numAux() { return OP::numAux(); }
39 
40  static Point ghost() { return OP::ghost(); }
41  static int order() { return OP::order(); }
42  /// Spectral Radius
43  inline T spectralRadius() const {return m_ops[0].spectralRadius(); }
44 
45  inline MBLevelOp();
46  inline MBLevelOp(const MBLevelMap<MAP,MEM>& a_map);
50  inline void define(const MBLevelMap<MAP,MEM>& a_map);
51 
52  inline void operator()(
53  LevelStateData& a_output,
54  const LevelStateData& a_state,
55  T a_scale = 1.0);
56  inline void operator()(
57  LevelStateData& a_output,
58  const LevelStateData& a_state,
59  const LevelAuxData& a_aux,
60  T a_scale = 1.0);
61  inline OP& operator[](MBIndex a_index);
62  inline const OP& operator[](MBIndex a_index) const;
63  inline void setDiagScale(T a_value);
64  inline void setFluxScale(T a_value);
65  inline void setTime(T a_time);
66  inline void setRKStage(unsigned int a_stage);
67  inline T diagScale() const { return m_diagScale; }
68  inline T fluxScale() const { return m_fluxScale; }
69  inline T time() const {return m_time; }
70  inline unsigned int RKStage() const {return m_rkStage; }
71  inline const MBDisjointBoxLayout& layout() const {return m_map->map().layout(); }
72  inline const OP& operator[](const LevelIndex& a_index) const { return m_ops[a_index]; }
73  inline void matchFlux(LevelStateData& a_rhs, const LevelStateData& a_state);
74  private:
75 
78  T m_time;
79  unsigned int m_rkStage;
80 
82  // mutable MBBoundaryRegister<T, OP::numState(), MEM> m_boundRegister;
83  std::vector<OP> m_ops;
84 };
85 
86 #include "implem/Proto_MBLevelOpImplem.H"
87 } // end namespace Proto
88 #endif //end include guard
T diagScale() const
Definition: Proto_MBLevelOp.H:67
MBLevelOp< OPType, MAP, T, BCType, MEM > & operator=(MBLevelOp< OPType, MAP, T, BCType, MEM > &&a_op)=default
OPType< T, MAP, MEM > OP
Definition: Proto_MBLevelOp.H:30
T time() const
Definition: Proto_MBLevelOp.H:69
OP & operator[](MBIndex a_index)
Definition: Proto_MBLevelOp.H:102
BCType< T, OP::numState(), MAP, MEM, PR_CELL > BC
Definition: Proto_MBLevelOp.H:31
BoxData< T, OP::numState(), MEM > StateData
Definition: Proto_MBLevelOp.H:32
unsigned int RKStage() const
Definition: Proto_MBLevelOp.H:70
void setDiagScale(T a_value)
Definition: Proto_MBLevelOp.H:122
Multidimensional Rectangular Array.
Definition: Proto_BoxData.H:314
const OP & operator[](const LevelIndex &a_index) const
Definition: Proto_MBLevelOp.H:72
T fluxScale() const
Definition: Proto_MBLevelOp.H:68
Single Level Mapped Multiblock Map.
Definition: Proto_MBLevelBoxData.H:19
MemType
Definition: Proto_MemType.H:7
No Boundary Condition.
Definition: Proto_MBLevelBCLib.H:15
static Point ghost()
Definition: Proto_MBLevelOp.H:40
Multiblock Level Box Data.
Definition: Proto_MBLevelBoxData.H:17
MBLevelBoxData< T, OP::numState(), MEM, PR_CELL > LevelStateData
Definition: Proto_MBLevelOp.H:34
const MBDisjointBoxLayout & layout() const
Definition: Proto_MBLevelOp.H:71
void setFluxScale(T a_value)
Definition: Proto_MBLevelOp.H:136
T m_time
Definition: Proto_MBLevelOp.H:78
void setRKStage(unsigned int a_stage)
Definition: Proto_MBLevelOp.H:164
unsigned int m_rkStage
Definition: Proto_MBLevelOp.H:79
MBLevelOp()
Definition: Proto_MBLevelOp.H:8
static constexpr unsigned int numState()
Definition: Proto_MBLevelOp.H:37
Definition: Proto_Array.H:17
static int order()
Definition: Proto_MBLevelOp.H:41
void operator()(LevelStateData &a_output, const LevelStateData &a_state, T a_scale=1.0)
Definition: Proto_MBLevelOp.H:47
void setTime(T a_time)
Definition: Proto_MBLevelOp.H:150
static constexpr unsigned int numAux()
Definition: Proto_MBLevelOp.H:38
Integer Valued Vector.
Definition: Proto_Point.H:24
Definition: Proto_MBDisjointBoxLayout.H:14
BoxData< T, OP::numAux(), MEM > AuxData
Definition: Proto_MBLevelOp.H:33
T m_diagScale
Definition: Proto_MBLevelOp.H:76
void define(const MBLevelMap< MAP, MEM > &a_map)
Definition: Proto_MBLevelOp.H:27
T m_fluxScale
Definition: Proto_MBLevelOp.H:77
std::vector< OP > m_ops
Definition: Proto_MBLevelOp.H:83
T spectralRadius() const
Spectral Radius.
Definition: Proto_MBLevelOp.H:43
void matchFlux(LevelStateData &a_rhs, const LevelStateData &a_state)
#define MEMTYPE_DEFAULT
Definition: Proto_MemType.H:24
Level-Scope Operator.
Definition: Proto_MBLevelOp.H:27
const MBLevelMap< MAP, MEM > * m_map
Definition: Proto_MBLevelOp.H:81
MBLevelBoxData< T, OP::numAux(), MEM, PR_CELL > LevelAuxData
Definition: Proto_MBLevelOp.H:35