Mundy: Multibody Nonlocal Dynamics Version of the Day
Loading...
Searching...
No Matches
mundy::mesh::MetaData Class Reference

A extension of STK's MetaData, better suited for some of Mundy's requirements. More...

#include <MetaData.hpp>

Inheritance diagram for mundy::mesh::MetaData:
[legend]

Public Member Functions

Constructors and destructor
 MetaData ()
 Construct a meta data manager to own parts and fields.
 MetaData (size_t spatial_dimension, const std::vector< std::string > &rank_names=std::vector< std::string >())
 Construct a meta data manager to own parts and fields.
virtual ~MetaData ()
 Destructor.
Actions
void declare_attribute (const stk::mesh::FieldBase &field, const std::string &attribute_name, const std::any &attribute_data)
 Declare an attribute on the given field.
void declare_attribute (const stk::mesh::FieldBase &field, const std::string &attribute_name, const std::any &&attribute_data)
 Declare an attribute on the given field.
void declare_attribute (const stk::mesh::Part &part, const std::string &attribute_name, const std::any &attribute_data)
 Declare an attribute on the given part.
void declare_attribute (const stk::mesh::Part &part, const std::string &attribute_name, const std::any &&attribute_data)
 Declare an attribute on the given part.
void declare_attribute (const std::string &attribute_name, const std::any &attribute_data)
 Declare an attribute on the mesh itself.
void declare_attribute (const std::string &attribute_name, const std::any &&attribute_data)
 Declare an attribute on the mesh itself.
bool remove_attribute (const stk::mesh::FieldBase &field, const std::string &attribute_name)
 Attempt to remove an attribute from the provided field.
bool remove_attribute (const stk::mesh::Part &part, const std::string &attribute_name)
 Attempt to remove an attribute from the provided part.
bool remove_attribute (const std::string &attribute_name)
 Attempt to remove an attribute from this mesh.
std::any * get_attribute (const stk::mesh::FieldBase &field, const std::string &attribute_name)
 Attempt to fetch a field attribute with the provided name from the given field.
std::any * get_attribute (const stk::mesh::Part &part, const std::string &attribute_name)
 Attempt to fetch a part attribute with the provided name from the given part.
std::any * get_attribute (const std::string &attribute_name)
 Attempt to fetch an attribute with the provided name from the current mesh.

Detailed Description

For now, this extension modifies how attributes are created and stored.

Constructor & Destructor Documentation

◆ MetaData() [1/2]

mundy::mesh::MetaData::MetaData ( )

◆ MetaData() [2/2]

mundy::mesh::MetaData::MetaData ( size_t spatial_dimension,
const std::vector< std::string > & rank_names = std::vector<std::string>() )
explicit

◆ ~MetaData()

mundy::mesh::MetaData::~MetaData ( )
virtual

Member Function Documentation

◆ declare_attribute() [1/6]

void mundy::mesh::MetaData::declare_attribute ( const stk::mesh::FieldBase & field,
const std::string & attribute_name,
const std::any & attribute_data )
Parameters
fieldThe field which should contain the given attribute.
attribute_nameThe given attribute's name. Must have a unique name not shared by other attributes on the field.
attribute_dataThe given attribute's data.

◆ declare_attribute() [2/6]

void mundy::mesh::MetaData::declare_attribute ( const stk::mesh::FieldBase & field,
const std::string & attribute_name,
const std::any && attribute_data )
Parameters
fieldThe field which should contain the given attribute.
attribute_nameThe given attribute's name. Must have a unique name not shared by other attributes on the field.
attribute_dataThe given attribute's data.

◆ declare_attribute() [3/6]

void mundy::mesh::MetaData::declare_attribute ( const stk::mesh::Part & part,
const std::string & attribute_name,
const std::any & attribute_data )
Parameters
partThe part which should contain the given attribute.
attribute_nameThe given attribute's name. Must have a unique name not shared by other attributes on the part.
attribute_dataThe given attribute's data.

◆ declare_attribute() [4/6]

void mundy::mesh::MetaData::declare_attribute ( const stk::mesh::Part & part,
const std::string & attribute_name,
const std::any && attribute_data )
Parameters
partThe part which should contain the given attribute.
attribute_nameThe given attribute's name. Must have a unique name not shared by other attributes on the part.
attribute_dataThe given attribute's data.

◆ declare_attribute() [5/6]

void mundy::mesh::MetaData::declare_attribute ( const std::string & attribute_name,
const std::any & attribute_data )
Parameters
attribute_nameThe name of the attribute to declare. Must have a unique name not shared by other attributes on the mesh.
attribute_dataThe given attribute's data.

◆ declare_attribute() [6/6]

void mundy::mesh::MetaData::declare_attribute ( const std::string & attribute_name,
const std::any && attribute_data )
Parameters
attribute_nameThe name of the attribute to declare. Must have a unique name not shared by other attributes on the mesh.
attribute_dataThe given attribute's data.

◆ remove_attribute() [1/3]

bool mundy::mesh::MetaData::remove_attribute ( const stk::mesh::FieldBase & field,
const std::string & attribute_name )
Parameters
fieldThe given field whose attribute we are trying to remove.
attribute_nameThe name of the attribute to remove.
Returns
A flag indicating if the attribute existed on the given field or not.

◆ remove_attribute() [2/3]

bool mundy::mesh::MetaData::remove_attribute ( const stk::mesh::Part & part,
const std::string & attribute_name )
Parameters
partThe given part whose attribute we are trying to remove.
attribute_nameThe name of the attribute to remove.
Returns
A flag indicating if the attribute existed on the given part or not.

◆ remove_attribute() [3/3]

bool mundy::mesh::MetaData::remove_attribute ( const std::string & attribute_name)
Parameters
attribute_nameThe name of the attribute to remove.
Returns
A flag indicating if the attribute existed on this mesh or not.

◆ get_attribute() [1/3]

std::any * mundy::mesh::MetaData::get_attribute ( const stk::mesh::FieldBase & field,
const std::string & attribute_name )
Parameters
fieldThe given field whose attribute we are trying to fetch.
attribute_nameThe name of the attribute to fetch.
Returns
A pointer to the internally maintained attribute data if it exists, nullptr otherwise. TODO(palmerb4): This should return a formal stk::mesh::Attribute which wraps the std::any and stores the attribute mesh ordinal and name.

◆ get_attribute() [2/3]

std::any * mundy::mesh::MetaData::get_attribute ( const stk::mesh::Part & part,
const std::string & attribute_name )
Parameters
partThe given part whose attribute we are trying to fetch.
attribute_nameThe name of the attribute to fetch.
Returns
A pointer to the internally maintained attribute data if it exists, nullptr otherwise. TODO(palmerb4): This should return a formal stk::mesh::Attribute which wraps the std::any and stores the attribute mesh ordinal and name.

◆ get_attribute() [3/3]

std::any * mundy::mesh::MetaData::get_attribute ( const std::string & attribute_name)
Parameters
attribute_nameThe name of the attribute to fetch.
Returns
A pointer to the internally maintained attribute data if it exists, nullptr otherwise. TODO(palmerb4): This should return a formal stk::mesh::Attribute which wraps the std::any and stores the attribute mesh ordinal and name.