Chombo + EB  3.2
CFStencil.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 _CFSTENCIL_H_
12 #define _CFSTENCIL_H_
13 
14 #include <iostream>
15 #include <math.h>
16 #include "SPACE.H"
17 #include <stdlib.h>
18 #include "DisjointBoxLayout.H"
19 #include "Box.H"
20 #include "LoHiSide.H"
21 #include "IntVectSet.H"
22 #include "NamespaceHeader.H"
23 
24 /// Class to encapsulate coarse-fine information for AMR operations.
25 /**
26  CFStencil is a wrapper around a bunch of things
27  that allow one to do coarse-fine interpolation.
28  This class should be considered internal to QuadCFInterp
29  and should not be considered part of the Chombo API.
30  */
31 class CFStencil
32 {
33 
34 private:
35 
36 protected:
37  //for internal use
38  void setDefaultValues();
39 
40  //the following variables are mainly for self-identification
41 
42  // direction normal to interface
44 
45  // interface is on high or low side of grid
47 
48  //
50 
51  //the following variables are to be used by others
52 
53  /* fine intvects which need to be interpolated */
55 
56  /* coar intvects where slopes can be computed
57  == coarsened version of fiinterp ivs*/
59 
61 
62  bool m_isPacked;
63 
65 
66 public:
67  /// {\bf Access functions}
68 
69  ///
70  /** returns true if CFStencil is defined */
71  bool isDefined() const;
72 
73  ///
74  /**
75  are there any interpolation points? \\
76  returns false if so.*/
77  bool isEmpty() const;
78 
79  ///
80  bool isPacked() const
81  {
82  return m_isPacked;
83  }
84  ///
85  const Box& packedBox() const
86 
87  {
88  return m_packedBox;
89  }
90 
91  ///
92  /** get fine intvects which need to be interpolated \\
93  This will be empty if isEmpty() returns true*/
94  const IntVectSet& getFineIVS() const;
95 
96  ///
97  /** get coarse intvects that underly fiinterpivs.
98  This will be empty if isEmpty() returns true
99  this is the same as getCoarInterpIVS
100  */
101  const IntVectSet& getCoarIVS() const ;
102 
103  ///
104  CFStencil& operator= (const CFStencil& cfs_in);
105 
106  ///
107  CFStencil(const CFStencil& cfs_in);
108 
109  /*dummy constructor so i can use this with
110  LocalBoxLayoutData
111  */
112  CFStencil(const Box& a_b, int a_nComp);
113 
114  void define(const Box& a_b, int a_nComp);
115 
116  ///
117  CFStencil();
118 
119  ///
120  ~CFStencil();
121 
122  ///
123  CFStencil(
124  const Box& FineDomain,
125  const Box& grid,
126  const DisjointBoxLayout& Levboxes,
127  const DisjointBoxLayout& LevCBoxes,
128  int RefRatio,
129  int Direction,
130  Side::LoHiSide hiorlo);
131 
132  ///
133  CFStencil(
134  const ProblemDomain& FineDomain,
135  const Box& grid,
136  const DisjointBoxLayout& Levboxes,
137  const DisjointBoxLayout& LevCBoxes,
138  int RefRatio,
139  int Direction,
140  Side::LoHiSide hiorlo);
141 
142  ///
143  void define(
144  const Box& FineDomain,
145  const Box& grid,
146  const DisjointBoxLayout& fine_boxes,
147  const DisjointBoxLayout& coar_boxes,
148  int Refratio,
149  int Direction,
150  Side::LoHiSide hiorlo);
151 
152  ///
153  void define(
154  const ProblemDomain& FineDomain,
155  const Box& grid,
156  const DisjointBoxLayout& fine_boxes,
157  const DisjointBoxLayout& coar_boxes,
158  int Refratio,
159  int Direction,
160  Side::LoHiSide hiorlo);
161 
162  /// faster define function that uses a sorted periodic vector
163  /** user calls the helper function "buildPeriodicVector", then
164  uses that returned Vector<Box> in the subsequent calls to this define.
165  */
166  void define(
167  const ProblemDomain& a_fineDomain,
168  const Box& a_grid,
169  const Vector<Box>& a_periodicVector,
170  int a_refRatio,
171  int a_direction,
172  Side::LoHiSide a_hiorlo);
173  ///
174  void clear();
175 
176 
177  static void buildPeriodicVector(Vector<Box>& a_periodicVector,
178  const ProblemDomain& a_fineDomain,
179  const DisjointBoxLayout& a_fineBoxes);
180 
181 };
182 #include "NamespaceFooter.H"
183 #endif
bool m_isPacked
Definition: CFStencil.H:62
DataIndex m_dataIndex
Definition: CFStencil.H:49
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
bool m_isDefined
Definition: CFStencil.H:60
void setDefaultValues()
void clear()
bool isEmpty() const
IntVectSet m_fineIVS
Definition: CFStencil.H:54
Class to encapsulate coarse-fine information for AMR operations.
Definition: CFStencil.H:31
CFStencil & operator=(const CFStencil &cfs_in)
const IntVectSet & getFineIVS() const
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
LoHiSide
Definition: LoHiSide.H:27
bool isDefined() const
{ Access functions}
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
const Box & packedBox() const
Definition: CFStencil.H:85
Definition: DataIndex.H:112
static void buildPeriodicVector(Vector< Box > &a_periodicVector, const ProblemDomain &a_fineDomain, const DisjointBoxLayout &a_fineBoxes)
Side::LoHiSide m_hiorlo
Definition: CFStencil.H:46
bool isPacked() const
Definition: CFStencil.H:80
void define(const Box &a_b, int a_nComp)
IntVectSet m_coarIVS
Definition: CFStencil.H:58
Box m_packedBox
Definition: CFStencil.H:64
int m_direction
Definition: CFStencil.H:43
const IntVectSet & getCoarIVS() const