[BACK]Return to floating_mixed_subdivisions.ads CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Root_Counts / Stalift

Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Stalift/floating_mixed_subdivisions.ads, Revision 1.1.1.1

1.1       maekawa     1: with Generic_Lists;
                      2: with Standard_Floating_Numbers;          use Standard_Floating_Numbers;
                      3: with Standard_Floating_Vectors;          use Standard_Floating_Vectors;
                      4: with Lists_of_Floating_Vectors;          use Lists_of_Floating_Vectors;
                      5: with Arrays_of_Floating_Vector_Lists;    use Arrays_of_Floating_Vector_Lists;
                      6:
                      7: package Floating_Mixed_Subdivisions is
                      8:
                      9: -- DESCRIPTION :
                     10: --   This package enables working with regular mixed subdivisions.
                     11:
                     12: -- DATA STRUCTURES :
                     13:
                     14:   type Mixed_Subdivision;              -- list of mixed cells
                     15:   type Link_to_Mixed_Subdivision is access Mixed_Subdivision;
                     16:
                     17:   type Mixed_Cell is record
                     18:     nor : Link_to_Vector;              -- inner normal to the facet
                     19:     pts : Link_to_Array_of_Lists;      -- points that span the cell
                     20:     sub : Link_to_Mixed_Subdivision;   -- subdivision of the cell
                     21:   end record;
                     22:
                     23:   package Lists_of_Mixed_Cells is new Generic_Lists(Mixed_Cell);
                     24:   type Mixed_Subdivision is new Lists_of_Mixed_Cells.List;
                     25:
                     26: -- CREATORS :
                     27:
                     28:   function Create ( pts : Array_of_Lists; nor : Vector; tol : double_float )
                     29:                   return Mixed_Cell;
                     30:   function Create ( pts : Array_of_Lists; nors : List; tol : double_float )
                     31:                   return Mixed_Subdivision;
                     32:
                     33:   -- DESCRIPTION :
                     34:   --   Creates the mixed cell(s) of those points whose inner product
                     35:   --   with the given normal(s) is minimal.
                     36:   --   The parameter tol is the tolerance on the precision.
                     37:
                     38:   function Create ( pts : Array_of_Lists; mixsub : Mixed_Subdivision;
                     39:                     tol : double_float ) return Mixed_Subdivision;
                     40:
                     41:   -- DESCRIPTION :
                     42:   --   Takes the normals of the cells in the given mixed subdivision
                     43:   --   and creates the mixed cells by selecting the points whose inner
                     44:   --   product with the normals are minimal.
                     45:
                     46:   procedure Update ( pts : in Array_of_Lists; nor : in Vector;
                     47:                      mixsub,mixsub_last : in out Mixed_Subdivision );
                     48:
                     49:   -- DESCRIPTION :
                     50:   --   Given a tuple of points and a normal, the mixed subdivision will
                     51:   --   be updated: either an existing cell will get additional points,
                     52:   --   if the normal already occurs in the subdivision, or otherwise,
                     53:   --   a new cell will be created and appended to the mixed subdivision.
                     54:
                     55: -- CONSTRUCTORS :
                     56:
                     57:   procedure Copy ( mic1 : in Mixed_Cell; mic2 : in out Mixed_Cell );
                     58:   procedure Copy ( mixsub1 : in Mixed_Subdivision;
                     59:                    mixsub2 : in out Mixed_Subdivision );
                     60:
                     61:   -- DESCRIPTION :
                     62:   --   Makes a deep copy of the cells and the subdivisions.
                     63:
                     64:   procedure Append_Diff ( first,last : in out Mixed_Subdivision;
                     65:                           mic : in Mixed_Cell );
                     66:
                     67:   -- DESCRIPTION :
                     68:   --   Appends a mixed cell to the list of cells first, where
                     69:   --   last points to the last element of the list first.
                     70:   --   The suffix _Diff means that only when the cell does not already
                     71:   --   belong to the list first, it will be appended.
                     72:
                     73:   procedure Concat_Diff ( first,last : in out Mixed_Subdivision;
                     74:                           mixsub : in Mixed_Subdivision );
                     75:
                     76:   -- DESCRIPTION :
                     77:   --   Concatenates all cells in mixsub to the list of cells first,
                     78:   --   last is a pointer to the last cell in first.
                     79:   --   The suffix _Diff means that only when those cells that do not already
                     80:   --   belong to the list first will be appended.
                     81:
                     82:   procedure Construct ( mixsub : in Mixed_Subdivision;
                     83:                         first : in out Mixed_Subdivision );
                     84:   procedure Construct_Diff ( mixsub : in Mixed_Subdivision;
                     85:                              first : in out Mixed_Subdivision );
                     86:
                     87:   -- DESCRIPTION :
                     88:   --   Constructs all cells in the mixed subdivision to the front of
                     89:   --   the list first.
                     90:   --   The suffix _Diff means that only when those cells that do not already
                     91:   --   belong to the list first will be constructed to first.
                     92:
                     93: -- SELECTORS :
                     94:
                     95:   function Equal ( mic1,mic2 : Mixed_Cell ) return boolean;
                     96:   function Equal ( mixsub1,mixsub2 : Mixed_Subdivision ) return boolean;
                     97:   function Equal ( mixsub1,mixsub2 : Link_to_Mixed_Subdivision )
                     98:                  return boolean;
                     99:
                    100:   -- DESCRIPTION :
                    101:   --   Returns true when two mixed cells and mixed subdivisions are equal.
                    102:
                    103:   function Is_In ( mixsub : Mixed_Subdivision; normal : Vector ) return boolean;
                    104:   function Is_In ( mixsub : Mixed_Subdivision; mic : Mixed_Cell )
                    105:                  return boolean;
                    106:
                    107:   -- DESCRIPTION :
                    108:   --   Returns true if normal or cell belongs to the mixed subdivision,
                    109:   --   otherwise false is returned.  When the whole mixed cell is given,
                    110:   --   then not only the normal, but also the points will be checked.
                    111:
                    112: -- DESTRUCTORS :
                    113:
                    114:   procedure Deep_Clear ( mic : in out Mixed_Cell );
                    115:   procedure Deep_Clear ( mixsub : in out Mixed_Subdivision );
                    116:   procedure Deep_Clear ( mixsub : in out Link_to_Mixed_Subdivision );
                    117:   procedure Shallow_Clear ( mic : in out Mixed_Cell );
                    118:   procedure Shallow_Clear ( mixsub : in out Mixed_Subdivision );
                    119:   procedure Shallow_Clear ( mixsub : in out Link_to_Mixed_Subdivision );
                    120:
                    121:   -- DESCRIPTION :
                    122:   --   The memory space allocated will be freed.
                    123:   --   A shallow clear only destroys the list structures,
                    124:   --   while with a deep clear, also the contents of the lists are freed.
                    125:
                    126: end Floating_Mixed_Subdivisions;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>