Finite Volume Solver  prototype
A framework to build finite volume solvers for the AG Klein at the Freie Universität Berlin.
SAMRAI/GriddingAlgorithm.hpp
Go to the documentation of this file.
1 // Copyright (c) 2018 Maikel Nadolski
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 // SOFTWARE.
20 
21 #ifndef FUB_SAMRAI_GRIDDING_ALGORITHM_HPP
22 #define FUB_SAMRAI_GRIDDING_ALGORITHM_HPP
23 
26 #include "fub/SAMRAI/ViewPatch.hpp"
27 
29 #include "fub/AnyInitialData.hpp"
30 #include "fub/AnyTaggingMethod.hpp"
31 
32 #include "fub/Duration.hpp"
33 
34 #include <SAMRAI/mesh/GriddingAlgorithm.h>
35 
36 namespace fub {
37 namespace samrai {
38 class GriddingAlgorithm;
39 }
40 
41 template <> struct GridTraits<samrai::GriddingAlgorithm> {
42  using PatchLevel = std::shared_ptr<SAMRAI::hier::PatchLevel>;
43  using TagDataHandle = int;
44  using DataReference = SAMRAI::hier::Patch&;
45 };
46 
47 namespace samrai {
51 
52 /// \ingroup GriddingAlgorithm
54 public:
56  AnyTaggingMethod tagging, std::vector<int> tag_buffer);
57 
60  GriddingAlgorithm tmp(ga);
61  std::swap(*this, tmp);
62  return *this;
63  }
64 
67 
68  void RegridAllFinerLevels(int level_num);
69 
70  void InitializeHierarchy(Duration initial_time = Duration(),
71  std::ptrdiff_t initial_cycle = 0);
72 
73  Duration GetTimePoint() const noexcept;
74  std::ptrdiff_t GetCycles() const noexcept;
75 
76  const PatchHierarchy& GetPatchHierarchy() const noexcept;
78 
79  const std::vector<int>& GetTagBuffer() const noexcept;
80 
81  const AnyInitialData& GetInitialData() const noexcept;
82 
83  const AnyTaggingMethod& GetTaggingMethod() const noexcept;
84 
85  const AnyBoundaryCondition& GetBoundaryCondition() const noexcept;
87 
88 private:
93 
94  std::vector<int> tag_buffer_;
95  std::shared_ptr<SAMRAI::xfer::RefineAlgorithm> refine_data_algorithm_{};
96  std::shared_ptr<SAMRAI::mesh::GriddingAlgorithm> algorithm_{};
97 };
98 
99 } // namespace samrai
100 } // namespace fub
101 
102 #endif
This is a polymorphic value type that wraps any BoundaryCondition object.
Definition: AnyBoundaryCondition.hpp:55
This class is a polymoprhic value type which stores components to initialize a gridding algorithm dur...
Definition: AnyInitialData.hpp:53
This class is a polymorphic value type that stores objects which satisfies the TaggingMethod<Gridding...
Definition: AnyTaggingMethod.hpp:48
Definition: SAMRAI/GriddingAlgorithm.hpp:53
const AnyInitialData & GetInitialData() const noexcept
AnyInitialData initial_data_
Definition: SAMRAI/GriddingAlgorithm.hpp:90
std::shared_ptr< SAMRAI::xfer::RefineAlgorithm > refine_data_algorithm_
Definition: SAMRAI/GriddingAlgorithm.hpp:95
const AnyTaggingMethod & GetTaggingMethod() const noexcept
GriddingAlgorithm(GriddingAlgorithm &&ph)=default
AnyBoundaryCondition boundary_condition_
Definition: SAMRAI/GriddingAlgorithm.hpp:92
const AnyBoundaryCondition & GetBoundaryCondition() const noexcept
GriddingAlgorithm(PatchHierarchy hier, AnyInitialData initial_data, AnyTaggingMethod tagging, std::vector< int > tag_buffer)
GriddingAlgorithm(const GriddingAlgorithm &ga)
const std::vector< int > & GetTagBuffer() const noexcept
void RegridAllFinerLevels(int level_num)
std::shared_ptr< SAMRAI::mesh::GriddingAlgorithm > algorithm_
Definition: SAMRAI/GriddingAlgorithm.hpp:96
GriddingAlgorithm & operator=(const GriddingAlgorithm &ga)
Definition: SAMRAI/GriddingAlgorithm.hpp:59
GriddingAlgorithm & operator=(GriddingAlgorithm &&ph)=default
std::ptrdiff_t GetCycles() const noexcept
AnyTaggingMethod tagging_method_
Definition: SAMRAI/GriddingAlgorithm.hpp:91
std::vector< int > tag_buffer_
Definition: SAMRAI/GriddingAlgorithm.hpp:94
Duration GetTimePoint() const noexcept
PatchHierarchy hierarchy_
Definition: SAMRAI/GriddingAlgorithm.hpp:89
const PatchHierarchy & GetPatchHierarchy() const noexcept
void InitializeHierarchy(Duration initial_time=Duration(), std::ptrdiff_t initial_cycle=0)
Definition: SAMRAI/PatchHierarchy.hpp:69
std::decay_t< decltype(*std::declval< T >().GetGriddingAlgorithm())> GriddingAlgorithm
A template typedef to detect the member function.
Definition: Meta.hpp:56
The fub namespace.
Definition: AnyBoundaryCondition.hpp:31
std::chrono::duration< double > Duration
Definition: Duration.hpp:31
int TagDataHandle
Definition: SAMRAI/GriddingAlgorithm.hpp:43
std::shared_ptr< SAMRAI::hier::PatchLevel > PatchLevel
Definition: SAMRAI/GriddingAlgorithm.hpp:42
SAMRAI::hier::Patch & DataReference
Definition: SAMRAI/GriddingAlgorithm.hpp:44
Definition: Meta.hpp:67