22 #include "pism/icemodel/IceModel.hh"
24 #include "pism/util/ConfigInterface.hh"
25 #include "pism/util/Diagnostic.hh"
26 #include "pism/util/error_handling.hh"
27 #include "pism/util/pism_utilities.hh"
28 #include "pism/util/petscwrappers/Viewer.hh"
29 #include "pism/util/Vars.hh"
34 unsigned int viewer_size = (
unsigned int)
m_config->get_number(
"output.runtime.viewer.size");
36 if (field->
ndims() != 2) {
38 "map-plane views of 3D quantities are not supported.");
44 for (
size_t k = 0;
k < field->
ndof(); ++
k) {
45 auto v = std::make_shared<petsc::Viewer>(
m_grid->com, field->
metadata(
k)[
"short_name"],
60 auto viewers =
set_split(
m_config->get_string(
"output.runtime.viewer.variables"),
',');
63 for (
auto v : viewers) {
64 if (
m_grid->variables().is_available(v)) {
71 this->
view_field(diag->second->compute().get());
virtual void view_field(const array::Array *field)
const Config::Ptr m_config
Configuration flags and parameters.
std::map< std::string, std::vector< std::shared_ptr< petsc::Viewer > > > m_viewers
std::map< std::string, Diagnostic::Ptr > m_diagnostics
Requested spatially-variable diagnostics.
virtual void update_viewers()
Update the runtime graphical viewers.
const std::shared_ptr< Grid > m_grid
Computational grid.
unsigned int ndof() const
Returns the number of degrees of freedom per grid point.
const std::string & get_name() const
Get the name of an Array object.
void view(std::vector< std::shared_ptr< petsc::Viewer > > viewers) const
View a 2D vector field using existing PETSc viewers.
unsigned int ndims() const
Returns the number of spatial dimensions.
SpatialVariableMetadata & metadata(unsigned int N=0)
Returns a reference to the SpatialVariableMetadata object containing metadata for the compoment N.
Abstract class for reading, writing, allocating, and accessing a DA-based PETSc Vec (2D and 3D fields...
#define PISM_ERROR_LOCATION
std::set< std::string > set_split(const std::string &input, char separator)
Transform a separator-separated list (a string) into a set of strings.