1 package org.catacomb.numeric.mesh;
2
3
4 public class DifMeshPoint implements MeshPoint {
5
6 double xpos;
7 double ypos;
8 double zpos;
9 double radius;
10
11 int idIndex;
12
13
14
15 int nnbr;
16 DifMeshPoint[] nbrs;
17
18 int iwork;
19
20
21
22
23 public DifMeshPoint() {
24 nbrs = new DifMeshPoint[4];
25 idIndex = -1;
26 }
27
28
29 public DifMeshPoint(double x, double y, double z, double r, int idx) {
30 this();
31 xpos = x;
32 ypos = y;
33 zpos = z;
34 radius = r;
35
36 idIndex = idx;
37 }
38
39
40
41 public int getNeighborCount() {
42 return nnbr;
43 }
44
45
46 public MeshPoint[] getNeighbors() {
47 return nbrs;
48 }
49
50
51
52
53
54
55
56
57
58
59
60
61
62 public void addNeighbor(MeshPoint nnn) {
63
64 nbrs[nnbr] = (DifMeshPoint)nnn;
65 nnbr += 1;
66 }
67
68 public void replaceNeighbor(MeshPoint oldNode, MeshPoint newNode) {
69 for (int i = 0; i < nnbr; i++) {
70 if (nbrs[i] == oldNode) {
71 nbrs[i] = (DifMeshPoint)newNode;
72 }
73 }
74 }
75
76
77
78 public void disconnect() {
79
80 nnbr = 0;
81 }
82
83
84 public void setWork(int i) {
85 iwork = i;
86 }
87
88 public int getWork() {
89 return iwork;
90 }
91
92
93 public double getX() {
94 return xpos;
95 }
96
97 public double getY() {
98 return ypos;
99 }
100
101 public double getZ() {
102 return zpos;
103 }
104
105 public double getR() {
106 return radius;
107 }
108
109 public int getIDIndex() {
110 return idIndex;
111 }
112
113 public void setX(double x) {
114 xpos = x;
115 }
116
117 public void setY(double y) {
118 ypos = y;
119 }
120
121 public void setZ(double z) {
122 zpos = z;
123 }
124
125 public void setR(double r) {
126 radius = r;
127 }
128
129
130
131
132 public MeshPoint newPoint() {
133 return new DifMeshPoint();
134 }
135
136 public MeshPoint[] newPointArray(int n) {
137 return new DifMeshPoint[n];
138 }
139
140 }
141
142