1 package org.catacomb.numeric.difnet.calc;
2
3 import org.catacomb.numeric.difnet.StateNode;
4 import org.catacomb.numeric.difnet.Stimulus;
5
6
7
8 public final class NetMapNode {
9
10 int peerIndex;
11 int index;
12
13 boolean fixed;
14 boolean locallyFixed;
15
16 double value;
17 double flux;
18
19 double capacitance;
20
21 double appliedValue;
22 double appliedFlux;
23 double appliedDrive;
24 double appliedConductance;
25
26 NetMapLink[] upLink;
27 NetMapLink[] downLink;
28
29
30 boolean mark;
31 double diag;
32 double rhs;
33
34
35 void readState(StateNode dnNode, double time) {
36 value = dnNode.getValue(null);
37 appliedValue = dnNode.getAppliedValue(null);
38
39 locallyFixed = false;
40 appliedFlux = 0.;
41
42 diag = 0.;
43 rhs = 0.;
44
45
46
47 Stimulus stim = dnNode.getStimulus();
48 if (stim != null) {
49 int typ = stim.getType();
50 double v = stim.getValue(time);
51 if (typ == Stimulus.VALUE) {
52 value = appliedValue = v;
53 locallyFixed = true;
54
55 diag = 1.;
56 rhs = 0.;
57
58 } else if (typ == Stimulus.FLUX) {
59 appliedFlux = v;
60 }
61 }
62 }
63
64
65 void writeState(StateNode dnNode) {
66 dnNode.setValue(null, value);
67 if (fixed || locallyFixed) {
68 dnNode.setFlux(null, flux);
69 }
70 }
71
72
73 boolean isFree() {
74 return (!fixed && !locallyFixed);
75 }
76
77 }