amr.hpp
Go to the documentation of this file.
1 
6 #ifndef AMR_HPP
7 #define AMR_HPP 1
8 
9 #include "computational_cell_2d.hpp"
10 #include "extensive.hpp"
11 #include "../common/equation_of_state.hpp"
12 #include "OuterBoundary.hpp"
13 #include "../../tessellation/tessellation.hpp"
14 #include "../../tessellation/ConvexHull.hpp"
15 #include "clipper.hpp"
16 #include "../test_2d/main_loop_2d.hpp"
17 #include "../../tessellation/polygon_overlap_area.hpp"
18 #include <boost/scoped_ptr.hpp>
20 
23 {
24 public:
25 
34  virtual ComputationalCell ConvertExtensiveToPrimitve(const Extensive& extensive,const EquationOfState& eos,
35  double volume,ComputationalCell const& old_cell,TracerStickerNames const& tracerstickernames) const = 0;
36 
38  virtual ~AMRCellUpdater(void);
39 };
40 
43 {
44 public:
45 
53  virtual Extensive ConvertPrimitveToExtensive(const ComputationalCell& cell, const EquationOfState& eos,
54  double volume,TracerStickerNames const& tracerstickernames) const = 0;
55 
57  virtual ~AMRExtensiveUpdater(void);
58 };
59 
62 {
63 public:
64  Extensive ConvertPrimitveToExtensive(const ComputationalCell& cell, const EquationOfState& eos,
65  double volume, TracerStickerNames const& tracerstickernames) const;
66 };
67 
70 {
71 private:
72  const vector<string> toskip_;
73 public:
78  explicit SimpleAMRCellUpdater(vector<string> toskip);
79 
81  double volume, ComputationalCell const& old_cell,TracerStickerNames const& tracerstickernames) const;
82 };
83 
86 {
87 public:
88  Extensive ConvertPrimitveToExtensive(const ComputationalCell& cell, const EquationOfState& eos,
89  double volume, TracerStickerNames const& tracerstickernames) const;
90 };
91 
94 {
95 private:
96  const double G_;
97  const vector<string> toskip_;
98 public:
104  explicit SimpleAMRCellUpdaterSR(double G,vector<string> toskip);
105 
107  double volume, ComputationalCell const& old_cell, TracerStickerNames const& tracerstickernames) const;
108 };
109 
112 {
113 public:
122  virtual std::pair<vector<size_t>,vector<double> > ToRemove(Tessellation const& tess,
123  vector<ComputationalCell> const& cells,double time,
124  TracerStickerNames const& tracerstickernames)const=0;
125 
127  virtual ~CellsToRemove(void);
128 };
129 
132 {
133 public:
142  virtual vector<size_t> ToRefine(Tessellation const& tess, vector<ComputationalCell> const& cells, double time,
143  TracerStickerNames const& tracerstickernames)const = 0;
144 
146  virtual ~CellsToRefine(void);
147 };
148 
150 class AMR : public Manipulate
151 {
152 protected:
153 
161 #ifdef RICH_MPI
162 #endif // RICH_MPI
164  void GetNewPoints
165  (vector<size_t> const& ToRefine,
166  Tessellation const& tess,
167  vector<std::pair<size_t, Vector2D> > &NewPoints,
168  vector<Vector2D> &Moved,
169  OuterBoundary const& obc
170 #ifdef RICH_MPI
171  , vector<Vector2D> const& proc_chull
172 #endif
173  )const;
174 #ifdef RICH_MPI
175 
182  vector<size_t> RemoveNearBoundaryPoints(vector<size_t> const&ToRemove,
183  Tessellation const& tess,vector<double> &merits)const;
184 #endif
185 
193  void GetNewPoints2
194  (vector<size_t> const& ToRefine,
195  Tessellation const& tess,
196  vector<std::pair<size_t, Vector2D> > &NewPoints,
197  vector<Vector2D> &Moved,
198  OuterBoundary const& obc)const;
199 
200 public:
205  virtual void operator() (hdsim &sim) = 0;
218 #ifdef RICH_MPI
219 #endif // RICH_MPI
221  virtual void UpdateCellsRefine(Tessellation &tess,
222  OuterBoundary const& obc, vector<ComputationalCell> &cells, EquationOfState const& eos,
223  vector<Extensive> &extensives, double time,
224 #ifdef RICH_MPI
225  Tessellation const& proctess,
226 #endif
227  TracerStickerNames const& tracerstickernames,
228  CacheData const& cd,
229  PhysicalGeometry const& pg)const = 0;
242 #ifdef RICH_MPI
243 #endif // RICH_MPI
245  virtual void UpdateCellsRemove(Tessellation &tess,
246  OuterBoundary const& obc, vector<ComputationalCell> &cells, vector<Extensive> &extensives,
247  EquationOfState const& eos, double time,
248 #ifdef RICH_MPI
249  Tessellation const& proctess,
250 #endif
251  TracerStickerNames const& tracerstickernames,
252  CacheData const& cd,
253  PhysicalGeometry const& pg)const = 0;
255  virtual ~AMR(void);
256 };
257 
260 class ConservativeAMR : public AMR
261 {
262 private:
263  CellsToRefine const& refine_;
264  CellsToRemove const& remove_;
267  const bool periodic_;
268  AMRCellUpdater* cu_;
269  AMRExtensiveUpdater* eu_;
270  LinearGaussImproved *interp_;
271 
272  ConservativeAMR(ConservativeAMR const& other);
273 
274  ConservativeAMR& operator=(ConservativeAMR const& other);
275 
276 public:
277  void operator() (hdsim &sim);
278 
288  (CellsToRefine const& refine,
289  CellsToRemove const& remove,
290  bool periodic = false,
291  LinearGaussImproved *slopes = 0,
292  AMRCellUpdater* cu=0,
293  AMRExtensiveUpdater* eu=0);
294 
295  void UpdateCellsRefine(Tessellation &tess,
296  OuterBoundary const& obc, vector<ComputationalCell> &cells,EquationOfState const& eos,
297  vector<Extensive> &extensives,double time,
298 #ifdef RICH_MPI
299  Tessellation const& proctess,
300 #endif
301  TracerStickerNames const& tracerstickernames,
302  CacheData const& cd,
303  PhysicalGeometry const& pg)const;
304 
305  void UpdateCellsRemove(Tessellation &tess,
306  OuterBoundary const& obc, vector<ComputationalCell> &cells, vector<Extensive> &extensives,
307  EquationOfState const& eos,double time,
308 #ifdef RICH_MPI
309  Tessellation const& proctess,
310 #endif
311  TracerStickerNames const& tracerstickernames,
312  CacheData const& cd,
313  PhysicalGeometry const& pg)const;
314 };
315 
317 class NonConservativeAMR : public AMR
318 {
319 private:
320  CellsToRefine const& refine_;
321  CellsToRemove const& remove_;
324  LinearGaussImproved *interp_;
325  AMRExtensiveUpdater* eu_;
326 
328 
329  NonConservativeAMR& operator=(NonConservativeAMR const& other);
330 
331 public:
332  void operator() (hdsim &sim);
333 
341  (CellsToRefine const& refine,
342  CellsToRemove const& remove,
343  LinearGaussImproved *slopes = 0,
344  AMRExtensiveUpdater* eu = 0);
345 
346  void UpdateCellsRefine(Tessellation &tess,
347  OuterBoundary const& obc, vector<ComputationalCell> &cells, EquationOfState const& eos,
348  vector<Extensive> &extensives, double time,
349 #ifdef RICH_MPI
350  Tessellation const& proctess,
351 #endif
352  TracerStickerNames const& tracerstickernames,
353  CacheData const& cd,
354  PhysicalGeometry const& pg)const;
355 
356  void UpdateCellsRemove(Tessellation &tess,
357  OuterBoundary const& obc, vector<ComputationalCell> &cells, vector<Extensive> &extensives,
358  EquationOfState const& eos, double time,
359 #ifdef RICH_MPI
360  Tessellation const& proctess,
361 #endif
362  TracerStickerNames const& tracerstickernames,
363  CacheData const& cd,
364  PhysicalGeometry const& pg)const;
365 };
366 
367 #endif // AMR_HPP
Extensive variables.
Definition: extensive.hpp:18
Simple class for extensive update scheme in amr.
Definition: amr.hpp:61
virtual ~AMRCellUpdater(void)
Class destructor.
Definition: amr.cpp:12
Outer Boundary Conditions.
Simple class for extensive update scheme in amr for SR.
Definition: amr.hpp:85
Abstract class for tessellation.
Abstract class for extensive update scheme in amr.
Definition: amr.hpp:42
Newtonian hydrodynamic simulation.
Definition: hdsim2d.hpp:43
Extensive variables.
Linear gauss interpolation.
Base class for equation of state.
Container for cache data.
Definition: cache_data.hpp:14
Abstract class for cell update scheme in amr.
Definition: amr.hpp:22
virtual ComputationalCell ConvertExtensiveToPrimitve(const Extensive &extensive, const EquationOfState &eos, double volume, ComputationalCell const &old_cell, TracerStickerNames const &tracerstickernames) const =0
Calculates the computational cell.
Base class for amr.
Definition: amr.hpp:150
Chooses which cells should be remove.
Definition: amr.hpp:111
Class for keeping the names of the tracers and stickers.
Conservative amr.
Definition: amr.hpp:260
Chooses which cells should be refined.
Definition: amr.hpp:131
Class for manual tweaking with the simulation data.
Simple class for cell update scheme in amr for SR.
Definition: amr.hpp:93
Abstract class for geometric boundary conditions for the tessellation.
Non conservative amr.
Definition: amr.hpp:317
Linear interpolation that guarantees compliance with the equation of state and calcualtes the GG grad...
Simple class for cell update scheme in amr.
Definition: amr.hpp:69
Base class for physical geometry.
Computational cell.