Template Class Node

Inheritance Relationships

Base Type

Class Documentation

template<typename ScalarT, typename IdxT>
class Node : public GridKit::Model::Evaluator<ScalarT, IdxT>

Circuit node representing a connection point.

Public Functions

inline virtual int allocate()

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 requires allocate() to be called in between modifying the model and reallocating may invoke undefined behaviour.

inline virtual int initialize()

Initialize node variables.

inline virtual int tagDifferentiable()

Node variables are algebraic.

inline virtual int setAbsoluteTolerance(RealT rel_tol)

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.

Template Parameters:
  • ScalarT – Scalar data type

  • IdxT – Index data type

Returns:

int 0 if successful, non-zero otherwise.

inline virtual int evaluateResidual()

Node does not compute residuals, so here we just reset residual values.

Warning

This implementation assumes node residuals are always evaluated before component model residuals.

inline virtual bool hasJacobian() final

Is the Jacobian defined. Used in IDA to determine whether DQ is used or not.

Returns:

true

Returns:

false

inline virtual int evaluateJacobian()

There is no Jacobian for node variables.

inline virtual IdxT size() final

How many variables exist in the model.

inline virtual IdxT nnz() final

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

getCsrJacobian()

inline virtual std::vector<bool> &tag() final

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.

inline virtual VectorT &absoluteTolerance() final

Get the absolute tolerance for each variable in the model.

Returns:

a reference to the absolute tolerance vector.

Pre:

setAbsoluteTolerance must have been called first.

inline virtual const VectorT &absoluteTolerance() const final

Get the absolute tolerance for each variable in the model.

Returns:

a const reference to the absolute tolerance vector.

Pre:

setAbsoluteTolerance must have been called first.