Show / Hide Table of Contents

Class VariableMap

A default implementation for a variable map.

Inheritance
object
VariableMap
Implements
IVariableMap
IEnumerable<KeyValuePair<IVariable, int>>
IEnumerable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: SpiceSharp.Simulations
Assembly: SpiceSharp.dll
Syntax
public class VariableMap : IVariableMap, IEnumerable<KeyValuePair<IVariable, int>>, IEnumerable
Remarks

Can be used to map to indices for a solver that uses matrix equations.

Constructors

VariableMap(IVariable)

Initializes a new instance of the VariableMap class.

Declaration
public VariableMap(IVariable ground)
Parameters
Type Name Description
IVariable ground

The ground variable that receives index 0.

Properties

Count

Gets the number of mapped variables.

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

The number of mapped variables.

this[IVariable]

Gets the index associated with the specified variable.

Declaration
public int this[IVariable variable] { get; }
Parameters
Type Name Description
IVariable variable

The variable.

Property Value
Type Description
int

The index.

Exceptions
Type Condition
ArgumentNullException

Thrown if variable is null.

KeyNotFoundException

Thrown if the variable was not found.

this[int]

Gets the variable associated to the specified index.

Declaration
public IVariable this[int index] { get; }
Parameters
Type Name Description
int index

The index.

Property Value
Type Description
IVariable

The variable.

Exceptions
Type Condition
ArgumentException

Thrown if no variable was found at the specified index.

Methods

Add(IVariable, int)

Adds the specified variable.

Declaration
public void Add(IVariable variable, int index)
Parameters
Type Name Description
IVariable variable

The variable.

int index

The index.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown if the index is not strictly positive.

ArgumentException

Thrown if a variable already exists with the same index.

Clear()

Clears the map.

Declaration
public void Clear()

Contains(IVariable)

Determines whether a variable is mapped.

Declaration
public bool Contains(IVariable variable)
Parameters
Type Name Description
IVariable variable

The variable.

Returns
Type Description
bool

true if the variable is mapped; otherwise, false.

Exceptions
Type Condition
ArgumentNullException

Thrown if variable is null.

GetEnumerator()

Returns an enumerator that iterates through the collection.

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

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

Implements

IVariableMap
IEnumerable<T>
IEnumerable

Extension Methods

Utility.ThrowIfNull<T>(T, string)
Utility.ThrowIfEmpty<T>(IEnumerable<T>, string)
In this article
Back to top Generated by DocFX