Annotation of OpenXM_contrib/PHC/Ada/Math_Lib/Supports/face_cardinalities.adb, Revision 1.1
1.1 ! maekawa 1: with Standard_Floating_Numbers; use Standard_Floating_Numbers;
! 2: with Integer_Face_Enumerators;
! 3: with Floating_Face_Enumerators;
! 4:
! 5: package body Face_Cardinalities is
! 6:
! 7: function fvector ( pts : in Standard_Integer_VecVecs.VecVec )
! 8: return Vector is
! 9:
! 10: -- ALGORITHM : plain enumeration of vertices, edges, k-faces...
! 11:
! 12: use Integer_Face_Enumerators;
! 13:
! 14: n : constant natural := pts(pts'first).all'length;
! 15: f : Vector(-1..n);
! 16:
! 17: procedure Count_Vertex ( i : in integer; cont : out boolean ) is
! 18: begin
! 19: f(0) := f(0) + 1;
! 20: cont := true;
! 21: end Count_Vertex;
! 22: procedure Count_Vertices is new Enumerate_Vertices(Count_Vertex);
! 23:
! 24: procedure Count_Edge ( i,j : in integer; cont : out boolean ) is
! 25: begin
! 26: f(1) := f(1) + 1;
! 27: cont := true;
! 28: end Count_Edge;
! 29: procedure Count_Edges is new Enumerate_Edges(Count_Edge);
! 30:
! 31: procedure Count_Face ( face : in Vector; cont : out boolean ) is
! 32: begin
! 33: f(face'length-1) := f(face'length-1) + 1;
! 34: cont := true;
! 35: end Count_Face;
! 36: procedure Count_Faces is new Enumerate_Faces(Count_Face);
! 37:
! 38: begin
! 39: f(-1) := 1;
! 40: f(0..n) := (0..n => 0);
! 41: Count_Vertices(pts);
! 42: Count_Edges(pts);
! 43: for i in 2..(n-1) loop
! 44: Count_Faces(i,pts);
! 45: exit when (f(i) = 0);
! 46: end loop;
! 47: if f(n-1) > 1
! 48: then f(n) := 1;
! 49: end if;
! 50: return f;
! 51: end fvector;
! 52:
! 53: function fvector ( pts : in Standard_Floating_VecVecs.VecVec )
! 54: return Vector is
! 55:
! 56: -- ALGORITHM : plain enumeration of vertices, edges, k-faces...
! 57:
! 58: use Floating_Face_Enumerators;
! 59:
! 60: n : constant natural := pts(pts'first).all'length;
! 61: f : Vector(-1..n);
! 62: tol : constant double_float := 10.0**(-8); --10.0**(-12);
! 63:
! 64: procedure Count_Vertex ( i : in integer; cont : out boolean ) is
! 65: begin
! 66: f(0) := f(0) + 1;
! 67: cont := true;
! 68: end Count_Vertex;
! 69: procedure Count_Vertices is new Enumerate_Vertices(Count_Vertex);
! 70:
! 71: procedure Count_Edge ( i,j : in integer; cont : out boolean ) is
! 72: begin
! 73: f(1) := f(1) + 1;
! 74: cont := true;
! 75: end Count_Edge;
! 76: procedure Count_Edges is new Enumerate_Edges(Count_Edge);
! 77:
! 78: procedure Count_Face ( face : in Vector; cont : out boolean ) is
! 79: begin
! 80: f(face'length-1) := f(face'length-1) + 1;
! 81: cont := true;
! 82: end Count_Face;
! 83: procedure Count_Faces is new Enumerate_Faces(Count_Face);
! 84:
! 85: begin
! 86: f(-1) := 1;
! 87: f(0..n) := (0..n => 0);
! 88: Count_Vertices(pts,tol);
! 89: Count_Edges(pts,tol);
! 90: for i in 2..(n-1) loop
! 91: Count_Faces(i,pts,tol);
! 92: exit when (f(i) = 0);
! 93: end loop;
! 94: if f(n-1) > 1
! 95: then f(n) := 1;
! 96: end if;
! 97: return f;
! 98: end fvector;
! 99:
! 100: end Face_Cardinalities;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>