Chombo + EB + MF  3.2
DerivStencil.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 _DERIVSTENCIL_H_
12 #define _DERIVSTENCIL_H_
13 
14 #include <iostream>
15 #include <math.h>
16 #include "SPACE.H"
17 #include <stdlib.h>
18 #include "REAL.H"
19 #include "IntVect.H"
20 #include "Vector.H"
21 #include "NamespaceHeader.H"
22 
23 ///class to encapsulate the operations to create derivs on irreg stencils
24 /**
25  DerivStencil is meant to be used to encapsulate the information
26  necessary to take finite difference derivatives at a point in
27  space. Every point in the stencil has a weight. You add them
28  (the boxarrayindex and the weight) at the same time and you can manipulate
29  the weights enmasse by real number operations. Stencils may not
30  interact with each other with the same sort of arithmetic because
31  that would bring up issues as to what to do when there is
32  incomplete intersection between the stencils.
33 
34  */
36 {
37 public:
38  ///
39  void define();
40 
41  ///
42  /** return true if any define function been called.
43  */
44  bool isDefined() const
45  {
46  return isdefined;
47  }
48 
49  ///
50  /**
51  default constructor; creates empty vectors
52  */
53  DerivStencil();
54 
55  ///
56  /**
57  copy constructor; sets *this = a_dsin
58  */
59  DerivStencil(const DerivStencil& a_dsin);
60 
61  ///
62  ~DerivStencil();
63 
64  ///
65  /**
66  make derivstencil empty
67  */
68  void clear();
69 
70  ///
71  /**
72  return length of vectors
73  */
74  int size() const;
75 
76  ///
77  /**
78  get iv at ivec
79  */
80  const IntVect& getIndex(int a_ivec) const;
81 
82  ///
83  /**
84  get weight at ivec
85  */
86  const Real& getWeight(int a_ivec) const;
87 
88  ///
89  /**
90  add another set if the IntVect is not in the
91  stencil already. \\
92  **Add the weight to the existing weight otherwise**
93  */
94  void accumulate(const IntVect& a_iv, Real a_weight);
95 
96  ///
97  /**
98  assignment operator
99  */
100  const DerivStencil& operator=(const DerivStencil& a_dsin);
101 
102  ///
103  /**
104  Multiply each weight by a_facin
105  does nothing if vectors are of zero length
106  */
107  const DerivStencil& operator*=(Real a_facin);
108 
109  ///
110  /**
111  divide each weight by a_denom
112  does nothing if vectors are of zero length.
113  Be advised ---
114  This function does no checking to see if a_denom
115  is close to zero.
116  */
117  const DerivStencil& operator/=(Real a_denom);
118 
119  ///
120  /**
121  add a_facin to each weight
122  does nothing if vectors are of zero length
123  */
124  const DerivStencil& operator+=(Real a_facin);
125 
126  ///
127  /**
128  subtract a_facin from each weight
129  does nothing if vectors are of zero length
130  */
131  const DerivStencil& operator-=(Real a_facin);
132 
133 protected:
134  ///
136  ///
138  ///
139  bool isdefined;
140 };
141 
142 #include "NamespaceFooter.H"
143 #endif
const Real & getWeight(int a_ivec) const
const DerivStencil & operator/=(Real a_denom)
const DerivStencil & operator*=(Real a_facin)
const DerivStencil & operator+=(Real a_facin)
Vector< Real > m_vectWgt
Definition: DerivStencil.H:137
const IntVect & getIndex(int a_ivec) const
int size() const
double Real
Definition: REAL.H:33
class to encapsulate the operations to create derivs on irreg stencils
Definition: DerivStencil.H:35
bool isdefined
Definition: DerivStencil.H:139
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
const DerivStencil & operator-=(Real a_facin)
Vector< IntVect > m_vectIV
Definition: DerivStencil.H:135
void accumulate(const IntVect &a_iv, Real a_weight)
bool isDefined() const
Definition: DerivStencil.H:44
const DerivStencil & operator=(const DerivStencil &a_dsin)