Class ParallelSolverState<T, S>
An abstract class with a default implementation for parallel access to solvers in parallel components.
Inheritance
Implements
Inherited Members
Namespace: SpiceSharp.Components.ParallelComponents
Assembly: SpiceSharp.dll
Syntax
public abstract class ParallelSolverState<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 base simulation state type. |
Constructors
ParallelSolverState(S)
Initializes a new instance of the ParallelSolverState<T, S> class.
Declaration
protected ParallelSolverState(S parent)
Parameters
| Type | Name | Description |
|---|---|---|
| S | parent | The parent simulation state. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
Fields
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 |
this[string]
Gets the variable with the specified name.
Declaration
public IVariable<T> this[string name] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the variable. |
Property Value
| Type | Description |
|---|---|
| IVariable<T> | The variable. |
Keys
Gets an enumerable collection that contains the keys in the dictionary.
Declaration
public IEnumerable<string> Keys { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<string> | The variable names. |
Map
Gets the IVariableMap that maps variables to indices for the solver.
Declaration
public IVariableMap Map { get; }
Property Value
| Type | Description |
|---|---|
| IVariableMap | The variable map. |
Solution
Gets the solution to the solved equations.
Declaration
public 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 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>> | The variables. |
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 |
| ArgumentException | Thrown if a variable with the same identifier already exists. |
Apply()
Applies the changes to the common solver.
Declaration
public void Apply()
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 |
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
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 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 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 |
Reset()
Resets all elements in the common solver.
Declaration
public void Reset()
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 |
Returns
| Type | Description |
|---|---|
| bool |
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |