Show / Hide Table of Contents

Class SubcircuitSolverState<T, S>

A subcircuit simulation state with a solver.

Inheritance
object
SubcircuitSolverState<T, S>
FlatSolverState<T, S>
LocalSolverState<T, S>
Implements
ISolverSimulationState<T>
ISimulationState
IVariableFactory<IVariable<T>>
IVariableDictionary<IVariable<T>>
IReadOnlyDictionary<string, IVariable<T>>
IReadOnlyCollection<KeyValuePair<string, IVariable<T>>>
IEnumerable<KeyValuePair<string, IVariable<T>>>
IEnumerable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: SpiceSharp.Components.Subcircuits
Assembly: SpiceSharp.dll
Syntax
public abstract class SubcircuitSolverState<T, S> : ISolverSimulationState<T>, ISimulationState, IVariableFactory<IVariable<T>>, IVariableDictionary<IVariable<T>>, IReadOnlyDictionary<string, IVariable<T>>, IReadOnlyCollection<KeyValuePair<string, IVariable<T>>>, IEnumerable<KeyValuePair<string, IVariable<T>>>, IEnumerable where S : ISolverSimulationState<T>
Type Parameters
Name Description
T

The base value type.

S

The parent simulation state type.

Constructors

SubcircuitSolverState(string, S)

Initializes a new instance of the SubcircuitSolverState<T, S> class.

Declaration
protected SubcircuitSolverState(string name, S parent)
Parameters
Type Name Description
string name

The name.

S parent

The parent.

Exceptions
Type Condition
ArgumentNullException

Thrown if name or parent is null.

Fields

Name

The name of the subcircuit.

Declaration
protected readonly string Name
Field Value
Type Description
string

Parent

The parent simulation state.

Declaration
protected readonly S Parent
Field Value
Type Description
S

Properties

Comparer

Gets the comparer used for comparing variable names.

Declaration
public IEqualityComparer<string> Comparer { get; }
Property Value
Type Description
IEqualityComparer<string>

The comparer.

Count

Gets the number of elements in the collection.

Declaration
public int Count { get; }
Property Value
Type Description
int

The number of elements in the collection.

this[string]

Gets the IVariable<T> with the specified key.

Declaration
public IVariable<T> this[string key] { get; }
Parameters
Type Name Description
string key

The key.

Property Value
Type Description
IVariable<T>

The IVariable<T>.

Keys

Gets an enumerable collection that contains the keys in the dictionary.

Declaration
public IEnumerable<string> Keys { get; }
Property Value
Type Description
IEnumerable<string>

Map

Gets the IVariableMap that maps variables to indices for the solver.

Declaration
public abstract IVariableMap Map { get; }
Property Value
Type Description
IVariableMap

The variable map.

Solution

Gets the solution to the solved equations.

Declaration
public abstract IVector<T> Solution { get; }
Property Value
Type Description
IVector<T>

The solution.

Solver

Gets the solver used to solve the system of equations.

Declaration
public abstract ISparsePivotingSolver<T> Solver { get; }
Property Value
Type Description
ISparsePivotingSolver<T>

The solver.

Values

Gets an enumerable collection that contains the values in the dictionary.

Declaration
public IEnumerable<IVariable<T>> Values { get; }
Property Value
Type Description
IEnumerable<IVariable<T>>

Methods

Add(string, IVariable<T>)

Adds a variable to the dictionary.

Declaration
public void Add(string id, IVariable<T> variable)
Parameters
Type Name Description
string id

The identifier.

IVariable<T> variable

The variable.

Exceptions
Type Condition
ArgumentNullException

Thrown if id or variable is null.

ArgumentException

Thrown if a variable with the same identifier already exists.

ContainsKey(string)

Determines whether the dictionary contains an element that has the specified key.

Declaration
public bool ContainsKey(string key)
Parameters
Type Name Description
string key

The key to locate.

Returns
Type Description
bool

true if the read-only dictionary contains an element that has the specified key; otherwise, false.

CreatePrivateVariable(string, IUnit)

Creates a variable that is private to whoever requested it. The factory will not shared this variable with anyone else, and the name is only used for display purposes.

Declaration
public abstract IVariable<T> CreatePrivateVariable(string name, IUnit unit)
Parameters
Type Name Description
string name

The name of the private variable.

IUnit unit

The unit of the variable.

Returns
Type Description
IVariable<T>

The private variable.

GetEnumerator()

Returns an enumerator that iterates through the collection.

Declaration
public IEnumerator<KeyValuePair<string, IVariable<T>>> GetEnumerator()
Returns
Type Description
IEnumerator<KeyValuePair<string, IVariable<T>>>

An enumerator that can be used to iterate through the collection.

GetSharedVariable(string)

Gets a variable that can be shared with other behaviors by the factory. If another variable already exists with the same name, that is returned instead.

Declaration
public abstract IVariable<T> GetSharedVariable(string name)
Parameters
Type Name Description
string name

The name of the shared variable.

Returns
Type Description
IVariable<T>

The shared variable.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

TryGetValue(string, out IVariable<T>)

Gets the value that is associated with the specified key.

Declaration
public bool TryGetValue(string key, out IVariable<T> value)
Parameters
Type Name Description
string key

The key to locate.

IVariable<T> value

When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.

Returns
Type Description
bool

true if the dictionary contains a variable that has the specified key; otherwise, false.

Implements

ISolverSimulationState<T>
ISimulationState
IVariableFactory<V>
IVariableDictionary<V>
IReadOnlyDictionary<TKey, TValue>
IReadOnlyCollection<T>
IEnumerable<T>
IEnumerable

Extension Methods

Utility.ThrowIfNull<T>(T, string)
Utility.ThrowIfEmpty<T>(IEnumerable<T>, string)

See Also

ISolverSimulationState<T>
In this article
Back to top Generated by DocFX