-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
255 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,71 @@ | ||
import { Reactor, State } from "../../core/internal"; | ||
import { InPort, MutationSandbox, OutPort, Reactor, State } from "../../core/internal"; | ||
import { SORActor } from "./actor"; | ||
import { SORRunner } from "./runner"; | ||
import { SorBorder } from "./sorutils"; | ||
import { Message, MessageTypes, SorBorder as SORBorder, SorBorder } from "./sorutils"; | ||
|
||
export class SORPeer extends Reactor { | ||
|
||
s: State<number>; | ||
partStart: State<number>; | ||
matrixPart: State<number[][]>; | ||
border: State<SORBorder>; | ||
sorSource: State<SORRunner> | ||
|
||
|
||
sorActors: State<Reactor[]>; | ||
public portFromSORRunner: InPort<Message>; | ||
|
||
constructor( | ||
parent: Reactor, | ||
s: number, | ||
partStart: number, | ||
matrixPart: number[][], | ||
border: SorBorder, | ||
border: SORBorder, | ||
sorSource: SORRunner | ||
) { | ||
super(parent, "SORPeer"); | ||
this.sorActors = new State([]); | ||
this.s = new State(s); | ||
this.partStart = new State(partStart); | ||
this.matrixPart = new State(matrixPart); | ||
this.border = new State(border); | ||
this.sorSource = new State(sorSour ce); | ||
|
||
this.portFromSORRunner = new InPort(this); | ||
} | ||
} | ||
|
||
static boot(this: MutationSandbox, args: BootProcessingArgs) { | ||
const myBorder: SORActor[] = []; | ||
const {_s, border, sorActors, partStart} = args; | ||
const s = _s.get(); | ||
const partStartVal = partStart.get(); | ||
|
||
const sorActorsValue = sorActors.get(); | ||
const borderValue = border.get(); | ||
for (let i = 0; i < s; ++i) { | ||
sorActorsValue[i * (s - partStartVal + 1)] = borderValue.borderActors[i]; | ||
} | ||
sorActors.set(sorActorsValue); | ||
|
||
for () | ||
} | ||
} | ||
|
||
interface BootProcessingArgs { | ||
type: MessageTypes.sorBootMessage, | ||
_s: State<number>, | ||
border: State<SORBorder>, | ||
sorActors: State<SORActor[]>, | ||
partStart: State<number>, | ||
} | ||
interface ResultProcessingArgs { | ||
type: MessageTypes.sorResultMessage, | ||
expectingBoot: State<boolean>, | ||
totalMsgRcv: State<number>, | ||
returned: State<number>, | ||
gTotal: State<number>, | ||
s: State<number>, | ||
part: State<number> | ||
} | ||
|
||
type ProcessingArgs = BootProcessingArgs | ResultProcessingArgs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.