Skip to content

Commit

Permalink
Remove some unnecessary tpp includes from headers
Browse files Browse the repository at this point in the history
  • Loading branch information
wthrowe committed Feb 19, 2025
1 parent 5525b1d commit f134dac
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 51 deletions.
42 changes: 41 additions & 1 deletion src/Domain/CoordinateMaps/CoordinateMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "Domain/FunctionsOfTime/FunctionOfTime.hpp"
#include "Utilities/Serialization/CharmPupable.hpp"
#include "Utilities/TMPL.hpp"
#include "Utilities/TypeTraits/CreateIsCallable.hpp"

/// \cond
class DataVector;
Expand All @@ -37,11 +38,50 @@ namespace TimeDependent {}
template <typename FirstMap, typename... Maps>
constexpr size_t map_dim = FirstMap::dim;
} // namespace CoordinateMaps

namespace CoordinateMap_detail {
CREATE_IS_CALLABLE(function_of_time_names)
CREATE_IS_CALLABLE_V(function_of_time_names)

template <typename T>
struct map_type {
using type = T;
};

template <typename T>
struct map_type<std::unique_ptr<T>> {
using type = T;
};

template <typename T>
using map_type_t = typename map_type<T>::type;

template <typename... Maps, size_t... Is>
std::unordered_set<std::string> initialize_names(
const std::tuple<Maps...>& maps, std::index_sequence<Is...> /*meta*/);
const std::tuple<Maps...>& maps, std::index_sequence<Is...> /*meta*/) {
std::unordered_set<std::string> function_of_time_names{};
const auto add_names = [&function_of_time_names, &maps](auto index) {
const auto& map = std::get<decltype(index)::value>(maps);
using TupleMap = std::decay_t<decltype(map)>;
constexpr bool map_is_unique_ptr = tt::is_a_v<std::unique_ptr, TupleMap>;
using Map = map_type_t<TupleMap>;
if constexpr (is_function_of_time_names_callable_v<Map>) {
if constexpr (map_is_unique_ptr) {
const auto& names = map->function_of_time_names();
function_of_time_names.insert(names.begin(), names.end());
} else {
const auto& names = map.function_of_time_names();
function_of_time_names.insert(names.begin(), names.end());
}
} else {
(void)function_of_time_names;
}
};
EXPAND_PACK_LEFT_TO_RIGHT(add_names(std::integral_constant<size_t, Is>{}));

return function_of_time_names;
}
} // namespace CoordinateMap_detail

/*!
* \ingroup CoordinateMapsGroup
Expand Down
43 changes: 0 additions & 43 deletions src/Domain/CoordinateMaps/CoordinateMap.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,11 @@
#include "Utilities/Serialization/CharmPupable.hpp"
#include "Utilities/TMPL.hpp"
#include "Utilities/Tuple.hpp"
#include "Utilities/TypeTraits/CreateIsCallable.hpp"
#include "Utilities/TypeTraits/IsA.hpp"

/// \cond
namespace domain {
namespace CoordinateMap_detail {
CREATE_IS_CALLABLE(function_of_time_names)
CREATE_IS_CALLABLE_V(function_of_time_names)

template <size_t Dim, typename T>
using combined_coords_frame_velocity_jacs_t =
decltype(std::declval<T>().coords_frame_velocity_jacobian(
Expand All @@ -63,45 +59,6 @@ struct has_combined_coords_frame_velocity_jacs<
template <size_t Dim, typename T>
inline constexpr bool has_combined_coords_frame_velocity_jacs_v =
has_combined_coords_frame_velocity_jacs<Dim, T>::value;

template <typename T>
struct map_type {
using type = T;
};

template <typename T>
struct map_type<std::unique_ptr<T>> {
using type = T;
};

template <typename T>
using map_type_t = typename map_type<T>::type;

template <typename... Maps, size_t... Is>
std::unordered_set<std::string> initialize_names(
const std::tuple<Maps...>& maps, std::index_sequence<Is...> /*meta*/) {
std::unordered_set<std::string> function_of_time_names{};
const auto add_names = [&function_of_time_names, &maps](auto index) {
const auto& map = std::get<decltype(index)::value>(maps);
using TupleMap = std::decay_t<decltype(map)>;
constexpr bool map_is_unique_ptr = tt::is_a_v<std::unique_ptr, TupleMap>;
using Map = map_type_t<TupleMap>;
if constexpr (is_function_of_time_names_callable_v<Map>) {
if constexpr (map_is_unique_ptr) {
const auto& names = map->function_of_time_names();
function_of_time_names.insert(names.begin(), names.end());
} else {
const auto& names = map.function_of_time_names();
function_of_time_names.insert(names.begin(), names.end());
}
} else {
(void)function_of_time_names;
}
};
EXPAND_PACK_LEFT_TO_RIGHT(add_names(std::integral_constant<size_t, Is>{}));

return function_of_time_names;
}
} // namespace CoordinateMap_detail

template <typename SourceFrame, typename TargetFrame, typename... Maps>
Expand Down
1 change: 1 addition & 0 deletions src/Domain/Creators/TimeDependence/ScalingAndZRotation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "Domain/CoordinateMaps/CoordinateMap.hpp"
#include "Domain/CoordinateMaps/Identity.hpp"
#include "Domain/CoordinateMaps/TimeDependent/CubicScale.hpp"
#include "Domain/CoordinateMaps/TimeDependent/ProductMaps.hpp"
#include "Domain/CoordinateMaps/TimeDependent/Rotation.hpp"
#include "Domain/Creators/TimeDependence/GenerateCoordinateMap.hpp"
#include "Domain/Creators/TimeDependence/TimeDependence.hpp"
Expand Down
7 changes: 1 addition & 6 deletions src/Domain/Creators/TimeDependence/TimeDependence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
#include <unordered_map>
#include <vector>

#include "Domain/CoordinateMaps/CoordinateMap.hpp"
#include "Domain/Structure/ObjectLabel.hpp"
#include "Utilities/TMPL.hpp"

/// \cond
namespace domain {
template <typename SourceFrame, typename TargetFrame, size_t Dim>
class CoordinateMapBase;
namespace FunctionsOfTime {
class FunctionOfTime;
} // namespace FunctionsOfTime
Expand Down Expand Up @@ -125,10 +124,6 @@ TimeDependence<MeshDim>::~TimeDependence() = default;
} // namespace time_dependence
} // namespace domain::creators

#include "Domain/CoordinateMaps/CoordinateMap.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.tpp"
#include "Domain/CoordinateMaps/TimeDependent/ProductMaps.hpp"
#include "Domain/CoordinateMaps/TimeDependent/ProductMaps.tpp"
#include "Domain/Creators/TimeDependence/CubicScale.hpp"
#include "Domain/Creators/TimeDependence/None.hpp"
#include "Domain/Creators/TimeDependence/RotationAboutZAxis.hpp"
Expand Down
1 change: 0 additions & 1 deletion src/Domain/ExcisionSphere.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include "DataStructures/Tensor/Tensor.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.tpp"
#include "Domain/Structure/Direction.hpp"
#include "Domain/Structure/ElementId.hpp"

Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/Domain/CoordinateMaps/Test_Wedge2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <random>

#include "DataStructures/Tensor/EagerMath/Determinant.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.tpp"
#include "Domain/CoordinateMaps/Distribution.hpp"
#include "Domain/CoordinateMaps/Wedge.hpp"
#include "Domain/Structure/Direction.hpp"
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/Domain/CoordinateMaps/Test_Wedge3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "DataStructures/Tensor/EagerMath/Magnitude.hpp"
#include "DataStructures/Tensor/Identity.hpp"
#include "DataStructures/Tensor/Tensor.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.tpp"
#include "Domain/CoordinateMaps/Distribution.hpp"
#include "Domain/CoordinateMaps/Wedge.hpp"
#include "Domain/Structure/OrientationMap.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <string>

#include "DataStructures/Tensor/Tensor.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.tpp"
#include "Domain/CoordinateMaps/TimeDependent/SphericalCompression.hpp"
#include "Domain/FunctionsOfTime/FunctionOfTime.hpp"
#include "Domain/FunctionsOfTime/PiecewisePolynomial.hpp"
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/Domain/Test_AreaElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "Domain/CoordinateMaps/Affine.hpp"
#include "Domain/CoordinateMaps/Composition.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.tpp"
#include "Domain/CoordinateMaps/KerrHorizonConforming.hpp"
#include "Domain/CoordinateMaps/Tags.hpp"
#include "Domain/CoordinateMaps/Wedge.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "DataStructures/Variables.hpp"
#include "DataStructures/VariablesTag.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.tpp"
#include "Domain/CoordinateMaps/Identity.hpp"
#include "Domain/CreateInitialElement.hpp"
#include "Domain/Creators/Rectilinear.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "DataStructures/Variables.hpp"
#include "Domain/Block.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.tpp"
#include "Domain/CoordinateMaps/Identity.hpp"
#include "Domain/CoordinateMaps/Tags.hpp"
#include "Domain/CreateInitialElement.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "DataStructures/Tensor/Tensor.hpp"
#include "DataStructures/Variables.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.tpp"
#include "Domain/CoordinateMaps/Identity.hpp"
#include "Domain/CoordinateMaps/Tags.hpp"
#include "Domain/CreateInitialElement.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "DataStructures/Tensor/Tensor.hpp"
#include "DataStructures/Variables.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.tpp"
#include "Domain/CoordinateMaps/Identity.hpp"
#include "Domain/CoordinateMaps/Tags.hpp"
#include "Domain/CreateInitialElement.hpp"
Expand Down

0 comments on commit f134dac

Please sign in to comment.