Advanced Multi-Physics (AMP)
On-Line Documentation
Public Member Functions | Protected Attributes | List of all members
AMP::LinearAlgebra::Variable Class Reference

A description of the data in the vector. More...

#include <Variable.h>

Inheritance diagram for AMP::LinearAlgebra::Variable:
Inheritance graph
[legend]

Public Member Functions

virtual std::string className () const
 A function that returns the name of a variable.
 
std::shared_ptr< Variableclone () const
 Create a variable of the same type with a new name.
 
virtual std::shared_ptr< Variableclone (const std::string &name) const
 Create a variable of the same type with a new name.
 
virtual std::shared_ptr< VectorSelectorcreateVectorSelector () const
 Create a VectorSelector.
 
virtual uint64_t getID () const
 Get a unique id hash for the vector.
 
auto & getName () const
 A function that returns the name of a variable.
 
virtual const UnitsgetUnits () const
 Get the units of this variable.
 
bool operator!= (const Variable &rhs) const
 Inverse of ==.
 
virtual bool operator== (const Variable &rhs) const
 Compares two variables for equality.
 
virtual void registerChildObjects (AMP::IO::RestartManager *manager) const
 Register any child objects.
 
virtual void setUnits (const Units &u)
 Set the units of this variable.
 
std::shared_ptr< Variableshared_from_this ()
 
std::shared_ptr< const Variableshared_from_this () const
 
 Variable ()=default
 
 Variable (const std::string &name)
 Construct a variable with a name.
 
 Variable (int64_t fid)
 Read restart data to file.
 
virtual void writeRestart (int64_t fid) const
 Write restart data to file.
 
virtual ~Variable ()
 Destructor.
 

Protected Attributes

AMP::Units d_Units
 The units this variable is measured in.
 
std::string d_VariableName
 A name given to the variable.
 
std::weak_ptr< Variableweak_ptr_
 

Detailed Description

A description of the data in the vector.

This class stores information about the vector such as the name and units. It is used in subsetting operations.

Definition at line 45 of file Variable.h.

Constructor & Destructor Documentation

◆ Variable() [1/3]

AMP::LinearAlgebra::Variable::Variable ( )
default

◆ Variable() [2/3]

AMP::LinearAlgebra::Variable::Variable ( const std::string &  name)
explicit

Construct a variable with a name.

At the very least, a variable must have a name. Since this class is virtual, this constructor is used by derived classes.

Parameters
nameThe name of the variable

◆ ~Variable()

virtual AMP::LinearAlgebra::Variable::~Variable ( )
virtual

Destructor.

◆ Variable() [3/3]

AMP::LinearAlgebra::Variable::Variable ( int64_t  fid)

Read restart data to file.

This function will create a variable from the restart file

Parameters
fidFile identifier to write

Member Function Documentation

◆ className()

virtual std::string AMP::LinearAlgebra::Variable::className ( ) const
inlinevirtual

◆ clone() [1/2]

std::shared_ptr< Variable > AMP::LinearAlgebra::Variable::clone ( ) const

Create a variable of the same type with a new name.

This function will create a "deep" copy of this variable.

◆ clone() [2/2]

virtual std::shared_ptr< Variable > AMP::LinearAlgebra::Variable::clone ( const std::string &  name) const
virtual

Create a variable of the same type with a new name.

This function will create a "deep" copy of this variable.

Reimplemented in AMP::LinearAlgebra::MultiVariable.

◆ createVectorSelector()

virtual std::shared_ptr< VectorSelector > AMP::LinearAlgebra::Variable::createVectorSelector ( ) const
virtual

◆ getID()

virtual uint64_t AMP::LinearAlgebra::Variable::getID ( ) const
virtual

◆ getName()

auto & AMP::LinearAlgebra::Variable::getName ( ) const
inline

A function that returns the name of a variable.

This gives access to the name

Definition at line 74 of file Variable.h.

References d_VariableName.

◆ getUnits()

virtual const Units & AMP::LinearAlgebra::Variable::getUnits ( ) const
virtual

Get the units of this variable.

◆ operator!=()

bool AMP::LinearAlgebra::Variable::operator!= ( const Variable rhs) const

Inverse of ==.

This function performs an equality check and negates it.

Parameters
rhsVariable to compare

◆ operator==()

virtual bool AMP::LinearAlgebra::Variable::operator== ( const Variable rhs) const
virtual

Compares two variables for equality.

This operation compares the names.

Parameters
rhsVariable to compare

Reimplemented in AMP::LinearAlgebra::MultiVariable.

◆ registerChildObjects()

virtual void AMP::LinearAlgebra::Variable::registerChildObjects ( AMP::IO::RestartManager manager) const
virtual

Register any child objects.

This function will register child objects with the manager

Parameters
managerRestart manager

Reimplemented in AMP::LinearAlgebra::MultiVariable.

◆ setUnits()

virtual void AMP::LinearAlgebra::Variable::setUnits ( const Units u)
virtual

Set the units of this variable.

Reimplemented in AMP::LinearAlgebra::MultiVariable.

◆ shared_from_this() [1/2]

std::shared_ptr< Variable > AMP::enable_shared_from_this< Variable >::shared_from_this ( )
inlineinherited

Definition at line 28 of file enable_shared_from_this.h.

◆ shared_from_this() [2/2]

std::shared_ptr< const Variable > AMP::enable_shared_from_this< Variable >::shared_from_this ( ) const
inlineinherited

Definition at line 46 of file enable_shared_from_this.h.

◆ writeRestart()

virtual void AMP::LinearAlgebra::Variable::writeRestart ( int64_t  fid) const
virtual

Member Data Documentation

◆ d_Units

AMP::Units AMP::LinearAlgebra::Variable::d_Units
protected

The units this variable is measured in.

Definition at line 155 of file Variable.h.

◆ d_VariableName

std::string AMP::LinearAlgebra::Variable::d_VariableName
protected

A name given to the variable.

Variables have names for easy identification. For instance, some variables are called displacement, concentration, search direction, etc.

Definition at line 151 of file Variable.h.

Referenced by getName().

◆ weak_ptr_

std::weak_ptr<Variable > AMP::enable_shared_from_this< Variable >::weak_ptr_
mutableprotectedinherited

Definition at line 69 of file enable_shared_from_this.h.


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



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:43.
Comments on this page