Chombo + EB + MF  3.2
ArrayViewData.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 _ARRAYVIEWDATA_H_
12 #define _ARRAYVIEWDATA_H_
13 
14 #include "REAL.H"
15 #include "BaseFab.H"
16 #include "FArrayBox.H"
17 #include "LayoutData.H"
18 #include "NamespaceHeader.H"
19 
20 /// Special LayoutData type for use with ArrayView
21 /** ArrayViewData is a wrapper around LayoutData for BaseFab<Real> or
22  * FArrayBox for use in ArrayView. It provides random access to the
23  * individual FABs and the ability to directly set the data in them. It is
24  * intended to work only in ArrayView. Any other attept to use this class
25  * is unsupported.
26  */
27 
29 {
30 public:
32  :
33  m_layoutdata_ptr(NULL)
34  {}
35 
37  {}
38 
39  ArrayViewData(LayoutData<BaseFab<Real> >* a_layoutdata_ptr)
40  :
41  m_layoutdata_ptr(a_layoutdata_ptr)
42  {}
43 
45  :
46  m_layoutdata_ptr((LayoutData<BaseFab<Real> >*) a_layoutdata_ptr)
47  {}
48 
49  /// Access a single FAB in the LayoutData using its internal index
51  {
52  return *(m_layoutdata_ptr->m_vector[a_elem]);
53  }
54 
55  /// Substitute a different FAB into the LayoutData
56  /** The caller is responsible for managing the memory used by the FAB that
57  * is being replaced.
58  */
59  void set(int a_elem,
60  BaseFab<Real>* a_fab_ptr)
61  {
62  m_layoutdata_ptr->m_vector[a_elem] = a_fab_ptr;
63  }
64 
65 
66 private:
68 };
69 
70 #include "NamespaceFooter.H"
71 #endif
Special LayoutData type for use with ArrayView.
Definition: ArrayViewData.H:28
Vector< T * > m_vector
Definition: LayoutData.H:124
Data that maintains a one-to-one mapping of T to the boxes in a BoxLayout.
Definition: BoxLayout.H:26
~ArrayViewData()
Definition: ArrayViewData.H:36
ArrayViewData(LayoutData< BaseFab< Real > > *a_layoutdata_ptr)
Definition: ArrayViewData.H:39
double Real
Definition: REAL.H:33
ArrayViewData()
Definition: ArrayViewData.H:31
BaseFab< Real > & operator[](int a_elem)
Access a single FAB in the LayoutData using its internal index.
Definition: ArrayViewData.H:50
ArrayViewData(LayoutData< FArrayBox > *a_layoutdata_ptr)
Definition: ArrayViewData.H:44
LayoutData< BaseFab< Real > > * m_layoutdata_ptr
Definition: ArrayViewData.H:67