Skip to content

Commit

Permalink
Merge pull request sxs-collaboration#6204 from AzerAfram/develop
Browse files Browse the repository at this point in the history
Observe DimensionfulSpinVector on horizons
  • Loading branch information
nilsvu authored Aug 15, 2024
2 parents 7f11326 + f32a7f4 commit 9c3f444
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/IO/Observer/ReductionActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ void append_to_reduction_data(
all_reduction_data->insert(all_reduction_data->end(), t.begin(), t.end());
}

void append_to_reduction_data(
const gsl::not_null<std::vector<double>*> all_reduction_data,
const std::array<double, 3>& t) {
all_reduction_data->insert(all_reduction_data->end(), t.begin(), t.end());
}

} // namespace observers::ThreadedActions::ReductionActions_detail
4 changes: 4 additions & 0 deletions src/IO/Observer/ReductionActions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ void append_to_reduction_data(
const gsl::not_null<std::vector<double>*> all_reduction_data,
const std::vector<double>& t);

void append_to_reduction_data(
gsl::not_null<std::vector<double>*> all_reduction_data,
const std::array<double, 3>& t);

template <typename... Ts, size_t... Is>
void write_data(const std::string& subfile_name,
const std::string& input_source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ using tags_for_observing = tmpl::list<
gr::surfaces::Tags::IrreducibleMassCompute<Frame>,
ylm::Tags::MaxRicciScalarCompute, ylm::Tags::MinRicciScalarCompute,
gr::surfaces::Tags::ChristodoulouMassCompute<Frame>,
gr::surfaces::Tags::DimensionlessSpinMagnitudeCompute<Frame>
// Needs `ObserveTimeSeriesOnSurface` to be able to write a `std::array`
// gr::surfaces::Tags::DimensionlessSpinVectorCompute<Frame, Frame>
gr::surfaces::Tags::DimensionlessSpinMagnitudeCompute<Frame>,
gr::surfaces::Tags::DimensionfulSpinVectorCompute<Frame, Frame>
>;

using surface_tags_for_observing = tmpl::list<ylm::Tags::RicciScalar>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,35 @@ namespace callbacks {

namespace detail {

template<typename T>
struct is_array_of_double : std::false_type {};

template<std::size_t N>
struct is_array_of_double<std::array<double, N>> : std::true_type {};

template <typename... Ts>
auto make_legend(tmpl::list<Ts...> /* meta */) {
return std::vector<std::string>{"Time", db::tag_name<Ts>()...};
std::vector<std::string> legend = {"Time"};

auto append_tags = [&legend](auto tag) {
using TagType = decltype(tag);
using ReturnType = typename TagType::type;

if constexpr (is_array_of_double<ReturnType>::value) {
constexpr std::array<const char*, 3> suffix = {"_x", "_y", "_z"};
for (size_t i = 0; i < std::tuple_size<ReturnType>::value; ++i) {
legend.push_back(db::tag_name<TagType>() + gsl::at(suffix, i));
}
}
else {
legend.push_back(db::tag_name<TagType>());
}

};

(append_tags(Ts{}), ...);

return legend;
}

template <typename DbTags, typename... Ts>
Expand Down
2 changes: 1 addition & 1 deletion src/PointwiseFunctions/GeneralRelativity/Surfaces/Spin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ GENERATE_INSTANTIATIONS(INSTANTIATE,

GENERATE_INSTANTIATIONS(INSTANTIATE,
(Frame::Grid, Frame::Distorted, Frame::Inertial),
(Frame::Inertial))
(Frame::Inertial, Frame::Distorted))
#undef INSTANTIATE
#undef MEASUREMENTFRAME
#undef METRICFRAME

0 comments on commit 9c3f444

Please sign in to comment.