Chombo + EB + MF  3.2
BlockRegister.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 // jafh, 5 Jan 2011
12 
13 #ifndef _BLOCKREGISTER_H_
14 #define _BLOCKREGISTER_H_
15 
16 #include <map>
17 
18 #include "MultiBlockCoordSys.H"
19 #include "FArrayBox.H"
20 #include "LevelData.H"
21 #include "LoHiSide.H"
22 #include "BlockBaseRegister.H"
23 
24 #include "NamespaceHeader.H"
25 
26 /// Class to hold data on a mapped multiblock domain block boundary.
28 {
29 public:
30 
31  /**
32  \name Constructor, destructor, and defines.
33  */
34  /*@{*/
35 
36  /// Empty constructor.
37  /**
38  */
40  :
41  m_verbosity(0),
42  m_isOpen(true),
45  {}
46 
47  /// Constructor.
48  /**
49  – a_mblock: Pointer to multiblock coordinate system.
50  – a_grids: DisjointBoxLayout over which multiblock grid is defined.
51  – a_ghost: Extension of register domain for auxiliary data.
52  */
53  BlockRegister(const MultiBlockCoordSys* a_mblock,
54  /// CELL-centered grids
55  const DisjointBoxLayout& a_grids,
56  /// ghost width for auxiliary data
57  const int& a_ghost = 0 );
58 
59  /// virtual destructor
60  virtual ~BlockRegister();
61 
62  /// Define function that matches constructor
63  /**
64  – a_mblock: Pointer to multiblock coordinate system.
65  – a_grids: DisjointBoxLayout over which multiblock grid is defined.
66  – a_ghost: Extension of register domain for auxiliary data.
67  */
68  void define(const MultiBlockCoordSys* a_mblock,
69  /// CELL-centered grids
70  const DisjointBoxLayout& a_grids,
71  /// ghost width for auxiliary data
72  const int& a_ghost = 0 );
73 
74  /// Set verbosity.
75  /**
76  Default is 0. Positive values output increasing amounts of information.
77  */
78  virtual void setVerbose(int a_verbose);
79 
80  /// Store fluxes on block-boundary faces.
81  /**
82  – a_flux: Face-centered flux to be stored.
83  – a_dataIndex: Index of box where flux has been computed.
84  – a_dir: Direction of the face.
85  – a_side: Low or high side of the box where the block-boundary
86  face lies.
87  */
88  void storeFlux(const FArrayBox& a_flux,
89  const DataIndex& a_dataIndex,
90  int a_dir,
91  Side::LoHiSide a_side);
92 
93  /// increment fluxes on block-boundary faces.
94  /**
95  – a_flux: Face-centered flux to be stored.
96  – a_dataIndex: Index of box where flux has been computed.
97  – a_dir: Direction of the face.
98  – a_side: Low or high side of the box where the block-boundary
99  face lies.
100  */
101  void incrementFlux(const FArrayBox& a_flux,
102  const DataIndex& a_dataIndex,
103  int a_dir,
104  Side::LoHiSide a_side);
105 
106  /// Store auxiliary data on block-boundary faces including layers of ghost faces.
107  /**
108  – a_data: Face-centered data to be stored.
109  – a_dataIndex: Index of box containing data to be stored.
110  – a_dir: Direction of the face.
111  – a_side: Low or high side of the box where the block-boundary
112  face lies.
113  */
114  void storeAux(const FArrayBox& a_data,
115  const DataIndex& a_dataIndex,
116  int a_dir,
117  Side::LoHiSide a_side);
118 
119 /// Store auxiliary data on block-boundary faces including layers of ghost faces.
120  /**
121  – a_data: Face-centered data to be stored.
122  – a_dataIndex: Index of box containing data to be stored.
123  – a_dir: Direction of the face.
124  – a_side: Low or high side of the box where the block-boundary
125  face lies.
126  */
127  void incrementAux(const FArrayBox& a_data,
128  const DataIndex& a_dataIndex,
129  int a_dir,
130  Side::LoHiSide a_side);
131 
132  ///
133  /**
134  Perform data manipulation of flux and auxiliary data, after it has been
135  stored, so that accessor functions have access to it.
136  */
137  void close();
138 
139  ///
140  /**
141  Sets the contents of the register to zero, and sets the register to be
142  open. If data is not already defined, argument a_n_comp must be defined
143  to be greater than zero.
144  – a_n_comp: Number of components in register.
145  */
146  void setToZero( const int a_n_comp=-1 );
147 
148  /// Returns whether or not a box has a block-boundary interface on one of its faces.
149  /**
150  – a_dataIndex: Index of box.
151  – a_dir: Direction of the face of the box.
152  – a_side: Low or high side of the box.
153  */
154  bool hasInterface(const DataIndex& a_dataIndex,
155  int a_dir,
156  Side::LoHiSide a_side) const;
157 
158  /// Return fluxes on a block-boundary interface of a box, if hasInterface(a_dataIndex, a_dir, a_side) is true.
159  /**
160  – a_flux: Face-centered flux returned.
161  – a_dataIndex: Index of box.
162  – a_dir: Direction of the face.
163  – a_side: Low or high side of the box.
164  – a_sideData: Low or high side of the block-boundary interface,
165  from which flux will be taken.
166  */
167  void getFlux(FArrayBox& a_flux,
168  const DataIndex& a_dataIndex,
169  int a_dir,
170  Side::LoHiSide a_side,
171  Side::LoHiSide a_sideData) const;
172 
173  /// Return auxiliary data on a block-boundary interface of a box, if hasInterface(a_dataIndex, a_dir, a_side) is true.
174  /**
175  – a_flux: Face-centered data returned.
176  – a_dataIndex: Index of box.
177  – a_dir: Direction of the face.
178  – a_side: Low or high side of the box.
179  – a_sideData: Low or high side of the block-boundary interface,
180  from which data will be taken.
181  */
182  void getAux(FArrayBox& a_data,
183  const DataIndex& a_dataIndex,
184  int a_dir,
185  Side::LoHiSide a_side,
186  Side::LoHiSide a_sideData) const ;
187 
188 protected:
189 
190  /// Returns true if register is open, false otherwise.
191  inline bool isNotClosed() const
192  {
193  return m_isOpen;
194  }
195 
196  /// Returns false if register is open, true otherwise.
197  inline bool isClosed() const
198  {
199  return !m_isOpen;
200  }
201 
203  bool m_isOpen;
204 
207 };
208 
209 #include "NamespaceFooter.H"
210 
211 #endif // include guard
bool m_isOpen
Definition: BlockRegister.H:203
BlockBaseRegister< FArrayBox > m_auxRegister
Definition: BlockRegister.H:206
Class to hold data on a mapped multiblock domain block boundary.
Definition: BlockRegister.H:27
BlockBaseRegister< FArrayBox > m_fluxRegister
Definition: BlockRegister.H:205
void storeFlux(const FArrayBox &a_flux, const DataIndex &a_dataIndex, int a_dir, Side::LoHiSide a_side)
Store fluxes on block-boundary faces.
void incrementAux(const FArrayBox &a_data, const DataIndex &a_dataIndex, int a_dir, Side::LoHiSide a_side)
Store auxiliary data on block-boundary faces including layers of ghost faces.
bool isNotClosed() const
Returns true if register is open, false otherwise.
Definition: BlockRegister.H:191
bool hasInterface(const DataIndex &a_dataIndex, int a_dir, Side::LoHiSide a_side) const
Returns whether or not a box has a block-boundary interface on one of its faces.
virtual void setVerbose(int a_verbose)
Set verbosity.
void define(const MultiBlockCoordSys *a_mblock, const DisjointBoxLayout &a_grids, const int &a_ghost=0)
Define function that matches constructor.
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
LoHiSide
Definition: LoHiSide.H:27
void incrementFlux(const FArrayBox &a_flux, const DataIndex &a_dataIndex, int a_dir, Side::LoHiSide a_side)
increment fluxes on block-boundary faces.
virtual interface class encapsulating multi-block mapping API
Definition: MultiBlockCoordSys.H:34
void getAux(FArrayBox &a_data, const DataIndex &a_dataIndex, int a_dir, Side::LoHiSide a_side, Side::LoHiSide a_sideData) const
Return auxiliary data on a block-boundary interface of a box, if hasInterface(a_dataIndex, a_dir, a_side) is true.
bool isClosed() const
Returns false if register is open, true otherwise.
Definition: BlockRegister.H:197
Definition: DataIndex.H:114
int m_verbosity
Definition: BlockRegister.H:202
void setToZero(const int a_n_comp=-1)
Definition: FArrayBox.H:45
void getFlux(FArrayBox &a_flux, const DataIndex &a_dataIndex, int a_dir, Side::LoHiSide a_side, Side::LoHiSide a_sideData) const
Return fluxes on a block-boundary interface of a box, if hasInterface(a_dataIndex, a_dir, a_side) is true.
BlockRegister()
Empty constructor.
Definition: BlockRegister.H:39
void storeAux(const FArrayBox &a_data, const DataIndex &a_dataIndex, int a_dir, Side::LoHiSide a_side)
Store auxiliary data on block-boundary faces including layers of ghost faces.
virtual ~BlockRegister()
virtual destructor