1 package org.catacomb.numeric.difnet.model;
2
3 import org.catacomb.numeric.difnet.StructureLink;
4 import org.catacomb.numeric.difnet.StructureNode;
5 import org.catacomb.numeric.geom.Carrot;
6
7
8 public class BasicStructureLink implements StructureLink {
9
10 BasicStructureNode nodeA;
11 BasicStructureNode nodeB;
12
13 boolean flip;
14
15 double area;
16 double capacitance;
17 double conductance;
18
19 double activeArea;
20
21
22 public BasicStructureLink() {
23
24 }
25
26 public BasicStructureLink(BasicStructureNode bsna, BasicStructureNode bsnb) {
27 nodeA = bsna;
28 nodeB = bsnb;
29 }
30
31
32
33
34
35 public void setFlip() {
36 flip = true;
37 }
38
39
40 public void applyAreaConductance(double g) {
41 conductance = activeArea * g;
42
43 }
44
45 public void applyAreaCapacitance(double c) {
46 capacitance = activeArea * c;
47
48 }
49
50
51
52 public void applyAxialConductance(double g) {
53 double cond = Carrot.conductance(nodeA.getX(), nodeA.getY(), nodeA.getZ(), nodeA.getRadius(),
54 nodeB.getX(), nodeB.getY(), nodeB.getZ(), nodeB.getRadius());
55
56 conductance = g * cond;
57
58 }
59
60
61
62
63 public BasicStateLink newState(BasicStateNode sna, BasicStateNode snb) {
64 return new BasicStateLink(this, sna, snb);
65 }
66
67
68
69 public void setNodeA(StructureNode sn) {
70 nodeA = (BasicStructureNode)sn;
71 }
72
73 public StructureNode getNodeA() {
74 return nodeA;
75 }
76
77 public void setNodeB(StructureNode sn) {
78 nodeB = (BasicStructureNode)sn;
79 }
80
81 public StructureNode getNodeB() {
82 return nodeB;
83 }
84
85
86 public void calculateArea() {
87 double farea = Carrot.area(nodeA.getX(), nodeA.getY(), nodeA.getZ(), nodeA.getRadius(),
88 nodeB.getX(), nodeB.getY(), nodeB.getZ(), nodeB.getRadius());
89 double har = farea / 2.;
90 nodeA.incrementArea(har);
91 nodeB.incrementArea(har);
92 }
93
94
95 public double getActiveArea() {
96 return activeArea;
97 }
98
99
100 public void setActiveArea(double activeArea) {
101 this.activeArea = activeArea;
102 }
103
104
105 public double getCapacitance() {
106 return capacitance;
107 }
108
109
110
111 public double getConductance() {
112 return conductance;
113 }
114
115
116
117
118 }
119
120
121
122