This class is designed to provide a uniform interface for any class that uses an array of coefficients for any of its operations. More...
#include <MutableCoefficientsInterface.h>
Public Member Functions | |
MutableCoefficientsInterface (const MooseObject *moose_object, const InputParameters ¶meters) | |
Real | operator[] (std::size_t index) const |
Get the value of the coefficient at the corresponding index. More... | |
const std::vector< std::size_t > & | getCharacteristics () const |
Get a reference to the characteristics array. More... | |
const std::vector< Real > & | getCoefficients () const |
Get a read-only reference to the vector of coefficients. More... | |
std::vector< Real > & | getCoefficients () |
Get a writeable reference to the vector of coefficients. More... | |
std::string | getCoefficientsTable () const |
Get a formatted string of the coefficients. More... | |
std::size_t | getSize () const |
Get the size, aka number of coefficients. More... | |
bool | isCompatibleWith (const MutableCoefficientsInterface &other) const |
Checks to see if another instance is compatible. More... | |
bool | isSizeEnforced () const |
Returns true if the size of the coefficient array is fixed and enforced. More... | |
void | enforceSize (bool enforce) |
Toggle whether the size of the coefficient array can be changed. More... | |
void | importCoefficients (const MutableCoefficientsInterface &other) |
Import the coefficients from another instance. More... | |
void | resize (std::size_t size, Real fill=0.0, bool fill_out_to_size=true) |
Resize the array, using the value for fill if the new size is larger. More... | |
void | setCharacteristics (const std::vector< std::size_t > &new_characteristics) |
Sets the characteristics array. More... | |
void | setCoefficients (const std::vector< Real > &new_coefficients) |
Set the coefficients using a copy operation. More... | |
void | setCoefficients (std::vector< Real > &&dropin_coefficients) |
Set the coefficients using a move operation (only works with temp objects) More... | |
Protected Member Functions | |
virtual void | coefficientsChanged () |
Called when the coefficients have been changed. More... | |
Protected Attributes | |
std::vector< std::size_t > & | _characteristics |
An array of integer characteristics that can be used to check compatibility. More... | |
std::vector< Real > & | _coefficients |
The coefficient array. More... | |
bool | _enforce_size |
Boolean that locks or allows resizing of the coefficient array. More... | |
const bool | _print_coefficients |
Boolean to flag if the coefficients should be printed when set. More... | |
Private Attributes | |
const ConsoleStream & | _console |
MooseObject instance of this to provide access to _console More... | |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const MutableCoefficientsInterface &me) |
Friend operator to easily print out the array of coefficients. More... | |
This class is designed to provide a uniform interface for any class that uses an array of coefficients for any of its operations.
In particular, the MultiAppFXTransfer mechanism transfers coefficients using this interface. Any derived class of MutableCoefficientsInterface can easily be used in any MultiAppFXTransfer-based transfer.
Definition at line 30 of file MutableCoefficientsInterface.h.
MutableCoefficientsInterface::MutableCoefficientsInterface | ( | const MooseObject * | moose_object, |
const InputParameters & | parameters | ||
) |
Definition at line 31 of file MutableCoefficientsInterface.C.
|
inlineprotectedvirtual |
Called when the coefficients have been changed.
Reimplemented in MutableCoefficientsFunctionInterface.
Definition at line 107 of file MutableCoefficientsInterface.h.
Referenced by importCoefficients(), resize(), and setCoefficients().
void MutableCoefficientsInterface::enforceSize | ( | bool | enforce | ) |
Toggle whether the size of the coefficient array can be changed.
Definition at line 111 of file MutableCoefficientsInterface.C.
Referenced by FunctionSeries::FunctionSeries(), and MutableCoefficientsFunctionInterface::MutableCoefficientsFunctionInterface().
const std::vector< std::size_t > & MutableCoefficientsInterface::getCharacteristics | ( | ) | const |
Get a reference to the characteristics array.
Definition at line 51 of file MutableCoefficientsInterface.C.
std::vector< Real > & MutableCoefficientsInterface::getCoefficients | ( | ) |
Get a writeable reference to the vector of coefficients.
Definition at line 63 of file MutableCoefficientsInterface.C.
const std::vector< Real > & MutableCoefficientsInterface::getCoefficients | ( | ) | const |
Get a read-only reference to the vector of coefficients.
Definition at line 57 of file MutableCoefficientsInterface.C.
std::string MutableCoefficientsInterface::getCoefficientsTable | ( | ) | const |
Get a formatted string of the coefficients.
Definition at line 69 of file MutableCoefficientsInterface.C.
std::size_t MutableCoefficientsInterface::getSize | ( | ) | const |
Get the size, aka number of coefficients.
Definition at line 80 of file MutableCoefficientsInterface.C.
Referenced by isCompatibleWith(), and operator<<().
void MutableCoefficientsInterface::importCoefficients | ( | const MutableCoefficientsInterface & | other | ) |
Import the coefficients from another instance.
Definition at line 117 of file MutableCoefficientsInterface.C.
Referenced by MultiAppFXTransfer::execute().
bool MutableCoefficientsInterface::isCompatibleWith | ( | const MutableCoefficientsInterface & | other | ) | const |
Checks to see if another instance is compatible.
Definition at line 86 of file MutableCoefficientsInterface.C.
Referenced by MultiAppFXTransfer::execute(), and importCoefficients().
bool MutableCoefficientsInterface::isSizeEnforced | ( | ) | const |
Returns true if the size of the coefficient array is fixed and enforced.
Definition at line 105 of file MutableCoefficientsInterface.C.
Real MutableCoefficientsInterface::operator[] | ( | std::size_t | index | ) | const |
Get the value of the coefficient at the corresponding index.
Definition at line 45 of file MutableCoefficientsInterface.C.
void MutableCoefficientsInterface::resize | ( | std::size_t | size, |
Real | fill = 0.0 , |
||
bool | fill_out_to_size = true |
||
) |
Resize the array, using the value for fill if the new size is larger.
Definition at line 131 of file MutableCoefficientsInterface.C.
Referenced by FunctionSeries::FunctionSeries().
void MutableCoefficientsInterface::setCharacteristics | ( | const std::vector< std::size_t > & | new_characteristics | ) |
Sets the characteristics array.
Definition at line 149 of file MutableCoefficientsInterface.C.
Referenced by FunctionSeries::FunctionSeries().
void MutableCoefficientsInterface::setCoefficients | ( | const std::vector< Real > & | new_coefficients | ) |
Set the coefficients using a copy operation.
Definition at line 156 of file MutableCoefficientsInterface.C.
Referenced by MutableCoefficientsFunctionInterface::MutableCoefficientsFunctionInterface().
void MutableCoefficientsInterface::setCoefficients | ( | std::vector< Real > && | dropin_coefficients | ) |
Set the coefficients using a move operation (only works with temp objects)
Definition at line 171 of file MutableCoefficientsInterface.C.
|
friend |
Friend operator to easily print out the array of coefficients.
Definition at line 186 of file MutableCoefficientsInterface.C.
|
protected |
An array of integer characteristics that can be used to check compatibility.
Definition at line 107 of file MutableCoefficientsInterface.h.
Referenced by FXIntegralBaseUserObject< ElementIntegralVariableUserObject >::FXIntegralBaseUserObject(), getCharacteristics(), isCompatibleWith(), and setCharacteristics().
|
protected |
The coefficient array.
Definition at line 113 of file MutableCoefficientsInterface.h.
Referenced by FunctionSeries::expand(), FXIntegralBaseUserObject< ElementIntegralVariableUserObject >::FXIntegralBaseUserObject(), getCoefficients(), getSize(), importCoefficients(), operator<<(), operator[](), resize(), and setCoefficients().
|
private |
MooseObject instance of this
to provide access to _console
Definition at line 123 of file MutableCoefficientsInterface.h.
Referenced by importCoefficients(), resize(), and setCoefficients().
|
protected |
Boolean that locks or allows resizing of the coefficient array.
Definition at line 116 of file MutableCoefficientsInterface.h.
Referenced by enforceSize(), isCompatibleWith(), isSizeEnforced(), resize(), and setCoefficients().
|
protected |
Boolean to flag if the coefficients should be printed when set.
Definition at line 119 of file MutableCoefficientsInterface.h.
Referenced by importCoefficients(), resize(), and setCoefficients().