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  /// Modifes this EdgeDataBox by adding src in the CELL-CENTERED sub-box
106  /** Modifies this EdgeDataBox by pointwise addition of values in the argument
107  EdgeDataBox. Adds src's components (a_srccomp : a_srccomp+a_numcomp-1)
108  to this EdgeDataBox's components (a_destcomp : a_destcomp+numcomp-1)
109  where the domain of this EdgeDataBox intersects the a_subbox. The actual
110  directionally-dependent subbox is given by
111  a_subbox.surroundingNodes();
112  a_subbox.enclosedCells(dir);
113  NOTE:
114  a_subbox must be contained in the cell-centered Box of this EdgeDataBox.
115  Returns *this
116  */
117  EdgeDataBox& plus(const EdgeDataBox& a_src,
118  const Box& a_subbox,
119  int a_srccomp,
120  int a_destcomp,
121  int a_numcomp = 1);
122 
123  // plus operator with calling sequence similar to matching copy (for use in additive exchange operations)
124  void plus (const Box& srcbox,
125  const Interval& destcomps,
126  const Box& destbox,
127  const EdgeDataBox& src,
128  const Interval& srccomps);
129 
130 
131 
132 
133  /// {\bf Linearization Functions}
134 
135  /*@ManMemo: returns size, in number of bytes, of a flat linear
136  representation of data in components comps in edges around
137  cell-centered box R */
138  size_t size(const Box& bx, const Interval& comps) const;
139 
140  /*@ManMemo:Write a linear representaion of the internal data for
141  the edges surrounding cell-centered box R. Assumes that sufficient
142  memory for the buffer has already been allocated by the caller */
143  void linearOut(void*buf, const Box& R, const Interval& comps) const;
144 
145  /// like linearOut, but returns current position in the buffer
146  void* linearOut2(void*buf, const Box& R, const Interval& comps) const;
147 
148  ///
149  void linearIn(void* buf);
150 
151  /// read a linear representation of the data over the box \rm R
152  /**
153  Reads in the output of LinearOut
154  */
155  void linearIn(void*buf, const Box& R, const Interval& comps);
156 
157  /// like linearIn, but returns current position in the buffer
158  void* linearIn2(void*buf, const Box& R, const Interval& comps);
159 
160  ///
161  static int preAllocatable()
162  {
163  return 0;
164  }
165 
166 
167 protected:
168  ///
170 
171  ///
172  int m_nvar;
173 
174  /// BL_SPACEDIM FArrayBoxes which hold fluxes
176 
177 
178 private:
179  /// these are disallowed
180 
181  EdgeDataBox (const EdgeDataBox&);
183 
184 };
185 
186 #include "NamespaceFooter.H"
187 
188 #endif
A FArrayBox-like container for edge-centered fluxes.
Definition: EdgeDataBox.H:21
EdgeDataBox()
default constructor
one dimensional dynamic array
Definition: Vector.H:53
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:175
int nComp() const
{ access functions}
const Box & box() const
returns cell-centered box which defines EdgeDataBox
size_t size(const Box &bx, const Interval &comps) const
{ Linearization Functions}
void clear()
this function returns the EdgeDataBox to the undefined state
static int preAllocatable()
Definition: EdgeDataBox.H:161
int m_nvar
Definition: EdgeDataBox.H:172
Structure for passing component ranges in code.
Definition: Interval.H:23
void * linearOut2(void *buf, const Box &R, const Interval &comps) const
like linearOut, but returns current position in the buffer
double Real
Definition: REAL.H:33
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)
resize EdgeDataBox similar to BaseFab::resize()
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
EdgeDataBox & operator=(const EdgeDataBox &)
EdgeDataBox & plus(const EdgeDataBox &a_src, const Box &a_subbox, int a_srccomp, int a_destcomp, int a_numcomp=1)
Modifes this EdgeDataBox by adding src in the CELL-CENTERED sub-box.
void * linearIn2(void *buf, const Box &R, const Interval &comps)
like linearIn, but returns current position in the buffer
Definition: FArrayBox.H:45
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:169
~EdgeDataBox()
destructor