Manual for OpenFLUID 2.1.11

Public Member Functions | List of all members
openfluid::core::MatrixValue Class Reference

Detailed Description

MatrixValue is a container for a 2D matrix of signed double precision floating point values.

See also
Value
Matrix

Example : declaration

// declaration of a MatrixValue, empty by default
// declaration of a MatrixValue, of 3 columns by 7 rows, with values initialized to 0.0
// declaration of a MatrixValue, of 3 columns by 7 rows, with values initialized to 1.99

Example : getting the contained values

double Tmp1;
Tmp1 = Val1.get(2,3);

Example : getting all values as a c-style array of double, rows-first indexed

double* DblArrayVal;
DblArrayVal = Val1.data();

Example : setting the contained values

// using the set method
Val1.set(0,0,101.99);

Example : conversion from string

// to MatrixValue, using two string values separators
StringVal.set("[[3,5,2.8,6,17.999923],[1,1,1,1,1],[2.11,2.12,2.13,2.14,2.15]]");
StringVal.toMatrixValue(Val2);
// to MatrixValue, using a single string values separator and row length
StringVal.set("[3,5,2.8,6,17.999923,1,1,1,1,1,2.11,2.12,2.13,2.14,2.15]");
StringVal.toMatrixValue(5,Val2);

Example : conversion to string

std::string StdStrVal = Val1.toString();

#include <core/MatrixValue.hpp>

Public Member Functions

 MatrixValue ()
 
 MatrixValue (const MatrixValue &Val)
 
 MatrixValue (MatrixValue &&Val)
 
 MatrixValue (unsigned long ColsNbr, unsigned long RowsNbr)
 
 MatrixValue (unsigned long ColsNbr, unsigned long RowsNbr, double InitValue)
 
MatrixValue & operator= (const Value &Other) override
 
MatrixValue & operator= (Value &&Other) override
 
MatrixValue & operator= (const MatrixValue &Other)
 
MatrixValue & operator= (MatrixValue &&Other)
 
virtual ~MatrixValue ()
 
Type getType () const override
 
Value * clone () const override
 
void writeToStream (std::ostream &OutStm) const override
 
void writeQuotedToStream (std::ostream &OutStm) const override
 
- Public Member Functions inherited from openfluid::core::CompoundValue
bool isSimple () const override
 
bool isCompound () const override
 
- Public Member Functions inherited from openfluid::core::Value
 Value ()=default
 
 Value (const Value &)=default
 
 Value (Value &&)=default
 
virtual ~Value ()=default
 
virtual bool convert (Value &) const
 
bool isDoubleValue () const
 
const DoubleValue & asDoubleValue () const
 
DoubleValue & asDoubleValue ()
 
bool isIntegerValue () const
 
const IntegerValue & asIntegerValue () const
 
IntegerValue & asIntegerValue ()
 
bool isBooleanValue () const
 
const BooleanValue & asBooleanValue () const
 
BooleanValue & asBooleanValue ()
 
bool isStringValue () const
 
const StringValue & asStringValue () const
 
StringValue & asStringValue ()
 
bool isNullValue () const
 
const NullValue & asNullValue () const
 
NullValue & asNullValue ()
 
bool isVectorValue () const
 
const VectorValue & asVectorValue () const
 
VectorValue & asVectorValue ()
 
bool isMatrixValue () const
 
const MatrixValue & asMatrixValue () const
 
MatrixValue & asMatrixValue ()
 
bool isMapValue () const
 
const MapValue & asMapValue () const
 
MapValue & asMapValue ()
 
bool isTreeValue () const
 
const TreeValue & asTreeValue () const
 
TreeValue & asTreeValue ()
 
std::string toString () const
 
- Public Member Functions inherited from openfluid::core::Matrix< double >
 Matrix ()
 
 Matrix (const Matrix &Other)
 
 Matrix (unsigned long ColsNbr, unsigned long RowsNbr)
 
 Matrix (unsigned long ColsNbr, unsigned long RowsNbr, const double &InitValue)
 
Matrix< double > & operator= (const Matrix &Other)
 
Matrix< double > & operator= (Matrix &&Other)
 
virtual ~Matrix ()=default
 
unsigned long getColsNbr () const
 
unsigned long getRowsNbr () const
 
unsigned long getSize () const
 
unsigned long size () const
 
double * data () const
 
void setData (double *Data, unsigned long ColsNbr, unsigned long RowsNbr)
 
double getElement (unsigned long ColIndex, unsigned long RowIndex) const
 
double at (unsigned long ColIndex, unsigned long RowIndex) const
 
double get (unsigned long ColIndex, unsigned long RowIndex) const
 
void setElement (unsigned long ColIndex, unsigned long RowIndex, const double &Val)
 
void set (unsigned long ColIndex, unsigned long RowIndex, const double &Val)
 
void fill (const double &Val)
 
void clear ()
 

Additional Inherited Members

- Public Types inherited from openfluid::core::Value
enum  Type {
  NONE, BOOLEAN, INTEGER, DOUBLE,
  STRING, VECTOR, MATRIX, MAP,
  TREE, NULLL
}
 
- Static Public Member Functions inherited from openfluid::core::Value
static bool getValueTypeFromString (const std::string &ValueTypeString, Value::Type &ValueType)
 
static std::string getStringFromValueType (const Value::Type ValueType)
 
- Protected Member Functions inherited from openfluid::core::Matrix< double >
bool allocate (unsigned long ColsNbr, unsigned long RowsNbr)
 
void init ()
 
- Protected Attributes inherited from openfluid::core::Matrix< double >
std::unique_ptr< double[]> m_Data
 
unsigned long m_ColsNbr
 
unsigned long m_RowsNbr
 
Inheritance diagram for openfluid::core::MatrixValue:
Inheritance graph
[legend]
Collaboration diagram for openfluid::core::MatrixValue:
Collaboration graph
[legend]

Constructor & Destructor Documentation

◆ MatrixValue() [1/5]

openfluid::core::MatrixValue::MatrixValue ( )
inline

Default constructor

◆ MatrixValue() [2/5]

openfluid::core::MatrixValue::MatrixValue ( const MatrixValue &  Val)
inline

Copy constructor

◆ MatrixValue() [3/5]

openfluid::core::MatrixValue::MatrixValue ( MatrixValue &&  Val)
inline

Move constructor

◆ MatrixValue() [4/5]

openfluid::core::MatrixValue::MatrixValue ( unsigned long  ColsNbr,
unsigned long  RowsNbr 
)
inline

Constructor, creates a Matrix containing ColsNbr x RowsNbr elements

◆ MatrixValue() [5/5]

openfluid::core::MatrixValue::MatrixValue ( unsigned long  ColsNbr,
unsigned long  RowsNbr,
double  InitValue 
)
inline

Constructor, creates a Matrix containing ColsNbr x RowsNbr elements, initialized with value InitValue

◆ ~MatrixValue()

virtual openfluid::core::MatrixValue::~MatrixValue ( )
inlinevirtual

Member Function Documentation

◆ clone()

Value* openfluid::core::MatrixValue::clone ( ) const
inlineoverridevirtual

Reimplemented from openfluid::core::Value.

◆ getType()

Type openfluid::core::MatrixValue::getType ( ) const
inlineoverridevirtual

◆ operator=() [1/4]

MatrixValue& openfluid::core::MatrixValue::operator= ( const MatrixValue &  Other)

◆ operator=() [2/4]

MatrixValue& openfluid::core::MatrixValue::operator= ( const Value &  )
overridevirtual

Assignment operator

Reimplemented from openfluid::core::Value.

◆ operator=() [3/4]

MatrixValue& openfluid::core::MatrixValue::operator= ( MatrixValue &&  Other)

◆ operator=() [4/4]

MatrixValue& openfluid::core::MatrixValue::operator= ( Value &&  )
overridevirtual

Move operator

Reimplemented from openfluid::core::Value.

◆ writeQuotedToStream()

void openfluid::core::MatrixValue::writeQuotedToStream ( std::ostream &  OutStm) const
inlineoverridevirtual

◆ writeToStream()

void openfluid::core::MatrixValue::writeToStream ( std::ostream &  OutStm) const
overridevirtual

The documentation for this class was generated from the following file:
openfluid::core::MatrixValue
Definition: MatrixValue.hpp:84
openfluid::core::StringValue::set
void set(const std::string &Val)
Definition: StringValue.hpp:200
openfluid::core::Value::toString
std::string toString() const
openfluid::core::Matrix::get
T get(unsigned long ColIndex, unsigned long RowIndex) const
Definition: Matrix.hpp:174
openfluid::core::Matrix::set
void set(unsigned long ColIndex, unsigned long RowIndex, const T &Val)
Definition: Matrix.hpp:186
openfluid::core::StringValue
Definition: StringValue.hpp:76
openfluid::core::StringValue::toMatrixValue
bool toMatrixValue(MatrixValue &Val) const
openfluid::core::Matrix::data
T * data() const
Definition: Matrix.hpp:148