Chombo + EB + MF  3.2
AggStencil.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 _AGGSTENCIL_H_
12 #define _AGGSTENCIL_H_
13 
14 #include "Stencils.H"
15 #include "BaseIndex.H"
16 #include "Vector.H"
17 #include "REAL.H"
18 #include "CH_Timer.H"
19 #include "RefCountedPtr.H"
20 #include "NamespaceHeader.H"
21 
22 /// Aggregated stencil
23 /**
24  srcData_t classes need the following functions
25  int dataType(BaseIndex);
26  int offset(BaseIndex);
27  Real* dataPtr(int dataType, int ivar);
28 
29  dstData_t classes need the following functions
30  int dataType(BaseIndex);
31  int offset(BaseIndex);
32  Real* dataPtr(int dataType, int ivar);
33 
34  sten_t classes need the following functions
35  srcIndex_t index(int isten)
36  Real weight(int isten)
37  */
38 template <class srcData_t, class dstData_t>
40 {
41 public:
42  ///
43  /**
44  a_dstIndex is where the answers will go.
45  a_srcStencil is the stencil into the src data
46  a_srcData is to provide offsets for source data (can be a dummy but must be the right size)
47  a_dstData is to provide offsets for destin data (can be a dummy but must be the right size)
48  */
49  AggStencil(const Vector<RefCountedPtr<BaseIndex > >& a_dstVoFs,
50  const Vector<RefCountedPtr<BaseStencil> >& a_stencil,
51  const srcData_t & a_srcData,
52  const dstData_t & a_dstData);
53 
54  ///
56  {
57  }
58 
59  ///
60  void apply(dstData_t & a_lph,
61  const srcData_t & a_phi,
62  const int & a_varDest,
63  const bool & a_incrementOnly) const;
64 
65  ///
66  /**
67  for applying a scalar operator to multiple operators.
68  Sets the initial variable for destination to a_varDest
69  Sets dataPtr for a_phi initial variable to a_varSrc
70  Runs over ncomp components
71  */
72  void apply(dstData_t & a_lph,
73  const srcData_t & a_phi,
74  const int & a_src,
75  const int & a_dst,
76  const int & a_nco,
77  const bool & a_incrementOnly) const;
78 
79  ///
80  void cache(const dstData_t& a_lph) const;
81 
82  ///
83  void uncache( dstData_t& a_phi) const;
84 
85  struct
86  {
87  size_t offset;
88  int dataID;
89  } typedef access_t;
90 
92 
93 protected:
94 
95  int m_destVar;
99 
100 private:
101  /// disallowed operators. Without code because Jeff says that is better.
102 
103  ///weak construction is bad.
104  AggStencil();
105 
106  ///deep copy for this object would kill performance
107  AggStencil& operator=(const AggStencil& stenin);
108 
109  ///no reason to allow this one either.
110  AggStencil(const AggStencil& stenin);
111 
112 };
113 
114 #include "AggStencilI.H"
115 #include "NamespaceFooter.H"
116 #endif
A reference-counting handle class.
Definition: RefCountedPtr.H:173
int dataID
Definition: AggStencil.H:88
one dimensional dynamic array
Definition: Vector.H:53
Vector< pair< access_t, Real > > stencil_t
Definition: AggStencil.H:91
Definition: AggStencil.H:85
Aggregated stencil.
Definition: AggStencil.H:39
Vector< Vector< Real > > m_cacheDst
Definition: AggStencil.H:98
AggStencil()
disallowed operators. Without code because Jeff says that is better.
Vector< stencil_t > m_ebstencil
Definition: AggStencil.H:96
void uncache(dstData_t &a_phi) const
Definition: AggStencilI.H:137
void apply(dstData_t &a_lph, const srcData_t &a_phi, const int &a_varDest, const bool &a_incrementOnly) const
Definition: AggStencilI.H:48
Vector< access_t > m_dstAccess
Definition: AggStencil.H:97
int m_destVar
Definition: AggStencil.H:95
void cache(const dstData_t &a_lph) const
Definition: AggStencilI.H:112
AggStencil & operator=(const AggStencil &stenin)
deep copy for this object would kill performance
~AggStencil()
Definition: AggStencil.H:55
size_t offset
Definition: AggStencil.H:87