Chombo + EB  3.0
MiniIVFAB.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 _MINIIVFAB_H_
12 #define _MINIIVFAB_H_
13 
14 #include <cmath>
15 #include <cstdlib>
16 #include "SPACE.H"
17 #include "Vector.H"
18 #include "IntVectSet.H"
19 #include "VolIndex.H"
20 #include "BaseFab.H"
21 #include "EBGraph.H"
22 #include "BaseIVFAB.H"
23 #include "NamespaceHeader.H"
24 
25 ///
26 /**
27  MiniIVFAB is a templated
28  data holder defined at the VoFs of an irregular domain.
29 
30 Implemented as just a raw vector of vofs and data, more optimized
31 for smaller memory footprint and faster linearIn/linearOut. will
32 be more brutal for vof-by-vof indexing.
33 bvs
34 */
35 template <class T>
36 class MiniIVFAB : public BaseIVFAB<T>
37 {
38 public:
39  ///
40  /**
41  Default constructor. Constructs an uninitialized IVFAB. You must
42  subsequently call {\bf define} before using this IVFAB.
43  */
44  MiniIVFAB();
45 
46  ///
47  /**
48  Defining constructor. Specifies the irregular domain
49  and the number of data components per VoF. The irregular domain
50  must lie completely within the EBGraph. The
51  contents are uninitialized. Calls full define function.
52  */
53  MiniIVFAB(const IntVectSet& a_region,
54  const EBGraph& a_ebgraph,
55  const int& a_nvarin);
56 
57  ///
58  /**
59  Constructs an 'aliased' BaseIVFAB of the requested interval of the
60  argument BaseIVFAB. This BaseIVFAB does not allocate any memory, but
61  sets its data pointer into the memory pointed to by the argument
62  BaseIVFAB. It is the users responsiblity to ensure this aliased
63  BaseIVFAB is not used after the original BaseIVFAB has deleted its data ptr
64  (resize, define(..) called, or destruction, etc.).
65 
66  This aliased BaseIVFAB will also generate side effects (modifying the values
67  of data in one will modify the other's data).
68 
69  This aliased BaseIVFAB will have a_comps.size() components, starting at zero.
70  */
71  MiniIVFAB(const Interval& a_comps,
72  BaseIVFAB<T>& a_original);
73 
74 
75  ///
76  virtual ~MiniIVFAB();
77 
78  ///
79  /**
80  Full define function. Specifies the irregular domain and the
81  number of data components per VoF. The irregular domain
82  must lie completely within the EBGraph. The contents
83  are uninitialized. If it has previously been defined, the old definition
84  data is overwritten and lost.
85  */
86  virtual void define(const IntVectSet& a_region,
87  const EBGraph& a_ebgraph,
88  const int& a_nvarin);
89 
90 
91 
92 
93  ///
94  int size(const Box& R, const Interval& comps) const ;
95 
96  ///
97  void linearOut(void* buf, const Box& R, const Interval& comps) const;
98 
99  ///
100  void linearIn(void* buf, const Box& R, const Interval& comps);
101 
102  ///
103  /**
104  Remove all data from this BaseIVFAB.
105  You must call {\bf define} again in order
106  to use it.
107  */
108  virtual void clear();
109 
110  const Vector<VolIndex>& getVoFs() const;
111 
112  ///invalid but necessary for leveldata to compile
113  MiniIVFAB(const Box& a_region, int a_nVar)
114  {
115  MayDay::Error("invalid constructor called for MiniIVFAB");
116  }
117 
118  ///get index into vector
119  /**
120  needs to be public so that bulk stencils can be constructed
121  */
122  virtual T* getIndex(const VolIndex& a_vof,const int& a_comp) const;
123 
124 private:
125  virtual void
127 
128 protected:
129 
131 
132 };
133 
134 #include "NamespaceFooter.H"
135 
136 #ifndef CH_EXPLICIT_TEMPLATES
137 #include "MiniIVFABI.H"
138 #endif
139 
140 #endif
MiniIVFAB()
Definition: MiniIVFABI.H:26
Vector< VolIndex > m_vofs
Definition: MiniIVFAB.H:130
virtual void define(const IntVectSet &a_region, const EBGraph &a_ebgraph, const int &a_nvarin)
Definition: MiniIVFABI.H:48
virtual void clear()
Definition: MiniIVFABI.H:177
virtual ~MiniIVFAB()
Definition: MiniIVFABI.H:32
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
int size(const Box &R, const Interval &comps) const
Definition: MiniIVFABI.H:85
virtual T * getIndex(const VolIndex &a_vof, const int &a_comp) const
get index into vector
Definition: MiniIVFABI.H:159
Geometric description within a box.
Definition: EBGraph.H:432
Structure for passing component ranges in code.
Definition: Interval.H:23
void linearIn(void *buf, const Box &R, const Interval &comps)
Definition: MiniIVFABI.H:136
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
void linearOut(void *buf, const Box &R, const Interval &comps) const
Definition: MiniIVFABI.H:104
const Vector< VolIndex > & getVoFs() const
Definition: MiniIVFABI.H:188
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
Volume of Fluid Index.
Definition: VolIndex.H:31
MiniIVFAB(const Box &a_region, int a_nVar)
invalid but necessary for leveldata to compile
Definition: MiniIVFAB.H:113
virtual void setDefaultValues()
Definition: MiniIVFABI.H:197
Definition: BaseIVFAB.H:32
Definition: MiniIVFAB.H:36