Chombo + EB  3.0
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 
66  /// {\bf data modification functions}
67  /// set all fluxes to val
68  void setVal(const Real val);
69 
70  /// set fluxes in direction dir to val
71  void setVal(const Real val, const int dir);
72 
73  /// more specific setVal
74  void setVal(const Real val, const int dir, const int startComp,
75  const int nComp);
76 
77  /// sets fluxes on edges surrounding cell-centered box bx
78  void setVal(const Real val, const Box& bx);
79 
80  /*@ManMemo: most specific setVal -- sets fluxes on edges surrounding
81  cell-centered box bx */
82  void setVal(const Real val, const Box& bx, const int dir,
83  const int startComp, const int nComp);
84 
85  /// copy from src to this EdgeDataBox -- sizes must be identical
86  void copy(const EdgeDataBox& src);
87 
88  /// copy on overlap, for all directions
89  void copy(const EdgeDataBox& src, const int srcComp,
90  const int destComp, const int numComp);
91 
92  /// copy on overlap of EdgeDataBoxes, in direction dir
93  void copy(const EdgeDataBox& src, const int dir, const int srcComp,
94  const int destComp, const int numComp);
95 
96  /*@ManMemo: copies from a subsection of one box into another.
97  Assumes the boxes are both in the same index space, and that
98  box R is completely contained in both the src and destination
99  boxes. This function equired by BoxLayoutData */
100  void copy(const Box& RegionFrom,
101  const Interval& Cdest,
102  const Box& RegionTo,
103  const EdgeDataBox& src,
104  const Interval& Csrc);
105 
106  /// {\bf Linearization Functions}
107 
108  /*@ManMemo: returns size, in number of bytes, of a flat linear
109  representation of data in components comps in edges around
110  cell-centered box R */
111  int size(const Box& bx, const Interval& comps) const;
112 
113 
114  /*@ManMemo:Write a linear representaion of the internal data for
115  the edges surrounding cell-centered box R. Assumes that sufficient
116  memory for the buffer has already been allocated by the caller */
117  void linearOut(void*buf, const Box& R, const Interval& comps) const;
118 
119  ///
120  void linearIn(void* buf);
121 
122  ///
123  void linearIn(void*buf, const Box& R, const Interval& comps);
124 
125  ///
126  static bool preAllocatable()
127  {
128  return true;
129  }
130 
131 
132 protected:
133  ///
135 
136  ///
137  int m_nvar;
138 
139  /// BL_SPACEDIM FArrayBoxes which hold fluxes
141 
142 
143 private:
144  /// these are disallowed
145 
146  EdgeDataBox (const EdgeDataBox&);
148 
149 };
150 
151 #include "NamespaceFooter.H"
152 
153 #endif
154 
155 
A FArrayBox-like container for edge-centered fluxes.
Definition: EdgeDataBox.H:21
EdgeDataBox()
default constructor
one dimensional dynamic array
Definition: Vector.H:52
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:140
int nComp() const
{ access functions}
const Box & box() const
returns cell-centered box which defines EdgeDataBox
void clear()
this function returns the EdgeDataBox to the undefined state
int m_nvar
Definition: EdgeDataBox.H:137
static bool preAllocatable()
Definition: EdgeDataBox.H:126
Structure for passing component ranges in code.
Definition: Interval.H:23
double Real
Definition: REAL.H:33
void resize(const Box &bx, int n=1)
resize EdgeDataBox similar to BaseFab::resize()
FArrayBox & operator[](const int dir)
returns FArrayBox in direction dir
void copy(const EdgeDataBox &src)
copy from src to this EdgeDataBox – sizes must be identical
void define(const Box &bx, int n=1)
int size(const Box &bx, const Interval &comps) const
{ Linearization Functions}
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
EdgeDataBox & operator=(const EdgeDataBox &)
Definition: FArrayBox.H:44
void setVal(const Real val)
void linearIn(void *buf)
void linearOut(void *buf, const Box &R, const Interval &comps) const
Box m_bx
Definition: EdgeDataBox.H:134
~EdgeDataBox()
destructor