WARPXM v1.10.0
Loading...
Searching...
No Matches
wxm::variable::variable_t Class Referenceabstract

#include <variable.h>

Inheritance diagram for wxm::variable::variable_t:
WxObject wxm::variable::distributed_variable_t wxm::dfem::variable::UniqueDistributedVariable wxm::dfem::variable::distributed_variable_t

Public Member Functions

virtual ~variable_t ()
 Destroy object.
 
virtual void setup (const WxCryptSet &wxc)
 Setup object using supplied crypset.
 
virtual void fill (const std::vector< real > &values)=0
 For each component, apply a fill value throughout the domain.
 
virtual void swap (variable_t &other)=0
 Swap the internal data storage of this variable with otherVar leaving the outer shell the same, given both have same size and properties.
 
virtual bool check_compatible (const variable_t &other) const =0
 Compares this variable to another supplied variable_t and report if they are swap compatible.
 
virtual void dump (WxIoBase &io, WxIoNodeType &group_node) const
 Dump object to file.
 
virtual void load (WxIoBase &io, const WxIoNodeType &group_node)
 Load object from file.
 
bool has_component (const std::string &component_name) const
 Check if this variable has a component matching the name supplied.
 
int num_components () const
 Returns number of components represented in the variable.
 
const std::vector< std::string > & component_names () const
 Get names of all components.
 
int component_index (const std::string &component_name) const
 Returns the component number associated with the componentName.
 
const std::string & component_name (const int component_index) const
 Returns the component name for a given index.
 
const WmSolverBaseget_parent () const
 Get the parent solver.
 
- Public Member Functions inherited from WxObject
virtual ~WxObject ()
 Dtor: destroy object.
 
void setIo (WxIoBase &io)
 Set the I/O pointer for use in object.
 
void setMsg (WxMsgBase &msg)
 Set the msg pointer for use in object.
 
WxIoBasegetIo ()
 Return reference to I/O object.
 
const WxIoBasegetIo () const
 Return constant reference to I/O object.
 
WxMsgBasegetMsg ()
 Return reference to msg object.
 
const WxMsgBasegetMsg () const
 Return const reference to msg object.
 
virtual void setup (const WxCryptSet &wxc)
 Setup object using supplied crypset.
 
virtual void init ()
 Initialize the object.
 
virtual void finishBuild ()
 Finish building the object.
 
virtual void load (WxIoBase &io, const WxIoNodeType &grpNode)
 Load object from file.
 
virtual void dump (WxIoBase &io, WxIoNodeType &grpNode) const
 Dump object to file.
 
virtual std::string name () const
 Get name of object.
 
void setName (const std::string &nm)
 Set object's name.
 

Protected Member Functions

 variable_t (const WmConstOpaquePtr &parent_solver)
 Constructor sets up basic variable container, but no properties or specifics.
 
- Protected Member Functions inherited from WxObject
 WxObject ()
 Create object, that will be initialized subsequently.
 
 WxObject (const std::string &name)
 Create object with given name bypassing object setup phase Protected because there is no reason to have a WxObject directly, as it is meant to be a parent class.
 

Protected Attributes

std::vector< std::string > _component_names
 List of component names in order.
 

Constructor & Destructor Documentation

◆ ~variable_t()

virtual wxm::variable::variable_t::~variable_t ( )
virtual

Destroy object.

◆ variable_t()

wxm::variable::variable_t::variable_t ( const WmConstOpaquePtr parent_solver)
protected

Constructor sets up basic variable container, but no properties or specifics.

Instead, must use setup(wxc) method. Protected because direct variable_t is not intended to be a complete type.

Parameters
parent_solvertype opaque wrapper to parent solver

Member Function Documentation

◆ check_compatible()

virtual bool wxm::variable::variable_t::check_compatible ( const variable_t other) const
pure virtual

Compares this variable to another supplied variable_t and report if they are swap compatible.

Returns
Result of comparison. True for equal.

Implemented in wxm::dfem::variable::distributed_variable_t.

◆ component_index()

int wxm::variable::variable_t::component_index ( const std::string &  component_name) const

Returns the component number associated with the componentName.

Parameters
component_namecomponent name to be checked
Returns
Index to the associated component Throws exception if component not found

◆ component_name()

const std::string & wxm::variable::variable_t::component_name ( const int  component_index) const

Returns the component name for a given index.

Throws exception if component not found

Parameters
componentNamecomponent name to be checked
Returns
Index to the associated component

◆ component_names()

const std::vector< std::string > & wxm::variable::variable_t::component_names ( ) const
inline

Get names of all components.

Parameters
Namesof all components

◆ dump()

virtual void wxm::variable::variable_t::dump ( WxIoBase io,
WxIoNodeType group_node 
) const
virtual

Dump object to file.

This methods is passed a group node to which is should write its data to. Enough data should be written so that it can reconstruct itself using the load() method.

Parameters
ioI/O object to use for writing
grpNodegroup node to write to

Reimplemented from WxObject.

Reimplemented in wxm::dfem::variable::distributed_variable_t, and wxm::dfem::variable::UniqueDistributedVariable.

◆ fill()

virtual void wxm::variable::variable_t::fill ( const std::vector< real > &  values)
pure virtual

For each component, apply a fill value throughout the domain.

Parameters
fillValuesvalues for each variable component.

Implemented in wxm::dfem::variable::distributed_variable_t, and wxm::dfem::variable::UniqueDistributedVariable.

◆ get_parent()

const WmSolverBase & wxm::variable::variable_t::get_parent ( ) const

Get the parent solver.

Throws WxExcept if parent solver not set.

Returns
parent solver reference

◆ has_component()

bool wxm::variable::variable_t::has_component ( const std::string &  component_name) const
inline

Check if this variable has a component matching the name supplied.

Parameters
componentNamecomponent name to be checked
Returns
Result of check. True if a component name for this variable.

◆ load()

virtual void wxm::variable::variable_t::load ( WxIoBase io,
const WxIoNodeType group_node 
)
virtual

Load object from file.

This method is passed a group node from which its data should be read and then constructed.

Parameters
ioI/O object to use for writing
grpNodegroup node to read from

Reimplemented from WxObject.

Reimplemented in wxm::dfem::variable::distributed_variable_t, and wxm::dfem::variable::UniqueDistributedVariable.

◆ num_components()

int wxm::variable::variable_t::num_components ( ) const
inline

Returns number of components represented in the variable.

Returns
Number of components in this variable

◆ setup()

virtual void wxm::variable::variable_t::setup ( const WxCryptSet wxc)
virtual

Setup object using supplied crypset.

This method reads in parameters needed to initialize the object. This establishes variable name and component names. The cryptset should have variables

NumComponents = int # number of components per value associated with this variable; if specified, components are named c0,c1,etc. ComponentNames = [ string, ... ] # names assigned to each component of the variable

Either ComponentNames or NumComponents can be specified, not both. If neither is specified, 1 component named to match the variable name is assumed. Subsequent calls to this function have no affect.

Component names shoud be a vector of names for each sub component like "x", "y", "z" or "E","B","J" The compents can be hierarchically named using dot '.' tokens such as "E.x", "E.y", "J.normal".

Parameters
wxcCryptset using which the object is set up.

Reimplemented from WxObject.

Reimplemented in wxm::variable::distributed_variable_t, wxm::dfem::variable::distributed_variable_t, and wxm::dfem::variable::UniqueDistributedVariable.

◆ swap()

virtual void wxm::variable::variable_t::swap ( variable_t other)
pure virtual

Swap the internal data storage of this variable with otherVar leaving the outer shell the same, given both have same size and properties.

Parameters
otherVaris the other variable to swap with Undefined if variables are not compatible.
See also
check_compatible()

Implemented in wxm::dfem::variable::distributed_variable_t.

Member Data Documentation

◆ _component_names

std::vector<std::string> wxm::variable::variable_t::_component_names
protected

List of component names in order.


The documentation for this class was generated from the following file: