Skip to content

Commit

Permalink
Remove ReducedWorldtubeModeRecorder
Browse files Browse the repository at this point in the history
And rename the file to just WorldtubeModeRecorder
  • Loading branch information
knelli2 committed Nov 7, 2024
1 parent cfbdb1e commit e17d729
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 92 deletions.
4 changes: 2 additions & 2 deletions src/Evolution/Systems/Cce/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ spectre_target_sources(
LinearSolve.cpp
NewmanPenrose.cpp
PrecomputeCceDependencies.cpp
ReducedWorldtubeModeRecorder.cpp
ScriPlusValues.cpp
SpecBoundaryData.cpp
WorldtubeBufferUpdater.cpp
WorldtubeDataManager.cpp
WorldtubeModeRecorder.cpp
)

spectre_target_headers(
Expand All @@ -44,7 +44,6 @@ spectre_target_headers(
PreSwshDerivatives.hpp
PrecomputeCceDependencies.hpp
ReceiveTags.hpp
ReducedWorldtubeModeRecorder.hpp
ScriPlusInterpolationManager.hpp
ScriPlusValues.hpp
SpecBoundaryData.hpp
Expand All @@ -55,6 +54,7 @@ spectre_target_headers(
Tags.hpp
WorldtubeBufferUpdater.hpp
WorldtubeDataManager.hpp
WorldtubeModeRecorder.hpp
)

target_link_libraries(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "DataStructures/VariablesTag.hpp"
#include "Evolution/Systems/Cce/BoundaryData.hpp"
#include "Evolution/Systems/Cce/OptionTags.hpp"
#include "Evolution/Systems/Cce/ReducedWorldtubeModeRecorder.hpp"
#include "Evolution/Systems/Cce/Tags.hpp"
#include "Evolution/Systems/Cce/WorldtubeModeRecorder.hpp"
#include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
#include "IO/Observer/Actions/GetLockPointer.hpp"
#include "IO/Observer/ObserverComponent.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Distributed under the MIT License.
// See LICENSE.txt for details.

#include "Evolution/Systems/Cce/ReducedWorldtubeModeRecorder.hpp"
#include "Evolution/Systems/Cce/WorldtubeModeRecorder.hpp"

#include <cstddef>

Expand Down Expand Up @@ -62,70 +62,6 @@ std::string dataset_label_for_tag<Cce::Tags::Du<Cce::Tags::BondiR>>() {
return "DuR";
}

void ReducedWorldtubeModeRecorder::append_worldtube_mode_data(
const std::string& dataset_path, const double time,
const ComplexModalVector& modes, const size_t l_max, const bool is_real) {
std::vector<std::string> legend;
const size_t output_size = square(l_max + 1);
legend.reserve(is_real ? output_size + 1 : 2 * output_size + 1);
legend.emplace_back("time");
for (int l = 0; l <= static_cast<int>(l_max); ++l) {
for (int m = is_real ? 0 : -l; m <= l; ++m) {
legend.push_back("Re(" + std::to_string(l) + "," + std::to_string(m) +
")");
if (LIKELY(not is_real or m != 0)) {
legend.push_back("Im(" + std::to_string(l) + "," + std::to_string(m) +
")");
}
}
}
auto& output_mode_dataset =
output_file_.try_insert<h5::Dat>(dataset_path, legend, 0);
std::vector<double> data_to_write;
if (is_real) {
data_to_write.resize(output_size + 1);
data_to_write[0] = time;
for (int l = 0; l <= static_cast<int>(l_max); ++l) {
data_to_write[static_cast<size_t>(square(l)) + 1] =
real(modes[Spectral::Swsh::goldberg_mode_index(
l_max, static_cast<size_t>(l), 0)]);
for (int m = 1; m <= l; ++m) {
// this is the right order of the casts, other orders give the wrong
// answer
// NOLINTNEXTLINE(misc-misplaced-widening-cast)
data_to_write[static_cast<size_t>(square(l) + 2 * m)] =
real(modes[Spectral::Swsh::goldberg_mode_index(
l_max, static_cast<size_t>(l), m)]);
// this is the right order of the casts, other orders give the wrong
// answer
// NOLINTNEXTLINE(misc-misplaced-widening-cast)
data_to_write[static_cast<size_t>(square(l) + 2 * m + 1)] =
imag(modes[Spectral::Swsh::goldberg_mode_index(
l_max, static_cast<size_t>(l), m)]);
}
}
} else {
data_to_write.resize(2 * output_size + 1);
data_to_write[0] = time;
for (int l = 0; l <= static_cast<int>(l_max); ++l) {
for (int m = -l; m <= l; ++m) {
data_to_write[2 * Spectral::Swsh::goldberg_mode_index(
l_max, static_cast<size_t>(l), m) +
1] =
real(modes[Spectral::Swsh::goldberg_mode_index(
l_max, static_cast<size_t>(l), m)]);
data_to_write[2 * Spectral::Swsh::goldberg_mode_index(
l_max, static_cast<size_t>(l), m) +
2] =
imag(modes[Spectral::Swsh::goldberg_mode_index(
l_max, static_cast<size_t>(l), m)]);
}
}
}
output_mode_dataset.append(data_to_write);
output_file_.close_current_object();
}

WorldtubeModeRecorder::WorldtubeModeRecorder() = default;
WorldtubeModeRecorder::WorldtubeModeRecorder(const size_t l_max,
const std::string& h5_filename)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,6 @@ namespace Cce {
template <typename Tag>
std::string dataset_label_for_tag();

/// Records a compressed representation of SpEC-like worldtube data associated
/// with just the spin-weighted scalars required to perform the CCE algorithm.
struct ReducedWorldtubeModeRecorder {
public:
/// The constructor takes the filename used to create the H5File object for
/// writing the data
explicit ReducedWorldtubeModeRecorder(const std::string& filename)
: output_file_{filename} {}

/// append to `dataset_path` the vector created by `time` followed by the
/// `modes` rearranged in ascending m-varies-fastest format.
///
/// For real quantities, negative m and the imaginary part of m=0 are omitted.
void append_worldtube_mode_data(const std::string& dataset_path, double time,
const ComplexModalVector& modes, size_t l_max,
bool is_real = false);

private:
h5::H5File<h5::AccessType::ReadWrite> output_file_;
};

/*!
* \brief Class that standardizes the output of our worldtube data into the
* Bondi modal format that the CharacteristicExtract executable can read in.
Expand Down
2 changes: 1 addition & 1 deletion src/Executables/ReduceCceWorldtube/ReduceCceWorldtube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#include "DataStructures/Variables.hpp"
#include "DataStructures/VariablesTag.hpp"
#include "Evolution/Systems/Cce/BoundaryData.hpp"
#include "Evolution/Systems/Cce/ReducedWorldtubeModeRecorder.hpp"
#include "Evolution/Systems/Cce/SpecBoundaryData.hpp"
#include "Evolution/Systems/Cce/Tags.hpp"
#include "Evolution/Systems/Cce/WorldtubeBufferUpdater.hpp"
#include "Evolution/Systems/Cce/WorldtubeModeRecorder.hpp"
#include "NumericalAlgorithms/SpinWeightedSphericalHarmonics/SwshCoefficients.hpp"
#include "NumericalAlgorithms/SpinWeightedSphericalHarmonics/SwshCollocation.hpp"
#include "Options/Auto.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

#include <cstddef>

#include "Evolution/Systems/Cce/ReducedWorldtubeModeRecorder.hpp"
#include "Evolution/Systems/Cce/WorldtubeBufferUpdater.hpp"
#include "Evolution/Systems/Cce/WorldtubeDataManager.hpp"
#include "Evolution/Systems/Cce/WorldtubeModeRecorder.hpp"
#include "Framework/TestHelpers.hpp"
#include "Helpers/DataStructures/MakeWithRandomValues.hpp"
#include "Helpers/Evolution/Systems/Cce/BoundaryTestHelpers.hpp"
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Evolution/Systems/Cce/Test_WorldtubeData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#include "DataStructures/Tensor/Tensor.hpp"
#include "DataStructures/Tensor/TypeAliases.hpp"
#include "Evolution/Systems/Cce/BoundaryData.hpp"
#include "Evolution/Systems/Cce/ReducedWorldtubeModeRecorder.hpp"
#include "Evolution/Systems/Cce/WorldtubeBufferUpdater.hpp"
#include "Evolution/Systems/Cce/WorldtubeDataManager.hpp"
#include "Evolution/Systems/Cce/WorldtubeModeRecorder.hpp"
#include "Framework/CheckWithRandomValues.hpp"
#include "Framework/SetupLocalPythonEnvironment.hpp"
#include "Helpers/DataStructures/MakeWithRandomValues.hpp"
Expand Down

0 comments on commit e17d729

Please sign in to comment.