Template Class Evaluator
Defined in File Evaluator.hpp
Inheritance Relationships
Derived Types
public GridKit::PhasorDynamics::BusBase< scalar_type, index_type >(Template Class BusBase)public GridKit::PhasorDynamics::Component< scalar_type, index_type >(Template Class Component)
Class Documentation
-
template<class scalar_type, typename index_type>
class Evaluator Abstract class describing a model.
Subclassed by GridKit::PhasorDynamics::BusBase< scalar_type, index_type >, GridKit::PhasorDynamics::Component< scalar_type, index_type >
Public Functions
-
virtual int allocate() = 0
Allocate all internal memory used by the model.
- Post:
Changing the model by changing its internal topology (i.e. size(), nnz(), sparsity pattern in getCsrJacobian(), etc.) may invalidate the model until
allocate()is called again. Calling any function that requiresallocate()to be called in between modifying the model and reallocating may invoke undefined behaviour.
-
virtual int tagDifferentiable() = 0
Fill the tag() vector with proper indicators.
Note
For some models, this may be a no-op, and the vector returned by tag() will still be empty.
- Pre:
allocate() must have been called.
-
virtual int setAbsoluteTolerance(RealT rel_tol) = 0
Compute the absolute tolerance for each variable in the model.
This represents a “noise” level close to zero for which pure relative error cannot be used.
- Parameters:
rel_tol – The relative tolerance which can be used to pick the absolute tolerance.
- Returns:
int 0 if successful, non-zero otherwise.
-
virtual int evaluateResidual() = 0
Evaluate the model’s residual function.
For models which can be appropriately modeled in semi-explicit form, this will evaluate
\[F(t, y, \dot{y}) = f(t,y) - M \dot{y},\]where\[M\]is the mass matrix. For models which can be modeled in Hessenberg form,\[M\]should be a simple indicator function for if the variable is differential (if\[\dot{y}\]appears in its equation). This indicator should be given by tag().
-
virtual IdxT size() = 0
How many variables exist in the model.
-
virtual IdxT nnz() = 0
How many non-zero elements are in this model’s Jacobian.
This knowledge may be needed to allocate the buffers for the model’s Jacobian, so it it should not depend on allocate() having been called.
See also
-
inline virtual bool monitoring() const
Is there something to monitor? Defaults to
false.
-
inline virtual void printMonitoredVariables() const
Print variables at current state.
-
inline virtual const VariableMonitorBase *getMonitor() const
Get non-owning reference to monitor.
-
inline virtual void startMonitor()
Get monitor ready for output.
-
inline virtual void stopMonitor()
Tell monitor to wrap up.
-
inline virtual CsrMatrixT *getCsrJacobian() const
Return a pointer to the CSR Jacobian.
- Pre:
allocate() must have been called.
-
virtual bool hasJacobian() = 0
Is the Jacobian defined. Used in IDA to determine whether DQ is used or not.
- Returns:
true
- Returns:
false
-
virtual VectorT &absoluteTolerance() = 0
Get the absolute tolerance for each variable in the model.
- Returns:
a reference to the absolute tolerance vector.
- Pre:
setAbsoluteTolerancemust have been called first.
-
virtual const VectorT &absoluteTolerance() const = 0
Get the absolute tolerance for each variable in the model.
- Returns:
a const reference to the absolute tolerance vector.
- Pre:
setAbsoluteTolerancemust have been called first.
-
virtual std::vector<bool> &tag() = 0
An indicator for which variables in the model are differential (true) or algebraic (false).
This information may be required for certain integrator features (such as the AnalysisManager::NativeDynamicSolver::Rosenbrock integrator), but is not required to be set. A reference to an empty vector may be returned.
- Pre:
tagDifferentiable() must have been called.
-
virtual int allocate() = 0