Skip to content

Commit

Permalink
Merge pull request #4663 from nilsvu/py_plot_power_monitors
Browse files Browse the repository at this point in the history
Add script to plot power monitors
  • Loading branch information
nilsvu committed Feb 7, 2023
2 parents 8ac60c0 + 58ee830 commit df9446a
Show file tree
Hide file tree
Showing 15 changed files with 454 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Domain/Creators/Brick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ Domain<3> Brick::create_domain() const {
Affine{-1., 1., lower_xyz_[1], upper_xyz_[1]},
Affine{-1., 1., lower_xyz_[2], upper_xyz_[2]}}),
std::vector<std::array<size_t, 8>>{{{0, 1, 2, 3, 4, 5, 6, 7}}},
identifications};
identifications,
{},
block_names_};

if (not time_dependence_->is_none()) {
domain.inject_time_dependent_map_for_block(
Expand Down
4 changes: 4 additions & 0 deletions src/Domain/Creators/Brick.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <array>
#include <cstddef>
#include <memory>
#include <string>
#include <vector>

#include "Domain/BoundaryConditions/BoundaryCondition.hpp"
Expand Down Expand Up @@ -149,6 +150,8 @@ class Brick : public DomainCreator<3> {
std::string,
std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>> override;

std::vector<std::string> block_names() const override { return block_names_; }

private:
typename LowerBound::type lower_xyz_{};
typename UpperBound::type upper_xyz_{};
Expand All @@ -159,6 +162,7 @@ class Brick : public DomainCreator<3> {
time_dependence_;
std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
boundary_condition_;
inline static const std::vector<std::string> block_names_{"Brick"};
};
} // namespace creators
} // namespace domain
2 changes: 2 additions & 0 deletions src/Domain/Python/Domain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ namespace {
template <size_t Dim>
void bind_domain_impl(py::module& m) { // NOLINT
py::class_<Domain<Dim>>(m, ("Domain" + get_output(Dim) + "D").c_str())
.def_property_readonly_static(
"dim", [](const py::object& /*self */) { return Dim; })
.def("is_time_dependent", &Domain<Dim>::is_time_dependent)
.def_property_readonly("blocks", &Domain<Dim>::blocks)
.def_property_readonly("block_groups", &Domain<Dim>::block_groups);
Expand Down
2 changes: 2 additions & 0 deletions src/Visualization/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ spectre_python_add_module(
InterpolateToCoords.py
InterpolateToMesh.py
PlotDatFile.py
PlotPowerMonitors.py
plots.mplstyle
ReadH5.py
Render1D.py
)
1 change: 1 addition & 0 deletions src/Visualization/Python/InterpolateToCoords.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def parse_points(ctx, param, values):
def interpolate_to_coords_command(h5_files, subfile_name, list_vars, vars,
target_coords, target_coords_file, output,
step, time, delimiter):
"""Interpolate volume data to target coordinates."""
# Script should be a noop if input files are empty
if not h5_files:
return
Expand Down
Loading

0 comments on commit df9446a

Please sign in to comment.