Chombo + EB + MF  3.2
BinFabFactory.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 // ANAG, LBNL
12 
13 #ifndef _BINFABFACTORY_H_
14 #define _BINFABFACTORY_H_
15 
16 #include "BoxLayoutData.H"
17 #include "BinFab.H"
18 #include "DataIndex.H"
19 #include "NamespaceHeader.H"
20 
21 /// Factory class to produce one or more instances of \p BinFab on the same level.
22 /**
23  The mesh and \p ProblemDomain will be the same for all instances created
24  by the factory. This is needed for LevelData construction.
25 */
26 template <class T>
28  : public DataFactory<BinFab<T> >
29 {
30 public:
31  /// Factory function.
32  /**
33  Creates a new \p BinFab object and returns a pointer to it.
34  Responsiblitly for calling operator 'delete' on this pointer
35  is passed to the user.
36 
37  Assumes \a a_ncomps is 1 and ignores \a a_dit.
38  */
39  virtual BinFab<T>* create(const Box& a_box,
40  int a_numComps,
41  const DataIndex& a_dit) const;
42 
43  /// Use these parameters for all manufactured \p BinFab instances.
44  /**
45  Fills internal data with inputs
46  */
47  BinFabFactory(const RealVect& a_meshSpacing,
48  const RealVect& a_origin)
49  {
50  define(a_meshSpacing,a_origin);
51  }
52 
53  /// Use these parameters for all manufactured \p BinFab instances, default the rest
54  /**
55  Fills internal data with inputs, defaulting origin to 0 and promoting meshspacing
56  from scalar to RealVect
57  */
58  BinFabFactory(const Real& a_meshSpacing)
59  {
60  define(RealVect::Unit*a_meshSpacing,RealVect::Zero);
61  };
62 
63  /// Use these parameters for all manufactured \p BinFab instances.
64  /**
65  Fills internal data with inputs
66  */
67  void define(const RealVect& a_meshSpacing,
68  const RealVect& a_origin);
69 
70  /// Destructor
71  virtual ~BinFabFactory();
72 
73 private:
74  /// cell size in physical coordinates
76 
77  /// location in physical space of the lower corner of the 0 cell
79 
80 };
81 
82 #include "NamespaceFooter.H"
83 
84 // Implementation
85 #include "BinFabFactoryI.H"
86 
87 #endif
virtual BinFab< T > * create(const Box &a_box, int a_numComps, const DataIndex &a_dit) const
Factory function.
Definition: BinFabFactoryI.H:33
void define(const RealVect &a_meshSpacing, const RealVect &a_origin)
Use these parameters for all manufactured BinFab instances.
Definition: BinFabFactoryI.H:24
RealVect m_origin
location in physical space of the lower corner of the 0 cell
Definition: BinFabFactory.H:78
static const RealVect Unit
Definition: RealVect.H:427
static const RealVect Zero
Definition: RealVect.H:421
double Real
Definition: REAL.H:33
BinFabFactory(const Real &a_meshSpacing)
Use these parameters for all manufactured BinFab instances, default the rest.
Definition: BinFabFactory.H:58
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
Definition: DataIndex.H:114
RealVect m_mesh_spacing
cell size in physical coordinates
Definition: BinFabFactory.H:75
Factory object to data members of a BoxLayoutData container.
Definition: BoxLayoutData.H:30
BinFabFactory(const RealVect &a_meshSpacing, const RealVect &a_origin)
Use these parameters for all manufactured BinFab instances.
Definition: BinFabFactory.H:47
Base class for particle data on a Box.
Definition: BinFab.H:30
virtual ~BinFabFactory()
Destructor.
Definition: BinFabFactoryI.H:18
Factory class to produce one or more instances of BinFab on the same level.
Definition: BinFabFactory.H:27