Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to read numerical initial data for ScalarTensor #6155

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Evolution/Systems/ScalarTensor/Actions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Distributed under the MIT License.
# See LICENSE.txt for details.

spectre_target_sources(
${LIBRARY}
PRIVATE
SetInitialData.cpp
)

spectre_target_headers(
${LIBRARY}
INCLUDE_DIRECTORY ${CMAKE_SOURCE_DIR}/src
HEADERS
SetInitialData.hpp
)
60 changes: 60 additions & 0 deletions src/Evolution/Systems/ScalarTensor/Actions/SetInitialData.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Distributed under the MIT License.
// See LICENSE.txt for details.

#include "Evolution/Systems/ScalarTensor/Actions/SetInitialData.hpp"

#include <boost/functional/hash.hpp>
#include <cstddef>
#include <string>
#include <utility>
#include <variant>

#include "DataStructures/DataVector.hpp"
#include "DataStructures/Tensor/Tensor.hpp"
#include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"
#include "PointwiseFunctions/GeneralRelativity/GeneralizedHarmonic/Phi.hpp"
#include "PointwiseFunctions/GeneralRelativity/GeneralizedHarmonic/Pi.hpp"
#include "PointwiseFunctions/GeneralRelativity/SpacetimeMetric.hpp"
#include "PointwiseFunctions/GeneralRelativity/TimeDerivativeOfSpatialMetric.hpp"
#include "Utilities/GenerateInstantiations.hpp"
#include "Utilities/Gsl.hpp"
#include "Utilities/MakeWithValue.hpp"
#include "Utilities/PrettyType.hpp"

namespace ScalarTensor {

NumericInitialData::NumericInitialData(
std::string file_glob, std::string subfile_name,

Check failure on line 27 in src/Evolution/Systems/ScalarTensor/Actions/SetInitialData.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Debug)

the parameter 'file_glob' is copied for each invocation but only used as a const reference; consider making it a const reference

Check failure on line 27 in src/Evolution/Systems/ScalarTensor/Actions/SetInitialData.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Debug)

the parameter 'subfile_name' is copied for each invocation but only used as a const reference; consider making it a const reference

Check failure on line 27 in src/Evolution/Systems/ScalarTensor/Actions/SetInitialData.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Release)

the parameter 'file_glob' is copied for each invocation but only used as a const reference; consider making it a const reference

Check failure on line 27 in src/Evolution/Systems/ScalarTensor/Actions/SetInitialData.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Release)

the parameter 'subfile_name' is copied for each invocation but only used as a const reference; consider making it a const reference
std::variant<double, importers::ObservationSelector> observation_value,
const bool enable_interpolation,
typename GhNumericId::Variables::type gh_selected_variables,
typename ScalarNumericId::Variables::type hydro_selected_variables)
: gh_numeric_id_(file_glob, subfile_name, observation_value,
enable_interpolation, std::move(gh_selected_variables)),
scalar_numeric_id_(std::move(file_glob), std::move(subfile_name),
observation_value, enable_interpolation,
std::move(hydro_selected_variables)) {}

NumericInitialData::NumericInitialData(CkMigrateMessage* msg)
: InitialData(msg) {}

PUP::able::PUP_ID NumericInitialData::my_PUP_ID = 0;

Check failure on line 41 in src/Evolution/Systems/ScalarTensor/Actions/SetInitialData.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Debug)

variable 'my_PUP_ID' is non-const and globally accessible, consider making it const

Check failure on line 41 in src/Evolution/Systems/ScalarTensor/Actions/SetInitialData.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Release)

variable 'my_PUP_ID' is non-const and globally accessible, consider making it const

size_t NumericInitialData::volume_data_id() const {

Check failure on line 43 in src/Evolution/Systems/ScalarTensor/Actions/SetInitialData.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Debug)

method 'volume_data_id' can be made static

Check failure on line 43 in src/Evolution/Systems/ScalarTensor/Actions/SetInitialData.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Release)

method 'volume_data_id' can be made static
size_t hash = 0;
boost::hash_combine(hash, gh_numeric_id_.volume_data_id());
boost::hash_combine(hash, scalar_numeric_id_.volume_data_id());
return hash;
}

void NumericInitialData::pup(PUP::er& p) {
p | gh_numeric_id_;
p | scalar_numeric_id_;
}

bool operator==(const NumericInitialData& lhs, const NumericInitialData& rhs) {
return lhs.gh_numeric_id_ == rhs.gh_numeric_id_ and
lhs.scalar_numeric_id_ == rhs.scalar_numeric_id_;
}

} // namespace ScalarTensor
Loading
Loading