Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Examples

SPARK::TVariable Class Reference

Class used to represent the properties and the numerical values of a problem variable. More...

#include <variable.h>

Collaboration diagram for SPARK::TVariable:

Collaboration graph
[legend]
List of all members.

Public Types

enum  FlagTypes {
  FlagType_BREAK = 0,
  FlagType_RESIDUAL,
  FlagType_DYNAMIC,
  FlagType_INPUT_FROM_LINK,
  FlagType_PREDICT_FROM_LINK,
  FlagType_REPORT,
  FLAGTYPES_L
}
 Describes internal properties of the variable as specified by setupcpp. More...


Public Member Functions

 TVariable ()
 Default constructor used when loading the problem at runtime.

 TVariable (unsigned handle, const char *name, const char *unit, SPARK::VariableTypes type, double initVal, double minVal, double maxVal, double atol, unsigned fromLinkId, const char *rd_url, const char *wr_url)
 Constructor used with compiled "problem.cpp" file.

Access methods for the current numerical value of the variable
double GetValue () const
 Returns the curent value as a double.

 operator double () const
 Enables implicit conversion to (double).

void SetValue (double scalar)
 Sets the current value to scalar.

SPARK::TVariableoperator= (double scalar)
 Sets the current value to scalar with operator=(double ).

double GetArgument () const
 Returns value for argument variable in an object.

void SetTarget (double scalar)
 Sets the target value for the matched object.

double GetTarget () const
 Returns value from evaluating the matched object (used by TEquationSystem and TJacobian internally).

double Predict () const
 Predicts value for current time based on past values only.

Access methods for past and inner values
unsigned GetNumPastValues () const
 Returns the number of past values that are being kept track of.

double GetPastValue (unsigned pastStep) const
 Returns the past value from idx steps ago.

double operator[] (unsigned pastStep) const
 Returns the past value from idx steps ago.

double GetInnerValue (unsigned innerStep) const
 Access the intermediate values over the currrent step.

double operator() (unsigned innerStep) const
 Access the intermediate values over the currrent step.

Updating methods
void SetFromLinkId (unsigned var_id)
 Set INPUT_FROM_LINK=FromLink or PREDICT_FROM_LINK=FromLink.

unsigned GetFromLinkId () const
 Get var_id of FromLink variables, SPARK::NotAssigned if not specified.

Access operations for the internal properties
TObjectGetMatchedObject ()
const TObjectGetMatchedObject () const
Access operations for the LINK properties
unsigned GetHandle () const
 Returns the unique handle as unsigned int.

SPARK::VariableTypes GetType () const
 Returns the variable type as SPARK::VariableTypes.

unsigned long GetFlag () const
 Returns the variable flag as an unsigned int.

const std::string & GetName () const
 Returns the variable name as a const char*.

const std::string & GetUnit () const
 Returns the unit string as const char*.

void SetUnit (const char *unit)
 Sets the unit string to unit.

double GetInit () const
 Returns the initial value as double.

void SetInit (double init)
 Sets the initial value to init.

double GetMin () const
 Returns the mimimum value as double.

void SetMin (double min)
 Sets the minimum value to min.

double GetMax () const
 Returns the maximum value as double.

void SetMax (double max)
 Sets the maximum value to max.

double GetAbsTolerance () const
 Returns the absolute tolerance as double.

void SetAbsTolerance (double atol)
 Sets the absolute tolerance to atol.

double GetScale () const
 Returns the current scale.

void SetScale (double scalar)
 Sets the current scale to scalar.

Predicate methods
bool IsFlag (FlagTypes flag) const
 Returns if flag is set for this variable, false otherwise.

IO operations
void Write (std::ostream &os, unsigned width, unsigned precision) const
R/W URL methods
Note:
Not yet documented


const char * GetReadUrlString () const
void SetReadUrlString (const char *url)
int GetReadUrlHandle () const
void SetReadUrlHandle (int s)
const char * GetWriteUrlString () const
void SetWriteUrlString (const char *url)
int GetWriteUrlHandle () const
void SetWriteUrlHandle (int s)

Detailed Description

Class used to represent the properties and the numerical values of a problem variable.

This class is the building block of the SPARK solver framework. It is used to represent all problem variables at the problem and component levels.

The low-level numerical solution methods do not operate directly on the SPARK::TVariable instances but on arrays of fundamental types (i.e., double, unsigned...).

Eventually, the numerical values in the SPARK::TVariable objects are updated with the solution of the nonlinear solver.


Member Enumeration Documentation

enum SPARK::TVariable::FlagTypes
 

Describes internal properties of the variable as specified by setupcpp.

Enumeration values:
FlagType_BREAK  setupcpp flaged this LINK as a break variable
FlagType_RESIDUAL  matched EVALUATE callback returns RESIDUAL value
FlagType_DYNAMIC  connected to X port of an INTEGRATOR atomic class
FlagType_INPUT_FROM_LINK  LINK specified with INPUT_FROM_LINK.
FlagType_PREDICT_FROM_LINK  LINK specified with PREDICT_FROM_LINK.
FlagType_REPORT  LINK specified with REPORT or Write URL specified with REPORT tag.
FLAGTYPES_L  Number of different flags.


Constructor & Destructor Documentation

SPARK::TVariable::TVariable  ) 
 

Default constructor used when loading the problem at runtime.

SPARK::TVariable::TVariable unsigned  handle,
const char *  name,
const char *  unit,
SPARK::VariableTypes  type,
double  initVal,
double  minVal,
double  maxVal,
double  atol,
unsigned  fromLinkId,
const char *  rd_url,
const char *  wr_url
 

Constructor used with compiled "problem.cpp" file.


Member Function Documentation

double SPARK::TVariable::GetValue  )  const [inline]
 

Returns the curent value as a double.

SPARK::TVariable::operator double  )  const [inline]
 

Enables implicit conversion to (double).

void SPARK::TVariable::SetValue double  scalar  )  [inline]
 

Sets the current value to scalar.

SPARK::TVariable& SPARK::TVariable::operator= double  scalar  )  [inline]
 

Sets the current value to scalar with operator=(double ).

double SPARK::TVariable::GetArgument  )  const [inline]
 

Returns value for argument variable in an object.

void SPARK::TVariable::SetTarget double  scalar  )  [inline]
 

Sets the target value for the matched object.

double SPARK::TVariable::GetTarget  )  const [inline]
 

Returns value from evaluating the matched object (used by TEquationSystem and TJacobian internally).

double SPARK::TVariable::Predict  )  const
 

Predicts value for current time based on past values only.

Returns an estimate of the solution at the current time using the explicit Euler scheme to calculate the extrapolatation from past values

Note:
After a static step, it returns the value at the past step

unsigned SPARK::TVariable::GetNumPastValues  )  const
 

Returns the number of past values that are being kept track of.

double SPARK::TVariable::GetPastValue unsigned  pastStep  )  const [inline]
 

Returns the past value from idx steps ago.

double SPARK::TVariable::operator[] unsigned  pastStep  )  const [inline]
 

Returns the past value from idx steps ago.

double SPARK::TVariable::GetInnerValue unsigned  innerStep  )  const [inline]
 

Access the intermediate values over the currrent step.

double SPARK::TVariable::operator() unsigned  innerStep  )  const [inline]
 

Access the intermediate values over the currrent step.

void SPARK::TVariable::SetFromLinkId unsigned  var_id  )  [inline]
 

Set INPUT_FROM_LINK=FromLink or PREDICT_FROM_LINK=FromLink.

unsigned SPARK::TVariable::GetFromLinkId  )  const [inline]
 

Get var_id of FromLink variables, SPARK::NotAssigned if not specified.

TObject* SPARK::TVariable::GetMatchedObject  )  [inline]
 

Returns the pointer to the object this variable is matched with

Warning:
If the variable is not an unknown, then there is no matched object and the data member is equal to 0.

const TObject* SPARK::TVariable::GetMatchedObject  )  const [inline]
 

Returns the const pointer to the object this variable is matched with

Warning:
If the variable is not an unknown, then there is no matched object and the data member is equal to 0.

unsigned SPARK::TVariable::GetHandle  )  const [inline]
 

Returns the unique handle as unsigned int.

SPARK::VariableTypes SPARK::TVariable::GetType  )  const [inline]
 

Returns the variable type as SPARK::VariableTypes.

unsigned long SPARK::TVariable::GetFlag  )  const [inline]
 

Returns the variable flag as an unsigned int.

const std::string& SPARK::TVariable::GetName  )  const [inline]
 

Returns the variable name as a const char*.

const std::string& SPARK::TVariable::GetUnit  )  const [inline]
 

Returns the unit string as const char*.

void SPARK::TVariable::SetUnit const char *  unit  )  [inline]
 

Sets the unit string to unit.

double SPARK::TVariable::GetInit  )  const [inline]
 

Returns the initial value as double.

void SPARK::TVariable::SetInit double  init  )  [inline]
 

Sets the initial value to init.

double SPARK::TVariable::GetMin  )  const [inline]
 

Returns the mimimum value as double.

void SPARK::TVariable::SetMin double  min  )  [inline]
 

Sets the minimum value to min.

Here is the call graph for this function:

double SPARK::TVariable::GetMax  )  const [inline]
 

Returns the maximum value as double.

void SPARK::TVariable::SetMax double  max  )  [inline]
 

Sets the maximum value to max.

Here is the call graph for this function:

double SPARK::TVariable::GetAbsTolerance  )  const [inline]
 

Returns the absolute tolerance as double.

void SPARK::TVariable::SetAbsTolerance double  atol  ) 
 

Sets the absolute tolerance to atol.

double SPARK::TVariable::GetScale  )  const [inline]
 

Returns the current scale.

void SPARK::TVariable::SetScale double  scalar  )  [inline]
 

Sets the current scale to scalar.

bool SPARK::TVariable::IsFlag FlagTypes  flag  )  const [inline]
 

Returns if flag is set for this variable, false otherwise.

void SPARK::TVariable::Write std::ostream &  os,
unsigned  width,
unsigned  precision
const
 

Pretty printing of the variable name, its numerical value and its unit string to the output stream os


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

Generated on 5 Nov 2003 for VisualSPARK 2.01