Chombo + EB  3.2
EdgeDataBox.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 #ifndef _EDGEDATABOX_H_
12 #define _EDGEDATABOX_H_
13 
14 #include "Box.H"
15 #include "Vector.H"
16 #include "FArrayBox.H"
17 
18 #include "NamespaceHeader.H"
19 
20 /// A FArrayBox-like container for edge-centered fluxes
22 /** This is a class to contain edge-centered fluxes on a box.
23  */
24 {
25 
26 public:
27  /// default constructor
28  EdgeDataBox();
29 
30  /// constructs EdgeDataBox on cell-centered box with n components
31  EdgeDataBox(const Box& bx, int n=1);
32 
33  /// destructor
34  ~EdgeDataBox();
35 
36  /// resize EdgeDataBox similar to BaseFab::resize()
37  //void resize(const Box& bx, int n=1);
38 
39  ///
40  void define(const Box& bx, int n=1);
41 
42  /// this function returns the EdgeDataBox to the undefined state
43  void clear();
44 
45  /// {\bf access functions}
46 
47  /// number of components
48  int nComp() const;
49 
50  /// returns cell-centered box which defines EdgeDataBox
51  const Box& box() const;
52 
53  /// returns edge-centered data in direction dir
54  FArrayBox& getData(const int dir);
55 
56  ///
57  const FArrayBox& getData(const int dir) const;
58 
59  /// returns FArrayBox in direction dir
60  FArrayBox& operator[] (const int dir);
61 
62  /// constant version
63  const FArrayBox& operator[] (const int dir) const;
64 
65  /// {\bf data modification functions}
66  /// set all fluxes to val
67  void setVal(const Real val);
68 
69  /// set fluxes in direction dir to val
70  void setVal(const Real val, const int dir);
71 
72  /// more specific setVal
73  void setVal(const Real val, const int dir, const int startComp,
74  const int nComp);
75 
76  /// sets fluxes on edges surrounding cell-centered box bx
77  void setVal(const Real val, const Box& bx);
78 
79  /*@ManMemo: most specific setVal -- sets fluxes on edges surrounding
80  cell-centered box bx */
81  void setVal(const Real val, const Box& bx, const int dir,
82  const int startComp, const int nComp);
83 
84  /// copy from src to this EdgeDataBox -- sizes must be identical
85  void copy(const EdgeDataBox& src);
86 
87  /// copy on overlap, for all directions
88  void copy(const EdgeDataBox& src, const int srcComp,
89  const int destComp, const int numComp);
90 
91  /// copy on overlap of EdgeDataBoxes, in direction dir
92  void copy(const EdgeDataBox& src, const int dir, const int srcComp,
93  const int destComp, const int numComp);
94 
95  /*@ManMemo: copies from a subsection of one box into another.
96  Assumes the boxes are both in the same index space, and that
97  box R is completely contained in both the src and destination
98  boxes. This function equired by BoxLayoutData */
99  void copy(const Box& RegionFrom,
100  const Interval& Cdest,
101  const Box& RegionTo,
102  const EdgeDataBox& src,
103  const Interval& Csrc);
104 
105  /// {\bf Linearization Functions}
106 
107  /*@ManMemo: returns size, in number of bytes, of a flat linear
108  representation of data in components comps in edges around
109  cell-centered box R */
110  size_t size(const Box& bx, const Interval& comps) const;
111 
112  /*@ManMemo:Write a linear representaion of the internal data for
113  the edges surrounding cell-centered box R. Assumes that sufficient
114  memory for the buffer has already been allocated by the caller */
115  void linearOut(void*buf, const Box& R, const Interval& comps) const;
116 
117  ///
118  void linearIn(void* buf);
119 
120  ///
121  void linearIn(void*buf, const Box& R, const Interval& comps);
122 
123  ///
124  static bool preAllocatable()
125  {
126  return true;
127  }
128 
129 
130 protected:
131  ///
133 
134  ///
135  int m_nvar;
136 
137  /// BL_SPACEDIM FArrayBoxes which hold fluxes
139 
140 
141 private:
142  /// these are disallowed
143 
144  EdgeDataBox (const EdgeDataBox&);
146 
147 };
148 
149 #include "NamespaceFooter.H"
150 
151 #endif
A FArrayBox-like container for edge-centered fluxes.
Definition: EdgeDataBox.H:21
EdgeDataBox()
default constructor
FArrayBox & getData(const int dir)
returns edge-centered data in direction dir
Vector< FArrayBox * > m_data
BL_SPACEDIM FArrayBoxes which hold fluxes.
Definition: EdgeDataBox.H:138
void clear()
this function returns the EdgeDataBox to the undefined state
int m_nvar
Definition: EdgeDataBox.H:135
size_t size(const Box &bx, const Interval &comps) const
{ Linearization Functions}
static bool preAllocatable()
Definition: EdgeDataBox.H:124
Structure for passing component ranges in code.
Definition: Interval.H:23
double Real
Definition: REAL.H:33
FArrayBox & operator[](const int dir)
returns FArrayBox in direction dir
const Box & box() const
returns cell-centered box which defines EdgeDataBox
void copy(const EdgeDataBox &src)
copy from src to this EdgeDataBox – sizes must be identical
void define(const Box &bx, int n=1)
resize EdgeDataBox similar to BaseFab::resize()
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
EdgeDataBox & operator=(const EdgeDataBox &)
void linearOut(void *buf, const Box &R, const Interval &comps) const
Definition: FArrayBox.H:45
void setVal(const Real val)
void linearIn(void *buf)
Box m_bx
Definition: EdgeDataBox.H:132
int nComp() const
{ access functions}
~EdgeDataBox()
destructor