Line data Source code
1 1 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : /// \file 5 : /// Defines class DomainCreator. 6 : 7 : #pragma once 8 : 9 : #include <array> 10 : #include <cstddef> 11 : #include <memory> 12 : #include <string> 13 : #include <unordered_map> 14 : #include <unordered_set> 15 : #include <vector> 16 : 17 : #include "DataStructures/Tensor/Tensor.hpp" 18 : #include "Domain/FunctionsOfTime/FunctionOfTime.hpp" 19 : #include "Domain/Structure/DirectionMap.hpp" 20 : 21 : /// \cond 22 : namespace Frame { 23 : struct Grid; 24 : } // namespace Frame 25 : template <size_t> 26 : class Domain; 27 : namespace domain::BoundaryConditions { 28 : class BoundaryCondition; 29 : } 30 : /// \endcond 31 : 32 : namespace domain { 33 : /// \ingroup ComputationalDomainGroup 34 : /// \brief Defines classes that create Domains. 35 : namespace creators {} 36 : } // namespace domain 37 : 38 : /// \ingroup ComputationalDomainGroup 39 : /// \brief Base class for creating Domains from an option string. 40 : template <size_t VolumeDim> 41 1 : class DomainCreator { 42 : public: 43 0 : static constexpr size_t volume_dim = VolumeDim; 44 : 45 0 : DomainCreator() = default; 46 0 : DomainCreator(const DomainCreator<VolumeDim>&) = delete; 47 0 : DomainCreator(DomainCreator<VolumeDim>&&) = default; 48 0 : DomainCreator<VolumeDim>& operator=(const DomainCreator<VolumeDim>&) = delete; 49 0 : DomainCreator<VolumeDim>& operator=(DomainCreator<VolumeDim>&&) = default; 50 0 : virtual ~DomainCreator() = default; 51 : 52 0 : virtual Domain<VolumeDim> create_domain() const = 0; 53 : 54 : /// A set of named coordinates in the grid frame, like the center of the 55 : /// domain or the positions of specific objects in a domain 56 : virtual std::unordered_map<std::string, 57 : tnsr::I<double, VolumeDim, Frame::Grid>> 58 1 : grid_anchors() const { 59 : return {}; 60 : } 61 : 62 : /// The set of external boundary condition for every block in the domain 63 : virtual std::vector<DirectionMap< 64 : VolumeDim, 65 : std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>>> 66 1 : external_boundary_conditions() const = 0; 67 : 68 : /// A human-readable name for every block, or empty if the domain creator 69 : /// doesn't support block names (yet). 70 1 : virtual std::vector<std::string> block_names() const { return {}; } 71 : 72 : /// Labels to refer to groups of blocks. The groups can overlap, and they 73 : /// don't have to cover all blocks in the domain. The groups can be used to 74 : /// refer to multiple blocks at once when specifying input-file options. 75 : virtual std::unordered_map<std::string, std::unordered_set<std::string>> 76 1 : block_groups() const { 77 : return {}; 78 : } 79 : 80 : /// Obtain the initial grid extents of the Element%s in each block. 81 1 : virtual std::vector<std::array<size_t, VolumeDim>> initial_extents() 82 : const = 0; 83 : 84 : /// Obtain the initial refinement levels of the blocks. 85 1 : virtual std::vector<std::array<size_t, VolumeDim>> initial_refinement_levels() 86 : const = 0; 87 : 88 : /// Retrieve the functions of time used for moving meshes. 89 : // LCOV_EXCL_START 90 1 : virtual auto functions_of_time(const std::unordered_map<std::string, double>& 91 : initial_expiration_times = {}) const 92 : -> std::unordered_map< 93 : std::string, 94 : std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>> { 95 : (void)(initial_expiration_times); 96 : return {}; 97 : } 98 : // LCOV_EXCL_STOP 99 : };