1 function res = check_consistency(grid)
2 %
function res = check_consistency(grid)
3 %
function checking the consistency of a polygonal grid, i.e. checking, whether
4 % the edge centroids correspond (implicit neighbour-index test)
6 % @todo: perhaps later further extensions
9 % res:
boolean value which is
'true' if the check succeeds, or
'false' if it
13 % Bernard Haasdonk 9.5.2007
17 % check neighbour indices corresponding across edges
18 % must satisfy NBI(NBI(i,j), INB(i,j)) = i;
19 % works
for general grids, but uses loops...
20 %disp(
'checking neighbour-edge relations');
21 %disp(
'and neighbour-edge-centroid consistency:');
22 for i=1:grid.nelements
25 if grid.NBI(grid.NBI(i,di), grid.INB(i,di))~=i
26 disp(
'neighbour relations are inconsistent!!');
29 if (abs(grid.ECX(grid.NBI(i,di), grid.INB(i,di))-grid.ECX(i,di))>eps)
30 disp(
'edge ECX are inconsistent!!');
33 if (abs(grid.ECY(grid.NBI(i,di), grid.INB(i,di))-grid.ECY(i,di))>eps)
34 disp(
'edge ECY are inconsistent!!');