Skip to content

Commit

Permalink
Add options
Browse files Browse the repository at this point in the history
  • Loading branch information
guilara committed Oct 21, 2023
1 parent 93d7393 commit 7bbe997
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
7 changes: 3 additions & 4 deletions src/Domain/Creators/Sphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,9 @@ Sphere::Sphere(
: radial_partitioning_[0],
// Translation inner radius
radial_partitioning_.empty()
? outer_radius_
: radial_partitioning_.back(),
// Translation outer radius
outer_radius_);
? std::nullopt
: std::optional<std::pair<double, double>>{
{radial_partitioning_.back(), outer_radius_}});
}
}
}
Expand Down
17 changes: 10 additions & 7 deletions src/Domain/Creators/SphereTimeDependentMaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,18 @@ TimeDependentMapOptions::create_functions_of_time(
std::make_unique<FunctionsOfTime::PiecewisePolynomial<2>>(
initial_time_,
std::array<DataVector, 3>{
{{3, 0.0}, initial_translation_velocity_temp, {3, 0.0}}},
{{3, 0.0},
std::move(initial_translation_velocity_temp),
{3, 0.0}}},
expiration_times.at(translation_name));

return result;
}

void TimeDependentMapOptions::build_maps(
const std::array<double, 3>& center, const double inner_radius,
const double outer_radius, const double translation_inner_radius,
const double translation_outer_radius) {
const double outer_radius,
std::optional<std::pair<double, double>> translation_transition_radii) {
std::unique_ptr<domain::CoordinateMaps::ShapeMapTransitionFunctions::
ShapeMapTransitionFunction>
transition_func =
Expand All @@ -135,13 +137,14 @@ void TimeDependentMapOptions::build_maps(
initial_l_max_, std::move(transition_func),
shape_name, size_name};

if (translation_inner_radius == translation_outer_radius) {
if (translation_transition_radii.has_value()) {
// Uniform translation
translation_map_ = TranslationMap{translation_name};
translation_map_ = TranslationMap{
translation_name, translation_transition_radii.value().first,
translation_transition_radii.value().second};
} else {
// Translation with transition
translation_map_ = TranslationMap{
translation_name, translation_inner_radius, translation_outer_radius};
translation_map_ = TranslationMap{translation_name};
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/Domain/Creators/SphereTimeDependentMaps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ struct TimeDependentMapOptions {
* - Shape: `Shape` (with a size function of time)
* - Translation: `Translation`
*/
void build_maps(const std::array<double, 3>& center,
const double inner_radius, const double outer_radius,
const double translation_inner_radius,
const double translation_outer_radius);
void build_maps(
const std::array<double, 3>& center, const double inner_radius,
const double outer_radius,
std::optional<std::pair<double, double>> translation_transition_radii);

/*!
* \brief This will construct the map from `Frame::Distorted` to
Expand Down
7 changes: 4 additions & 3 deletions tests/Unit/Domain/Creators/Test_SphereTimeDependentMaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ void test(const bool use_non_zero_shape) {
.get()) == translation_non_zero);

for (const bool include_distorted : make_array(true, false)) {
time_dep_options.build_maps(center, inner_radius, outer_radius,
translation_inner_radius,
translation_outer_radius);
time_dep_options.build_maps(
center, inner_radius, outer_radius,
std::pair<double, double>{translation_inner_radius,
translation_outer_radius});

const auto grid_to_distorted_map =
time_dep_options.grid_to_distorted_map(include_distorted);
Expand Down

0 comments on commit 7bbe997

Please sign in to comment.