Class Sub1SPF
Inheritance
object
Sub1SPF
Assembly: .dll
Syntax
public class Sub1SPF : Subroutine
Constructors
|
Edit this page
View Source
Sub1SPF(Particle, SubETT)
Declaration
public Sub1SPF(Particle p, SubETT ett = null)
Parameters
Fields
|
Edit this page
View Source
controlColor
Declaration
private BinAttributeBool controlColor
Field Value
|
Edit this page
View Source
destColor
Declaration
private static readonly Color destColor
Field Value
|
Edit this page
View Source
destPortalColor
Declaration
private static readonly Color destPortalColor
Field Value
|
Edit this page
View Source
dirCounter
Declaration
private BinAttributeInt dirCounter
Field Value
|
Edit this page
View Source
ett
Declaration
Field Value
|
Edit this page
View Source
finished
Declaration
private BinAttributeBool finished
Field Value
|
Edit this page
View Source
ignoreDirs
Declaration
private BinAttributeBitField ignoreDirs
Field Value
|
Edit this page
View Source
instanceIdx
Declaration
private BinAttributeInt instanceIdx
Field Value
|
Edit this page
View Source
isDest
Declaration
private BinAttributeBool isDest
Field Value
|
Edit this page
View Source
isSource
Declaration
private BinAttributeBool isSource
Field Value
|
Edit this page
View Source
manualCtrUpdate0
Declaration
private BinAttributeBool manualCtrUpdate0
Field Value
|
Edit this page
View Source
manualCtrUpdate1
Declaration
private BinAttributeBool manualCtrUpdate1
Field Value
|
Edit this page
View Source
mixedPortalColor
Declaration
private static readonly Color mixedPortalColor
Field Value
|
Edit this page
View Source
nbrPortal1
Declaration
private BinAttributeDirection nbrPortal1
Field Value
|
Edit this page
View Source
nbrPortal2
Declaration
private BinAttributeDirection nbrPortal2
Field Value
|
Edit this page
View Source
onDestPortal
Declaration
private BinAttributeBool onDestPortal
Field Value
|
Edit this page
View Source
onSourcePortal
Declaration
private BinAttributeBool onSourcePortal
Field Value
|
Edit this page
View Source
parentCounters
Declaration
private BinAttributeInt[] parentCounters
Field Value
|
Edit this page
View Source
parentDir
Declaration
private BinAttributeDirection parentDir
Field Value
|
Edit this page
View Source
pruned
Declaration
private BinAttributeBool pruned
Field Value
|
Edit this page
View Source
round
Declaration
private BinAttributeInt round
Field Value
|
Edit this page
View Source
sourceColor
Declaration
private static readonly Color sourceColor
Field Value
|
Edit this page
View Source
sourcePortalColor
Declaration
private static readonly Color sourcePortalColor
Field Value
|
Edit this page
View Source
state1
Declaration
private ParticleAttribute<int> state1
Field Value
|
Edit this page
View Source
state2
Declaration
private ParticleAttribute<int> state2
Field Value
Methods
|
Edit this page
View Source
ActivateReceive()
The first half of the subroutine activation. Must be called
in the round immediately after ActivateSend()
was called.
Declaration
public void ActivateReceive()
|
Edit this page
View Source
ActivateSend()
The second half of the subroutine activation. Before this
can be called, the pin configuration set up by
SetupPC(PinConfiguration) must be planned.
Declaration
public void ActivateSend()
|
Edit this page
View Source
DeterminePortalNeighbors(Direction)
Sets the neighbor portal flags of this amoebot. Direction 1
indicates the "top" neighbor edge, direction 2 the "bottom"
neighbor edge. The direction will be unequal to
NONE if and only if this amoebot
is the unique amoebot with the edge to that neighboring portal.
Declaration
private void DeterminePortalNeighbors(Direction portalDir)
Parameters
| Type |
Name |
Description |
| Direction |
portalDir |
The direction of the portal axis.
|
|
Edit this page
View Source
Init(bool, bool, bool, List<Direction>, int)
Initializes the subroutine.
Declaration
public void Init(bool isSource, bool isDest, bool controlColor = false, List<Direction> ignoreDirections = null, int instanceIndex = 0)
Parameters
| Type |
Name |
Description |
| bool |
isSource |
Whether this amoebot is the source. Exactly one
amoebot in the component running this subroutine must be the source.
|
| bool |
isDest |
Whether this amoebot is a destination.
|
| bool |
controlColor |
Whether the subroutine should control
the amoebot's color.
|
| List<Direction> |
ignoreDirections |
The directions in which neighbors should
be ignored.
|
| int |
instanceIndex |
The index of this instance. Instances that run at the same time on the same
amoebot must have different indices.
|
|
Edit this page
View Source
IsFinished()
Checks whether the SPF procedure has finished.
Declaration
Returns
| Type |
Description |
| bool |
true if and only if the shortest paths
to the source have been found.
|
|
Edit this page
View Source
IsPruned()
Declaration
Returns
|
Edit this page
View Source
PSetPortal1(Direction)
The ID of the first partition set on the given portal axis.
Declaration
private int PSetPortal1(Direction portalDir)
Parameters
Returns
|
Edit this page
View Source
PSetPortal2(Direction)
The ID of the second partition set on the given portal axis.
Declaration
private int PSetPortal2(Direction portalDir)
Parameters
Returns
|
Edit this page
View Source
Parent()
Gets the parent direction of this amoebot after the procedure
is finished.
Declaration
public Direction Parent()
Returns
| Type |
Description |
| Direction |
The direction of this amoebot in the shortest path
forest. NONE if the amoebot has no parent
(this is the case if it is the source/root or has been pruned).
|
|
Edit this page
View Source
SetColor()
Declaration
|
Edit this page
View Source
SetupGlobalCircuit(PinConfiguration, int, int)
Sets up a global circuit using the given pin offset.
Declaration
private void SetupGlobalCircuit(PinConfiguration pc, int offset, int pSet)
Parameters
| Type |
Name |
Description |
| PinConfiguration |
pc |
The pin configuration to modify.
|
| int |
offset |
The pin offset.
|
| int |
pSet |
The partition set ID.
|
|
Edit this page
View Source
SetupPC(PinConfiguration)
Sets up the pin configuration required for the
ActivateSend() call. The pin configuration
is not planned by this method.
Declaration
public void SetupPC(PinConfiguration pc)
Parameters
|
Edit this page
View Source
SetupPortalNeighborCircuits(PinConfiguration, Direction)
Sets up one circuit for each neighbor of a portal along
the given axis. The "top" partition set will have the ID
PSetPortal1(Direction) and the "bottom" partition set
the ID PSetPortal2(Direction). If there
is no neighbor in one of the directions, no partition set
will be created for that direction. Also, if no partition set
can be created, the corresponding manual update flag is set.
Declaration
private void SetupPortalNeighborCircuits(PinConfiguration pc, Direction portalDir)
Parameters
| Type |
Name |
Description |
| PinConfiguration |
pc |
The pin configuration to modify.
|
| Direction |
portalDir |
The direction of the portal axis.
|
|
Edit this page
View Source
SetupSimplePortalCircuit(PinConfiguration, Direction, int, int)
Sets up a simple circuit connecting all amoebots along the given
portal direction, using the given pin offset in that direction.
No partition set will be created if there are no neighbors on the
portal axis.
Declaration
private void SetupSimplePortalCircuit(PinConfiguration pc, Direction portalDir, int pinOffset, int partitionSet = 0)
Parameters
| Type |
Name |
Description |
| PinConfiguration |
pc |
The pin configuration to modify.
|
| Direction |
portalDir |
The direction of the portal axis.
|
| int |
pinOffset |
The pin offset in portal direction.
|
| int |
partitionSet |
The partition set ID to use.
|
|
Edit this page
View Source
UpdateParentCounter(Direction, int)
Increments the parent counter of the parent in
direction d in case a beep
was received on the partition set with ID
pSet and there is a neighbor
in that direction.
Declaration
private void UpdateParentCounter(Direction dir, int pSet)
Parameters
| Type |
Name |
Description |
| Direction |
dir |
The direction of the neighbor to update.
|
| int |
pSet |
The partition set to check.
|