This file is indexed.

/usr/share/netgen/libsrc/csg/surface.hpp is in netgen-headers 4.9.13.dfsg-8build2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
#ifndef FILE_SURFACE
#define FILE_SURFACE

/**************************************************************************/
/* File:   surface.hh                                                     */
/* Author: Joachim Schoeberl                                              */
/* Date:   1. Dez. 95                                                     */
/**************************************************************************/


namespace netgen 
{

  class TriangleApproximation;


  /**
     Basis class for implicit surface geometry.
     This class is used for generation of surface meshes
     in NETGEN 
  */
  class Surface
  {
  protected:
    /// invert normal vector
    bool inverse;
    /// maximal h in surface
    double maxh;
    /// name of surface
    char * name;
    /// boundary condition nr
    int bcprop;
    /// boundary condition label
    string bcname;
  
  public:
    Surface ();
    /** @name Tangential plane.
	The tangential plane is used for surface mesh generation.
    */
  
    virtual ~Surface();

  protected:
    /** @name Points in the surface defining tangential plane.
	Tangential plane is taken in p1, the local x-axis
	is directed to p2.
    */
    //@{
    ///
    Point<3> p1;
    ///
    Point<3> p2;
    //@}
    /** @name Base-vectos for local coordinate system. */
    //@{
    /// in plane, directed p1->p2
    Vec<3> ex;
    /// in plane
    Vec<3> ey;
    /// outer normal direction
    Vec<3> ez;
    //@}
  public:

    void SetName (const char * aname);
    const char * Name () const { return name; }

    //@{
    /**
       Defines tangential plane in ap1.
       The local x-coordinate axis points to the direction of ap2 */
    virtual void DefineTangentialPlane (const Point<3> & ap1, 
					const Point<3> & ap2);

    /// Transforms 3d point p3d to local coordinates pplane
    virtual void ToPlane (const Point<3> & p3d, Point<2> & pplane, 
			  double h, int & zone) const;
  
    /// Transforms point pplane in local coordinates to 3d point
    virtual void FromPlane (const Point<2> & pplane, 
			    Point<3> & p3d, double h) const;
    //@}


    /// Project point p onto surface (closest point)
    virtual void Project (Point<3> & p) const;

    /// Project along direction
    virtual void SkewProject(Point<3> & p, const Vec<3> & direction) const;

    /// Is current surface identic to surface 2 ?
    virtual int IsIdentic (const Surface & /* s2 */, int & /* inv */, 
			   double /* eps */) const
    { return 0; }
  
    ///
    virtual int PointOnSurface (const Point<3> & p,
				double eps = 1e-6) const;
  

    /** @name Implicit function.
	Calculate function value and derivatives.
    */
    //@{
    /// Calculate implicit function value in point point
    virtual double CalcFunctionValue (const Point<3> & point) const = 0;

    /**
       Calc gradient of implicit function.
       gradient should be O(1) at surface
    */
    virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const = 0;

    /**
       Calculate second derivatives of implicit function.
    */
    virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;

    /**
       Returns outer normal vector.
    */
    // virtual void GetNormalVector (const Point<3> & p, Vec<3> & n) const;
    virtual Vec<3> GetNormalVector (const Point<3> & p) const;

    /**
       Upper bound for spectral norm of Hesse-matrix
    */
    virtual double HesseNorm () const = 0;

    /**
       Upper bound for spectral norm of Hesse-matrix in the
       rad - environment of point c.
    */
    virtual double HesseNormLoc (const Point<3> & /* c */, 
				 double /* rad */) const
    { return HesseNorm (); }
    //@}


    ///
    virtual double MaxCurvature () const;
    ///
    virtual double MaxCurvatureLoc (const Point<3> & /* c */ , 
				    double /* rad */) const;

    /** Returns any point in the surface.
	Needed to start surface mesh generation e.g. on sphere */
    virtual Point<3> GetSurfacePoint () const = 0;

    ///
    bool Inverse () const { return inverse; }
    ///
    void SetInverse (bool ainverse) { inverse = ainverse; }
    /// 
    virtual void Print (ostream & str) const = 0;
  
    ///
    virtual void Reduce (const BoxSphere<3> & /* box */) { };
    ///
    virtual void UnReduce () { };

    /// set max h in surface
    void SetMaxH (double amaxh) { maxh = amaxh; }
    ///
    double GetMaxH () const { return maxh; }
    ///
    int GetBCProperty () const { return bcprop; }
    ///
    void SetBCProperty (int abc) { bcprop = abc; }

    /** Determine local mesh-size.
	Find 
	\[ h \leq hmax, \]
	such that
	\[ h  \times \kappa (x) \leq c \qquad \mbox{in} B(x, h), \]
	where kappa(x) is the curvature in x. */
    virtual double LocH (const Point<3> & p, double x, 
			 double c, double hmax) const;

    /**
       Gets Approximation by triangles,
       where qual is about the number of triangles per radius
    */
    virtual void GetTriangleApproximation (TriangleApproximation & /* tas */, 
					   const Box<3> & /* boundingbox */, 
					   double /* facets */ ) const { };


    string GetBCName() const { return bcname; }

    void SetBCName( string abc ) { bcname = abc; }
  };


  inline ostream & operator<< (ostream & ost, const Surface & surf)
  {
    surf.Print(ost);
    return ost;
  }



  typedef enum { IS_OUTSIDE = 0, IS_INSIDE = 1, DOES_INTERSECT = 2}
    INSOLID_TYPE;




  class DummySurface : public Surface
  {
    virtual double CalcFunctionValue (const Point<3> & point) const 
    { return 0; }

    virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const 
    { grad = Vec<3> (0,0,0); }
  
    virtual Point<3> GetSurfacePoint () const
    { return Point<3> (0,0,0); }

    virtual double HesseNorm () const
    { return 0; }

    virtual void Project (Point<3> & p) const
    { ; }

    virtual void Print (ostream & ost) const
    { ost << "dummy surface"; }
  };



  class Primitive
  {

  public:

    Primitive ();

    virtual ~Primitive();

  
    /*
      Check, whether box intersects solid defined by surface.

      return values:
      0 .. box outside solid \\
      1 .. box in solid \\
      2 .. can't decide (allowed, iff box is close to solid)
    */
    virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const = 0;
    virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
				       double eps) const = 0;

    virtual void GetTangentialSurfaceIndices (const Point<3> & p, 
					      Array<int> & surfind, double eps) const;

    virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
				     const Vec<3> & v,
				     double eps) const = 0;

    // checks if lim s->0 lim t->0  p + t(v1 + s v2) in solid
    virtual INSOLID_TYPE VecInSolid2 (const Point<3> & p,
				      const Vec<3> & v1,
				      const Vec<3> & v2,
				      double eps) const;

    // checks if  p + s v1 + s*s/2 v2 is inside
    virtual INSOLID_TYPE VecInSolid3 (const Point<3> & p,
				      const Vec<3> & v1,
				      const Vec<3> & v2,
				      double eps) const;

    // like VecInSolid2, but second order approximation
    virtual INSOLID_TYPE VecInSolid4 (const Point<3> & p,
				      const Vec<3> & v,
				      const Vec<3> & v2,
				      const Vec<3> & m,
				      double eps) const;

    virtual void GetTangentialVecSurfaceIndices (const Point<3> & p, const Vec<3> & v,
						 Array<int> & surfind, double eps) const;

    virtual void GetTangentialVecSurfaceIndices2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
						  Array<int> & surfind, double eps) const;


    virtual void CalcSpecialPoints (Array<Point<3> > & /* pts */) const { ; }
    virtual void AnalyzeSpecialPoint (const Point<3> & /* pt */, 
				      Array<Point<3> > & /* specpts */) const { ; }
    virtual Vec<3> SpecialPointTangentialVector (const Point<3> & /* p */, 
						 int /* s1 */, int /* s2 */) const 
    { return Vec<3> (0,0,0); }

  
    virtual int GetNSurfaces() const = 0;
    virtual Surface & GetSurface (int i = 0) = 0;
    virtual const Surface & GetSurface (int i = 0) const = 0;

    Array<int> surfaceids;
    Array<int> surfaceactive;

    int GetSurfaceId (int i = 0) const;
    void SetSurfaceId (int i, int id);
    int SurfaceActive (int i) const { return surfaceactive[i]; }
    virtual int SurfaceInverted (int /* i */ = 0) const { return 0; }

    virtual void GetPrimitiveData (const char *& classname, 
				   Array<double> & coeffs) const;
    virtual void SetPrimitiveData (Array<double> & coeffs);
    static Primitive * CreatePrimitive (const char * classname);


    virtual void Reduce (const BoxSphere<3> & /* box */) { };
    virtual void UnReduce () { };

    virtual Primitive * Copy () const;
    virtual void Transform (Transformation<3> & trans);
  };




  class OneSurfacePrimitive : public Surface, public Primitive
  {
  public:
    OneSurfacePrimitive();
    ~OneSurfacePrimitive();

    virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
				       double eps) const;
    virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
				     const Vec<3> & v,
				     double eps) const;
    virtual INSOLID_TYPE VecInSolid2 (const Point<3> & p,
				      const Vec<3> & v1,
				      const Vec<3> & v2,
				      double eps) const;

    virtual INSOLID_TYPE VecInSolid3 (const Point<3> & p,
				      const Vec<3> & v1,
				      const Vec<3> & v2,
				      double eps) const;

    virtual INSOLID_TYPE VecInSolid4 (const Point<3> & p,
				      const Vec<3> & v,
				      const Vec<3> & v2,
				      const Vec<3> & m,
				      double eps) const;

    virtual int GetNSurfaces() const;
    virtual Surface & GetSurface (int i = 0);
    virtual const Surface & GetSurface (int i = 0) const;
  };






  /**
     Projects point to edge.
     The point hp is projected to the edge descibed by f1 and f2.
     It is assumed that the edge is non-degenerated, and the
     (generalized) Newton method converges.
  */
  extern void ProjectToEdge (const Surface * f1, 
			     const Surface * f2,
			     Point<3> & hp);


}

#endif