Civil Engineering Reference
In-Depth Information
Algorithm Neighbour_T4 (Np, Ne, V, T, P, Q)
// Np and Ne are respectively the number of nodes and elements in the mesh.
// Input: V = Vertices of the elements
// Output: T = Neighbouring tetrahedra
// Working arrays: P, Q
// Index array I ij = j th node of face i, I = {2,4,3; 1,3,4; 1,4,2; 1,2,3}
Initialize linear array P: P 1 = 1, {P k = 0, k=2,N p }
Loop: i = 1,Ne
Loop: j = 1,4
a = I j1 ; b = I j2 ; c = I j3
j1=V i a ; j2=V i b ; j3=V i c ; k = min(j1, j2, j3)
P k = P k + 1
End loop j
End loop i
Loop: k = 2,Np
P k = P k + P k-1
End loop k
n = P Np
Set {Q k = 0, k = 1,n}
Loop: i = 1,Ne
Loop: j = 1,4
a = I j1 ; b = I j2 ; c = I j3
j1=V i a ; j2=V i b ; j3=V i c
k1 = min(j1, j2, j3); k3 = max(j1, j2, j3); k2 = j1+j2+j3-k1-k3
m = P k1
1
m = m - 1
If (Q m = 0) then
j
Q m = 4(i-1) + j; T=0
i
else
k = Q m ; i* = (k+3)/4; j* = k - 4(i*-1)
a* = I j*1 ; b* = I j*2 ; c* = I j*3
j1*=V i a* ; j2*=V i b* ; j3*=V i c*
k3* = max(j1*, j2*, j3*); k2* = j1*+j2*+j3*-k1-k3*
If (k2* ≠ k2 or k3* ≠ k3) go to 1
j
j*
T=i*;T=i
i
i*
L = m - 1
While (Q L ≠ 0) L = L - 1
Q m = Q L+1 ; Q L+1 = 0
End if
End loop j
End loop i
2.5.3 Find the elements connected to each node in a mesh
In finding the elements connected to each node in a mesh, in the first part of the algorithm,
the number of elements connected to each node is determined and stored in array P. In the
second part, the same two loops are executed again, but this time, knowing the number of
elements connected to node k, the actual element i is stored in the space allocated to node
k in P. It is noted that only one single linear array P has been used to mark off the start-
ing point and the ending point of the elements connected to each node k, which are also
stored in P according to the starting-point and ending-point positions. The algorithm can be
applied to other element types, say, tetrahedral meshes or even meshes with mixed element
types by modifying the j loop to go over all the nodes of each element in turn. The following
Search WWH ::




Custom Search