WARPXM v1.10.0
|
Base class for variables that store one or more components of data. More...
#include <wmvariable.h>
Base class for variables that store one or more components of data.
No assumption about data element connectivity or array properties is made.
Classes | |
struct | SwapImpl |
Public Types | |
typedef unsigned | variableComponent_t |
variableComponent serves as a sort of pointer to individual components of the variable and is the value payload for nodes in the WmNameTree. | |
Public Member Functions | |
virtual | ~WmVariable () |
Destroy object. | |
virtual void | setup (const WxCryptSet &wxc) |
Setup object using supplied crypset. | |
virtual void | copy (const WmVariable &var) |
Set the variable from supplied one. | |
virtual void | fill (const std::vector< WxAny > &fillValues) |
For each component, apply a fill value throughout the domain. | |
virtual void | swap (WmVariable &otherVar) |
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 | checkCompatible (const WmVariable &var) const |
Compares this variable to another supplied WmVariable and report if they are swap compatible. | |
virtual void | dump (WxIoBase &io, WxIoNodeType &grpNode) const |
Dump object to file. | |
virtual void | load (WxIoBase &io, const WxIoNodeType &grpNode) |
Load object from file. | |
bool | hasComponent (const std::string &componentName) const |
Check if this variable has a component matching the name supplied. | |
virtual const std::type_info & | getElementTypeForComponent (unsigned int index) const |
Returns a type_info reference for the most primative element type stored by the variable. | |
virtual const std::type_info & | getElementType () const |
Returns a type_info reference for the most primative element type stored by the variable. | |
unsigned int | getNumComponents () const |
Returns number of components represented in the variable. | |
std::vector< std::string > | getComponentNames () const |
Get names of all components (alphabetical order) | |
variableComponent_t | getIndexForComponent (const std::string &componentName) const |
Returns the component number associated with the componentName. | |
const std::string & | getComponentName (const variableComponent_t index) const |
Returns the component name for a given index. | |
virtual const WxAny | min (const int componentIndex) const |
Returns the minimum value for the component identified. | |
virtual const WxAny | absoluteMin (const int componentIndex) const |
Returns the absolute minimum value for the component identified Absolute min is the closest value to zero Value will be negative if any negative values were found. | |
const WmSolverBase & | getParent () const |
Get the parent solver. | |
![]() | |
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. | |
WxIoBase & | getIo () |
Return reference to I/O object. | |
const WxIoBase & | getIo () const |
Return constant reference to I/O object. | |
WxMsgBase & | getMsg () |
Return reference to msg object. | |
const WxMsgBase & | getMsg () 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 Types | |
typedef WmNameTree< variableComponent_t >::const_iterator | component_const_iterator_t |
Protected Member Functions | |
WmVariable (const WmConstOpaquePtr &parent_solver) | |
Constructor sets up basic variable container, but no properties or specifics. | |
WmVariable (const std::string &name, const std::vector< std::string > &orderedComponentNames) | |
Constructor sets up basic variable container, and all properties otherwise set through setup() method in the no-argument form. | |
const std::type_info & | getRealTypeID () const |
Get the type that real type aliases. | |
std::string | getRealTypeStr () const |
Get the name for the type that real type aliases. | |
![]() | |
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 | |
WmNameTree< variableComponent_t > | _componentTree |
unsigned | _numComponents |
std::vector< std::string > | _orderedComponentNames |
SwapImpl * | p_impl |
|
protected |
typedef unsigned WmVariable::variableComponent_t |
variableComponent serves as a sort of pointer to individual components of the variable and is the value payload for nodes in the WmNameTree.
|
virtual |
Destroy object.
|
protected |
Constructor sets up basic variable container, but no properties or specifics.
Instead, must use setup(wxc) method. Protected because direct WmVariable is not intended to be a complete type.
parent_solver | type opaque wrapper to parent solver |
|
protected |
Constructor sets up basic variable container, and all properties otherwise set through setup() method in the no-argument form.
Calls to setup() for this instance will have no affect. Protected because direct WmVariable is not intended to be a complete type.
name | name of this instance |
orderedComponentNames | name for each component of the variable |
|
inlinevirtual |
Returns the absolute minimum value for the component identified Absolute min is the closest value to zero Value will be negative if any negative values were found.
componentIndex | Index of component |
Reimplemented in WmUnstructuredArray.
|
virtual |
Compares this variable to another supplied WmVariable and report if they are swap compatible.
|
virtual |
Set the variable from supplied one.
source | variable to copy from |
|
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.
io | I/O object to use for writing |
grpNode | group node to write to |
Reimplemented from WxObject.
Reimplemented in WmUnstructuredArray.
|
inlinevirtual |
For each component, apply a fill value throughout the domain.
fillValues | values for each variable component. |
Reimplemented in WmUnstructuredArray.
const std::string & WmVariable::getComponentName | ( | const variableComponent_t | index | ) | const |
Returns the component name for a given index.
componentName | component name to be checked |
std::vector< std::string > WmVariable::getComponentNames | ( | ) | const |
Get names of all components (alphabetical order)
Names | of all components |
|
virtual |
Returns a type_info reference for the most primative element type stored by the variable.
|
virtual |
Returns a type_info reference for the most primative element type stored by the variable.
i.e. The type is expected to be float, double, int, or some low-level struct
index | Component index of interest |
Reimplemented in WmUnstructuredArray.
variableComponent_t WmVariable::getIndexForComponent | ( | const std::string & | componentName | ) | const |
Returns the component number associated with the componentName.
componentName | component name to be checked |
unsigned int WmVariable::getNumComponents | ( | ) | const |
Returns number of components represented in the variable.
const WmSolverBase & WmVariable::getParent | ( | ) | const |
Get the parent solver.
|
protected |
Get the type that real type aliases.
Should be equal to either double, float, or int.
|
protected |
Get the name for the type that real type aliases.
Should be equal to either "double", "float", or "int".
bool WmVariable::hasComponent | ( | const std::string & | componentName | ) | const |
Check if this variable has a component matching the name supplied.
componentName | component name to be checked |
|
virtual |
Load object from file.
This method is passed a group node from which its data should be read and then constructed.
io | I/O object to use for writing |
grpNode | group node to read from |
Reimplemented from WxObject.
Reimplemented in WmUnstructuredArray.
|
inlinevirtual |
Returns the minimum value for the component identified.
componentIndex | Index of component |
Reimplemented in WmUnstructuredArray.
|
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".
wxc | Cryptset using which the object is set up. |
Reimplemented from WxObject.
Reimplemented in WmUnstructuredArray, and WmDistributedVariable.
|
virtual |
Swap the internal data storage of this variable with otherVar leaving the outer shell the same, given both have same size and properties.
otherVar | is the other variable to swap with Undefined if variables are not compatible. |
|
protected |
|
protected |
|
protected |
|
protected |