Class Parallel
A component that can execute multiple behaviors created by IEntity instances in parallel.
Implements
Inherited Members
Namespace: SpiceSharp.Components
Assembly: SpiceSharp.dll
Syntax
public class Parallel : Entity<Parameters>, IParameterized<Parameters>, IComponent, IEntity, IParameterSetCollection, IParameterSet, ICloneable<IEntity>, IRuleSubject
Remarks
Running entity behaviors in parallel requires shared resources to be locked. Running entities in parallel are not a good idea if the entities spend a lot of time accessing these shared resources compared to the time they spend actually computing. Especially since there is also some overhead in setting up these resources and structures for executing behaviors in parallel.
It is possible to combine entities into a Subcircuit first, and having them use a local solver. This keeps the shared resources very limited, allowing each subcircuit to do its work without interference from read-write locking. This option is very advantageous if the subcircuits are large, but have only a few voltage nodes common with the outside.
Constructors
Parallel(string)
Initializes a new instance of the SpiceSharp.Components.ParallelComponents class.
Declaration
public Parallel(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the component. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
See Also
Parallel(string, params IEntity[])
Initializes a new instance of the SpiceSharp.Components.ParallelComponents class.
Declaration
public Parallel(string name, params IEntity[] entities)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the component. |
IEntity[] | entities | The components that can be executed in parallel. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
See Also
Parallel(string, IEnumerable<IEntity>)
Initializes a new instance of the SpiceSharp.Components.ParallelComponents class.
Declaration
public Parallel(string name, IEnumerable<IEntity> entities)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the component. |
IEnumerable<IEntity> | entities | The components that can be executed in parallel. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
See Also
Properties
Model
Gets or sets the name of the component model.
Declaration
public string Model { get; set; }
Property Value
Type | Description |
---|---|
string | The name of the component model. |
See Also
Nodes
Gets a list of all the nodes that the component is connected to.
Declaration
public IReadOnlyList<string> Nodes { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<string> | The nodes. |
See Also
Methods
Apply(IRules)
Applies the subject to any rules in the validation provider.
Declaration
public void Apply(IRules rules)
Parameters
Type | Name | Description |
---|---|---|
IRules | rules | The provider. |
See Also
Connect(params string[])
Connects the component in the circuit.
Declaration
public IComponent Connect(params string[] nodes)
Parameters
Type | Name | Description |
---|---|---|
string[] | nodes | The node indices. |
Returns
Type | Description |
---|---|
IComponent | The instance calling the method for chaining. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
NodeMismatchException | Thrown if the number of nodes does not match the pin count of the component. |
See Also
CreateBehaviors(ISimulation)
Creates the behaviors and stores them in the specified container.
Declaration
public override void CreateBehaviors(ISimulation simulation)
Parameters
Type | Name | Description |
---|---|---|
ISimulation | simulation | The simulation. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentException | Thrown if the simulation does not use an IComplexSimulationState. |
TypeNotFoundException | Thrown if a required behavior or parameter set could not be found. |
AmbiguousTypeException | Thrown if a behavior or parameter set could not be resolved unambiguously. |