1 #ifndef FILE_RULER3
2 #define FILE_RULER3
3 
4 
5 /**
6   3D element generation rule.
7  */
8 class vnetrule
9 {
10 private:
11   /// rule is applicable for quality classes above this value
12   int quality;
13   /// name of rule
14   char * name;
15   /// point coordinates in reference position
16   Array<Point3d> points;
17   /// old and new faces in reference numbering
18   Array<Element2d> faces;
19   /// additional edges of rule
20   Array<twoint> edges;
21 
22   /// points of freezone in reference coordinates
23   Array<Point3d> freezone;
24   /// points of freezone in reference coordinates if tolcalss to infty
25   Array<Point3d> freezonelimit;
26   /// point index, if point equal to mappoint, otherwise 0
27   Array<int> freezonepi;
28   /// faces of each convex part of freezone
29   Array<Array<threeint>*> freefaces;
30   /// set of points of each convex part of freezone
31   Array<Array<int>*> freesets;
32   /// points of transformed freezone
33   Array<Point3d> transfreezone;
34   /// edges of each convex part of freezone
35   Array<Array<twoint>*> freeedges;
36 
37   /// face numbers to be deleted
38   Array<int> delfaces;
39   /// elements to be generated
40   Array<Element> elements;
41   /// tolerances for points and faces (used ??)
42   Array<double> tolerances, linetolerances;
43   /// transformation matrix
44   DenseMatrix oldutonewu;
45   /// transformation matrix: deviation old point to dev. freezone
46   DenseMatrix * oldutofreezone;
47   /** transformation matrix: deviation old point to dev. freezone,
48     quality class to infinity */
49   DenseMatrix * oldutofreezonelimit;
50 
51   // can be deleted:
52   // BaseMatrix *outf, *outfl;
53 
54   /**
55     a point is outside of convex part of freezone,
56     iff mat * (point, 1) >= 0 for each component (correct ?)
57     */
58   Array<DenseMatrix*> freefaceinequ;
59   ///
60   Array<fourint> orientations;
61   /**
62     flags specified in rule-description file:
63     t .. test rule
64     */
65   Array<char> flags;
66 
67   /**
68     topological distance of face to base element
69     non-connected: > 100  (??)
70     */
71   Array<int> fnearness;
72   Array<int> pnearness;
73   int maxpnearness;
74 
75   /// number of old points in rule
76   int noldp;
77   /// number of new poitns in rule
78   int noldf;
79   /// box containing free-zone
80 public:
81   // double fzminx, fzmaxx, fzminy, fzmaxy, fzminz, fzmaxz;
82   Box3d fzbox;
83 
84 public:
85 
86   ///
87   vnetrule ();
88   ///
89   ~vnetrule ();
90   ///
GetNP() const91   int GetNP () const { return points.Size(); }
92   ///
GetNF() const93   int GetNF () const { return faces.Size(); }
94   ///
GetNE() const95   int GetNE () const { return elements.Size(); }
96   ///
GetNO() const97   int GetNO () const { return orientations.Size(); }
98   ///
GetNEd() const99   int GetNEd () const { return edges.Size(); }
100   ///
GetNOldP() const101   int GetNOldP () const { return noldp; }
102   ///
GetNOldF() const103   int GetNOldF () const { return noldf; }
104   ///
GetNDelF() const105   int GetNDelF () const { return delfaces.Size(); }
106   ///
GetQuality() const107   int GetQuality () const { return quality; }
108   ///
GetFNearness(int fi) const109   int GetFNearness (int fi) const { return fnearness.Get(fi); }
110   ///
GetPNearness(int pi) const111   int GetPNearness (int pi) const { return pnearness.Get(pi); }
112   ///
GetMaxPNearness() const113   int GetMaxPNearness () const { return maxpnearness; }
114 
115 
116   ///
GetPoint(int i) const117   const Point3d & GetPoint (int i) const { return points.Get(i); }
118   ///
GetFace(int i) const119   const Element2d & GetFace (int i) const { return faces.Get(i); }
120   ///
GetElement(int i) const121   const Element & GetElement (int i) const { return elements.Get(i); }
122   ///
GetEdge(int i) const123   const twoint & GetEdge (int i) const { return edges.Get(i); }
124   ///
GetDelFace(int i) const125   int GetDelFace (int i) const { return delfaces.Get(i); }
126   ///
127   int IsDelFace (int fn) const;
128 
129   ///
130   float CalcPointDist (int pi, const Point3d & p) const;
131   ///
PointDistFactor(int pi) const132   double PointDistFactor (int pi) const
133     {
134       return tolerances.Get(pi);
135     }
136   ///
137   void SetFreeZoneTransformation (const Vector & allp,
138 				  int tolclass);
139   ///
140   int IsInFreeZone (const Point3d & p) const;
141   /**
142     0 not in free-zone
143     1 in free-zone
144     -1 maybe
145    */
146   int IsTriangleInFreeZone (const Point3d & p1, const Point3d & p2,
147                             const Point3d & p3, const Array<int> & pi, int newone);
148   ///
149   int IsQuadInFreeZone (const Point3d & p1, const Point3d & p2,
150 			const Point3d & p3, const Point3d & p4,
151 			const Array<int> & pi, int newone);
152   ///
153   int IsTriangleInFreeSet (const Point3d & p1, const Point3d & p2,
154                            const Point3d & p3, int fs, const Array<int> & pi, int newone);
155 
156   ///
157   int IsQuadInFreeSet (const Point3d & p1, const Point3d & p2,
158 		       const Point3d & p3, const Point3d & p4,
159 		       int fs, const Array<int> & pi, int newone);
160 
161   ///
162   int ConvexFreeZone () const;
163 
164   /// if t1 and t2 are neighbourtriangles, NTP returns the opposite Point of t1 in t2
165   int NeighbourTrianglePoint (const threeint & t1, const threeint & t2) const;
166   ///
GetTransFreeZone(int i)167   const Point3d & GetTransFreeZone (int i) { return transfreezone.Get(i); }
168 
169   ///
GetNP(int fn) const170   int GetNP (int fn) const
171   { return faces.Get(fn).GetNP(); }
172   ///
GetPointNr(int fn,int endp) const173   int GetPointNr (int fn, int endp) const
174   { return faces.Get(fn).PNum(endp); }
175   ///
GetPointNrMod(int fn,int endp) const176   int GetPointNrMod (int fn, int endp) const
177   { return faces.Get(fn).PNumMod(endp); }
178   ///
GetOrientation(int i)179   const fourint & GetOrientation (int i) { return orientations.Get(i); }
180 
181   ///
182   int TestFlag (char flag) const;
183 
184   ///
GetOldUToNewU() const185   const DenseMatrix & GetOldUToNewU () const { return oldutonewu; }
186   //
187   //  const DenseMatrix & GetOldUToFreeZone () const { return oldutofreezone; }
188   //
189   //  const DenseMatrix & GetOldUToFreeZoneLimit () const
190   //    { return oldutofreezonelimit; }
191   ///
Name() const192   const char * Name () const { return name; }
193   ///
194   void LoadRule (istream & ist);
195 
196   ///
GetTransFreeZone()197   const Array<Point3d> & GetTransFreeZone () { return transfreezone; }
198   ///
199   int TestOk () const;
200 
201   ///
202   friend void TestRules ();
203   ///
204   //  friend void Plot3DRule (const ROT3D & r, char key);
205 };
206 
207 
208 
209 #endif
210 
211