scalarAndError Class Reference

Class to encapsulate a scalar value and an associated round-off error. The error is tracked through operations performed between scalarAndError variables. More...

Public Types

typedef scalarAndError cmptType
 Component type. More...
 

Public Member Functions

 scalarAndError ()
 Default construct. More...
 
 scalarAndError (const zero &)
 Construct zero. More...
 
 scalarAndError (const scalar v)
 Construct from a scalar. More...
 
 scalarAndError (const scalar v, const scalar e)
 Construct from a scalar and an error. More...
 
scalarAndError operator- () const
 Negate. More...
 
void operator+= (const scalarAndError &sae)
 Add another scalar-and-error to this one. More...
 
void operator-= (const scalarAndError &sae)
 Subtract another scalar-and-error from this one. More...
 
void operator*= (const scalarAndError &sae)
 Multiply another scalar-and-error with this one. More...
 
void operator/= (const scalarAndError &sae)
 Divide this scalar-and-error by another. More...
 

Public Attributes

scalar value
 The value. More...
 
scalar error
 The error. More...
 

Static Public Attributes

static const direction dim = 3
 Dimensionality of space. More...
 
static const direction rank = 0
 Rank of scalarAndError is 0. More...
 
static const direction nComponents = 1
 Number of components in scalarAndError is 1. More...
 

Detailed Description

Class to encapsulate a scalar value and an associated round-off error. The error is tracked through operations performed between scalarAndError variables.

Source files

Definition at line 52 of file scalarAndError.H.

Member Typedef Documentation

◆ cmptType

Component type.

Definition at line 57 of file scalarAndError.H.

Constructor & Destructor Documentation

◆ scalarAndError() [1/4]

scalarAndError ( )
inline

Default construct.

Definition at line 84 of file scalarAndError.H.

Referenced by scalarAndError::operator-().

Here is the caller graph for this function:

◆ scalarAndError() [2/4]

scalarAndError ( const zero )
inline

Construct zero.

Definition at line 88 of file scalarAndError.H.

◆ scalarAndError() [3/4]

scalarAndError ( const scalar  v)
inline

Construct from a scalar.

Definition at line 95 of file scalarAndError.H.

◆ scalarAndError() [4/4]

scalarAndError ( const scalar  v,
const scalar  e 
)
inline

Construct from a scalar and an error.

Definition at line 102 of file scalarAndError.H.

Member Function Documentation

◆ operator-()

scalarAndError operator- ( ) const
inline

Negate.

Definition at line 112 of file scalarAndError.H.

References scalarAndError::scalarAndError(), and scalarAndError::value.

Here is the call graph for this function:

◆ operator+=()

void operator+= ( const scalarAndError sae)
inline

Add another scalar-and-error to this one.

Definition at line 118 of file scalarAndError.H.

References scalarAndError::error, Foam::mag(), and scalarAndError::value.

Referenced by scalarAndError::operator-=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator-=()

void operator-= ( const scalarAndError sae)
inline

Subtract another scalar-and-error from this one.

Definition at line 125 of file scalarAndError.H.

References scalarAndError::operator+=().

Here is the call graph for this function:

◆ operator*=()

void operator*= ( const scalarAndError sae)
inline

Multiply another scalar-and-error with this one.

Definition at line 131 of file scalarAndError.H.

References scalarAndError::error, Foam::mag(), and scalarAndError::value.

Here is the call graph for this function:

◆ operator/=()

void operator/= ( const scalarAndError sae)
inline

Divide this scalar-and-error by another.

Definition at line 138 of file scalarAndError.H.

References scalarAndError::error, Foam::mag(), Foam::sqr(), and scalarAndError::value.

Here is the call graph for this function:

Member Data Documentation

◆ dim

const direction dim = 3
static

Dimensionality of space.

Definition at line 63 of file scalarAndError.H.

◆ rank

const direction rank = 0
static

Rank of scalarAndError is 0.

Definition at line 66 of file scalarAndError.H.

◆ nComponents

const direction nComponents = 1
static

Number of components in scalarAndError is 1.

Definition at line 69 of file scalarAndError.H.

◆ value

◆ error


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