20 using std::dynamic_pointer_cast;
22 #include "pism/util/Vars.hh"
23 #include "pism/util/VariableMetadata.hh"
24 #include "pism/util/array/CellType.hh"
25 #include "pism/util/array/Vector.hh"
26 #include "pism/util/array/Array3D.hh"
27 #include "pism/util/error_handling.hh"
55 " was added already.",
74 std::string standard_name = m[
"standard_name"];
79 " was added already.",
80 standard_name.c_str());
88 " was added already.",
102 std::string std_name = m[
"standard_name"];
134 std::string short_name = j->second;
183 "2D cell type variable '%s' is not available", name.c_str());
206 std::set<std::string> result;
209 result.insert(v.first);
213 result.insert(v.first);
222 std::string name = variable->
get_name();
226 std::string standard_name = m[
"standard_name"];
231 " was added already.",
232 standard_name.c_str());
240 " was added already.",
250 " was added already.",
282 std::shared_ptr<array::Scalar> tmp = dynamic_pointer_cast<array::Scalar,array::Array>(this->
get_internal_shared(name));
291 std::shared_ptr<array::Vector> tmp = dynamic_pointer_cast<array::Vector,array::Array>(this->
get_internal_shared(name));
300 std::shared_ptr<array::Scalar> tmp = dynamic_pointer_cast<array::Scalar,array::Array>(this->
get_internal_shared(name));
308 auto tmp = dynamic_pointer_cast<array::CellType,array::Array>(this->
get_internal_shared(name));
311 "shared 2D cell type variable '%s' is not available", name.c_str());
318 std::shared_ptr<array::Array3D> tmp = dynamic_pointer_cast<array::Array3D,array::Array>(this->
get_internal_shared(name));
328 std::set<std::string> result;
330 result.insert(v.first);
340 std::string short_name = j->second;
347 return std::shared_ptr<array::Array>();
355 return std::shared_ptr<array::Array>();
static RuntimeError formatted(const ErrorLocation &location, const char format[],...) __attribute__((format(printf
build a RuntimeError with a formatted message
Vec2IntPtr get_2d_mask_shared(const std::string &name) const
const array::Array3D * get_3d_scalar(const std::string &name) const
const array::Vector * get_2d_vector(const std::string &name) const
std::set< std::string > keys_shared() const
const array::Array * get_internal(const std::string &name) const
Vec3Ptr get_3d_scalar_shared(const std::string &name) const
std::set< std::string > keys() const
Returns the set of keys (variable names) in the dictionary.
const array::CellType * get_2d_cell_type(const std::string &name) const
VecPtr get_shared(const std::string &name) const
std::map< std::string, VecPtr > m_variables_shared
variables in shared ownership
Vec2CellTypePtr get_2d_cell_type_shared(const std::string &name) const
bool is_available_shared(const std::string &name) const
std::shared_ptr< array::Array > VecPtr
const array::Scalar * get_2d_mask(const std::string &name) const
const array::Scalar * get_2d_scalar(const std::string &name) const
const array::Array * get(const std::string &name) const
Returns a pointer to an array::Array containing variable name or NULL if that variable was not found.
void remove(const std::string &name)
Removes a variable with the key name from the dictionary.
bool is_available(const std::string &name) const
VecPtr get_internal_shared(const std::string &name) const
Vec2SPtr get_2d_scalar_shared(const std::string &name) const
std::map< std::string, const array::Array * > m_variables
Vec2VPtr get_2d_vector_shared(const std::string &name) const
void add(const array::Array &)
Add an array::Array to the dictionary.
std::map< std::string, std::string > m_standard_names
A virtual class collecting methods common to ice and bedrock 3D fields.
const std::string & get_name() const
Get the name of an Array object.
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...
"Cell type" mask. Adds convenience methods to array::Scalar.
#define PISM_ERROR_LOCATION