Mesh verification of a random 5-dimensional point set
Set the random number generator.
Set the points defining the region to be meshed.
Find the Delaunay triangulation of the point set using the new convex hull algorithm.
Find the Delaunay triangulation of the point set using the algorithm provided by MATLAB.
Error check 1: mesh sizes
Find the number of elements of the mesh calculated using the new convex hull algorithm.
Find the number of elements of the mesh calculated using the algorithm provided by MATLAB
Check if the number of elements of the two meshes is the same. If this is not the case, throw an error.
if celements~=helements error('The number of elements does not match the true solution.'); end
Error check 2: duplicate elements
is the dimension of the problem.
Loop over all elements in pairs, such that each element pair contains two different elements. For each pair, the elements of which are defined by points each, check if the two elements contain common points. If so, this means that the two elements are defined by the same points, therefore the two elements of the pair are identical. There must not be any duplicate elements, so if a pair is found having two identical elements, throw an error.
for i=1:helements for j=i+1:helements if nnz(ismember(T1(i,:),T1(j,:)))==d+1 error('Duplicate element.') end end end
Error check 3: true solution
For each element () of the mesh calculated by the new algorithm, loop over all elements () of the mesh calculated by the algorithm provided by MATLAB, and check if the points defining element and the points defining element are common. This must happen exactly one time, since the faces defining the two meshes are unique according to the above check 2, and their number is the same according to the above check 1, namely the parameter can take the values or . If no th element identical to th element is encountered, then the parameter will remain , otherwise it will be set equal to . If the parameter remains equal to , throw an error.
for i=1:helements element1=T1(i,:); count=0; for j=1:celements element2=T2(j,:); if nnz(ismember(element1,element2))==d+1 count=1; end end if ~count error(['Element(' num2str(i) ') = [' num2str(element1) '] is not in the true solution.']) end end
(c) 2014 by George Papazafeiropoulos First Lieutenant, Infrastructure Engineer, Hellenic Air Force Civil Engineer, M.Sc., Ph.D. candidate, NTUA