mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
namespaces, layers for 2D geometry
This commit is contained in:
parent
c429a6cc6c
commit
975d220350
@ -3,348 +3,351 @@
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* File: algprim.hh */
|
||||
/* File: algprim.hpp */
|
||||
/* Author: Joachim Schoeberl */
|
||||
/* Date: 1. Dez. 95 */
|
||||
/**************************************************************************/
|
||||
|
||||
/*
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
Quadric Surfaces (Plane, Sphere, Cylinder)
|
||||
/*
|
||||
|
||||
Quadric Surfaces (Plane, Sphere, Cylinder)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
A quadric surface.
|
||||
surface defined by
|
||||
cxx x^2 + cyy y^2 + czz z^2 + cxy x y + cxz x z + cyz y z +
|
||||
cx x + cy y + cz z + c1 = 0.
|
||||
**/
|
||||
class QuadraticSurface : public OneSurfacePrimitive
|
||||
{
|
||||
protected:
|
||||
double cxx, cyy, czz, cxy, cxz, cyz, cx, cy, cz, c1;
|
||||
|
||||
public:
|
||||
virtual double CalcFunctionValue (const Point<3> & point) const;
|
||||
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
|
||||
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
|
||||
/*
|
||||
virtual int RootInBox (const Box<3> & box)
|
||||
const { return 0; }
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box)
|
||||
const { return DOES_INTERSECT; }
|
||||
*/
|
||||
virtual double HesseNorm () const { return cxx + cyy + czz; }
|
||||
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
|
||||
|
||||
virtual void Print (ostream & ist) const;
|
||||
virtual void Read (istream & ist);
|
||||
void PrintCoeff (ostream & ost) const;
|
||||
};
|
||||
|
||||
|
||||
/// A Plane (i.e., the plane and everything behind it).
|
||||
class Plane : public QuadraticSurface
|
||||
{
|
||||
/// a point in the plane
|
||||
Point<3> p;
|
||||
/// outward normal vector
|
||||
Vec<3> n;
|
||||
|
||||
double eps_base;
|
||||
|
||||
public:
|
||||
///
|
||||
Plane (const Point<3> & ap, Vec<3> an);
|
||||
|
||||
virtual void GetPrimitiveData (const char *& classname,
|
||||
Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
static Primitive * CreateDefault ();
|
||||
|
||||
virtual Primitive * Copy () const;
|
||||
virtual void Transform (Transformation<3> & trans);
|
||||
|
||||
|
||||
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
||||
|
||||
///
|
||||
virtual void DefineTangentialPlane (const Point<3> & ap1,
|
||||
const Point<3> & ap2);
|
||||
///
|
||||
virtual void ToPlane (const Point<3> & p3d,
|
||||
Point<2> & pplane, double h,
|
||||
int & zone) const;
|
||||
///
|
||||
virtual void FromPlane (const Point<2> & pplane,
|
||||
Point<3> & p3d,
|
||||
double h) const;
|
||||
///
|
||||
virtual void Project (Point<3> & p) const;
|
||||
|
||||
///
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
|
||||
///
|
||||
inline virtual double CalcFunctionValue (const Point<3> & p3d) const
|
||||
{return cx * p3d(0) + cy * p3d(1) + cz * p3d(2) + c1;}
|
||||
///
|
||||
virtual void CalcGradient (const Point<3> & point,
|
||||
Vec<3> & grad) const;
|
||||
///
|
||||
virtual void CalcHesse (const Point<3> & point,
|
||||
Mat<3> & hesse) const;
|
||||
///
|
||||
virtual double HesseNorm () const;
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
///
|
||||
virtual void GetTriangleApproximation
|
||||
(TriangleApproximation & tas,
|
||||
const Box<3> & boundingbox, double facets) const;
|
||||
|
||||
};
|
||||
|
||||
// typedef Plane Plane;
|
||||
|
||||
|
||||
///
|
||||
class Sphere : public QuadraticSurface
|
||||
{
|
||||
///
|
||||
Point<3> c;
|
||||
///
|
||||
double r;
|
||||
public:
|
||||
///
|
||||
Sphere (const Point<3> & ac, double ar);
|
||||
|
||||
virtual void GetPrimitiveData (const char *& classname,
|
||||
Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
static Primitive * CreateDefault ();
|
||||
|
||||
virtual Primitive * Copy () const;
|
||||
virtual void Transform (Transformation<3> & trans);
|
||||
|
||||
|
||||
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
||||
|
||||
///
|
||||
virtual void DefineTangentialPlane (const Point<3> & ap1,
|
||||
const Point<3> & ap2);
|
||||
///
|
||||
virtual void ToPlane (const Point<3> & p3d,
|
||||
Point<2> & pplane, double h,
|
||||
int & zone) const;
|
||||
///
|
||||
virtual void FromPlane (const Point<2> & pplane,
|
||||
Point<3> & p, double h) const;
|
||||
///
|
||||
virtual void Project (Point<3> & p) const;
|
||||
|
||||
///
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
///
|
||||
virtual double HesseNorm () const;
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
///
|
||||
const Point<3> & Center () const { return c; }
|
||||
///
|
||||
double Radius () const { return r; }
|
||||
|
||||
///
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & bbox,
|
||||
double facets) const;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
class Cylinder : public QuadraticSurface
|
||||
{
|
||||
///
|
||||
Point<3> a, b;
|
||||
///
|
||||
double r;
|
||||
///
|
||||
Vec<3> vab;
|
||||
|
||||
public:
|
||||
Cylinder (const Point<3> & aa, const Point<3> & ab, double ar);
|
||||
Cylinder (Array<double> & coeffs);
|
||||
|
||||
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
static Primitive * CreateDefault ();
|
||||
|
||||
virtual Primitive * Copy () const;
|
||||
virtual void Transform (Transformation<3> & trans);
|
||||
|
||||
///
|
||||
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
||||
///
|
||||
virtual void DefineTangentialPlane (const Point<3> & ap1,
|
||||
const Point<3> & ap2);
|
||||
///
|
||||
virtual void ToPlane (const Point<3> & p,
|
||||
Point<2> & pplane,
|
||||
double h,
|
||||
int & zone) const;
|
||||
///
|
||||
virtual void FromPlane (const Point<2> & pplane,
|
||||
Point<3> & p,
|
||||
double h) const;
|
||||
///
|
||||
virtual void Project (Point<3> & p) const;
|
||||
|
||||
///
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
///
|
||||
virtual double HesseNorm () const;
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
///
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & bbox,
|
||||
double facets) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///
|
||||
class EllipticCylinder : public QuadraticSurface
|
||||
{
|
||||
private:
|
||||
///
|
||||
Point<3> a;
|
||||
///
|
||||
Vec<3> vl, vs;
|
||||
///
|
||||
Vec<3> vab, t0vec, t1vec;
|
||||
///
|
||||
double vabl, t0, t1;
|
||||
public:
|
||||
///
|
||||
EllipticCylinder (const Point<3> & aa,
|
||||
const Vec<3> & avl, const Vec<3> & avs);
|
||||
|
||||
/*
|
||||
static Primitive * CreateDefault ();
|
||||
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
*/
|
||||
///
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
///
|
||||
virtual double HesseNorm () const;
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & bbox,
|
||||
double facets) const;
|
||||
|
||||
/**
|
||||
A quadric surface.
|
||||
surface defined by
|
||||
cxx x^2 + cyy y^2 + czz z^2 + cxy x y + cxz x z + cyz y z +
|
||||
cx x + cy y + cz z + c1 = 0.
|
||||
**/
|
||||
class QuadraticSurface : public OneSurfacePrimitive
|
||||
{
|
||||
protected:
|
||||
double cxx, cyy, czz, cxy, cxz, cyz, cx, cy, cz, c1;
|
||||
|
||||
public:
|
||||
virtual double CalcFunctionValue (const Point<3> & point) const;
|
||||
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
|
||||
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
|
||||
/*
|
||||
virtual int RootInBox (const Box<3> & box)
|
||||
const { return 0; }
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box)
|
||||
const { return DOES_INTERSECT; }
|
||||
*/
|
||||
virtual double HesseNorm () const { return cxx + cyy + czz; }
|
||||
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
|
||||
|
||||
virtual void Print (ostream & ist) const;
|
||||
virtual void Read (istream & ist);
|
||||
void PrintCoeff (ostream & ost) const;
|
||||
};
|
||||
|
||||
|
||||
/// A Plane (i.e., the plane and everything behind it).
|
||||
class Plane : public QuadraticSurface
|
||||
{
|
||||
/// a point in the plane
|
||||
Point<3> p;
|
||||
/// outward normal vector
|
||||
Vec<3> n;
|
||||
|
||||
double eps_base;
|
||||
|
||||
public:
|
||||
///
|
||||
Plane (const Point<3> & ap, Vec<3> an);
|
||||
|
||||
virtual void GetPrimitiveData (const char *& classname,
|
||||
Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
static Primitive * CreateDefault ();
|
||||
|
||||
virtual Primitive * Copy () const;
|
||||
virtual void Transform (Transformation<3> & trans);
|
||||
|
||||
|
||||
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
||||
|
||||
///
|
||||
virtual void DefineTangentialPlane (const Point<3> & ap1,
|
||||
const Point<3> & ap2);
|
||||
///
|
||||
virtual void ToPlane (const Point<3> & p3d,
|
||||
Point<2> & pplane, double h,
|
||||
int & zone) const;
|
||||
///
|
||||
virtual void FromPlane (const Point<2> & pplane,
|
||||
Point<3> & p3d,
|
||||
double h) const;
|
||||
///
|
||||
virtual void Project (Point<3> & p) const;
|
||||
|
||||
///
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
|
||||
///
|
||||
inline virtual double CalcFunctionValue (const Point<3> & p3d) const
|
||||
{return cx * p3d(0) + cy * p3d(1) + cz * p3d(2) + c1;}
|
||||
///
|
||||
virtual void CalcGradient (const Point<3> & point,
|
||||
Vec<3> & grad) const;
|
||||
///
|
||||
virtual void CalcHesse (const Point<3> & point,
|
||||
Mat<3> & hesse) const;
|
||||
///
|
||||
virtual double HesseNorm () const;
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
///
|
||||
virtual void GetTriangleApproximation
|
||||
(TriangleApproximation & tas,
|
||||
const Box<3> & boundingbox, double facets) const;
|
||||
|
||||
};
|
||||
|
||||
// typedef Plane Plane;
|
||||
|
||||
|
||||
///
|
||||
class Sphere : public QuadraticSurface
|
||||
{
|
||||
///
|
||||
Point<3> c;
|
||||
///
|
||||
double r;
|
||||
public:
|
||||
///
|
||||
Sphere (const Point<3> & ac, double ar);
|
||||
|
||||
virtual void GetPrimitiveData (const char *& classname,
|
||||
Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
static Primitive * CreateDefault ();
|
||||
|
||||
virtual Primitive * Copy () const;
|
||||
virtual void Transform (Transformation<3> & trans);
|
||||
|
||||
|
||||
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
||||
|
||||
///
|
||||
virtual void DefineTangentialPlane (const Point<3> & ap1,
|
||||
const Point<3> & ap2);
|
||||
///
|
||||
virtual void ToPlane (const Point<3> & p3d,
|
||||
Point<2> & pplane, double h,
|
||||
int & zone) const;
|
||||
///
|
||||
virtual void FromPlane (const Point<2> & pplane,
|
||||
Point<3> & p, double h) const;
|
||||
///
|
||||
virtual void Project (Point<3> & p) const;
|
||||
|
||||
///
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
///
|
||||
virtual double HesseNorm () const;
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
///
|
||||
const Point<3> & Center () const { return c; }
|
||||
///
|
||||
double Radius () const { return r; }
|
||||
|
||||
///
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & bbox,
|
||||
double facets) const;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
class Cylinder : public QuadraticSurface
|
||||
{
|
||||
///
|
||||
Point<3> a, b;
|
||||
///
|
||||
double r;
|
||||
///
|
||||
Vec<3> vab;
|
||||
|
||||
public:
|
||||
Cylinder (const Point<3> & aa, const Point<3> & ab, double ar);
|
||||
Cylinder (Array<double> & coeffs);
|
||||
|
||||
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
static Primitive * CreateDefault ();
|
||||
|
||||
virtual Primitive * Copy () const;
|
||||
virtual void Transform (Transformation<3> & trans);
|
||||
|
||||
///
|
||||
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
||||
///
|
||||
virtual void DefineTangentialPlane (const Point<3> & ap1,
|
||||
const Point<3> & ap2);
|
||||
///
|
||||
virtual void ToPlane (const Point<3> & p,
|
||||
Point<2> & pplane,
|
||||
double h,
|
||||
int & zone) const;
|
||||
///
|
||||
virtual void FromPlane (const Point<2> & pplane,
|
||||
Point<3> & p,
|
||||
double h) const;
|
||||
///
|
||||
virtual void Project (Point<3> & p) const;
|
||||
|
||||
///
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
///
|
||||
virtual double HesseNorm () const;
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
///
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & bbox,
|
||||
double facets) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///
|
||||
class EllipticCylinder : public QuadraticSurface
|
||||
{
|
||||
private:
|
||||
///
|
||||
Point<3> a;
|
||||
///
|
||||
Vec<3> vl, vs;
|
||||
///
|
||||
Vec<3> vab, t0vec, t1vec;
|
||||
///
|
||||
double vabl, t0, t1;
|
||||
public:
|
||||
///
|
||||
EllipticCylinder (const Point<3> & aa,
|
||||
const Vec<3> & avl, const Vec<3> & avs);
|
||||
|
||||
/*
|
||||
static Primitive * CreateDefault ();
|
||||
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
*/
|
||||
///
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
///
|
||||
virtual double HesseNorm () const;
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & bbox,
|
||||
double facets) const;
|
||||
|
||||
|
||||
virtual double MaxCurvature () const;
|
||||
virtual double MaxCurvature () const;
|
||||
|
||||
virtual double MaxCurvatureLoc (const Point<3> & /* c */ ,
|
||||
double /* rad */) const;
|
||||
virtual double MaxCurvatureLoc (const Point<3> & /* c */ ,
|
||||
double /* rad */) const;
|
||||
|
||||
|
||||
private:
|
||||
void CalcData();
|
||||
};
|
||||
private:
|
||||
void CalcData();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///
|
||||
class Ellipsoid : public QuadraticSurface
|
||||
{
|
||||
private:
|
||||
///
|
||||
Point<3> a;
|
||||
///
|
||||
Vec<3> v1, v2, v3;
|
||||
///
|
||||
double rmin;
|
||||
public:
|
||||
///
|
||||
Ellipsoid (const Point<3> & aa,
|
||||
const Vec<3> & av1,
|
||||
const Vec<3> & av2,
|
||||
const Vec<3> & av3);
|
||||
///
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
///
|
||||
virtual double HesseNorm () const;
|
||||
///
|
||||
virtual double MaxCurvature () const;
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & bbox,
|
||||
double facets) const;
|
||||
|
||||
private:
|
||||
void CalcData();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///
|
||||
class Cone : public QuadraticSurface
|
||||
{
|
||||
///
|
||||
Point<3> a, b;
|
||||
///
|
||||
double ra, rb, minr;
|
||||
///
|
||||
Vec<3> vab, t0vec, t1vec;
|
||||
///
|
||||
double vabl, t0, t1;
|
||||
public:
|
||||
///
|
||||
Cone (const Point<3> & aa, const Point<3> & ab, double ara, double arb);
|
||||
///
|
||||
static Primitive * CreateDefault ();
|
||||
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
|
||||
///
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
///
|
||||
virtual double HesseNorm () const;
|
||||
class Ellipsoid : public QuadraticSurface
|
||||
{
|
||||
private:
|
||||
///
|
||||
Point<3> a;
|
||||
///
|
||||
Vec<3> v1, v2, v3;
|
||||
///
|
||||
double rmin;
|
||||
public:
|
||||
///
|
||||
Ellipsoid (const Point<3> & aa,
|
||||
const Vec<3> & av1,
|
||||
const Vec<3> & av2,
|
||||
const Vec<3> & av3);
|
||||
///
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
///
|
||||
virtual double HesseNorm () const;
|
||||
///
|
||||
virtual double MaxCurvature () const;
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & bbox,
|
||||
double facets) const;
|
||||
|
||||
private:
|
||||
void CalcData();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual double LocH (const Point<3> & p, double x,
|
||||
double c, double hmax) const;
|
||||
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
class Cone : public QuadraticSurface
|
||||
{
|
||||
///
|
||||
Point<3> a, b;
|
||||
///
|
||||
double ra, rb, minr;
|
||||
///
|
||||
Vec<3> vab, t0vec, t1vec;
|
||||
///
|
||||
double vabl, t0, t1;
|
||||
public:
|
||||
///
|
||||
Cone (const Point<3> & aa, const Point<3> & ab, double ara, double arb);
|
||||
///
|
||||
static Primitive * CreateDefault ();
|
||||
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & bbox,
|
||||
double facets) const;
|
||||
///
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
///
|
||||
virtual double HesseNorm () const;
|
||||
|
||||
private:
|
||||
void CalcData();
|
||||
};
|
||||
virtual double LocH (const Point<3> & p, double x,
|
||||
double c, double hmax) const;
|
||||
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & bbox,
|
||||
double facets) const;
|
||||
|
||||
private:
|
||||
void CalcData();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -353,84 +356,84 @@ private:
|
||||
|
||||
|
||||
|
||||
/// Torus
|
||||
/// Lorenzo Codecasa (codecasa@elet.polimi.it)
|
||||
/// April 27th, 2005
|
||||
///
|
||||
/// begin...
|
||||
class Torus : public OneSurfacePrimitive
|
||||
{
|
||||
/// center of the torus
|
||||
Point<3> c;
|
||||
/// vector normal to the symmetry plane of the torus
|
||||
Vec<3> n;
|
||||
/// Large radius of the torus
|
||||
double R;
|
||||
/// Small radius of the torus
|
||||
double r;
|
||||
/// Torus
|
||||
/// Lorenzo Codecasa (codecasa@elet.polimi.it)
|
||||
/// April 27th, 2005
|
||||
///
|
||||
/// begin...
|
||||
class Torus : public OneSurfacePrimitive
|
||||
{
|
||||
/// center of the torus
|
||||
Point<3> c;
|
||||
/// vector normal to the symmetry plane of the torus
|
||||
Vec<3> n;
|
||||
/// Large radius of the torus
|
||||
double R;
|
||||
/// Small radius of the torus
|
||||
double r;
|
||||
|
||||
public:
|
||||
/// OK
|
||||
Torus (const Point<3> & ac, const Vec<3> & an, double aR, double ar);
|
||||
/// OK
|
||||
const Point<3> & Center () const { return c; }
|
||||
/// OK
|
||||
const Vec<3> & NormalToPlane () const { return n; }
|
||||
/// OK
|
||||
double LargeRadius () const { return R; }
|
||||
/// OK
|
||||
double SmallRadius () const { return r; }
|
||||
/// OK
|
||||
virtual double CalcFunctionValue (const Point<3> & point) const;
|
||||
/// OK
|
||||
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
|
||||
/// OK
|
||||
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
|
||||
/// OK
|
||||
virtual double HesseNorm () const;
|
||||
/// OK
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
/// OK
|
||||
virtual void GetPrimitiveData (const char *& classname,
|
||||
Array<double> & coeffs) const;
|
||||
/// OK
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
/// OK
|
||||
static Primitive * CreateDefault ();
|
||||
/// OK
|
||||
virtual Primitive * Copy () const;
|
||||
/// OK
|
||||
virtual void Transform (Transformation<3> & trans);
|
||||
/// OK
|
||||
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
||||
/// OK
|
||||
/// virtual void DefineTangentialPlane (const Point<3> & ap1,
|
||||
// const Point<3> & ap2);
|
||||
/// OK
|
||||
/// virtual void ToPlane (const Point<3> & p3d,
|
||||
/// Point<2> & pplane,
|
||||
/// double h, int & zone) const;
|
||||
/// OK
|
||||
/// virtual void FromPlane (const Point<2> & pplane,
|
||||
// Point<3> & p, double h) const;
|
||||
/// OK
|
||||
/// virtual void Project (Point<3> & p) const;
|
||||
/// OK
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
/// OK
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & bbox,
|
||||
double facets) const;
|
||||
/// OK
|
||||
virtual void Print (ostream & ist) const;
|
||||
/// OK
|
||||
virtual void Read (istream & ist);
|
||||
};
|
||||
|
||||
/// ...end
|
||||
public:
|
||||
/// OK
|
||||
Torus (const Point<3> & ac, const Vec<3> & an, double aR, double ar);
|
||||
/// OK
|
||||
const Point<3> & Center () const { return c; }
|
||||
/// OK
|
||||
const Vec<3> & NormalToPlane () const { return n; }
|
||||
/// OK
|
||||
double LargeRadius () const { return R; }
|
||||
/// OK
|
||||
double SmallRadius () const { return r; }
|
||||
/// OK
|
||||
virtual double CalcFunctionValue (const Point<3> & point) const;
|
||||
/// OK
|
||||
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
|
||||
/// OK
|
||||
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
|
||||
/// OK
|
||||
virtual double HesseNorm () const;
|
||||
/// OK
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
/// OK
|
||||
virtual void GetPrimitiveData (const char *& classname,
|
||||
Array<double> & coeffs) const;
|
||||
/// OK
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
/// OK
|
||||
static Primitive * CreateDefault ();
|
||||
/// OK
|
||||
virtual Primitive * Copy () const;
|
||||
/// OK
|
||||
virtual void Transform (Transformation<3> & trans);
|
||||
/// OK
|
||||
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
||||
/// OK
|
||||
/// virtual void DefineTangentialPlane (const Point<3> & ap1,
|
||||
// const Point<3> & ap2);
|
||||
/// OK
|
||||
/// virtual void ToPlane (const Point<3> & p3d,
|
||||
/// Point<2> & pplane,
|
||||
/// double h, int & zone) const;
|
||||
/// OK
|
||||
/// virtual void FromPlane (const Point<2> & pplane,
|
||||
// Point<3> & p, double h) const;
|
||||
/// OK
|
||||
/// virtual void Project (Point<3> & p) const;
|
||||
/// OK
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
/// OK
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & bbox,
|
||||
double facets) const;
|
||||
/// OK
|
||||
virtual void Print (ostream & ist) const;
|
||||
/// OK
|
||||
virtual void Read (istream & ist);
|
||||
};
|
||||
|
||||
/// ...end
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -8,113 +8,119 @@
|
||||
/* Date: 11. Mar. 98 */
|
||||
/**************************************************************************/
|
||||
|
||||
/*
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
|
||||
brick geometry, has several surfaces
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
class Parallelogram3d : public Surface
|
||||
{
|
||||
Point<3> p1, p2, p3, p4;
|
||||
Vec<3> v12, v13;
|
||||
Vec<3> n;
|
||||
class Parallelogram3d : public Surface
|
||||
{
|
||||
Point<3> p1, p2, p3, p4;
|
||||
Vec<3> v12, v13;
|
||||
Vec<3> n;
|
||||
|
||||
public:
|
||||
Parallelogram3d (Point<3> ap1, Point<3> ap2, Point<3> ap3);
|
||||
virtual ~Parallelogram3d ();
|
||||
public:
|
||||
Parallelogram3d (Point<3> ap1, Point<3> ap2, Point<3> ap3);
|
||||
virtual ~Parallelogram3d ();
|
||||
|
||||
void SetPoints (Point<3> ap1, Point<3> ap2, Point<3> ap3);
|
||||
void SetPoints (Point<3> ap1, Point<3> ap2, Point<3> ap3);
|
||||
|
||||
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
||||
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
||||
|
||||
virtual double CalcFunctionValue (const Point<3> & point) const;
|
||||
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
|
||||
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
|
||||
virtual double HesseNorm () const;
|
||||
virtual double CalcFunctionValue (const Point<3> & point) const;
|
||||
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
|
||||
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
|
||||
virtual double HesseNorm () const;
|
||||
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
virtual void Print (ostream & str) const;
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
virtual void Print (ostream & str) const;
|
||||
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & boundingbox,
|
||||
double facets) const;
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & boundingbox,
|
||||
double facets) const;
|
||||
|
||||
protected:
|
||||
void CalcData();
|
||||
};
|
||||
protected:
|
||||
void CalcData();
|
||||
};
|
||||
|
||||
|
||||
class Brick : public Primitive
|
||||
{
|
||||
Point<3> p1, p2, p3, p4;
|
||||
Vec<3> v12, v13, v14;
|
||||
// Array<OneSurfacePrimitive*> faces;
|
||||
Array<Plane*> faces;
|
||||
class Brick : public Primitive
|
||||
{
|
||||
Point<3> p1, p2, p3, p4;
|
||||
Vec<3> v12, v13, v14;
|
||||
// Array<OneSurfacePrimitive*> faces;
|
||||
Array<Plane*> faces;
|
||||
|
||||
public:
|
||||
Brick (Point<3> ap1, Point<3> ap2, Point<3> ap3, Point<3> ap4);
|
||||
virtual ~Brick ();
|
||||
static Primitive * CreateDefault ();
|
||||
public:
|
||||
Brick (Point<3> ap1, Point<3> ap2, Point<3> ap3, Point<3> ap4);
|
||||
virtual ~Brick ();
|
||||
static Primitive * CreateDefault ();
|
||||
|
||||
virtual Primitive * Copy () const;
|
||||
virtual void Transform (Transformation<3> & trans);
|
||||
virtual Primitive * Copy () const;
|
||||
virtual void Transform (Transformation<3> & trans);
|
||||
|
||||
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
|
||||
virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
|
||||
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 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 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 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 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 int GetNSurfaces() const
|
||||
{ return 6; }
|
||||
virtual Surface & GetSurface (int i)
|
||||
virtual Surface & GetSurface (int i)
|
||||
{ return *faces[i]; }
|
||||
virtual const Surface & GetSurface (int i) const
|
||||
virtual const Surface & GetSurface (int i) const
|
||||
{ return *faces[i]; }
|
||||
|
||||
|
||||
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
|
||||
virtual void Reduce (const BoxSphere<3> & box);
|
||||
virtual void UnReduce ();
|
||||
virtual void Reduce (const BoxSphere<3> & box);
|
||||
virtual void UnReduce ();
|
||||
|
||||
protected:
|
||||
void CalcData();
|
||||
};
|
||||
protected:
|
||||
void CalcData();
|
||||
};
|
||||
|
||||
|
||||
class OrthoBrick : public Brick
|
||||
{
|
||||
protected:
|
||||
Point<3> pmin, pmax;
|
||||
public:
|
||||
OrthoBrick (const Point<3> & ap1, const Point<3> & ap2);
|
||||
class OrthoBrick : public Brick
|
||||
{
|
||||
protected:
|
||||
Point<3> pmin, pmax;
|
||||
public:
|
||||
OrthoBrick (const Point<3> & ap1, const Point<3> & ap2);
|
||||
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
virtual void Reduce (const BoxSphere<3> & box);
|
||||
};
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
virtual void Reduce (const BoxSphere<3> & box);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -13,8 +13,10 @@
|
||||
|
||||
#include <geometry2d.hpp>
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
#include "surface.hpp"
|
||||
#include "solid.hpp"
|
||||
#include "identify.hpp"
|
||||
@ -22,16 +24,8 @@ namespace netgen
|
||||
#include "csgeom.hpp"
|
||||
#include "csgparser.hpp"
|
||||
|
||||
#ifndef SMALLLIB
|
||||
#define _INCLUDE_MORE
|
||||
#endif
|
||||
//#ifdef LINUX
|
||||
#define _INCLUDE_MORE
|
||||
//#endif
|
||||
|
||||
#ifdef _INCLUDE_MORE
|
||||
#include "triapprox.hpp"
|
||||
|
||||
#include "algprim.hpp"
|
||||
#include "brick.hpp"
|
||||
#include "spline3d.hpp"
|
||||
@ -45,7 +39,6 @@ namespace netgen
|
||||
#include "specpoin.hpp"
|
||||
#include "edgeflw.hpp"
|
||||
#include "meshsurf.hpp"
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -7,312 +7,315 @@
|
||||
/* Date: 27. Nov. 97 */
|
||||
/**************************************************************************/
|
||||
|
||||
/**
|
||||
Constructive Solid Geometry
|
||||
*/
|
||||
|
||||
|
||||
class TriangleApproximation;
|
||||
class TATriangle;
|
||||
|
||||
|
||||
/**
|
||||
A top level object is an entity to be meshed.
|
||||
I can be either a solid, or one surface patch of a solid.
|
||||
*/
|
||||
class TopLevelObject
|
||||
namespace netgen
|
||||
{
|
||||
Solid * solid;
|
||||
Surface * surface;
|
||||
|
||||
double red, blue, green;
|
||||
bool visible, transp;
|
||||
double maxh;
|
||||
string material;
|
||||
int layer;
|
||||
int bc; // for surface patches, only
|
||||
string bcname;
|
||||
/**
|
||||
Constructive Solid Geometry
|
||||
*/
|
||||
|
||||
public:
|
||||
TopLevelObject (Solid * asolid,
|
||||
Surface * asurface = NULL);
|
||||
|
||||
const Solid * GetSolid() const { return solid; }
|
||||
Solid * GetSolid() { return solid; }
|
||||
class TriangleApproximation;
|
||||
class TATriangle;
|
||||
|
||||
const Surface * GetSurface () const { return surface; }
|
||||
Surface * GetSurface () { return surface; }
|
||||
|
||||
void GetData (ostream & ost);
|
||||
void SetData (istream & ist);
|
||||
|
||||
void SetMaxH (double amaxh) { maxh = amaxh; }
|
||||
double GetMaxH () const { return maxh; }
|
||||
|
||||
void SetRGB (double ared, double agreen, double ablue)
|
||||
/**
|
||||
A top level object is an entity to be meshed.
|
||||
I can be either a solid, or one surface patch of a solid.
|
||||
*/
|
||||
class TopLevelObject
|
||||
{
|
||||
red = ared;
|
||||
green = agreen;
|
||||
blue = ablue;
|
||||
}
|
||||
Solid * solid;
|
||||
Surface * surface;
|
||||
|
||||
double GetRed () const { return red; }
|
||||
double GetGreen () const { return green; }
|
||||
double GetBlue () const { return blue; }
|
||||
double red, blue, green;
|
||||
bool visible, transp;
|
||||
double maxh;
|
||||
string material;
|
||||
int layer;
|
||||
int bc; // for surface patches, only
|
||||
string bcname;
|
||||
|
||||
void SetTransparent (bool atransp)
|
||||
{ transp = atransp; }
|
||||
bool GetTransparent () const { return transp; }
|
||||
|
||||
void SetVisible (bool avisible)
|
||||
{ visible = avisible; }
|
||||
bool GetVisible () const { return visible; }
|
||||
|
||||
const string GetMaterial () const { return material; }
|
||||
void SetMaterial (const string & mat) { material = mat; }
|
||||
|
||||
int GetLayer () const { return layer; }
|
||||
void SetLayer (int alayer) { layer = alayer; }
|
||||
|
||||
void SetBCProp (int abc) { bc = abc; }
|
||||
int GetBCProp () const { return bc; }
|
||||
|
||||
void SetBCName (string abc) { bcname = abc; }
|
||||
const string GetBCName () const { return bcname; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
CSGeometry has the whole geometric information
|
||||
*/
|
||||
class CSGeometry : public NetgenGeometry
|
||||
{
|
||||
private:
|
||||
/// all surfaces
|
||||
SYMBOLTABLE<Surface*> surfaces;
|
||||
|
||||
public:
|
||||
/// primitive of surface
|
||||
Array<const Primitive*> surf2prim;
|
||||
|
||||
private:
|
||||
Array<Surface*> delete_them;
|
||||
|
||||
/// all named solids
|
||||
SYMBOLTABLE<Solid*> solids;
|
||||
|
||||
/// all 2d splinecurves
|
||||
SYMBOLTABLE< SplineGeometry<2>* > splinecurves2d;
|
||||
/// all 3d splinecurves
|
||||
SYMBOLTABLE< SplineGeometry<3>* > splinecurves3d;
|
||||
|
||||
/// all top level objects: solids and surfaces
|
||||
Array<TopLevelObject*> toplevelobjects;
|
||||
|
||||
/// additional points specified by user
|
||||
Array<Point<3> > userpoints;
|
||||
Array<double> userpoints_ref_factor;
|
||||
|
||||
mutable Array<Point<3> > identpoints;
|
||||
|
||||
/// triangular approximation of top level objects
|
||||
Array<TriangleApproximation*> triapprox;
|
||||
|
||||
/// increment, if geometry is changed
|
||||
static int changeval;
|
||||
|
||||
/// bounding box of geometry
|
||||
Box<3> boundingbox;
|
||||
|
||||
/// bounding box, if not set by input file
|
||||
static Box<3> default_boundingbox;
|
||||
|
||||
/// identic surfaces are stored by pair of indizes, val = inverse
|
||||
INDEX_2_HASHTABLE<int> identicsurfaces;
|
||||
Array<int> isidenticto;
|
||||
/// identification of boundaries (periodic, thin domains, ...)
|
||||
|
||||
double ideps;
|
||||
|
||||
/// filename of inputfile
|
||||
string filename;
|
||||
|
||||
public:
|
||||
CSGeometry ();
|
||||
CSGeometry (const string & afilename);
|
||||
~CSGeometry ();
|
||||
|
||||
void Clean ();
|
||||
|
||||
void Save (ostream & ost);
|
||||
void Load (istream & ist);
|
||||
|
||||
void SaveSurfaces (ostream & out);
|
||||
void LoadSurfaces (istream & in);
|
||||
|
||||
int GetChangeVal() { return changeval; }
|
||||
void Change() { changeval++; }
|
||||
|
||||
void AddSurface (Surface * surf);
|
||||
void AddSurface (char * name, Surface * surf);
|
||||
void AddSurfaces (Primitive * prim);
|
||||
|
||||
int GetNSurf () const { return surfaces.Size(); }
|
||||
const Surface * GetSurface (const char * name) const;
|
||||
const Surface * GetSurface (int i) const
|
||||
{ return surfaces[i]; }
|
||||
|
||||
void SetSolid (const char * name, Solid * sol);
|
||||
const Solid * GetSolid (const char * name) const;
|
||||
const Solid * GetSolid (const string & name) const;
|
||||
int GetNSolids () const { return solids.Size(); }
|
||||
const Solid * GetSolid (int i) const { return solids[i]; }
|
||||
const SYMBOLTABLE<Solid*> & GetSolids () const { return solids; }
|
||||
|
||||
|
||||
void SetSplineCurve (const char * name, SplineGeometry<2> * spl);
|
||||
void SetSplineCurve (const char * name, SplineGeometry<3> * spl);
|
||||
const SplineGeometry<2> * GetSplineCurve2d (const string & name) const;
|
||||
const SplineGeometry<3> * GetSplineCurve3d (const string & name) const;
|
||||
|
||||
|
||||
void SetFlags (const char * solidname, const Flags & flags);
|
||||
|
||||
|
||||
int GetNTopLevelObjects () const
|
||||
{ return toplevelobjects.Size(); }
|
||||
int SetTopLevelObject (Solid * sol, Surface * surf = NULL);
|
||||
void GetTopLevelObject (int nr, Solid *& sol, Surface *& surf)
|
||||
{
|
||||
sol = toplevelobjects[nr]->GetSolid();
|
||||
surf = toplevelobjects[nr]->GetSurface();
|
||||
}
|
||||
void GetTopLevelObject (int nr, const Solid *& sol, const Surface *& surf) const
|
||||
{
|
||||
sol = toplevelobjects[nr]->GetSolid();
|
||||
surf = toplevelobjects[nr]->GetSurface();
|
||||
}
|
||||
|
||||
TopLevelObject * GetTopLevelObject (const Solid * sol, const Surface * surf = NULL);
|
||||
TopLevelObject * GetTopLevelObject (int nr)
|
||||
{ return toplevelobjects[nr]; }
|
||||
const TopLevelObject * GetTopLevelObject (int nr) const
|
||||
{ return toplevelobjects[nr]; }
|
||||
void RemoveTopLevelObject (Solid * sol, Surface * surf = NULL);
|
||||
|
||||
|
||||
void AddUserPoint (const Point<3> & p, double ref_factor = 0)
|
||||
{ userpoints.Append (p); userpoints_ref_factor.Append (ref_factor); }
|
||||
int GetNUserPoints () const
|
||||
{ return userpoints.Size(); }
|
||||
const Point<3> & GetUserPoint (int nr) const
|
||||
{ return userpoints[nr]; }
|
||||
double GetUserPointRefFactor (int nr) const
|
||||
{ return userpoints_ref_factor[nr]; }
|
||||
|
||||
void AddIdentPoint (const Point<3> & p) const
|
||||
{ identpoints.Append(p);}
|
||||
int GetNIdentPoints (void) const
|
||||
{ return identpoints.Size();}
|
||||
const Point<3> & GetIdentPoint(int nr) const
|
||||
{ return identpoints[nr]; }
|
||||
void DeleteIdentPoints(void) const
|
||||
{ identpoints.DeleteAll();}
|
||||
|
||||
|
||||
// quick implementations:
|
||||
Array<SingularFace*> singfaces;
|
||||
Array<SingularEdge*> singedges;
|
||||
Array<SingularPoint*> singpoints;
|
||||
Array<Identification*> identifications;
|
||||
|
||||
int GetNIdentifications (void) const { return identifications.Size(); }
|
||||
void AddIdentification (Identification * ident);
|
||||
|
||||
|
||||
///
|
||||
void CalcTriangleApproximation(const Box<3> & boundingbox,
|
||||
double detail, double facets);
|
||||
|
||||
///
|
||||
void FindIdenticSurfaces (double eps);
|
||||
///
|
||||
void GetSurfaceIndices (const Solid * sol,
|
||||
const BoxSphere<3> & box,
|
||||
Array<int> & locsurf) const;
|
||||
///
|
||||
void GetIndependentSurfaceIndices (const Solid * sol,
|
||||
const BoxSphere<3> & box,
|
||||
Array<int> & locsurf) const;
|
||||
///
|
||||
void GetIndependentSurfaceIndices (const Solid * sol,
|
||||
const Point<3> & p, Vec<3> & v,
|
||||
Array<int> & locsurf) const;
|
||||
///
|
||||
void GetIndependentSurfaceIndices (Array<int> & locsurf) const;
|
||||
|
||||
///
|
||||
int GetSurfaceClassRepresentant (int si) const
|
||||
{ return isidenticto[si]; }
|
||||
|
||||
///
|
||||
const TriangleApproximation * GetTriApprox (int msnr)
|
||||
{
|
||||
if (msnr < triapprox.Size())
|
||||
return triapprox[msnr];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void IterateAllSolids (SolidIterator & it, bool only_once = false);
|
||||
|
||||
void RefineTriangleApprox (Solid * locsol,
|
||||
int surfind,
|
||||
const BoxSphere<3> & box,
|
||||
double detail,
|
||||
const TATriangle & tria,
|
||||
TriangleApproximation & tams,
|
||||
IndexSet & iset,
|
||||
int level);
|
||||
|
||||
const Box<3> & BoundingBox () const { return boundingbox; }
|
||||
|
||||
void SetBoundingBox (const Box<3> & abox)
|
||||
{
|
||||
boundingbox = abox;
|
||||
}
|
||||
|
||||
|
||||
static void SetDefaultBoundingBox (const Box<3> & abox)
|
||||
{
|
||||
default_boundingbox = abox;
|
||||
}
|
||||
|
||||
double MaxSize () const;
|
||||
|
||||
void SetIdEps(double eps){ideps = eps;}
|
||||
double GetIdEps(void) const {return ideps;}
|
||||
|
||||
class BCModification {
|
||||
public:
|
||||
int si;
|
||||
int tlonr;
|
||||
int bcnr;
|
||||
string * bcname;
|
||||
TopLevelObject (Solid * asolid,
|
||||
Surface * asurface = NULL);
|
||||
|
||||
const Solid * GetSolid() const { return solid; }
|
||||
Solid * GetSolid() { return solid; }
|
||||
|
||||
const Surface * GetSurface () const { return surface; }
|
||||
Surface * GetSurface () { return surface; }
|
||||
|
||||
void GetData (ostream & ost);
|
||||
void SetData (istream & ist);
|
||||
|
||||
void SetMaxH (double amaxh) { maxh = amaxh; }
|
||||
double GetMaxH () const { return maxh; }
|
||||
|
||||
void SetRGB (double ared, double agreen, double ablue)
|
||||
{
|
||||
red = ared;
|
||||
green = agreen;
|
||||
blue = ablue;
|
||||
}
|
||||
|
||||
double GetRed () const { return red; }
|
||||
double GetGreen () const { return green; }
|
||||
double GetBlue () const { return blue; }
|
||||
|
||||
void SetTransparent (bool atransp)
|
||||
{ transp = atransp; }
|
||||
bool GetTransparent () const { return transp; }
|
||||
|
||||
void SetVisible (bool avisible)
|
||||
{ visible = avisible; }
|
||||
bool GetVisible () const { return visible; }
|
||||
|
||||
const string GetMaterial () const { return material; }
|
||||
void SetMaterial (const string & mat) { material = mat; }
|
||||
|
||||
int GetLayer () const { return layer; }
|
||||
void SetLayer (int alayer) { layer = alayer; }
|
||||
|
||||
void SetBCProp (int abc) { bc = abc; }
|
||||
int GetBCProp () const { return bc; }
|
||||
|
||||
void SetBCName (string abc) { bcname = abc; }
|
||||
const string GetBCName () const { return bcname; }
|
||||
};
|
||||
|
||||
Array<BCModification> bcmodifications;
|
||||
|
||||
virtual int GenerateMesh (Mesh*& mesh,
|
||||
int perfstepsstart, int perfstepsend, char* optstring);
|
||||
|
||||
virtual const Refinement & GetRefinement () const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
CSGeometry has the whole geometric information
|
||||
*/
|
||||
class CSGeometry : public NetgenGeometry
|
||||
{
|
||||
private:
|
||||
/// all surfaces
|
||||
SYMBOLTABLE<Surface*> surfaces;
|
||||
|
||||
public:
|
||||
/// primitive of surface
|
||||
Array<const Primitive*> surf2prim;
|
||||
|
||||
private:
|
||||
Array<Surface*> delete_them;
|
||||
|
||||
/// all named solids
|
||||
SYMBOLTABLE<Solid*> solids;
|
||||
|
||||
/// all 2d splinecurves
|
||||
SYMBOLTABLE< SplineGeometry<2>* > splinecurves2d;
|
||||
/// all 3d splinecurves
|
||||
SYMBOLTABLE< SplineGeometry<3>* > splinecurves3d;
|
||||
|
||||
/// all top level objects: solids and surfaces
|
||||
Array<TopLevelObject*> toplevelobjects;
|
||||
|
||||
/// additional points specified by user
|
||||
Array<Point<3> > userpoints;
|
||||
Array<double> userpoints_ref_factor;
|
||||
|
||||
mutable Array<Point<3> > identpoints;
|
||||
|
||||
/// triangular approximation of top level objects
|
||||
Array<TriangleApproximation*> triapprox;
|
||||
|
||||
/// increment, if geometry is changed
|
||||
static int changeval;
|
||||
|
||||
/// bounding box of geometry
|
||||
Box<3> boundingbox;
|
||||
|
||||
/// bounding box, if not set by input file
|
||||
static Box<3> default_boundingbox;
|
||||
|
||||
/// identic surfaces are stored by pair of indizes, val = inverse
|
||||
INDEX_2_HASHTABLE<int> identicsurfaces;
|
||||
Array<int> isidenticto;
|
||||
/// identification of boundaries (periodic, thin domains, ...)
|
||||
|
||||
double ideps;
|
||||
|
||||
/// filename of inputfile
|
||||
string filename;
|
||||
|
||||
public:
|
||||
CSGeometry ();
|
||||
CSGeometry (const string & afilename);
|
||||
~CSGeometry ();
|
||||
|
||||
void Clean ();
|
||||
|
||||
void Save (ostream & ost);
|
||||
void Load (istream & ist);
|
||||
|
||||
void SaveSurfaces (ostream & out);
|
||||
void LoadSurfaces (istream & in);
|
||||
|
||||
int GetChangeVal() { return changeval; }
|
||||
void Change() { changeval++; }
|
||||
|
||||
void AddSurface (Surface * surf);
|
||||
void AddSurface (char * name, Surface * surf);
|
||||
void AddSurfaces (Primitive * prim);
|
||||
|
||||
int GetNSurf () const { return surfaces.Size(); }
|
||||
const Surface * GetSurface (const char * name) const;
|
||||
const Surface * GetSurface (int i) const
|
||||
{ return surfaces[i]; }
|
||||
|
||||
void SetSolid (const char * name, Solid * sol);
|
||||
const Solid * GetSolid (const char * name) const;
|
||||
const Solid * GetSolid (const string & name) const;
|
||||
int GetNSolids () const { return solids.Size(); }
|
||||
const Solid * GetSolid (int i) const { return solids[i]; }
|
||||
const SYMBOLTABLE<Solid*> & GetSolids () const { return solids; }
|
||||
|
||||
|
||||
void SetSplineCurve (const char * name, SplineGeometry<2> * spl);
|
||||
void SetSplineCurve (const char * name, SplineGeometry<3> * spl);
|
||||
const SplineGeometry<2> * GetSplineCurve2d (const string & name) const;
|
||||
const SplineGeometry<3> * GetSplineCurve3d (const string & name) const;
|
||||
|
||||
|
||||
void SetFlags (const char * solidname, const Flags & flags);
|
||||
|
||||
|
||||
int GetNTopLevelObjects () const
|
||||
{ return toplevelobjects.Size(); }
|
||||
int SetTopLevelObject (Solid * sol, Surface * surf = NULL);
|
||||
void GetTopLevelObject (int nr, Solid *& sol, Surface *& surf)
|
||||
{
|
||||
sol = toplevelobjects[nr]->GetSolid();
|
||||
surf = toplevelobjects[nr]->GetSurface();
|
||||
}
|
||||
void GetTopLevelObject (int nr, const Solid *& sol, const Surface *& surf) const
|
||||
{
|
||||
sol = toplevelobjects[nr]->GetSolid();
|
||||
surf = toplevelobjects[nr]->GetSurface();
|
||||
}
|
||||
|
||||
TopLevelObject * GetTopLevelObject (const Solid * sol, const Surface * surf = NULL);
|
||||
TopLevelObject * GetTopLevelObject (int nr)
|
||||
{ return toplevelobjects[nr]; }
|
||||
const TopLevelObject * GetTopLevelObject (int nr) const
|
||||
{ return toplevelobjects[nr]; }
|
||||
void RemoveTopLevelObject (Solid * sol, Surface * surf = NULL);
|
||||
|
||||
|
||||
void AddUserPoint (const Point<3> & p, double ref_factor = 0)
|
||||
{ userpoints.Append (p); userpoints_ref_factor.Append (ref_factor); }
|
||||
int GetNUserPoints () const
|
||||
{ return userpoints.Size(); }
|
||||
const Point<3> & GetUserPoint (int nr) const
|
||||
{ return userpoints[nr]; }
|
||||
double GetUserPointRefFactor (int nr) const
|
||||
{ return userpoints_ref_factor[nr]; }
|
||||
|
||||
void AddIdentPoint (const Point<3> & p) const
|
||||
{ identpoints.Append(p);}
|
||||
int GetNIdentPoints (void) const
|
||||
{ return identpoints.Size();}
|
||||
const Point<3> & GetIdentPoint(int nr) const
|
||||
{ return identpoints[nr]; }
|
||||
void DeleteIdentPoints(void) const
|
||||
{ identpoints.DeleteAll();}
|
||||
|
||||
|
||||
// quick implementations:
|
||||
Array<SingularFace*> singfaces;
|
||||
Array<SingularEdge*> singedges;
|
||||
Array<SingularPoint*> singpoints;
|
||||
Array<Identification*> identifications;
|
||||
|
||||
int GetNIdentifications (void) const { return identifications.Size(); }
|
||||
void AddIdentification (Identification * ident);
|
||||
|
||||
|
||||
///
|
||||
void CalcTriangleApproximation(const Box<3> & boundingbox,
|
||||
double detail, double facets);
|
||||
|
||||
///
|
||||
void FindIdenticSurfaces (double eps);
|
||||
///
|
||||
void GetSurfaceIndices (const Solid * sol,
|
||||
const BoxSphere<3> & box,
|
||||
Array<int> & locsurf) const;
|
||||
///
|
||||
void GetIndependentSurfaceIndices (const Solid * sol,
|
||||
const BoxSphere<3> & box,
|
||||
Array<int> & locsurf) const;
|
||||
///
|
||||
void GetIndependentSurfaceIndices (const Solid * sol,
|
||||
const Point<3> & p, Vec<3> & v,
|
||||
Array<int> & locsurf) const;
|
||||
///
|
||||
void GetIndependentSurfaceIndices (Array<int> & locsurf) const;
|
||||
|
||||
///
|
||||
int GetSurfaceClassRepresentant (int si) const
|
||||
{ return isidenticto[si]; }
|
||||
|
||||
///
|
||||
const TriangleApproximation * GetTriApprox (int msnr)
|
||||
{
|
||||
if (msnr < triapprox.Size())
|
||||
return triapprox[msnr];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void IterateAllSolids (SolidIterator & it, bool only_once = false);
|
||||
|
||||
void RefineTriangleApprox (Solid * locsol,
|
||||
int surfind,
|
||||
const BoxSphere<3> & box,
|
||||
double detail,
|
||||
const TATriangle & tria,
|
||||
TriangleApproximation & tams,
|
||||
IndexSet & iset,
|
||||
int level);
|
||||
|
||||
const Box<3> & BoundingBox () const { return boundingbox; }
|
||||
|
||||
void SetBoundingBox (const Box<3> & abox)
|
||||
{
|
||||
boundingbox = abox;
|
||||
}
|
||||
|
||||
|
||||
static void SetDefaultBoundingBox (const Box<3> & abox)
|
||||
{
|
||||
default_boundingbox = abox;
|
||||
}
|
||||
|
||||
double MaxSize () const;
|
||||
|
||||
void SetIdEps(double eps){ideps = eps;}
|
||||
double GetIdEps(void) const {return ideps;}
|
||||
|
||||
class BCModification {
|
||||
public:
|
||||
int si;
|
||||
int tlonr;
|
||||
int bcnr;
|
||||
string * bcname;
|
||||
};
|
||||
|
||||
Array<BCModification> bcmodifications;
|
||||
|
||||
virtual int GenerateMesh (Mesh*& mesh,
|
||||
int perfstepsstart, int perfstepsend, char* optstring);
|
||||
|
||||
virtual const Refinement & GetRefinement () const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -2,10 +2,9 @@
|
||||
#define _CSGPARSER_HPP
|
||||
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
|
||||
//namespace netgen
|
||||
//{
|
||||
enum TOKEN_TYPE
|
||||
{
|
||||
TOK_MINUS = '-', TOK_LP = '(', OK_RP = ')', TOK_LSP = '[', TOK_RSP = ']',
|
||||
@ -94,14 +93,9 @@
|
||||
|
||||
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _CSGPARSER_HPP
|
||||
|
@ -7,53 +7,61 @@
|
||||
/* Date: 24. Jul. 96 */
|
||||
/**************************************************************************/
|
||||
|
||||
/*
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
|
||||
2D Curve repesentation
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
///
|
||||
class Curve2d : public Manifold
|
||||
///
|
||||
class Curve2d : public Manifold
|
||||
{
|
||||
public:
|
||||
///
|
||||
virtual void Project (Point<2> & p) const = 0;
|
||||
///
|
||||
virtual void NormalVector (const Point<2> & p, Vec<2> & n) const = 0;
|
||||
///
|
||||
virtual void Project (Point<2> & p) const = 0;
|
||||
///
|
||||
virtual void NormalVector (const Point<2> & p, Vec<2> & n) const = 0;
|
||||
};
|
||||
|
||||
///
|
||||
class CircleCurve2d : public Curve2d
|
||||
///
|
||||
class CircleCurve2d : public Curve2d
|
||||
{
|
||||
///
|
||||
Point<2> center;
|
||||
///
|
||||
double rad;
|
||||
///
|
||||
Point<2> center;
|
||||
///
|
||||
double rad;
|
||||
public:
|
||||
///
|
||||
CircleCurve2d (const Point<2> & acenter, double arad);
|
||||
///
|
||||
virtual void Project (Point<2> & p) const;
|
||||
///
|
||||
virtual void NormalVector (const Point<2> & p, Vec<2> & n) const;
|
||||
///
|
||||
CircleCurve2d (const Point<2> & acenter, double arad);
|
||||
///
|
||||
virtual void Project (Point<2> & p) const;
|
||||
///
|
||||
virtual void NormalVector (const Point<2> & p, Vec<2> & n) const;
|
||||
};
|
||||
|
||||
///
|
||||
class QuadraticCurve2d : public Curve2d
|
||||
{
|
||||
///
|
||||
double cxx, cyy, cxy, cx, cy, c;
|
||||
public:
|
||||
///
|
||||
QuadraticCurve2d ();
|
||||
///
|
||||
void Read (istream & ist);
|
||||
///
|
||||
virtual void Project (Point<2> & p) const;
|
||||
///
|
||||
virtual void NormalVector (const Point<2> & p, Vec<2> & n) const;
|
||||
};
|
||||
class QuadraticCurve2d : public Curve2d
|
||||
{
|
||||
///
|
||||
double cxx, cyy, cxy, cx, cy, c;
|
||||
public:
|
||||
///
|
||||
QuadraticCurve2d ();
|
||||
///
|
||||
void Read (istream & ist);
|
||||
///
|
||||
virtual void Project (Point<2> & p) const;
|
||||
///
|
||||
virtual void NormalVector (const Point<2> & p, Vec<2> & n) const;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -7,98 +7,104 @@
|
||||
/* Date: 01. Okt. 95 */
|
||||
/**************************************************************************/
|
||||
|
||||
/*
|
||||
|
||||
Edge - following function and
|
||||
Projection to edge of implicitly given edge
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Edge - following function and
|
||||
Projection to edge of implicitly given edge
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
Calculates edges.
|
||||
The edges of a solid geometry are computed. Special
|
||||
points have to be given.
|
||||
*/
|
||||
extern void CalcEdges (const CSGeometry & geometry,
|
||||
const Array<SpecialPoint> & specpoints,
|
||||
double h, Mesh & mesh);
|
||||
/**
|
||||
Calculates edges.
|
||||
The edges of a solid geometry are computed. Special
|
||||
points have to be given.
|
||||
*/
|
||||
extern void CalcEdges (const CSGeometry & geometry,
|
||||
const Array<SpecialPoint> & specpoints,
|
||||
double h, Mesh & mesh);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class EdgeCalculation
|
||||
{
|
||||
const CSGeometry & geometry;
|
||||
Array<SpecialPoint> & specpoints;
|
||||
Point3dTree * searchtree;
|
||||
Point3dTree * meshpoint_tree;
|
||||
int cntedge;
|
||||
class EdgeCalculation
|
||||
{
|
||||
const CSGeometry & geometry;
|
||||
Array<SpecialPoint> & specpoints;
|
||||
Point3dTree * searchtree;
|
||||
Point3dTree * meshpoint_tree;
|
||||
int cntedge;
|
||||
|
||||
double ideps;
|
||||
double ideps;
|
||||
|
||||
public:
|
||||
EdgeCalculation (const CSGeometry & ageometry,
|
||||
Array<SpecialPoint> & aspecpoints);
|
||||
public:
|
||||
EdgeCalculation (const CSGeometry & ageometry,
|
||||
Array<SpecialPoint> & aspecpoints);
|
||||
|
||||
~EdgeCalculation();
|
||||
~EdgeCalculation();
|
||||
|
||||
void SetIdEps(const double epsin) {ideps = epsin;}
|
||||
void SetIdEps(const double epsin) {ideps = epsin;}
|
||||
|
||||
void Calc(double h, Mesh & mesh);
|
||||
void Calc(double h, Mesh & mesh);
|
||||
|
||||
|
||||
private:
|
||||
void CalcEdges1 (double h, Mesh & mesh);
|
||||
private:
|
||||
void CalcEdges1 (double h, Mesh & mesh);
|
||||
|
||||
|
||||
void FollowEdge (int pi1, int & ep, int & pos,
|
||||
// const Array<SpecialPoint> & hsp,
|
||||
const Array<int> & hsp,
|
||||
double h, const Mesh & mesh,
|
||||
Array<Point<3> > & edgepoints,
|
||||
Array<double> & curvelength);
|
||||
void FollowEdge (int pi1, int & ep, int & pos,
|
||||
// const Array<SpecialPoint> & hsp,
|
||||
const Array<int> & hsp,
|
||||
double h, const Mesh & mesh,
|
||||
Array<Point<3> > & edgepoints,
|
||||
Array<double> & curvelength);
|
||||
|
||||
|
||||
void AnalyzeEdge (int s1, int s2, int s1_rep, int s2_rep, int pos, int layer,
|
||||
void AnalyzeEdge (int s1, int s2, int s1_rep, int s2_rep, int pos, int layer,
|
||||
const Array<Point<3> > & edgepoints,
|
||||
Array<Segment> & refedges,
|
||||
Array<bool> & refedgesinv);
|
||||
|
||||
void StoreEdge (const Array<Segment> & refedges,
|
||||
const Array<bool> & refedgesinv,
|
||||
const Array<Point<3> > & edgepoints,
|
||||
Array<Segment> & refedges,
|
||||
Array<bool> & refedgesinv);
|
||||
const Array<double> & curvelength,
|
||||
int layer,
|
||||
Mesh & mesh);
|
||||
|
||||
void StoreEdge (const Array<Segment> & refedges,
|
||||
const Array<bool> & refedgesinv,
|
||||
const Array<Point<3> > & edgepoints,
|
||||
const Array<double> & curvelength,
|
||||
int layer,
|
||||
Mesh & mesh);
|
||||
void StoreShortEdge (const Array<Segment> & refedges,
|
||||
const Array<bool> & refedgesinv,
|
||||
const Array<Point<3> > & edgepoints,
|
||||
const Array<double> & curvelength,
|
||||
int layer,
|
||||
Mesh & mesh);
|
||||
|
||||
void StoreShortEdge (const Array<Segment> & refedges,
|
||||
const Array<bool> & refedgesinv,
|
||||
const Array<Point<3> > & edgepoints,
|
||||
const Array<double> & curvelength,
|
||||
int layer,
|
||||
Mesh & mesh);
|
||||
|
||||
void CopyEdge (const Array<Segment> & refedges,
|
||||
const Array<bool> & refedgesinv,
|
||||
int copyfromedge,
|
||||
const Point<3> & fromstart, const Point<3> & fromend,
|
||||
const Point<3> & tostart, const Point<3> & toend,
|
||||
int copyedgeidentification,
|
||||
int layer,
|
||||
Mesh & mesh);
|
||||
void CopyEdge (const Array<Segment> & refedges,
|
||||
const Array<bool> & refedgesinv,
|
||||
int copyfromedge,
|
||||
const Point<3> & fromstart, const Point<3> & fromend,
|
||||
const Point<3> & tostart, const Point<3> & toend,
|
||||
int copyedgeidentification,
|
||||
int layer,
|
||||
Mesh & mesh);
|
||||
|
||||
|
||||
void SplitEqualOneSegEdges (Mesh & mesh);
|
||||
void FindClosedSurfaces (double h, Mesh & mesh);
|
||||
void SplitEqualOneSegEdges (Mesh & mesh);
|
||||
void FindClosedSurfaces (double h, Mesh & mesh);
|
||||
|
||||
|
||||
public:
|
||||
bool point_on_edge_problem;
|
||||
public:
|
||||
bool point_on_edge_problem;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -7,103 +7,107 @@
|
||||
/* Date: 14. Oct. 96 */
|
||||
/**************************************************************************/
|
||||
|
||||
/*
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
/*
|
||||
|
||||
Explicit 2D Curve repesentation
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
///
|
||||
class ExplicitCurve2d : public Curve2d
|
||||
{
|
||||
public:
|
||||
///
|
||||
ExplicitCurve2d ();
|
||||
class ExplicitCurve2d : public Curve2d
|
||||
{
|
||||
public:
|
||||
///
|
||||
ExplicitCurve2d ();
|
||||
|
||||
///
|
||||
virtual void Project (Point<2> & p) const;
|
||||
///
|
||||
virtual double ProjectParam (const Point<2> & p) const = 0;
|
||||
///
|
||||
virtual double NumericalProjectParam (const Point<2> & p, double lb, double ub) const;
|
||||
///
|
||||
virtual double MinParam () const = 0;
|
||||
///
|
||||
virtual double MaxParam () const = 0;
|
||||
///
|
||||
virtual Point<2> Eval (double t) const = 0;
|
||||
///
|
||||
virtual Vec<2> EvalPrime (double t) const = 0;
|
||||
///
|
||||
virtual Vec<2> Normal (double t) const;
|
||||
///
|
||||
virtual void NormalVector (const Point<2> & p, Vec<2> & n) const;
|
||||
///
|
||||
virtual Vec<2> EvalPrimePrime (double t) const = 0;
|
||||
///
|
||||
virtual void Project (Point<2> & p) const;
|
||||
///
|
||||
virtual double ProjectParam (const Point<2> & p) const = 0;
|
||||
///
|
||||
virtual double NumericalProjectParam (const Point<2> & p, double lb, double ub) const;
|
||||
///
|
||||
virtual double MinParam () const = 0;
|
||||
///
|
||||
virtual double MaxParam () const = 0;
|
||||
///
|
||||
virtual Point<2> Eval (double t) const = 0;
|
||||
///
|
||||
virtual Vec<2> EvalPrime (double t) const = 0;
|
||||
///
|
||||
virtual Vec<2> Normal (double t) const;
|
||||
///
|
||||
virtual void NormalVector (const Point<2> & p, Vec<2> & n) const;
|
||||
///
|
||||
virtual Vec<2> EvalPrimePrime (double t) const = 0;
|
||||
|
||||
///
|
||||
virtual double MaxCurvature () const;
|
||||
///
|
||||
virtual double MaxCurvatureLoc (const Point<2> & p, double rad) const;
|
||||
///
|
||||
virtual double MaxCurvature () const;
|
||||
///
|
||||
virtual double MaxCurvatureLoc (const Point<2> & p, double rad) const;
|
||||
|
||||
///
|
||||
virtual Point<2> CurvCircle (double t) const;
|
||||
///
|
||||
virtual void Print (ostream & /* str */) const { };
|
||||
///
|
||||
virtual Point<2> CurvCircle (double t) const;
|
||||
///
|
||||
virtual void Print (ostream & /* str */) const { };
|
||||
|
||||
///
|
||||
virtual int SectionUsed (double /* t */) const { return 1; }
|
||||
///
|
||||
virtual void Reduce (const Point<2> & /* p */, double /* rad */) { };
|
||||
///
|
||||
virtual void UnReduce () { };
|
||||
};
|
||||
///
|
||||
virtual int SectionUsed (double /* t */) const { return 1; }
|
||||
///
|
||||
virtual void Reduce (const Point<2> & /* p */, double /* rad */) { };
|
||||
///
|
||||
virtual void UnReduce () { };
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
class BSplineCurve2d : public ExplicitCurve2d
|
||||
{
|
||||
///
|
||||
Array<Point<2> > points;
|
||||
///
|
||||
Array<int> intervallused;
|
||||
///
|
||||
int redlevel;
|
||||
class BSplineCurve2d : public ExplicitCurve2d
|
||||
{
|
||||
///
|
||||
Array<Point<2> > points;
|
||||
///
|
||||
Array<int> intervallused;
|
||||
///
|
||||
int redlevel;
|
||||
|
||||
public:
|
||||
///
|
||||
BSplineCurve2d ();
|
||||
///
|
||||
void AddPoint (const Point<2> & apoint);
|
||||
public:
|
||||
///
|
||||
BSplineCurve2d ();
|
||||
///
|
||||
void AddPoint (const Point<2> & apoint);
|
||||
|
||||
bool Inside (const Point<2> & p, double & dist) const;
|
||||
bool Inside (const Point<2> & p, double & dist) const;
|
||||
|
||||
///
|
||||
virtual double ProjectParam (const Point<2> & p) const;
|
||||
///
|
||||
virtual double MinParam () const { return 0; }
|
||||
///
|
||||
virtual double MaxParam () const { return points.Size(); }
|
||||
///
|
||||
virtual Point<2> Eval (double t) const;
|
||||
///
|
||||
virtual Vec<2> EvalPrime (double t) const;
|
||||
///
|
||||
virtual Vec<2> EvalPrimePrime (double t) const;
|
||||
///
|
||||
virtual void Print (ostream & str) const;
|
||||
|
||||
///
|
||||
virtual int SectionUsed (double t) const;
|
||||
///
|
||||
virtual void Reduce (const Point<2> & p, double rad);
|
||||
///
|
||||
virtual void UnReduce ();
|
||||
};
|
||||
///
|
||||
virtual double ProjectParam (const Point<2> & p) const;
|
||||
///
|
||||
virtual double MinParam () const { return 0; }
|
||||
///
|
||||
virtual double MaxParam () const { return points.Size(); }
|
||||
///
|
||||
virtual Point<2> Eval (double t) const;
|
||||
///
|
||||
virtual Vec<2> EvalPrime (double t) const;
|
||||
///
|
||||
virtual Vec<2> EvalPrimePrime (double t) const;
|
||||
///
|
||||
virtual void Print (ostream & str) const;
|
||||
|
||||
///
|
||||
virtual int SectionUsed (double t) const;
|
||||
///
|
||||
virtual void Reduce (const Point<2> & p, double rad);
|
||||
///
|
||||
virtual void UnReduce ();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,152 +1,155 @@
|
||||
#ifndef _EXTRUSION_HPP
|
||||
#define _EXTRUSION_HPP
|
||||
|
||||
|
||||
class Extrusion;
|
||||
|
||||
class ExtrusionFace : public Surface
|
||||
namespace netgen
|
||||
{
|
||||
private:
|
||||
const SplineSeg<2> * profile;
|
||||
const SplineGeometry<3> * path;
|
||||
Vec<3> glob_z_direction;
|
||||
|
||||
bool deletable;
|
||||
class Extrusion;
|
||||
|
||||
class ExtrusionFace : public Surface
|
||||
{
|
||||
private:
|
||||
const SplineSeg<2> * profile;
|
||||
const SplineGeometry<3> * path;
|
||||
Vec<3> glob_z_direction;
|
||||
|
||||
bool deletable;
|
||||
|
||||
Array< const SplineSeg3<3> * > spline3_path;
|
||||
Array< const LineSeg<3> * > line_path;
|
||||
Array< const SplineSeg3<3> * > spline3_path;
|
||||
Array< const LineSeg<3> * > line_path;
|
||||
|
||||
mutable Array < Vec<3> > x_dir, y_dir, z_dir, loc_z_dir;
|
||||
mutable Array < Point<3> > p0;
|
||||
mutable Array < Vec<3> > x_dir, y_dir, z_dir, loc_z_dir;
|
||||
mutable Array < Point<3> > p0;
|
||||
|
||||
mutable Vec<3> profile_tangent;
|
||||
mutable double profile_par;
|
||||
mutable Vec<3> profile_tangent;
|
||||
mutable double profile_par;
|
||||
|
||||
mutable Vector profile_spline_coeff;
|
||||
mutable Vector profile_spline_coeff;
|
||||
|
||||
mutable int latest_seg;
|
||||
mutable double latest_t;
|
||||
mutable Point<2> latest_point2d;
|
||||
mutable Point<3> latest_point3d;
|
||||
mutable int latest_seg;
|
||||
mutable double latest_t;
|
||||
mutable Point<2> latest_point2d;
|
||||
mutable Point<3> latest_point3d;
|
||||
|
||||
|
||||
private:
|
||||
void Orthogonalize(const Vec<3> & v1, Vec<3> & v2) const;
|
||||
private:
|
||||
void Orthogonalize(const Vec<3> & v1, Vec<3> & v2) const;
|
||||
|
||||
void Init(void);
|
||||
void Init(void);
|
||||
|
||||
public:
|
||||
double CalcProj(const Point<3> & point3d, Point<2> & point2d,
|
||||
int seg) const;
|
||||
void CalcProj(const Point<3> & point3d, Point<2> & point2d,
|
||||
int & seg, double & t) const;
|
||||
public:
|
||||
double CalcProj(const Point<3> & point3d, Point<2> & point2d,
|
||||
int seg) const;
|
||||
void CalcProj(const Point<3> & point3d, Point<2> & point2d,
|
||||
int & seg, double & t) const;
|
||||
|
||||
public:
|
||||
ExtrusionFace(const SplineSeg<2> * profile_in,
|
||||
const SplineGeometry<3> * path_in,
|
||||
const Vec<3> & z_direction);
|
||||
public:
|
||||
ExtrusionFace(const SplineSeg<2> * profile_in,
|
||||
const SplineGeometry<3> * path_in,
|
||||
const Vec<3> & z_direction);
|
||||
|
||||
ExtrusionFace(const Array<double> & raw_data);
|
||||
ExtrusionFace(const Array<double> & raw_data);
|
||||
|
||||
|
||||
~ExtrusionFace();
|
||||
~ExtrusionFace();
|
||||
|
||||
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
||||
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
||||
|
||||
virtual double CalcFunctionValue (const Point<3> & point) const;
|
||||
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
|
||||
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
|
||||
virtual double HesseNorm () const;
|
||||
virtual double CalcFunctionValue (const Point<3> & point) const;
|
||||
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
|
||||
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
|
||||
virtual double HesseNorm () const;
|
||||
|
||||
virtual double MaxCurvature () const;
|
||||
//virtual double MaxCurvatureLoc (const Point<3> & /* c */ ,
|
||||
// double /* rad */) const;
|
||||
virtual double MaxCurvature () const;
|
||||
//virtual double MaxCurvatureLoc (const Point<3> & /* c */ ,
|
||||
// double /* rad */) const;
|
||||
|
||||
virtual void Project (Point<3> & p) const;
|
||||
virtual void Project (Point<3> & p) const;
|
||||
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
virtual void Print (ostream & str) const;
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
virtual void Print (ostream & str) const;
|
||||
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & boundingbox,
|
||||
double facets) const;
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & boundingbox,
|
||||
double facets) const;
|
||||
|
||||
const SplineGeometry<3> & GetPath(void) const {return *path;}
|
||||
const SplineSeg<2> & GetProfile(void) const {return *profile;}
|
||||
const SplineGeometry<3> & GetPath(void) const {return *path;}
|
||||
const SplineSeg<2> & GetProfile(void) const {return *profile;}
|
||||
|
||||
bool BoxIntersectsFace(const Box<3> & box) const;
|
||||
bool BoxIntersectsFace(const Box<3> & box) const;
|
||||
|
||||
void LineIntersections ( const Point<3> & p,
|
||||
const Vec<3> & v,
|
||||
const double eps,
|
||||
int & before,
|
||||
int & after,
|
||||
bool & intersecting ) const;
|
||||
void LineIntersections ( const Point<3> & p,
|
||||
const Vec<3> & v,
|
||||
const double eps,
|
||||
int & before,
|
||||
int & after,
|
||||
bool & intersecting ) const;
|
||||
|
||||
INSOLID_TYPE VecInFace ( const Point<3> & p,
|
||||
const Vec<3> & v,
|
||||
const double eps ) const;
|
||||
INSOLID_TYPE VecInFace ( const Point<3> & p,
|
||||
const Vec<3> & v,
|
||||
const double eps ) const;
|
||||
|
||||
const Vec<3> & GetYDir ( void ) const {return y_dir[latest_seg];}
|
||||
const Vec<3> & GetProfileTangent (void) const {return profile_tangent;}
|
||||
double GetProfilePar(void) const {return profile_par;}
|
||||
const Vec<3> & GetYDir ( void ) const {return y_dir[latest_seg];}
|
||||
const Vec<3> & GetProfileTangent (void) const {return profile_tangent;}
|
||||
double GetProfilePar(void) const {return profile_par;}
|
||||
|
||||
void GetRawData(Array<double> & data) const;
|
||||
void GetRawData(Array<double> & data) const;
|
||||
|
||||
void CalcLocalCoordinates (int seg, double t,
|
||||
Vec<3> & ex, Vec<3> & ey, Vec<3> & ez) const;
|
||||
void CalcLocalCoordinates (int seg, double t,
|
||||
Vec<3> & ex, Vec<3> & ey, Vec<3> & ez) const;
|
||||
|
||||
void CalcLocalCoordinatesDeriv (int seg, double t,
|
||||
Vec<3> & ex, Vec<3> & ey, Vec<3> & ez,
|
||||
Vec<3> & dex, Vec<3> & dey, Vec<3> & dez) const;
|
||||
void CalcLocalCoordinatesDeriv (int seg, double t,
|
||||
Vec<3> & ex, Vec<3> & ey, Vec<3> & ez,
|
||||
Vec<3> & dex, Vec<3> & dey, Vec<3> & dez) const;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Extrusion : public Primitive
|
||||
{
|
||||
private:
|
||||
const SplineGeometry<3> & path;
|
||||
const SplineGeometry<2> & profile;
|
||||
class Extrusion : public Primitive
|
||||
{
|
||||
private:
|
||||
const SplineGeometry<3> & path;
|
||||
const SplineGeometry<2> & profile;
|
||||
|
||||
const Vec<3> & z_direction;
|
||||
const Vec<3> & z_direction;
|
||||
|
||||
Array<ExtrusionFace*> faces;
|
||||
Array<ExtrusionFace*> faces;
|
||||
|
||||
mutable int latestfacenum;
|
||||
mutable int latestfacenum;
|
||||
|
||||
public:
|
||||
Extrusion(const SplineGeometry<3> & path_in,
|
||||
const SplineGeometry<2> & profile_in,
|
||||
const Vec<3> & z_dir);
|
||||
~Extrusion();
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
|
||||
public:
|
||||
Extrusion(const SplineGeometry<3> & path_in,
|
||||
const SplineGeometry<2> & profile_in,
|
||||
const Vec<3> & z_dir);
|
||||
~Extrusion();
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
|
||||
double eps) const;
|
||||
INSOLID_TYPE PointInSolid (const Point<3> & p,
|
||||
double eps,
|
||||
Array<int> * const facenums) const;
|
||||
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
|
||||
const Vec<3> & v,
|
||||
double eps) const;
|
||||
INSOLID_TYPE PointInSolid (const Point<3> & p,
|
||||
double eps,
|
||||
Array<int> * const facenums) const;
|
||||
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
|
||||
const Vec<3> & v,
|
||||
double eps) const;
|
||||
|
||||
// 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 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;
|
||||
|
||||
|
||||
virtual int GetNSurfaces() const;
|
||||
virtual Surface & GetSurface (int i = 0);
|
||||
virtual const Surface & GetSurface (int i = 0) const;
|
||||
virtual int GetNSurfaces() const;
|
||||
virtual Surface & GetSurface (int i = 0);
|
||||
virtual const Surface & GetSurface (int i = 0) const;
|
||||
|
||||
|
||||
virtual void Reduce (const BoxSphere<3> & box);
|
||||
virtual void UnReduce ();
|
||||
virtual void Reduce (const BoxSphere<3> & box);
|
||||
virtual void UnReduce ();
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //_EXTRUSION_HPP
|
||||
|
@ -7,58 +7,64 @@
|
||||
/* Date: 14. Oct. 96 */
|
||||
/**************************************************************************/
|
||||
|
||||
/*
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Generalized Cylinder
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
///
|
||||
class GeneralizedCylinder : public Surface
|
||||
{
|
||||
///
|
||||
ExplicitCurve2d & crosssection;
|
||||
///
|
||||
Point<3> planep;
|
||||
///
|
||||
Vec<3> planee1, planee2, planee3;
|
||||
|
||||
/// Vec<3> ex, ey, ez;
|
||||
Vec2d e2x, e2y;
|
||||
class GeneralizedCylinder : public Surface
|
||||
{
|
||||
///
|
||||
Point<3> cp;
|
||||
ExplicitCurve2d & crosssection;
|
||||
///
|
||||
Point<3> planep;
|
||||
///
|
||||
Vec<3> planee1, planee2, planee3;
|
||||
|
||||
public:
|
||||
///
|
||||
GeneralizedCylinder (ExplicitCurve2d & acrosssection,
|
||||
Point<3> ap, Vec<3> ae1, Vec<3> ae2);
|
||||
/// Vec<3> ex, ey, ez;
|
||||
Vec2d e2x, e2y;
|
||||
///
|
||||
Point<3> cp;
|
||||
|
||||
///
|
||||
virtual void Project (Point<3> & p) const;
|
||||
public:
|
||||
///
|
||||
GeneralizedCylinder (ExplicitCurve2d & acrosssection,
|
||||
Point<3> ap, Vec<3> ae1, Vec<3> ae2);
|
||||
|
||||
///
|
||||
virtual int BoxInSolid (const BoxSphere<3> & box) const;
|
||||
/// 0 .. no, 1 .. yes, 2 .. maybe
|
||||
///
|
||||
virtual void Project (Point<3> & p) const;
|
||||
|
||||
virtual double CalcFunctionValue (const Point<3> & point) const;
|
||||
///
|
||||
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
|
||||
///
|
||||
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
|
||||
///
|
||||
virtual double HesseNorm () const;
|
||||
///
|
||||
virtual double MaxCurvatureLoc (const Point<3> & c, double rad) const;
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
///
|
||||
virtual void Print (ostream & str) const;
|
||||
///
|
||||
virtual int BoxInSolid (const BoxSphere<3> & box) const;
|
||||
/// 0 .. no, 1 .. yes, 2 .. maybe
|
||||
|
||||
///
|
||||
virtual void Reduce (const BoxSphere<3> & box);
|
||||
///
|
||||
virtual void UnReduce ();
|
||||
};
|
||||
virtual double CalcFunctionValue (const Point<3> & point) const;
|
||||
///
|
||||
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
|
||||
///
|
||||
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
|
||||
///
|
||||
virtual double HesseNorm () const;
|
||||
///
|
||||
virtual double MaxCurvatureLoc (const Point<3> & c, double rad) const;
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
///
|
||||
virtual void Print (ostream & str) const;
|
||||
|
||||
///
|
||||
virtual void Reduce (const BoxSphere<3> & box);
|
||||
///
|
||||
virtual void UnReduce ();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -6,199 +6,205 @@
|
||||
/* File: identify.hh */
|
||||
/* Author: Joachim Schoeberl */
|
||||
/* Date: 1. Aug. 99 */
|
||||
/**************************************************************************/
|
||||
|
||||
/**
|
||||
Identify surfaces for periodic b.c. or
|
||||
thin domains
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
class SpecialPoint;
|
||||
class Identification
|
||||
namespace netgen
|
||||
{
|
||||
protected:
|
||||
const CSGeometry & geom;
|
||||
// identified faces, index sorted
|
||||
INDEX_2_HASHTABLE<int> identfaces;
|
||||
int nr;
|
||||
|
||||
public:
|
||||
Identification (int anr, const CSGeometry & ageom);
|
||||
virtual ~Identification ();
|
||||
virtual void Print (ostream & ost) const = 0;
|
||||
virtual void GetData (ostream & ost) const = 0;
|
||||
/**
|
||||
Identify surfaces for periodic b.c. or
|
||||
thin domains
|
||||
*/
|
||||
|
||||
/// obsolete
|
||||
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
|
||||
|
||||
/// can identify both special points (fixed direction)
|
||||
/// (identified points, same tangent)
|
||||
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
|
||||
const TABLE<int> & specpoint2solid,
|
||||
const TABLE<int> & specpoint2surface) const;
|
||||
///
|
||||
virtual int Identifyable (const Point<3> & p1, const Point<3> & sp2) const;
|
||||
/// is it possible to identify sp1 with some other ?
|
||||
virtual int IdentifyableCandidate (const SpecialPoint & sp1) const;
|
||||
class SpecialPoint;
|
||||
class Identification
|
||||
{
|
||||
protected:
|
||||
const CSGeometry & geom;
|
||||
// identified faces, index sorted
|
||||
INDEX_2_HASHTABLE<int> identfaces;
|
||||
int nr;
|
||||
|
||||
public:
|
||||
Identification (int anr, const CSGeometry & ageom);
|
||||
virtual ~Identification ();
|
||||
virtual void Print (ostream & ost) const = 0;
|
||||
virtual void GetData (ostream & ost) const = 0;
|
||||
|
||||
/// obsolete
|
||||
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
|
||||
|
||||
/// can identify both special points (fixed direction)
|
||||
/// (identified points, same tangent)
|
||||
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
|
||||
const TABLE<int> & specpoint2solid,
|
||||
const TABLE<int> & specpoint2surface) const;
|
||||
///
|
||||
virtual int Identifyable (const Point<3> & p1, const Point<3> & sp2) const;
|
||||
/// is it possible to identify sp1 with some other ?
|
||||
virtual int IdentifyableCandidate (const SpecialPoint & sp1) const;
|
||||
|
||||
/// are points (if connected) by a short edge (direction anyhow) ?
|
||||
virtual int ShortEdge (const SpecialPoint & sp1, const SpecialPoint & sp2) const;
|
||||
/// are points (if connected) by a short edge (direction anyhow) ?
|
||||
virtual int ShortEdge (const SpecialPoint & sp1, const SpecialPoint & sp2) const;
|
||||
|
||||
/// add entries in mesh identification tables
|
||||
virtual void IdentifyPoints (class Mesh & mesh);
|
||||
/// add entries in mesh identification tables
|
||||
virtual void IdentifyPoints (class Mesh & mesh);
|
||||
|
||||
/// add entries to identified faces (based on segment infos)
|
||||
virtual void IdentifyFaces (class Mesh & mesh);
|
||||
/// add entries to identified faces (based on segment infos)
|
||||
virtual void IdentifyFaces (class Mesh & mesh);
|
||||
|
||||
/// get point on other surface, add entry in mesh identifications
|
||||
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1);
|
||||
/// get point on other surface, add entry in mesh identifications
|
||||
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1);
|
||||
|
||||
/// copy surfaces, or fill rectangles
|
||||
virtual void BuildSurfaceElements (Array<class Segment> & segs,
|
||||
class Mesh & mesh,
|
||||
const Surface * surf);
|
||||
/// copy surfaces, or fill rectangles
|
||||
virtual void BuildSurfaceElements (Array<class Segment> & segs,
|
||||
class Mesh & mesh,
|
||||
const Surface * surf);
|
||||
|
||||
/// insert volume elements in thin layers
|
||||
virtual void BuildVolumeElements (Array<class Element2d> & surfels,
|
||||
class Mesh & mesh);
|
||||
/// insert volume elements in thin layers
|
||||
virtual void BuildVolumeElements (Array<class Element2d> & surfels,
|
||||
class Mesh & mesh);
|
||||
|
||||
/// get list of identified faces
|
||||
virtual void GetIdentifiedFaces (Array<INDEX_2> & idfaces) const;
|
||||
/// get list of identified faces
|
||||
virtual void GetIdentifiedFaces (Array<INDEX_2> & idfaces) const;
|
||||
|
||||
friend ostream & operator<< (ostream & ost, Identification & ident);
|
||||
};
|
||||
friend ostream & operator<< (ostream & ost, Identification & ident);
|
||||
};
|
||||
|
||||
|
||||
class PeriodicIdentification : public Identification
|
||||
{
|
||||
const Surface * s1;
|
||||
const Surface * s2;
|
||||
public:
|
||||
PeriodicIdentification (int anr,
|
||||
const CSGeometry & ageom,
|
||||
const Surface * as1,
|
||||
const Surface * as2);
|
||||
virtual ~PeriodicIdentification ();
|
||||
virtual void Print (ostream & ost) const;
|
||||
virtual void GetData (ostream & ost) const;
|
||||
|
||||
|
||||
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
|
||||
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
|
||||
const TABLE<int> & specpoint2solid,
|
||||
const TABLE<int> & specpoint2surface) const;
|
||||
|
||||
virtual int Identifyable (const Point<3> & p1, const Point<3> & sp2) const;
|
||||
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1);
|
||||
virtual void IdentifyPoints (class Mesh & mesh);
|
||||
virtual void IdentifyFaces (class Mesh & mesh);
|
||||
virtual void BuildSurfaceElements (Array<class Segment> & segs,
|
||||
class Mesh & mesh,
|
||||
const Surface * surf);
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
class TopLevelObject;
|
||||
class CloseSurfaceIdentification : public Identification
|
||||
{
|
||||
const Surface * s1;
|
||||
const Surface * s2;
|
||||
const TopLevelObject * domain;
|
||||
///
|
||||
int dom_nr;
|
||||
/// number of refinement levels (in Z-refinement)
|
||||
int ref_levels;
|
||||
/// number of refinement levels for layer next to s1 (in Z-refinement)
|
||||
int ref_levels_s1;
|
||||
/// number of refinement levels for layer next to s2 (in Z-refinement)
|
||||
int ref_levels_s2;
|
||||
///
|
||||
double eps_n;
|
||||
Array<double> slices;
|
||||
/// used only for domain-local identification:
|
||||
Array<int> domain_surfaces;
|
||||
///
|
||||
bool dom_surf_valid;
|
||||
|
||||
///
|
||||
Vec<3> direction;
|
||||
///
|
||||
bool usedirection;
|
||||
public:
|
||||
CloseSurfaceIdentification (int anr,
|
||||
const CSGeometry & ageom,
|
||||
const Surface * as1,
|
||||
const Surface * as2,
|
||||
const TopLevelObject * adomain,
|
||||
const Flags & flags);
|
||||
virtual ~CloseSurfaceIdentification ();
|
||||
|
||||
virtual void Print (ostream & ost) const;
|
||||
virtual void GetData (ostream & ost) const;
|
||||
|
||||
|
||||
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
|
||||
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
|
||||
const TABLE<int> & specpoint2solid,
|
||||
const TABLE<int> & specpoint2surface) const;
|
||||
virtual int Identifyable (const Point<3> & p1, const Point<3> & sp2) const;
|
||||
virtual int IdentifyableCandidate (const SpecialPoint & sp1) const;
|
||||
virtual int ShortEdge (const SpecialPoint & sp1, const SpecialPoint & sp2) const;
|
||||
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1);
|
||||
const Array<double> & GetSlices () const { return slices; }
|
||||
virtual void IdentifyPoints (class Mesh & mesh);
|
||||
virtual void IdentifyFaces (class Mesh & mesh);
|
||||
virtual void BuildSurfaceElements (Array<class Segment> & segs,
|
||||
class Mesh & mesh,
|
||||
const Surface * surf);
|
||||
void BuildSurfaceElements2 (Array<class Segment> & segs,
|
||||
class Mesh & mesh,
|
||||
const Surface * surf);
|
||||
|
||||
virtual void BuildVolumeElements (Array<class Element2d> & surfels,
|
||||
class Mesh & mesh);
|
||||
|
||||
int RefLevels () const { return ref_levels; }
|
||||
int RefLevels1 () const { return ref_levels_s1; }
|
||||
int RefLevels2 () const { return ref_levels_s2; }
|
||||
|
||||
bool IsSkewIdentification(void) const {return usedirection;}
|
||||
const Vec<3> & GetDirection(void) const {return direction;}
|
||||
|
||||
const Surface & GetSurface1(void) const
|
||||
{ return *s1;}
|
||||
const Surface & GetSurface2(void) const
|
||||
{ return *s2;}
|
||||
};
|
||||
|
||||
|
||||
class CloseEdgesIdentification : public Identification
|
||||
{
|
||||
const Surface * facet;
|
||||
const Surface * s1;
|
||||
const Surface * s2;
|
||||
public:
|
||||
CloseEdgesIdentification (int anr,
|
||||
class PeriodicIdentification : public Identification
|
||||
{
|
||||
const Surface * s1;
|
||||
const Surface * s2;
|
||||
public:
|
||||
PeriodicIdentification (int anr,
|
||||
const CSGeometry & ageom,
|
||||
const Surface * afacet,
|
||||
const Surface * as1,
|
||||
const Surface * as2);
|
||||
virtual ~CloseEdgesIdentification ();
|
||||
virtual void Print (ostream & ost) const;
|
||||
virtual void GetData (ostream & ost) const;
|
||||
|
||||
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
|
||||
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
|
||||
const TABLE<int> & specpoint2solid,
|
||||
const TABLE<int> & specpoint2surface) const;
|
||||
virtual ~PeriodicIdentification ();
|
||||
virtual void Print (ostream & ost) const;
|
||||
virtual void GetData (ostream & ost) const;
|
||||
|
||||
|
||||
virtual void IdentifyPoints (class Mesh & mesh);
|
||||
virtual void BuildSurfaceElements (Array<class Segment> & segs,
|
||||
class Mesh & mesh,
|
||||
const Surface * surf);
|
||||
};
|
||||
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
|
||||
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
|
||||
const TABLE<int> & specpoint2solid,
|
||||
const TABLE<int> & specpoint2surface) const;
|
||||
|
||||
virtual int Identifyable (const Point<3> & p1, const Point<3> & sp2) const;
|
||||
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1);
|
||||
virtual void IdentifyPoints (class Mesh & mesh);
|
||||
virtual void IdentifyFaces (class Mesh & mesh);
|
||||
virtual void BuildSurfaceElements (Array<class Segment> & segs,
|
||||
class Mesh & mesh,
|
||||
const Surface * surf);
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
class TopLevelObject;
|
||||
class CloseSurfaceIdentification : public Identification
|
||||
{
|
||||
const Surface * s1;
|
||||
const Surface * s2;
|
||||
const TopLevelObject * domain;
|
||||
///
|
||||
int dom_nr;
|
||||
/// number of refinement levels (in Z-refinement)
|
||||
int ref_levels;
|
||||
/// number of refinement levels for layer next to s1 (in Z-refinement)
|
||||
int ref_levels_s1;
|
||||
/// number of refinement levels for layer next to s2 (in Z-refinement)
|
||||
int ref_levels_s2;
|
||||
///
|
||||
double eps_n;
|
||||
Array<double> slices;
|
||||
/// used only for domain-local identification:
|
||||
Array<int> domain_surfaces;
|
||||
///
|
||||
bool dom_surf_valid;
|
||||
|
||||
///
|
||||
Vec<3> direction;
|
||||
///
|
||||
bool usedirection;
|
||||
public:
|
||||
CloseSurfaceIdentification (int anr,
|
||||
const CSGeometry & ageom,
|
||||
const Surface * as1,
|
||||
const Surface * as2,
|
||||
const TopLevelObject * adomain,
|
||||
const Flags & flags);
|
||||
virtual ~CloseSurfaceIdentification ();
|
||||
|
||||
virtual void Print (ostream & ost) const;
|
||||
virtual void GetData (ostream & ost) const;
|
||||
|
||||
|
||||
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
|
||||
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
|
||||
const TABLE<int> & specpoint2solid,
|
||||
const TABLE<int> & specpoint2surface) const;
|
||||
virtual int Identifyable (const Point<3> & p1, const Point<3> & sp2) const;
|
||||
virtual int IdentifyableCandidate (const SpecialPoint & sp1) const;
|
||||
virtual int ShortEdge (const SpecialPoint & sp1, const SpecialPoint & sp2) const;
|
||||
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1);
|
||||
const Array<double> & GetSlices () const { return slices; }
|
||||
virtual void IdentifyPoints (class Mesh & mesh);
|
||||
virtual void IdentifyFaces (class Mesh & mesh);
|
||||
virtual void BuildSurfaceElements (Array<class Segment> & segs,
|
||||
class Mesh & mesh,
|
||||
const Surface * surf);
|
||||
void BuildSurfaceElements2 (Array<class Segment> & segs,
|
||||
class Mesh & mesh,
|
||||
const Surface * surf);
|
||||
|
||||
virtual void BuildVolumeElements (Array<class Element2d> & surfels,
|
||||
class Mesh & mesh);
|
||||
|
||||
int RefLevels () const { return ref_levels; }
|
||||
int RefLevels1 () const { return ref_levels_s1; }
|
||||
int RefLevels2 () const { return ref_levels_s2; }
|
||||
|
||||
bool IsSkewIdentification(void) const {return usedirection;}
|
||||
const Vec<3> & GetDirection(void) const {return direction;}
|
||||
|
||||
const Surface & GetSurface1(void) const
|
||||
{ return *s1;}
|
||||
const Surface & GetSurface2(void) const
|
||||
{ return *s2;}
|
||||
};
|
||||
|
||||
|
||||
class CloseEdgesIdentification : public Identification
|
||||
{
|
||||
const Surface * facet;
|
||||
const Surface * s1;
|
||||
const Surface * s2;
|
||||
public:
|
||||
CloseEdgesIdentification (int anr,
|
||||
const CSGeometry & ageom,
|
||||
const Surface * afacet,
|
||||
const Surface * as1,
|
||||
const Surface * as2);
|
||||
virtual ~CloseEdgesIdentification ();
|
||||
virtual void Print (ostream & ost) const;
|
||||
virtual void GetData (ostream & ost) const;
|
||||
|
||||
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
|
||||
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
|
||||
const TABLE<int> & specpoint2solid,
|
||||
const TABLE<int> & specpoint2surface) const;
|
||||
|
||||
|
||||
virtual void IdentifyPoints (class Mesh & mesh);
|
||||
virtual void BuildSurfaceElements (Array<class Segment> & segs,
|
||||
class Mesh & mesh,
|
||||
const Surface * surf);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -7,16 +7,23 @@
|
||||
/* Date: 7. Aug. 96 */
|
||||
/**************************************************************************/
|
||||
|
||||
/**
|
||||
Basis class for manifolds in 2d and 3d
|
||||
*/
|
||||
class Manifold
|
||||
namespace netgen
|
||||
{
|
||||
public:
|
||||
///
|
||||
Manifold ();
|
||||
///
|
||||
virtual ~Manifold ();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Basis class for manifolds in 2d and 3d
|
||||
*/
|
||||
class Manifold
|
||||
{
|
||||
public:
|
||||
///
|
||||
Manifold ();
|
||||
///
|
||||
virtual ~Manifold ();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,46 +1,49 @@
|
||||
#ifndef FILE_MESHSURF
|
||||
#define FILE_MESHSURF
|
||||
|
||||
///
|
||||
class Meshing2Surfaces : public Meshing2
|
||||
namespace netgen
|
||||
{
|
||||
///
|
||||
const Surface & surface;
|
||||
|
||||
public:
|
||||
///
|
||||
// Meshing2Surfaces (const Surface & asurf);
|
||||
///
|
||||
Meshing2Surfaces (const Surface & asurf, const Box<3> & aboundingbox);
|
||||
|
||||
protected:
|
||||
///
|
||||
virtual void DefineTransformation (const Point3d & p1, const Point3d & p2,
|
||||
const PointGeomInfo * geominfo1,
|
||||
const PointGeomInfo * geominfo2);
|
||||
///
|
||||
virtual void TransformToPlain (const Point3d & locpoint,
|
||||
const MultiPointGeomInfo & geominfo,
|
||||
Point2d & plainpoint,
|
||||
double h, int & zone);
|
||||
///
|
||||
virtual int TransformFromPlain (Point2d & plainpoint,
|
||||
Point3d & locpoint,
|
||||
PointGeomInfo & gi,
|
||||
double h);
|
||||
///
|
||||
virtual double CalcLocalH (const Point3d & p, double gh) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
///
|
||||
class MeshOptimize2dSurfaces : public MeshOptimize2d
|
||||
class Meshing2Surfaces : public Meshing2
|
||||
{
|
||||
///
|
||||
const CSGeometry & geometry;
|
||||
///
|
||||
const Surface & surface;
|
||||
|
||||
public:
|
||||
///
|
||||
// Meshing2Surfaces (const Surface & asurf);
|
||||
///
|
||||
Meshing2Surfaces (const Surface & asurf, const Box<3> & aboundingbox);
|
||||
|
||||
public:
|
||||
protected:
|
||||
///
|
||||
virtual void DefineTransformation (const Point3d & p1, const Point3d & p2,
|
||||
const PointGeomInfo * geominfo1,
|
||||
const PointGeomInfo * geominfo2);
|
||||
///
|
||||
virtual void TransformToPlain (const Point3d & locpoint,
|
||||
const MultiPointGeomInfo & geominfo,
|
||||
Point2d & plainpoint,
|
||||
double h, int & zone);
|
||||
///
|
||||
virtual int TransformFromPlain (Point2d & plainpoint,
|
||||
Point3d & locpoint,
|
||||
PointGeomInfo & gi,
|
||||
double h);
|
||||
///
|
||||
virtual double CalcLocalH (const Point3d & p, double gh) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
///
|
||||
class MeshOptimize2dSurfaces : public MeshOptimize2d
|
||||
{
|
||||
///
|
||||
const CSGeometry & geometry;
|
||||
|
||||
public:
|
||||
///
|
||||
MeshOptimize2dSurfaces (const CSGeometry & ageometry);
|
||||
|
||||
@ -50,43 +53,44 @@ public:
|
||||
virtual void ProjectPoint2 (INDEX surfind, INDEX surfind2, Point<3> & p) const;
|
||||
///
|
||||
virtual void GetNormalVector(INDEX surfind, const Point<3> & p, Vec<3> & n) const;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
class RefinementSurfaces : public Refinement
|
||||
{
|
||||
const CSGeometry & geometry;
|
||||
class RefinementSurfaces : public Refinement
|
||||
{
|
||||
const CSGeometry & geometry;
|
||||
|
||||
public:
|
||||
RefinementSurfaces (const CSGeometry & ageometry);
|
||||
virtual ~RefinementSurfaces ();
|
||||
public:
|
||||
RefinementSurfaces (const CSGeometry & ageometry);
|
||||
virtual ~RefinementSurfaces ();
|
||||
|
||||
virtual void PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint,
|
||||
int surfi,
|
||||
const PointGeomInfo & gi1,
|
||||
const PointGeomInfo & gi2,
|
||||
Point<3> & newp, PointGeomInfo & newgi);
|
||||
virtual void PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint,
|
||||
int surfi,
|
||||
const PointGeomInfo & gi1,
|
||||
const PointGeomInfo & gi2,
|
||||
Point<3> & newp, PointGeomInfo & newgi);
|
||||
|
||||
virtual void PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint,
|
||||
int surfi1, int surfi2,
|
||||
const EdgePointGeomInfo & ap1,
|
||||
const EdgePointGeomInfo & ap2,
|
||||
Point<3> & newp, EdgePointGeomInfo & newgi);
|
||||
virtual void PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint,
|
||||
int surfi1, int surfi2,
|
||||
const EdgePointGeomInfo & ap1,
|
||||
const EdgePointGeomInfo & ap2,
|
||||
Point<3> & newp, EdgePointGeomInfo & newgi);
|
||||
|
||||
virtual Vec<3> GetTangent (const Point<3> & p, int surfi1, int surfi2,
|
||||
const EdgePointGeomInfo & ap1) const;
|
||||
virtual Vec<3> GetTangent (const Point<3> & p, int surfi1, int surfi2,
|
||||
const EdgePointGeomInfo & ap1) const;
|
||||
|
||||
virtual Vec<3> GetNormal (const Point<3> & p, int surfi1,
|
||||
const PointGeomInfo & gi) const;
|
||||
virtual Vec<3> GetNormal (const Point<3> & p, int surfi1,
|
||||
const PointGeomInfo & gi) const;
|
||||
|
||||
|
||||
virtual void ProjectToSurface (Point<3> & p, int surfi);
|
||||
virtual void ProjectToSurface (Point<3> & p, int surfi);
|
||||
|
||||
virtual void ProjectToEdge (Point<3> & p, int surfi1, int surfi2, const EdgePointGeomInfo & egi) const;
|
||||
virtual void ProjectToEdge (Point<3> & p, int surfi1, int surfi2, const EdgePointGeomInfo & egi) const;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -8,92 +8,97 @@
|
||||
/* Date: 19. Mar. 2000 */
|
||||
/**************************************************************************/
|
||||
|
||||
/*
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
/*
|
||||
|
||||
Polyhedral primitive
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
class Polyhedra : public Primitive
|
||||
{
|
||||
class Face {
|
||||
public:
|
||||
int pnums[3];
|
||||
int planenr;
|
||||
|
||||
int inputnr;
|
||||
|
||||
Box<3> bbox;
|
||||
// Point<3> center;
|
||||
Vec<3> v1, v2; // edges
|
||||
Vec<3> w1, w2; // pseudo-inverse
|
||||
Vec<3> n; // normal to face
|
||||
Vec<3> nn; // normed normal
|
||||
|
||||
Face () { ; }
|
||||
Face (int pi1, int pi2, int pi3,
|
||||
const Array<Point<3> > & points,
|
||||
int ainputnr);
|
||||
};
|
||||
|
||||
Array<Point<3> > points;
|
||||
Array<Face> faces;
|
||||
Array<Plane*> planes;
|
||||
Box<3> poly_bbox;
|
||||
|
||||
double eps_base1;
|
||||
|
||||
class Polyhedra : public Primitive
|
||||
{
|
||||
class Face {
|
||||
public:
|
||||
int pnums[3];
|
||||
int planenr;
|
||||
Polyhedra ();
|
||||
virtual ~Polyhedra ();
|
||||
static Primitive * CreateDefault ();
|
||||
|
||||
int inputnr;
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
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;
|
||||
|
||||
Box<3> bbox;
|
||||
// Point<3> center;
|
||||
Vec<3> v1, v2; // edges
|
||||
Vec<3> w1, w2; // pseudo-inverse
|
||||
Vec<3> n; // normal to face
|
||||
Vec<3> nn; // normed normal
|
||||
// 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;
|
||||
|
||||
Face () { ; }
|
||||
Face (int pi1, int pi2, int pi3,
|
||||
const Array<Point<3> > & points,
|
||||
int ainputnr);
|
||||
virtual void GetTangentialSurfaceIndices (const Point<3> & p,
|
||||
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;
|
||||
|
||||
virtual int GetNSurfaces() const
|
||||
{ return planes.Size(); }
|
||||
virtual Surface & GetSurface (int i)
|
||||
{ return *planes[i]; }
|
||||
virtual const Surface & GetSurface (int i) const
|
||||
{ return *planes[i]; }
|
||||
|
||||
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
|
||||
virtual void Reduce (const BoxSphere<3> & box);
|
||||
virtual void UnReduce ();
|
||||
|
||||
int AddPoint (const Point<3> & p);
|
||||
int AddFace (int pi1, int pi2, int pi3, int inputnum);
|
||||
|
||||
void GetPolySurfs(Array < Array<int> * > & polysurfs);
|
||||
|
||||
protected:
|
||||
int FaceBoxIntersection (int fnr, const BoxSphere<3> & box) const;
|
||||
// void CalcData();
|
||||
};
|
||||
|
||||
Array<Point<3> > points;
|
||||
Array<Face> faces;
|
||||
Array<Plane*> planes;
|
||||
Box<3> poly_bbox;
|
||||
|
||||
double eps_base1;
|
||||
|
||||
public:
|
||||
Polyhedra ();
|
||||
virtual ~Polyhedra ();
|
||||
static Primitive * CreateDefault ();
|
||||
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
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;
|
||||
|
||||
// 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;
|
||||
|
||||
virtual void GetTangentialSurfaceIndices (const Point<3> & p,
|
||||
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;
|
||||
|
||||
virtual int GetNSurfaces() const
|
||||
{ return planes.Size(); }
|
||||
virtual Surface & GetSurface (int i)
|
||||
{ return *planes[i]; }
|
||||
virtual const Surface & GetSurface (int i) const
|
||||
{ return *planes[i]; }
|
||||
|
||||
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
|
||||
virtual void Reduce (const BoxSphere<3> & box);
|
||||
virtual void UnReduce ();
|
||||
|
||||
int AddPoint (const Point<3> & p);
|
||||
int AddFace (int pi1, int pi2, int pi3, int inputnum);
|
||||
|
||||
void GetPolySurfs(Array < Array<int> * > & polysurfs);
|
||||
|
||||
protected:
|
||||
int FaceBoxIntersection (int fnr, const BoxSphere<3> & box) const;
|
||||
// void CalcData();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,149 +1,153 @@
|
||||
#ifndef _REVOLUTION_HPP
|
||||
#define _REVOLUTION_HPP
|
||||
|
||||
class Revolution;
|
||||
|
||||
class RevolutionFace : public Surface
|
||||
namespace netgen
|
||||
{
|
||||
private:
|
||||
bool isfirst, islast;
|
||||
const SplineSeg<2> * spline;
|
||||
bool deletable;
|
||||
|
||||
Point<3> p0;
|
||||
Vec<3> v_axis;
|
||||
class Revolution;
|
||||
|
||||
int id;
|
||||
class RevolutionFace : public Surface
|
||||
{
|
||||
private:
|
||||
bool isfirst, islast;
|
||||
const SplineSeg<2> * spline;
|
||||
bool deletable;
|
||||
|
||||
Point<3> p0;
|
||||
Vec<3> v_axis;
|
||||
|
||||
int id;
|
||||
|
||||
mutable Vector spline_coefficient;
|
||||
mutable Vector spline_coefficient;
|
||||
|
||||
|
||||
Array < Vec<2>* > checklines_vec;
|
||||
Array < Point<2>* > checklines_start;
|
||||
Array < Vec<2>* > checklines_normal;
|
||||
Array < Vec<2>* > checklines_vec;
|
||||
Array < Point<2>* > checklines_start;
|
||||
Array < Vec<2>* > checklines_normal;
|
||||
|
||||
private:
|
||||
void Init (void);
|
||||
private:
|
||||
void Init (void);
|
||||
|
||||
public:
|
||||
void CalcProj(const Point<3> & point3d, Point<2> & point2d) const;
|
||||
void CalcProj(const Point<3> & point3d, Point<2> & point2d,
|
||||
const Vec<3> & vector3d, Vec<2> & vector2d) const;
|
||||
void CalcProj0(const Vec<3> & point3d_minus_p0, Point<2> & point2d) const;
|
||||
public:
|
||||
void CalcProj(const Point<3> & point3d, Point<2> & point2d) const;
|
||||
void CalcProj(const Point<3> & point3d, Point<2> & point2d,
|
||||
const Vec<3> & vector3d, Vec<2> & vector2d) const;
|
||||
void CalcProj0(const Vec<3> & point3d_minus_p0, Point<2> & point2d) const;
|
||||
|
||||
public:
|
||||
RevolutionFace(const SplineSeg<2> & spline_in,
|
||||
const Point<3> & p,
|
||||
const Vec<3> & vec,
|
||||
bool first = false,
|
||||
bool last = false,
|
||||
const int id_in = 0);
|
||||
public:
|
||||
RevolutionFace(const SplineSeg<2> & spline_in,
|
||||
const Point<3> & p,
|
||||
const Vec<3> & vec,
|
||||
bool first = false,
|
||||
bool last = false,
|
||||
const int id_in = 0);
|
||||
|
||||
RevolutionFace(const Array<double> & raw_data);
|
||||
RevolutionFace(const Array<double> & raw_data);
|
||||
|
||||
~RevolutionFace();
|
||||
~RevolutionFace();
|
||||
|
||||
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
||||
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
||||
|
||||
virtual double CalcFunctionValue (const Point<3> & point) const;
|
||||
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
|
||||
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
|
||||
virtual double HesseNorm () const;
|
||||
virtual double CalcFunctionValue (const Point<3> & point) const;
|
||||
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
|
||||
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
|
||||
virtual double HesseNorm () const;
|
||||
|
||||
virtual double MaxCurvature () const;
|
||||
//virtual double MaxCurvatureLoc (const Point<3> & /* c */ ,
|
||||
// double /* rad */) const;
|
||||
virtual double MaxCurvature () const;
|
||||
//virtual double MaxCurvatureLoc (const Point<3> & /* c */ ,
|
||||
// double /* rad */) const;
|
||||
|
||||
virtual void Project (Point<3> & p) const;
|
||||
virtual void Project (Point<3> & p) const;
|
||||
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
virtual void Print (ostream & str) const;
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
virtual void Print (ostream & str) const;
|
||||
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & boundingbox,
|
||||
double facets) const;
|
||||
virtual void GetTriangleApproximation (TriangleApproximation & tas,
|
||||
const Box<3> & boundingbox,
|
||||
double facets) const;
|
||||
|
||||
bool BoxIntersectsFace (const Box<3> & box) const;
|
||||
/*
|
||||
bool BoxIntersectsFace (const BoxSphere<2> & box, bool & uncertain) const;
|
||||
bool BoxIntersectsFace (const BoxSphere<3> & box, bool & uncertain) const;
|
||||
*/
|
||||
|
||||
const SplineSeg<2> & GetSpline(void) const {return *spline;}
|
||||
|
||||
INSOLID_TYPE PointInFace (const Point<3> & p, const double eps) const;
|
||||
|
||||
void GetRawData(Array<double> & data) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
bool BoxIntersectsFace (const Box<3> & box) const;
|
||||
/*
|
||||
bool BoxIntersectsFace (const BoxSphere<2> & box, bool & uncertain) const;
|
||||
bool BoxIntersectsFace (const BoxSphere<3> & box, bool & uncertain) const;
|
||||
*/
|
||||
|
||||
const SplineSeg<2> & GetSpline(void) const {return *spline;}
|
||||
|
||||
INSOLID_TYPE PointInFace (const Point<3> & p, const double eps) const;
|
||||
|
||||
void GetRawData(Array<double> & data) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Primitive of revolution
|
||||
|
||||
*/
|
||||
|
||||
|
||||
class Revolution : public Primitive
|
||||
{
|
||||
private:
|
||||
Point<3> p0,p1;
|
||||
Vec<3> v_axis;
|
||||
const SplineGeometry<2> & splinecurve;
|
||||
const int nsplines;
|
||||
|
||||
// 1 ... torus-like
|
||||
// 2 ... sphere-like
|
||||
int type;
|
||||
|
||||
|
||||
Array<RevolutionFace*> faces;
|
||||
|
||||
mutable int intersecting_face;
|
||||
|
||||
public:
|
||||
Revolution(const Point<3> & p0_in,
|
||||
const Point<3> & p1_in,
|
||||
const SplineGeometry<2> & spline_in);
|
||||
|
||||
~Revolution();
|
||||
|
||||
|
||||
/*
|
||||
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;
|
||||
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;
|
||||
|
||||
// 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;
|
||||
|
||||
class Revolution : public Primitive
|
||||
{
|
||||
private:
|
||||
Point<3> p0,p1;
|
||||
Vec<3> v_axis;
|
||||
const SplineGeometry<2> & splinecurve;
|
||||
const int nsplines;
|
||||
|
||||
// 1 ... torus-like
|
||||
// 2 ... sphere-like
|
||||
int type;
|
||||
|
||||
|
||||
Array<RevolutionFace*> faces;
|
||||
|
||||
mutable int intersecting_face;
|
||||
|
||||
public:
|
||||
Revolution(const Point<3> & p0_in,
|
||||
const Point<3> & p1_in,
|
||||
const SplineGeometry<2> & spline_in);
|
||||
|
||||
~Revolution();
|
||||
|
||||
|
||||
/*
|
||||
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;
|
||||
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;
|
||||
|
||||
// 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;
|
||||
|
||||
|
||||
virtual int GetNSurfaces() const;
|
||||
virtual Surface & GetSurface (int i = 0);
|
||||
virtual const Surface & GetSurface (int i = 0) const;
|
||||
virtual int GetNSurfaces() const;
|
||||
virtual Surface & GetSurface (int i = 0);
|
||||
virtual const Surface & GetSurface (int i = 0) const;
|
||||
|
||||
|
||||
virtual void Reduce (const BoxSphere<3> & box);
|
||||
virtual void UnReduce ();
|
||||
virtual void Reduce (const BoxSphere<3> & box);
|
||||
virtual void UnReduce ();
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -7,72 +7,78 @@
|
||||
/* Date: 25. Sep. 99 */
|
||||
/**************************************************************************/
|
||||
|
||||
/**
|
||||
Control for local refinement
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Singular Face.
|
||||
Causes a bounday layer mesh refinement.
|
||||
All elements in subdomain domnr will get a boundary layer
|
||||
on faces sharing the solid sol
|
||||
*/
|
||||
class SingularFace
|
||||
namespace netgen
|
||||
{
|
||||
public:
|
||||
int domnr;
|
||||
const Solid *sol;
|
||||
double factor;
|
||||
// Array<Point<3> > points;
|
||||
// Array<INDEX_2> segms;
|
||||
public:
|
||||
SingularFace (int adomnr, const Solid * asol, double sf)
|
||||
: domnr(adomnr), sol(asol), factor(sf) { ; }
|
||||
const Solid * GetSolid() const { return sol; }
|
||||
int GetDomainNr () const { return domnr; }
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
class SingularEdge
|
||||
{
|
||||
public:
|
||||
double beta;
|
||||
int domnr;
|
||||
const CSGeometry& geom;
|
||||
const Solid *sol1, *sol2;
|
||||
Array<Point<3> > points;
|
||||
Array<INDEX_2> segms;
|
||||
double factor;
|
||||
|
||||
double maxhinit;
|
||||
public:
|
||||
SingularEdge (double abeta, int adomnr,
|
||||
const CSGeometry & ageom,
|
||||
const Solid * asol1, const Solid * asol2, double sf,
|
||||
const double maxh_at_initialization = -1);
|
||||
void FindPointsOnEdge (class Mesh & mesh);
|
||||
void SetMeshSize (class Mesh & mesh, double globalh);
|
||||
};
|
||||
/**
|
||||
Control for local refinement
|
||||
*/
|
||||
|
||||
|
||||
///
|
||||
class SingularPoint
|
||||
{
|
||||
public:
|
||||
double beta;
|
||||
const Solid *sol1, *sol2, *sol3;
|
||||
Array<Point<3> > points;
|
||||
double factor;
|
||||
|
||||
/**
|
||||
Singular Face.
|
||||
Causes a bounday layer mesh refinement.
|
||||
All elements in subdomain domnr will get a boundary layer
|
||||
on faces sharing the solid sol
|
||||
*/
|
||||
class SingularFace
|
||||
{
|
||||
public:
|
||||
int domnr;
|
||||
const Solid *sol;
|
||||
double factor;
|
||||
// Array<Point<3> > points;
|
||||
// Array<INDEX_2> segms;
|
||||
public:
|
||||
SingularFace (int adomnr, const Solid * asol, double sf)
|
||||
: domnr(adomnr), sol(asol), factor(sf) { ; }
|
||||
const Solid * GetSolid() const { return sol; }
|
||||
int GetDomainNr () const { return domnr; }
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
class SingularEdge
|
||||
{
|
||||
public:
|
||||
double beta;
|
||||
int domnr;
|
||||
const CSGeometry& geom;
|
||||
const Solid *sol1, *sol2;
|
||||
Array<Point<3> > points;
|
||||
Array<INDEX_2> segms;
|
||||
double factor;
|
||||
|
||||
double maxhinit;
|
||||
public:
|
||||
SingularEdge (double abeta, int adomnr,
|
||||
const CSGeometry & ageom,
|
||||
const Solid * asol1, const Solid * asol2, double sf,
|
||||
const double maxh_at_initialization = -1);
|
||||
void FindPointsOnEdge (class Mesh & mesh);
|
||||
void SetMeshSize (class Mesh & mesh, double globalh);
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
class SingularPoint
|
||||
{
|
||||
public:
|
||||
double beta;
|
||||
const Solid *sol1, *sol2, *sol3;
|
||||
Array<Point<3> > points;
|
||||
double factor;
|
||||
|
||||
public:
|
||||
SingularPoint (double abeta, const Solid * asol1, const Solid * asol2,
|
||||
const Solid * asol3, double sf);
|
||||
void FindPoints (class Mesh & mesh);
|
||||
void SetMeshSize (class Mesh & mesh, double globalh);
|
||||
};
|
||||
public:
|
||||
SingularPoint (double abeta, const Solid * asol1, const Solid * asol2,
|
||||
const Solid * asol3, double sf);
|
||||
void FindPoints (class Mesh & mesh);
|
||||
void SetMeshSize (class Mesh & mesh, double globalh);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -7,235 +7,240 @@
|
||||
/* Date: 1. Dez. 95 */
|
||||
/**************************************************************************/
|
||||
|
||||
/*
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Constructive Solid Model (csg)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
class Solid;
|
||||
|
||||
class SolidIterator
|
||||
{
|
||||
public:
|
||||
SolidIterator () { ; }
|
||||
virtual ~SolidIterator () { ; }
|
||||
virtual void Do (Solid * sol) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Solid
|
||||
{
|
||||
public:
|
||||
*/
|
||||
|
||||
typedef enum optyp1 { TERM, TERM_REF, SECTION, UNION, SUB, ROOT /*, DUMMY */ } optyp;
|
||||
|
||||
|
||||
|
||||
class Solid;
|
||||
|
||||
private:
|
||||
char * name;
|
||||
Primitive * prim;
|
||||
Solid * s1, * s2;
|
||||
class SolidIterator
|
||||
{
|
||||
public:
|
||||
SolidIterator () { ; }
|
||||
virtual ~SolidIterator () { ; }
|
||||
virtual void Do (Solid * sol) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Solid
|
||||
{
|
||||
public:
|
||||
|
||||
optyp op;
|
||||
bool visited;
|
||||
double maxh;
|
||||
typedef enum optyp1 { TERM, TERM_REF, SECTION, UNION, SUB, ROOT /*, DUMMY */ } optyp;
|
||||
|
||||
private:
|
||||
char * name;
|
||||
Primitive * prim;
|
||||
Solid * s1, * s2;
|
||||
|
||||
optyp op;
|
||||
bool visited;
|
||||
double maxh;
|
||||
|
||||
// static int cntnames;
|
||||
// static int cntnames;
|
||||
|
||||
public:
|
||||
Solid (Primitive * aprim);
|
||||
Solid (optyp aop, Solid * as1, Solid * as2 = NULL);
|
||||
~Solid ();
|
||||
public:
|
||||
Solid (Primitive * aprim);
|
||||
Solid (optyp aop, Solid * as1, Solid * as2 = NULL);
|
||||
~Solid ();
|
||||
|
||||
const char * Name () const { return name; }
|
||||
void SetName (const char * aname);
|
||||
const char * Name () const { return name; }
|
||||
void SetName (const char * aname);
|
||||
|
||||
Solid * Copy (class CSGeometry & geom) const;
|
||||
void Transform (Transformation<3> & trans);
|
||||
Solid * Copy (class CSGeometry & geom) const;
|
||||
void Transform (Transformation<3> & trans);
|
||||
|
||||
|
||||
void IterateSolid (SolidIterator & it, bool only_once = 0);
|
||||
void IterateSolid (SolidIterator & it, bool only_once = 0);
|
||||
|
||||
|
||||
void Boundaries (const Point<3> & p, Array<int> & bounds) const;
|
||||
int NumPrimitives () const;
|
||||
void GetSurfaceIndices (Array<int> & surfind) const;
|
||||
void GetSurfaceIndices (IndexSet & iset) const;
|
||||
void Boundaries (const Point<3> & p, Array<int> & bounds) const;
|
||||
int NumPrimitives () const;
|
||||
void GetSurfaceIndices (Array<int> & surfind) const;
|
||||
void GetSurfaceIndices (IndexSet & iset) const;
|
||||
|
||||
void GetTangentialSurfaceIndices (const Point<3> & p, Array<int> & surfids, double eps) const;
|
||||
void GetTangentialSurfaceIndices2 (const Point<3> & p, const Vec<3> & v, Array<int> & surfids, double eps) const;
|
||||
void GetTangentialSurfaceIndices3 (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2, Array<int> & surfids, double eps) const;
|
||||
void GetTangentialSurfaceIndices (const Point<3> & p, Array<int> & surfids, double eps) const;
|
||||
void GetTangentialSurfaceIndices2 (const Point<3> & p, const Vec<3> & v, Array<int> & surfids, double eps) const;
|
||||
void GetTangentialSurfaceIndices3 (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2, Array<int> & surfids, double eps) const;
|
||||
|
||||
|
||||
Primitive * GetPrimitive ()
|
||||
Primitive * GetPrimitive ()
|
||||
{ return (op == TERM || op == TERM_REF) ? prim : NULL; }
|
||||
const Primitive * GetPrimitive () const
|
||||
const Primitive * GetPrimitive () const
|
||||
{ return (op == TERM || op == TERM_REF) ? prim : NULL; }
|
||||
|
||||
Solid * S1() { return s1; }
|
||||
Solid * S2() { return s2; }
|
||||
Solid * S1() { return s1; }
|
||||
Solid * S2() { return s2; }
|
||||
|
||||
// geometric tests
|
||||
// geometric tests
|
||||
|
||||
bool IsIn (const Point<3> & p, double eps = 1e-6) const;
|
||||
bool IsStrictIn (const Point<3> & p, double eps = 1e-6) const;
|
||||
bool VectorIn (const Point<3> & p, const Vec<3> & v, double eps = 1e-6) const;
|
||||
bool VectorStrictIn (const Point<3> & p, const Vec<3> & v, double eps = 1e-6) const;
|
||||
bool IsIn (const Point<3> & p, double eps = 1e-6) const;
|
||||
bool IsStrictIn (const Point<3> & p, double eps = 1e-6) const;
|
||||
bool VectorIn (const Point<3> & p, const Vec<3> & v, double eps = 1e-6) const;
|
||||
bool VectorStrictIn (const Point<3> & p, const Vec<3> & v, double eps = 1e-6) const;
|
||||
|
||||
bool VectorIn2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
|
||||
double eps) const;
|
||||
bool VectorIn2Rec (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
|
||||
double eps) const;
|
||||
bool VectorIn2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
|
||||
double eps) const;
|
||||
bool VectorIn2Rec (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
|
||||
double eps) const;
|
||||
|
||||
|
||||
/// compute localization in point p
|
||||
void TangentialSolid (const Point<3> & p, Solid *& tansol, Array<int> & surfids, double eps) const;
|
||||
/// compute localization in point p
|
||||
void TangentialSolid (const Point<3> & p, Solid *& tansol, Array<int> & surfids, double eps) const;
|
||||
|
||||
/// compute localization in point p tangential to vector t
|
||||
void TangentialSolid2 (const Point<3> & p, const Vec<3> & t,
|
||||
Solid *& tansol, Array<int> & surfids, double eps) const;
|
||||
/// compute localization in point p tangential to vector t
|
||||
void TangentialSolid2 (const Point<3> & p, const Vec<3> & t,
|
||||
Solid *& tansol, Array<int> & surfids, double eps) const;
|
||||
|
||||
/** compute localization in point p, with second order approximation to edge
|
||||
p + s t + s*s/2 t2 **/
|
||||
void TangentialSolid3 (const Point<3> & p, const Vec<3> & t, const Vec<3> & t2,
|
||||
Solid *& tansol, Array<int> & surfids, double eps) const;
|
||||
/** compute localization in point p, with second order approximation to edge
|
||||
p + s t + s*s/2 t2 **/
|
||||
void TangentialSolid3 (const Point<3> & p, const Vec<3> & t, const Vec<3> & t2,
|
||||
Solid *& tansol, Array<int> & surfids, double eps) const;
|
||||
|
||||
|
||||
|
||||
/** tangential solid, which follows the edge
|
||||
p + s t + s*s/2 t2
|
||||
with second order, and the neighbouring face
|
||||
p + s t + s*s/2 t2 + r m
|
||||
with first order
|
||||
**/
|
||||
void TangentialEdgeSolid (const Point<3> & p, const Vec<3> & t, const Vec<3> & t2,
|
||||
const Vec<3> & m,
|
||||
Solid *& tansol, Array<int> & surfids, double eps) const;
|
||||
/** tangential solid, which follows the edge
|
||||
p + s t + s*s/2 t2
|
||||
with second order, and the neighbouring face
|
||||
p + s t + s*s/2 t2 + r m
|
||||
with first order
|
||||
**/
|
||||
void TangentialEdgeSolid (const Point<3> & p, const Vec<3> & t, const Vec<3> & t2,
|
||||
const Vec<3> & m,
|
||||
Solid *& tansol, Array<int> & surfids, double eps) const;
|
||||
|
||||
|
||||
void CalcOnePrimitiveSpecialPoints (const Box<3> & box, Array<Point<3> > & pts) const;
|
||||
void CalcOnePrimitiveSpecialPoints (const Box<3> & box, Array<Point<3> > & pts) const;
|
||||
|
||||
///
|
||||
int Edge (const Point<3> & p, const Vec<3> & v, double eps) const;
|
||||
///
|
||||
int OnFace (const Point<3> & p, const Vec<3> & v, double eps) const;
|
||||
///
|
||||
void Print (ostream & str) const;
|
||||
///
|
||||
void CalcSurfaceInverse ();
|
||||
///
|
||||
Solid * GetReducedSolid (const BoxSphere<3> & box) const;
|
||||
///
|
||||
int Edge (const Point<3> & p, const Vec<3> & v, double eps) const;
|
||||
///
|
||||
int OnFace (const Point<3> & p, const Vec<3> & v, double eps) const;
|
||||
///
|
||||
void Print (ostream & str) const;
|
||||
///
|
||||
void CalcSurfaceInverse ();
|
||||
///
|
||||
Solid * GetReducedSolid (const BoxSphere<3> & box) const;
|
||||
|
||||
|
||||
void SetMaxH (double amaxh)
|
||||
void SetMaxH (double amaxh)
|
||||
{ maxh = amaxh; }
|
||||
double GetMaxH () const
|
||||
double GetMaxH () const
|
||||
{ return maxh; }
|
||||
|
||||
void GetSolidData (ostream & ost, int first = 1) const;
|
||||
static Solid * CreateSolid (istream & ist, const SYMBOLTABLE<Solid*> & solids);
|
||||
void GetSolidData (ostream & ost, int first = 1) const;
|
||||
static Solid * CreateSolid (istream & ist, const SYMBOLTABLE<Solid*> & solids);
|
||||
|
||||
|
||||
static BlockAllocator ball;
|
||||
void * operator new(size_t /* s */)
|
||||
static BlockAllocator ball;
|
||||
void * operator new(size_t /* s */)
|
||||
{
|
||||
return ball.Alloc();
|
||||
}
|
||||
|
||||
void operator delete (void * p)
|
||||
{
|
||||
ball.Free (p);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
///
|
||||
|
||||
void RecBoundaries (const Point<3> & p, Array<int> & bounds,
|
||||
int & in, int & strin) const;
|
||||
///
|
||||
void RecTangentialSolid (const Point<3> & p, Solid *& tansol, Array<int> & surfids,
|
||||
int & in, int & strin, double eps) const;
|
||||
|
||||
void RecTangentialSolid2 (const Point<3> & p, const Vec<3> & vec,
|
||||
Solid *& tansol, Array<int> & surfids,
|
||||
int & in, int & strin, double eps) const;
|
||||
///
|
||||
void RecTangentialSolid3 (const Point<3> & p, const Vec<3> & vec,const Vec<3> & vec2,
|
||||
Solid *& tansol, Array<int> & surfids,
|
||||
int & in, int & strin, double eps) const;
|
||||
///
|
||||
void RecTangentialEdgeSolid (const Point<3> & p, const Vec<3> & t, const Vec<3> & t2,
|
||||
const Vec<3> & m,
|
||||
Solid *& tansol, Array<int> & surfids,
|
||||
int & in, int & strin, double eps) const;
|
||||
|
||||
///
|
||||
void RecEdge (const Point<3> & p, const Vec<3> & v,
|
||||
int & in, int & strin, int & faces, double eps) const;
|
||||
///
|
||||
void CalcSurfaceInverseRec (int inv);
|
||||
///
|
||||
Solid * RecGetReducedSolid (const BoxSphere<3> & box, INSOLID_TYPE & in) const;
|
||||
///
|
||||
void RecGetSurfaceIndices (Array<int> & surfind) const;
|
||||
void RecGetTangentialSurfaceIndices (const Point<3> & p, Array<int> & surfids, double eps) const;
|
||||
void RecGetTangentialSurfaceIndices2 (const Point<3> & p, const Vec<3> & v, Array<int> & surfids, double eps) const;
|
||||
void RecGetTangentialSurfaceIndices3 (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2,
|
||||
Array<int> & surfids, double eps) const;
|
||||
void RecGetTangentialEdgeSurfaceIndices (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2, const Vec<3> & m,
|
||||
Array<int> & surfids, double eps) const;
|
||||
void RecGetSurfaceIndices (IndexSet & iset) const;
|
||||
|
||||
void RecCalcOnePrimitiveSpecialPoints (Array<Point<3> > & pts) const;
|
||||
|
||||
friend class SolidIterator;
|
||||
friend class ClearVisitedIt;
|
||||
friend class RemoveDummyIterator;
|
||||
friend class CSGeometry;
|
||||
};
|
||||
|
||||
|
||||
inline ostream & operator<< (ostream & ost, const Solid & sol)
|
||||
{
|
||||
return ball.Alloc();
|
||||
}
|
||||
|
||||
void operator delete (void * p)
|
||||
{
|
||||
ball.Free (p);
|
||||
sol.Print (ost);
|
||||
return ost;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
///
|
||||
|
||||
void RecBoundaries (const Point<3> & p, Array<int> & bounds,
|
||||
int & in, int & strin) const;
|
||||
///
|
||||
void RecTangentialSolid (const Point<3> & p, Solid *& tansol, Array<int> & surfids,
|
||||
int & in, int & strin, double eps) const;
|
||||
|
||||
void RecTangentialSolid2 (const Point<3> & p, const Vec<3> & vec,
|
||||
Solid *& tansol, Array<int> & surfids,
|
||||
int & in, int & strin, double eps) const;
|
||||
///
|
||||
void RecTangentialSolid3 (const Point<3> & p, const Vec<3> & vec,const Vec<3> & vec2,
|
||||
Solid *& tansol, Array<int> & surfids,
|
||||
int & in, int & strin, double eps) const;
|
||||
///
|
||||
void RecTangentialEdgeSolid (const Point<3> & p, const Vec<3> & t, const Vec<3> & t2,
|
||||
const Vec<3> & m,
|
||||
Solid *& tansol, Array<int> & surfids,
|
||||
int & in, int & strin, double eps) const;
|
||||
|
||||
///
|
||||
void RecEdge (const Point<3> & p, const Vec<3> & v,
|
||||
int & in, int & strin, int & faces, double eps) const;
|
||||
///
|
||||
void CalcSurfaceInverseRec (int inv);
|
||||
///
|
||||
Solid * RecGetReducedSolid (const BoxSphere<3> & box, INSOLID_TYPE & in) const;
|
||||
///
|
||||
void RecGetSurfaceIndices (Array<int> & surfind) const;
|
||||
void RecGetTangentialSurfaceIndices (const Point<3> & p, Array<int> & surfids, double eps) const;
|
||||
void RecGetTangentialSurfaceIndices2 (const Point<3> & p, const Vec<3> & v, Array<int> & surfids, double eps) const;
|
||||
void RecGetTangentialSurfaceIndices3 (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2,
|
||||
Array<int> & surfids, double eps) const;
|
||||
void RecGetTangentialEdgeSurfaceIndices (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2, const Vec<3> & m,
|
||||
Array<int> & surfids, double eps) const;
|
||||
void RecGetSurfaceIndices (IndexSet & iset) const;
|
||||
|
||||
void RecCalcOnePrimitiveSpecialPoints (Array<Point<3> > & pts) const;
|
||||
|
||||
friend class SolidIterator;
|
||||
friend class ClearVisitedIt;
|
||||
friend class RemoveDummyIterator;
|
||||
friend class CSGeometry;
|
||||
};
|
||||
|
||||
|
||||
inline ostream & operator<< (ostream & ost, const Solid & sol)
|
||||
{
|
||||
sol.Print (ost);
|
||||
return ost;
|
||||
|
||||
|
||||
class ReducePrimitiveIterator : public SolidIterator
|
||||
{
|
||||
const BoxSphere<3> & box;
|
||||
public:
|
||||
ReducePrimitiveIterator (const BoxSphere<3> & abox)
|
||||
: SolidIterator(), box(abox) { ; }
|
||||
virtual ~ReducePrimitiveIterator () { ; }
|
||||
virtual void Do (Solid * sol)
|
||||
{
|
||||
if (sol -> GetPrimitive())
|
||||
sol -> GetPrimitive() -> Reduce (box);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class UnReducePrimitiveIterator : public SolidIterator
|
||||
{
|
||||
public:
|
||||
UnReducePrimitiveIterator () { ; }
|
||||
virtual ~UnReducePrimitiveIterator () { ; }
|
||||
virtual void Do (Solid * sol)
|
||||
{
|
||||
if (sol -> GetPrimitive())
|
||||
sol -> GetPrimitive() -> UnReduce ();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class ReducePrimitiveIterator : public SolidIterator
|
||||
{
|
||||
const BoxSphere<3> & box;
|
||||
public:
|
||||
ReducePrimitiveIterator (const BoxSphere<3> & abox)
|
||||
: SolidIterator(), box(abox) { ; }
|
||||
virtual ~ReducePrimitiveIterator () { ; }
|
||||
virtual void Do (Solid * sol)
|
||||
{
|
||||
if (sol -> GetPrimitive())
|
||||
sol -> GetPrimitive() -> Reduce (box);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class UnReducePrimitiveIterator : public SolidIterator
|
||||
{
|
||||
public:
|
||||
UnReducePrimitiveIterator () { ; }
|
||||
virtual ~UnReducePrimitiveIterator () { ; }
|
||||
virtual void Do (Solid * sol)
|
||||
{
|
||||
if (sol -> GetPrimitive())
|
||||
sol -> GetPrimitive() -> UnReduce ();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -8,166 +8,171 @@
|
||||
/* Date: 01. Okt. 95 */
|
||||
/**************************************************************************/
|
||||
|
||||
/*
|
||||
|
||||
Special Point Calculation
|
||||
|
||||
*/
|
||||
|
||||
class Surface;
|
||||
class Solid;
|
||||
|
||||
/// Special point.
|
||||
class SpecialPoint
|
||||
namespace netgen
|
||||
{
|
||||
public:
|
||||
/// coordinates
|
||||
Point<3> p;
|
||||
/// tangential to edge
|
||||
Vec<3> v;
|
||||
///
|
||||
int layer;
|
||||
/// point must be used in mesh
|
||||
bool unconditional;
|
||||
|
||||
/// surfaces defining edge
|
||||
int s1, s2;
|
||||
/// if s1 and s2 are only representatives, then these are the original indices
|
||||
int s1_orig, s2_orig;
|
||||
int nr;
|
||||
///
|
||||
SpecialPoint () : p(0,0,0), v(0,0,0), layer(0), unconditional(0), s1(0), s2(0), s1_orig(0), s2_orig(0)
|
||||
{ ; }
|
||||
|
||||
///
|
||||
SpecialPoint (const SpecialPoint & sp2);
|
||||
|
||||
///
|
||||
SpecialPoint & operator= (const SpecialPoint & sp2);
|
||||
|
||||
///
|
||||
void Print (ostream & str) const;
|
||||
|
||||
|
||||
int GetLayer() const { return layer; }
|
||||
|
||||
///
|
||||
bool HasSurfaces (int as1, int as2) const
|
||||
{
|
||||
return ( (s1 == as1 && s2 == as2) || (s1 == as2 && s2 == as1) );
|
||||
}
|
||||
};
|
||||
|
||||
inline ostream & operator<< (ostream & ost, const SpecialPoint & sp)
|
||||
{
|
||||
sp.Print (ost);
|
||||
return ost;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
///
|
||||
class SpecialPointCalculation
|
||||
{
|
||||
private:
|
||||
///
|
||||
const CSGeometry * geometry;
|
||||
///
|
||||
Array<MeshPoint> * points;
|
||||
///
|
||||
Array<long int> boxesinlevel;
|
||||
|
||||
///
|
||||
double size;
|
||||
///
|
||||
double relydegtest; // maximal dimension of bisection intervall for
|
||||
/// test of degeneration parameters
|
||||
double cpeps1, epeps1, epeps2, epspointdist2;
|
||||
|
||||
double ideps;
|
||||
|
||||
public:
|
||||
|
||||
///
|
||||
SpecialPointCalculation ();
|
||||
|
||||
///
|
||||
void SetIdEps(const double epsin) {ideps = epsin;}
|
||||
|
||||
///
|
||||
void CalcSpecialPoints (const CSGeometry & ageometry,
|
||||
Array<MeshPoint> & points);
|
||||
///
|
||||
void AnalyzeSpecialPoints (const CSGeometry & geometry,
|
||||
Array<MeshPoint> & points,
|
||||
Array<SpecialPoint> & specpoints);
|
||||
|
||||
protected:
|
||||
///
|
||||
void CalcSpecialPointsRec (const Solid * sol, int layer,
|
||||
const BoxSphere<3> & box,
|
||||
int level,
|
||||
bool calccp, bool calcep);
|
||||
|
||||
|
||||
///
|
||||
bool CrossPointNewtonConvergence (const Surface * f1, const Surface * f2,
|
||||
const Surface * f3, const BoxSphere<3> & box);
|
||||
///
|
||||
bool CrossPointDegenerated (const Surface * f1, const Surface * f2,
|
||||
const Surface * f3, const BoxSphere<3> & box) const;
|
||||
///
|
||||
void CrossPointNewton (const Surface * f1, const Surface * f2,
|
||||
const Surface * f3, Point<3> & p);
|
||||
|
||||
bool EdgeNewtonConvergence (const Surface * f1, const Surface * f2,
|
||||
const Point<3> & p);
|
||||
///
|
||||
bool EdgeDegenerated (const Surface * f1, const Surface * f2,
|
||||
const BoxSphere<3> & box) const;
|
||||
///
|
||||
void EdgeNewton (const Surface * f1, const Surface * f2,
|
||||
Point<3> & p);
|
||||
///
|
||||
bool IsEdgeExtremalPoint (const Surface * f1, const Surface * f2,
|
||||
const Point<3> & p, Point<3> & pp, double rad);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
///
|
||||
bool ExtremalPointPossible (const Surface * f1, const Surface * f2,
|
||||
int dir, const BoxSphere<3> & box);
|
||||
///
|
||||
bool ExtremalPointDegenerated (const Surface * f1, const Surface * f2,
|
||||
int dir, const BoxSphere<3> & box);
|
||||
///
|
||||
bool ExtremalPointNewtonConvergence (const Surface * f1, const Surface * f2,
|
||||
int dir, const BoxSphere<3> & box);
|
||||
|
||||
Special Point Calculation
|
||||
|
||||
*/
|
||||
///
|
||||
void ExtremalPointNewton (const Surface * f1, const Surface * f2,
|
||||
int dir, Point<3> & p);
|
||||
|
||||
class Surface;
|
||||
class Solid;
|
||||
|
||||
/// Special point.
|
||||
class SpecialPoint
|
||||
{
|
||||
public:
|
||||
/// coordinates
|
||||
Point<3> p;
|
||||
/// tangential to edge
|
||||
Vec<3> v;
|
||||
///
|
||||
int layer;
|
||||
/// point must be used in mesh
|
||||
bool unconditional;
|
||||
|
||||
/// surfaces defining edge
|
||||
int s1, s2;
|
||||
/// if s1 and s2 are only representatives, then these are the original indices
|
||||
int s1_orig, s2_orig;
|
||||
int nr;
|
||||
///
|
||||
SpecialPoint () : p(0,0,0), v(0,0,0), layer(0), unconditional(0), s1(0), s2(0), s1_orig(0), s2_orig(0)
|
||||
{ ; }
|
||||
|
||||
///
|
||||
SpecialPoint (const SpecialPoint & sp2);
|
||||
|
||||
///
|
||||
SpecialPoint & operator= (const SpecialPoint & sp2);
|
||||
|
||||
///
|
||||
void Print (ostream & str) const;
|
||||
|
||||
|
||||
int GetLayer() const { return layer; }
|
||||
|
||||
///
|
||||
bool HasSurfaces (int as1, int as2) const
|
||||
{
|
||||
return ( (s1 == as1 && s2 == as2) || (s1 == as2 && s2 == as1) );
|
||||
}
|
||||
};
|
||||
|
||||
inline ostream & operator<< (ostream & ost, const SpecialPoint & sp)
|
||||
{
|
||||
sp.Print (ost);
|
||||
return ost;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
///
|
||||
bool AddPoint (const Point<3> & p, int layer);
|
||||
class SpecialPointCalculation
|
||||
{
|
||||
private:
|
||||
///
|
||||
const CSGeometry * geometry;
|
||||
///
|
||||
Array<MeshPoint> * points;
|
||||
///
|
||||
Array<long int> boxesinlevel;
|
||||
|
||||
void ComputeExtremalPoints (const Plane * plane,
|
||||
const QuadraticSurface * quadric,
|
||||
Array<Point<3> > & pts);
|
||||
///
|
||||
double size;
|
||||
///
|
||||
double relydegtest; // maximal dimension of bisection intervall for
|
||||
/// test of degeneration parameters
|
||||
double cpeps1, epeps1, epeps2, epspointdist2;
|
||||
|
||||
void ComputeCrossPoints (const Plane * plane1,
|
||||
const Plane * plane2,
|
||||
const Plane * plane3,
|
||||
Array<Point<3> > & pts);
|
||||
double ideps;
|
||||
|
||||
void ComputeCrossPoints (const Plane * plane1,
|
||||
const Plane * plane2,
|
||||
const QuadraticSurface * quadratic,
|
||||
Array<Point<3> > & pts);
|
||||
};
|
||||
public:
|
||||
|
||||
///
|
||||
SpecialPointCalculation ();
|
||||
|
||||
///
|
||||
void SetIdEps(const double epsin) {ideps = epsin;}
|
||||
|
||||
///
|
||||
void CalcSpecialPoints (const CSGeometry & ageometry,
|
||||
Array<MeshPoint> & points);
|
||||
///
|
||||
void AnalyzeSpecialPoints (const CSGeometry & geometry,
|
||||
Array<MeshPoint> & points,
|
||||
Array<SpecialPoint> & specpoints);
|
||||
|
||||
protected:
|
||||
///
|
||||
void CalcSpecialPointsRec (const Solid * sol, int layer,
|
||||
const BoxSphere<3> & box,
|
||||
int level,
|
||||
bool calccp, bool calcep);
|
||||
|
||||
|
||||
///
|
||||
bool CrossPointNewtonConvergence (const Surface * f1, const Surface * f2,
|
||||
const Surface * f3, const BoxSphere<3> & box);
|
||||
///
|
||||
bool CrossPointDegenerated (const Surface * f1, const Surface * f2,
|
||||
const Surface * f3, const BoxSphere<3> & box) const;
|
||||
///
|
||||
void CrossPointNewton (const Surface * f1, const Surface * f2,
|
||||
const Surface * f3, Point<3> & p);
|
||||
|
||||
bool EdgeNewtonConvergence (const Surface * f1, const Surface * f2,
|
||||
const Point<3> & p);
|
||||
///
|
||||
bool EdgeDegenerated (const Surface * f1, const Surface * f2,
|
||||
const BoxSphere<3> & box) const;
|
||||
///
|
||||
void EdgeNewton (const Surface * f1, const Surface * f2,
|
||||
Point<3> & p);
|
||||
///
|
||||
bool IsEdgeExtremalPoint (const Surface * f1, const Surface * f2,
|
||||
const Point<3> & p, Point<3> & pp, double rad);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
///
|
||||
bool ExtremalPointPossible (const Surface * f1, const Surface * f2,
|
||||
int dir, const BoxSphere<3> & box);
|
||||
///
|
||||
bool ExtremalPointDegenerated (const Surface * f1, const Surface * f2,
|
||||
int dir, const BoxSphere<3> & box);
|
||||
///
|
||||
bool ExtremalPointNewtonConvergence (const Surface * f1, const Surface * f2,
|
||||
int dir, const BoxSphere<3> & box);
|
||||
*/
|
||||
///
|
||||
void ExtremalPointNewton (const Surface * f1, const Surface * f2,
|
||||
int dir, Point<3> & p);
|
||||
|
||||
|
||||
///
|
||||
bool AddPoint (const Point<3> & p, int layer);
|
||||
|
||||
void ComputeExtremalPoints (const Plane * plane,
|
||||
const QuadraticSurface * quadric,
|
||||
Array<Point<3> > & pts);
|
||||
|
||||
void ComputeCrossPoints (const Plane * plane1,
|
||||
const Plane * plane2,
|
||||
const Plane * plane3,
|
||||
Array<Point<3> > & pts);
|
||||
|
||||
void ComputeCrossPoints (const Plane * plane1,
|
||||
const Plane * plane2,
|
||||
const QuadraticSurface * quadratic,
|
||||
Array<Point<3> > & pts);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,92 +1,99 @@
|
||||
///
|
||||
class splinesegment3d
|
||||
{
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
///
|
||||
Point<3> p1, p2, p3;
|
||||
class splinesegment3d
|
||||
{
|
||||
///
|
||||
Point<3> p1, p2, p3;
|
||||
|
||||
public:
|
||||
///
|
||||
splinesegment3d (const Point<3> & ap1, const Point<3> & ap2,
|
||||
const Point<3> & ap3);
|
||||
///
|
||||
void Evaluate (double t, Point<3> & p) const;
|
||||
///
|
||||
void EvaluateTangent (double t, Vec<3> & tang) const;
|
||||
///
|
||||
const Point<3> & P1() const { return p1; }
|
||||
///
|
||||
const Point<3> & P2() const { return p2; }
|
||||
///
|
||||
const Point<3> & P3() const { return p3; }
|
||||
///
|
||||
splinesegment3d (const Point<3> & ap1, const Point<3> & ap2,
|
||||
const Point<3> & ap3);
|
||||
///
|
||||
void Evaluate (double t, Point<3> & p) const;
|
||||
///
|
||||
void EvaluateTangent (double t, Vec<3> & tang) const;
|
||||
///
|
||||
const Point<3> & P1() const { return p1; }
|
||||
///
|
||||
const Point<3> & P2() const { return p2; }
|
||||
///
|
||||
const Point<3> & P3() const { return p3; }
|
||||
};
|
||||
|
||||
///
|
||||
class spline3d
|
||||
{
|
||||
///
|
||||
Array<splinesegment3d *> segments;
|
||||
class spline3d
|
||||
{
|
||||
///
|
||||
Array<splinesegment3d *> segments;
|
||||
|
||||
public:
|
||||
///
|
||||
spline3d () { };
|
||||
///
|
||||
void AddSegment (const Point<3> & ap1, const Point<3> & ap2, const Point<3> & ap3);
|
||||
///
|
||||
int GetNumSegments () const { return segments.Size(); }
|
||||
///
|
||||
double ProjectToSpline (Point<3> & p) const;
|
||||
///
|
||||
double ProjectToSpline (Point<3> & p, double t) const;
|
||||
///
|
||||
void Evaluate (double t, Point<3> & p) const;
|
||||
///
|
||||
void EvaluateTangent (double t, Vec<3> & tang) const;
|
||||
///
|
||||
const Point<3> & P1(int i) const { return segments.Get(i)->P1(); }
|
||||
///
|
||||
const Point<3> & P2(int i) const { return segments.Get(i)->P2(); }
|
||||
///
|
||||
const Point<3> & P3(int i) const { return segments.Get(i)->P3(); }
|
||||
///
|
||||
spline3d () { };
|
||||
///
|
||||
void AddSegment (const Point<3> & ap1, const Point<3> & ap2, const Point<3> & ap3);
|
||||
///
|
||||
int GetNumSegments () const { return segments.Size(); }
|
||||
///
|
||||
double ProjectToSpline (Point<3> & p) const;
|
||||
///
|
||||
double ProjectToSpline (Point<3> & p, double t) const;
|
||||
///
|
||||
void Evaluate (double t, Point<3> & p) const;
|
||||
///
|
||||
void EvaluateTangent (double t, Vec<3> & tang) const;
|
||||
///
|
||||
const Point<3> & P1(int i) const { return segments.Get(i)->P1(); }
|
||||
///
|
||||
const Point<3> & P2(int i) const { return segments.Get(i)->P2(); }
|
||||
///
|
||||
const Point<3> & P3(int i) const { return segments.Get(i)->P3(); }
|
||||
};
|
||||
|
||||
///
|
||||
class splinetube : public Surface
|
||||
///
|
||||
class splinetube : public Surface
|
||||
{
|
||||
///
|
||||
const spline3d & middlecurve;
|
||||
///
|
||||
double r;
|
||||
/// Vec<3> ex, ey, ez;
|
||||
Vec<2> e2x, e2y;
|
||||
///
|
||||
Point<3> cp;
|
||||
///
|
||||
const spline3d & middlecurve;
|
||||
///
|
||||
double r;
|
||||
/// Vec<3> ex, ey, ez;
|
||||
Vec<2> e2x, e2y;
|
||||
///
|
||||
Point<3> cp;
|
||||
|
||||
public:
|
||||
///
|
||||
splinetube (const spline3d & amiddlecurve, double ar);
|
||||
///
|
||||
splinetube (const spline3d & amiddlecurve, double ar);
|
||||
|
||||
///
|
||||
virtual void DefineTangentialPlane (const Point<3> & ap1, const Point<3> & ap2);
|
||||
///
|
||||
virtual void ToPlane (const Point<3> & p, Point<2> & pplain, double h, int & zone) const;
|
||||
///
|
||||
virtual void FromPlane (const Point<2> & pplain, Point<3> & p, double h) const;
|
||||
///
|
||||
virtual void Project (Point<3> & p) const;
|
||||
///
|
||||
virtual void DefineTangentialPlane (const Point<3> & ap1, const Point<3> & ap2);
|
||||
///
|
||||
virtual void ToPlane (const Point<3> & p, Point<2> & pplain, double h, int & zone) const;
|
||||
///
|
||||
virtual void FromPlane (const Point<2> & pplain, Point<3> & p, double h) const;
|
||||
///
|
||||
virtual void Project (Point<3> & p) const;
|
||||
|
||||
// virtual int RootInBox (const box3d & box) const { return 0; }
|
||||
// virtual int RootInBox (const box3d & box) const { return 0; }
|
||||
/// 0 .. no, 1 .. yes, 2 .. maybe
|
||||
|
||||
virtual int BoxInSolid (const BoxSphere<3> & box) const;
|
||||
virtual int BoxInSolid (const BoxSphere<3> & box) const;
|
||||
/// 0 .. no, 1 .. yes, 2 .. maybe
|
||||
|
||||
virtual double CalcFunctionValue (const Point<3> & point) const;
|
||||
///
|
||||
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
|
||||
///
|
||||
virtual double HesseNorm () const { return 0.5 / r; }
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
///
|
||||
virtual void Print (ostream & str) const;
|
||||
virtual double CalcFunctionValue (const Point<3> & point) const;
|
||||
///
|
||||
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
|
||||
///
|
||||
virtual double HesseNorm () const { return 0.5 / r; }
|
||||
///
|
||||
virtual Point<3> GetSurfacePoint () const;
|
||||
///
|
||||
virtual void Print (ostream & str) const;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -8,369 +8,371 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
// class DenseMatrix;
|
||||
// class Box3dSphere;
|
||||
class TriangleApproximation;
|
||||
|
||||
/**
|
||||
Basis class for implicit surface geometry.
|
||||
This class is used for generation of surface meshes
|
||||
in NETGEN as well as for mesh refinement in FEPP.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
class Surface
|
||||
namespace netgen
|
||||
{
|
||||
protected:
|
||||
/// invert normal vector
|
||||
bool inverse;
|
||||
/// maximal h in surface
|
||||
double maxh;
|
||||
/// name of surface
|
||||
char * name;
|
||||
/// boundary condition nr
|
||||
int bcprop;
|
||||
///
|
||||
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:
|
||||
// class DenseMatrix;
|
||||
// class Box3dSphere;
|
||||
class TriangleApproximation;
|
||||
|
||||
void SetName (const char * aname);
|
||||
const char * Name () const { return name; }
|
||||
|
||||
//@{
|
||||
/**
|
||||
Defines tangential plane in ap1.
|
||||
The local x-coordinate axis point 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;
|
||||
//@}
|
||||
|
||||
|
||||
/// Move Point p to closes point in surface
|
||||
virtual void Project (Point<3> & p) const;
|
||||
|
||||
///
|
||||
virtual void SkewProject(Point<3> & p, const Vec<3> & direction) const;
|
||||
|
||||
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.
|
||||
Basis class for implicit surface geometry.
|
||||
This class is used for generation of surface meshes
|
||||
in NETGEN as well as for mesh refinement in FEPP.
|
||||
*/
|
||||
//@{
|
||||
/// 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;
|
||||
class Surface
|
||||
{
|
||||
protected:
|
||||
/// invert normal vector
|
||||
bool inverse;
|
||||
/// maximal h in surface
|
||||
double maxh;
|
||||
/// name of surface
|
||||
char * name;
|
||||
/// boundary condition nr
|
||||
int bcprop;
|
||||
///
|
||||
string bcname;
|
||||
|
||||
///
|
||||
virtual void Reduce (const BoxSphere<3> & /* box */) { };
|
||||
///
|
||||
virtual void UnReduce () { };
|
||||
public:
|
||||
Surface ();
|
||||
/** @name Tangential plane.
|
||||
The tangential plane is used for surface mesh generation.
|
||||
*/
|
||||
|
||||
virtual ~Surface();
|
||||
|
||||
/// 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; }
|
||||
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:
|
||||
|
||||
/** 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;
|
||||
void SetName (const char * aname);
|
||||
const char * Name () const { return name; }
|
||||
|
||||
/**
|
||||
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 { };
|
||||
//@{
|
||||
/**
|
||||
Defines tangential plane in ap1.
|
||||
The local x-coordinate axis point 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;
|
||||
//@}
|
||||
|
||||
|
||||
string GetBCName() const { return bcname; }
|
||||
/// Move Point p to closes point in surface
|
||||
virtual void Project (Point<3> & p) const;
|
||||
|
||||
void SetBCName( string abc ) { bcname = abc; }
|
||||
///
|
||||
virtual void SkewProject(Point<3> & p, const Vec<3> & direction) const;
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
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; }
|
||||
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 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 Point<3> GetSurfacePoint () const
|
||||
{ return Point<3> (0,0,0); }
|
||||
|
||||
virtual double HesseNorm () const
|
||||
{ return 0; }
|
||||
virtual double HesseNorm () const
|
||||
{ return 0; }
|
||||
|
||||
virtual void Project (Point<3> & p) const
|
||||
{ ; }
|
||||
virtual void Project (Point<3> & p) const
|
||||
{ ; }
|
||||
|
||||
virtual void Print (ostream & ost) const
|
||||
{ ost << "dummy surface"; }
|
||||
};
|
||||
virtual void Print (ostream & ost) const
|
||||
{ ost << "dummy surface"; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Primitive
|
||||
{
|
||||
class Primitive
|
||||
{
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
Primitive ();
|
||||
Primitive ();
|
||||
|
||||
virtual ~Primitive();
|
||||
virtual ~Primitive();
|
||||
|
||||
|
||||
/*
|
||||
Check, whether box intersects solid defined by surface.
|
||||
/*
|
||||
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,
|
||||
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;
|
||||
|
||||
virtual void GetTangentialSurfaceIndices (const Point<3> & p,
|
||||
Array<int> & surfind, double eps) const;
|
||||
// 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;
|
||||
|
||||
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
|
||||
const Vec<3> & v,
|
||||
double eps) const = 0;
|
||||
// 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;
|
||||
|
||||
// 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;
|
||||
// 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;
|
||||
|
||||
// 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;
|
||||
virtual void GetTangentialVecSurfaceIndices (const Point<3> & p, const Vec<3> & v,
|
||||
Array<int> & surfind, 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 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 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;
|
||||
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;
|
||||
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; }
|
||||
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 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 void Reduce (const BoxSphere<3> & /* box */) { };
|
||||
virtual void UnReduce () { };
|
||||
|
||||
virtual Primitive * Copy () const;
|
||||
virtual void Transform (Transformation<3> & trans);
|
||||
};
|
||||
virtual Primitive * Copy () const;
|
||||
virtual void Transform (Transformation<3> & trans);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class OneSurfacePrimitive : public Surface, public Primitive
|
||||
{
|
||||
public:
|
||||
OneSurfacePrimitive();
|
||||
~OneSurfacePrimitive();
|
||||
class OneSurfacePrimitive : public Surface, public Primitive
|
||||
{
|
||||
public:
|
||||
OneSurfacePrimitive();
|
||||
~OneSurfacePrimitive();
|
||||
|
||||
virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
|
||||
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 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 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 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 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;
|
||||
};
|
||||
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);
|
||||
/**
|
||||
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
|
||||
|
@ -7,51 +7,57 @@
|
||||
/* Date: 2. Mar. 98 */
|
||||
/**************************************************************************/
|
||||
|
||||
/**
|
||||
Triangulated approxiamtion to true surface
|
||||
*/
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
/**
|
||||
Triangulated approxiamtion to true surface
|
||||
*/
|
||||
|
||||
|
||||
class TATriangle
|
||||
{
|
||||
int pi[3];
|
||||
int surfind;
|
||||
public:
|
||||
TATriangle () { ; }
|
||||
class TATriangle
|
||||
{
|
||||
int pi[3];
|
||||
int surfind;
|
||||
public:
|
||||
TATriangle () { ; }
|
||||
|
||||
TATriangle (int si, int pi1, int pi2, int pi3)
|
||||
TATriangle (int si, int pi1, int pi2, int pi3)
|
||||
{ surfind = si; pi[0] = pi1; pi[1] = pi2; pi[2] = pi3; }
|
||||
|
||||
int SurfaceIndex() const { return surfind; }
|
||||
int & SurfaceIndex() { return surfind; }
|
||||
int SurfaceIndex() const { return surfind; }
|
||||
int & SurfaceIndex() { return surfind; }
|
||||
|
||||
int & operator[] (int i) { return pi[i]; }
|
||||
const int & operator[] (int i) const { return pi[i]; }
|
||||
};
|
||||
int & operator[] (int i) { return pi[i]; }
|
||||
const int & operator[] (int i) const { return pi[i]; }
|
||||
};
|
||||
|
||||
|
||||
class TriangleApproximation
|
||||
{
|
||||
Array<Point<3> > points;
|
||||
Array<Vec<3> > normals;
|
||||
Array<TATriangle> trigs;
|
||||
class TriangleApproximation
|
||||
{
|
||||
Array<Point<3> > points;
|
||||
Array<Vec<3> > normals;
|
||||
Array<TATriangle> trigs;
|
||||
|
||||
public:
|
||||
TriangleApproximation();
|
||||
int GetNP () const { return points.Size(); }
|
||||
int GetNT () const { return trigs.Size(); }
|
||||
public:
|
||||
TriangleApproximation();
|
||||
int GetNP () const { return points.Size(); }
|
||||
int GetNT () const { return trigs.Size(); }
|
||||
|
||||
int AddPoint (const Point<3> & p) { points.Append (p); return points.Size()-1; }
|
||||
int AddNormal (const Vec<3> & n) { normals.Append (n); return normals.Size()-1; }
|
||||
int AddTriangle (const TATriangle & tri, bool invert = 0);
|
||||
int AddPoint (const Point<3> & p) { points.Append (p); return points.Size()-1; }
|
||||
int AddNormal (const Vec<3> & n) { normals.Append (n); return normals.Size()-1; }
|
||||
int AddTriangle (const TATriangle & tri, bool invert = 0);
|
||||
|
||||
const Point<3> & GetPoint (int i) const { return points[i]; }
|
||||
const TATriangle & GetTriangle (int i) const { return trigs[i]; }
|
||||
const Vec<3> & GetNormal (int i) const { return normals[i]; }
|
||||
const Point<3> & GetPoint (int i) const { return points[i]; }
|
||||
const TATriangle & GetTriangle (int i) const { return trigs[i]; }
|
||||
const Vec<3> & GetNormal (int i) const { return normals[i]; }
|
||||
|
||||
void RemoveUnusedPoints ();
|
||||
void RemoveUnusedPoints ();
|
||||
|
||||
friend class CSGeometry;
|
||||
};
|
||||
friend class CSGeometry;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -195,20 +195,33 @@ namespace netgen
|
||||
|
||||
Meshing2 meshing (Box<3> (pmin, pmax));
|
||||
|
||||
Array<int, PointIndex::BASE> compress(bnp);
|
||||
compress = -1;
|
||||
int cnt = 0;
|
||||
for (PointIndex pi = PointIndex::BASE; pi < bnp+PointIndex::BASE; pi++)
|
||||
meshing.AddPoint ( (*mesh)[pi], pi);
|
||||
|
||||
if ( (*mesh)[pi].GetLayer() == geometry.GetDomainLayer(domnr))
|
||||
{
|
||||
meshing.AddPoint ( (*mesh)[pi], pi);
|
||||
cnt++;
|
||||
compress[pi] = cnt;
|
||||
}
|
||||
|
||||
PointGeomInfo gi;
|
||||
gi.trignum = 1;
|
||||
for (SegmentIndex si = 0; si < mesh->GetNSeg(); si++)
|
||||
{
|
||||
if ( (*mesh)[si].domin == domnr)
|
||||
meshing.AddBoundaryElement ( (*mesh)[si][0] + 1 - PointIndex::BASE,
|
||||
(*mesh)[si][1] + 1 - PointIndex::BASE, gi, gi);
|
||||
{
|
||||
meshing.AddBoundaryElement ( compress[(*mesh)[si][0]],
|
||||
compress[(*mesh)[si][1]], gi, gi);
|
||||
}
|
||||
if ( (*mesh)[si].domout == domnr)
|
||||
meshing.AddBoundaryElement ( (*mesh)[si][1] + 1 - PointIndex::BASE,
|
||||
(*mesh)[si][0] + 1 - PointIndex::BASE, gi, gi);
|
||||
{
|
||||
meshing.AddBoundaryElement ( compress[(*mesh)[si][1]],
|
||||
compress[(*mesh)[si][0]], gi, gi);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,41 +8,44 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
class Refinement2d : public Refinement
|
||||
namespace netgen
|
||||
{
|
||||
const SplineGeometry2d & geometry;
|
||||
|
||||
public:
|
||||
Refinement2d (const SplineGeometry2d & ageometry);
|
||||
virtual ~Refinement2d ();
|
||||
class Refinement2d : public Refinement
|
||||
{
|
||||
const SplineGeometry2d & geometry;
|
||||
|
||||
public:
|
||||
Refinement2d (const SplineGeometry2d & ageometry);
|
||||
virtual ~Refinement2d ();
|
||||
|
||||
virtual void PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint,
|
||||
int surfi,
|
||||
const PointGeomInfo & gi1,
|
||||
const PointGeomInfo & gi2,
|
||||
Point<3> & newp, PointGeomInfo & newgi);
|
||||
virtual void PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint,
|
||||
int surfi,
|
||||
const PointGeomInfo & gi1,
|
||||
const PointGeomInfo & gi2,
|
||||
Point<3> & newp, PointGeomInfo & newgi);
|
||||
|
||||
virtual void PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint,
|
||||
int surfi1, int surfi2,
|
||||
const EdgePointGeomInfo & ap1,
|
||||
const EdgePointGeomInfo & ap2,
|
||||
Point<3> & newp, EdgePointGeomInfo & newgi);
|
||||
virtual void PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint,
|
||||
int surfi1, int surfi2,
|
||||
const EdgePointGeomInfo & ap1,
|
||||
const EdgePointGeomInfo & ap2,
|
||||
Point<3> & newp, EdgePointGeomInfo & newgi);
|
||||
|
||||
|
||||
virtual Vec<3> GetTangent (const Point<3> & p, int surfi1, int surfi2,
|
||||
const EdgePointGeomInfo & ap1) const;
|
||||
virtual Vec<3> GetTangent (const Point<3> & p, int surfi1, int surfi2,
|
||||
const EdgePointGeomInfo & ap1) const;
|
||||
|
||||
virtual Vec<3> GetNormal (const Point<3> & p, int surfi1,
|
||||
const PointGeomInfo & gi) const;
|
||||
virtual Vec<3> GetNormal (const Point<3> & p, int surfi1,
|
||||
const PointGeomInfo & gi) const;
|
||||
|
||||
virtual void ProjectToSurface (Point<3> & p, int surfi, const PointGeomInfo & /* gi */);
|
||||
|
||||
virtual void ProjectToEdge (Point<3> & p, int surfi1, int surfi2,
|
||||
const EdgePointGeomInfo & egi) const;
|
||||
};
|
||||
virtual void ProjectToSurface (Point<3> & p, int surfi, const PointGeomInfo & /* gi */);
|
||||
|
||||
virtual void ProjectToEdge (Point<3> & p, int surfi1, int surfi2,
|
||||
const EdgePointGeomInfo & egi) const;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -10,11 +10,10 @@
|
||||
#include <myadt.hpp>
|
||||
#include <gprim.hpp>
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
#include "spline.hpp"
|
||||
#include "splinegeometry.hpp"
|
||||
#include "geom2dmesh.hpp"
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -7,6 +7,9 @@
|
||||
/* Date: 24. Jul. 96 */
|
||||
/**************************************************************************/
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
|
||||
void CalcPartition (double l, double h, double h1, double h2,
|
||||
double hcurve, double elto0, Array<double> & points);
|
||||
@ -60,6 +63,14 @@ public:
|
||||
bool hpref_left;
|
||||
/// perfrom anisotropic refinement (hp-refinement) to edge
|
||||
bool hpref_right;
|
||||
///
|
||||
int layer;
|
||||
|
||||
|
||||
SplineSeg ()
|
||||
{
|
||||
layer = 1;
|
||||
}
|
||||
|
||||
/// calculates length of curve
|
||||
virtual double Length () const;
|
||||
@ -344,10 +355,18 @@ void SplineSeg<D> :: Partition (double h, double elto0,
|
||||
|
||||
Vec<3> v (1e-4*h, 1e-4*h, 1e-4*h);
|
||||
searchtree.GetIntersecting (oldmark3 - v, oldmark3 + v, locsearch);
|
||||
if (locsearch.Size()) pi1 = locsearch[0];
|
||||
|
||||
for (int k = 0; k < locsearch.Size(); k++)
|
||||
if ( mesh[PointIndex(locsearch[k])].GetLayer() == layer)
|
||||
pi1 = locsearch[k];
|
||||
// if (locsearch.Size()) pi1 = locsearch[0];
|
||||
|
||||
searchtree.GetIntersecting (mark3 - v, mark3 + v, locsearch);
|
||||
if (locsearch.Size()) pi2 = locsearch[0];
|
||||
for (int k = 0; k < locsearch.Size(); k++)
|
||||
if ( mesh[PointIndex(locsearch[k])].GetLayer() == layer)
|
||||
pi2 = locsearch[k];
|
||||
// if (locsearch.Size()) pi2 = locsearch[0];
|
||||
|
||||
/*
|
||||
for (PointIndex pk = PointIndex::BASE;
|
||||
pk < mesh.GetNP()+PointIndex::BASE; pk++)
|
||||
@ -363,20 +382,15 @@ void SplineSeg<D> :: Partition (double h, double elto0,
|
||||
|
||||
if (pi1 == -1)
|
||||
{
|
||||
pi1 = mesh.AddPoint(oldmark3);
|
||||
pi1 = mesh.AddPoint(oldmark3, layer);
|
||||
searchtree.Insert (oldmark3, pi1);
|
||||
}
|
||||
if (pi2 == -1)
|
||||
{
|
||||
pi2 = mesh.AddPoint(mark3);
|
||||
pi2 = mesh.AddPoint(mark3, layer);
|
||||
searchtree.Insert (mark3, pi2);
|
||||
}
|
||||
|
||||
/*
|
||||
cout << "pi1 = " << pi1 << endl;
|
||||
cout << "pi2 = " << pi2 << endl;
|
||||
cout << "leftdom = " << leftdom << ", rightdom = " << rightdom << endl;
|
||||
*/
|
||||
Segment seg;
|
||||
seg.edgenr = segnr;
|
||||
seg.si = bc; // segnr;
|
||||
@ -854,6 +868,9 @@ typedef CircleSeg<2> CircleSegment;
|
||||
typedef DiscretePointsSeg<2> DiscretePointsSegment;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -295,6 +295,8 @@ void SplineGeometry<D> :: LoadDataV2 ( ifstream & infile )
|
||||
quadmeshing = false;
|
||||
tensormeshing.SetSize ( numdomains );
|
||||
tensormeshing = false;
|
||||
layer.SetSize ( numdomains );
|
||||
layer = 1;
|
||||
|
||||
|
||||
TestComment ( infile );
|
||||
@ -329,6 +331,7 @@ void SplineGeometry<D> :: LoadDataV2 ( ifstream & infile )
|
||||
maxh[domainnr-1] = flags.GetNumFlag ( "maxh", 1000);
|
||||
if (flags.GetDefineFlag("quad")) quadmeshing[domainnr-1] = true;
|
||||
if (flags.GetDefineFlag("tensor")) tensormeshing[domainnr-1] = true;
|
||||
layer[domainnr-1] = int(flags.GetNumFlag ("layer", 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -989,11 +992,15 @@ void SplineGeometry<D> :: PartitionBoundary (double h, Mesh & mesh2d)
|
||||
pmax(j) = bbox.PMax()(j);
|
||||
}
|
||||
|
||||
|
||||
if (printmessage_importance>0)
|
||||
cout << "searchtree from " << pmin << " to " << pmax << endl;
|
||||
Point3dTree searchtree (pmin, pmax);
|
||||
|
||||
for (int i = 0; i < splines.Size(); i++)
|
||||
for (int side = 0; side <= 1; side++)
|
||||
{
|
||||
int dom = (side == 0) ? splines[i]->leftdom : splines[i]->rightdom;
|
||||
if (dom != 0) splines[i] -> layer = GetDomainLayer (dom);
|
||||
}
|
||||
|
||||
for (int i = 0; i < splines.Size(); i++)
|
||||
if (splines[i]->copyfrom == -1)
|
||||
{
|
||||
|
@ -13,139 +13,148 @@ in geom2d only 2D - Geometry classes (with material properties etc.)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _FILE_SPLINEGEOMETRY
|
||||
#define _FILE_SPLINEGEOMETRY
|
||||
#include "../csg/csgparser.hpp"
|
||||
|
||||
///
|
||||
extern void LoadBoundarySplines (const char * filename,
|
||||
Array < GeomPoint<2> > & geompoints,
|
||||
Array < SplineSeg<2>* > & splines,
|
||||
double & elto0);
|
||||
///
|
||||
extern void PartitionBoundary (const Array < SplineSeg<2>* > & splines,
|
||||
double h, double elto0,
|
||||
Mesh & mesh2d);
|
||||
|
||||
|
||||
// allow to turn off messages: cover all couts !!
|
||||
extern int printmessage_importance;
|
||||
|
||||
template < int D >
|
||||
class SplineGeometry
|
||||
namespace netgen
|
||||
{
|
||||
Array < GeomPoint<D> > geompoints;
|
||||
Array < SplineSeg<D>* > splines;
|
||||
double elto0;
|
||||
Array<char*> materials;
|
||||
Array<string*> bcnames;
|
||||
Array<double> maxh;
|
||||
Array<bool> quadmeshing;
|
||||
Array<bool> tensormeshing;
|
||||
|
||||
private:
|
||||
void AppendSegment(SplineSeg<D> * spline, const int leftdomain, const int rightdomain,
|
||||
const int bc,
|
||||
const double reffac, const bool hprefleft, const bool hprefright,
|
||||
const int copyfrom);
|
||||
///
|
||||
extern void LoadBoundarySplines (const char * filename,
|
||||
Array < GeomPoint<2> > & geompoints,
|
||||
Array < SplineSeg<2>* > & splines,
|
||||
double & elto0);
|
||||
///
|
||||
extern void PartitionBoundary (const Array < SplineSeg<2>* > & splines,
|
||||
double h, double elto0,
|
||||
Mesh & mesh2d);
|
||||
|
||||
public:
|
||||
~SplineGeometry();
|
||||
|
||||
int Load (const Array<double> & raw_data, const int startpos = 0);
|
||||
void Load (const char * filename);
|
||||
void CSGLoad (CSGScanner & scan);
|
||||
// allow to turn off messages: cover all couts !!
|
||||
extern int printmessage_importance;
|
||||
|
||||
void LoadData( ifstream & infile );
|
||||
void LoadDataNew ( ifstream & infile );
|
||||
void LoadDataV2 ( ifstream & infile );
|
||||
template < int D >
|
||||
class SplineGeometry
|
||||
{
|
||||
Array < GeomPoint<D> > geompoints;
|
||||
Array < SplineSeg<D>* > splines;
|
||||
double elto0;
|
||||
Array<char*> materials;
|
||||
Array<string*> bcnames;
|
||||
Array<double> maxh;
|
||||
Array<bool> quadmeshing;
|
||||
Array<bool> tensormeshing;
|
||||
Array<int> layer;
|
||||
|
||||
void PartitionBoundary (double h, Mesh & mesh2d);
|
||||
private:
|
||||
void AppendSegment(SplineSeg<D> * spline, const int leftdomain, const int rightdomain,
|
||||
const int bc,
|
||||
const double reffac, const bool hprefleft, const bool hprefright,
|
||||
const int copyfrom);
|
||||
|
||||
void GetRawData (Array<double> & raw_data) const;
|
||||
public:
|
||||
~SplineGeometry();
|
||||
|
||||
void CopyEdgeMesh (int from, int to, Mesh & mesh2d, Point3dTree & searchtree);
|
||||
int Load (const Array<double> & raw_data, const int startpos = 0);
|
||||
void Load (const char * filename);
|
||||
void CSGLoad (CSGScanner & scan);
|
||||
|
||||
const Array<SplineSeg<D>*> & GetSplines () const
|
||||
{ return splines; }
|
||||
void LoadData( ifstream & infile );
|
||||
void LoadDataNew ( ifstream & infile );
|
||||
void LoadDataV2 ( ifstream & infile );
|
||||
|
||||
int GetNSplines (void) const { return splines.Size(); }
|
||||
string GetSplineType (const int i) const { return splines[i]->GetType(); }
|
||||
SplineSeg<D> & GetSpline (const int i) {return *splines[i];}
|
||||
const SplineSeg<D> & GetSpline (const int i) const {return *splines[i];}
|
||||
void PartitionBoundary (double h, Mesh & mesh2d);
|
||||
|
||||
void GetBoundingBox (Box<D> & box) const;
|
||||
Box<D> GetBoundingBox () const
|
||||
{ Box<D> box; GetBoundingBox (box); return box; }
|
||||
void GetRawData (Array<double> & raw_data) const;
|
||||
|
||||
int GetNP () const { return geompoints.Size(); }
|
||||
const GeomPoint<D> & GetPoint(int i) const { return geompoints[i]; }
|
||||
void CopyEdgeMesh (int from, int to, Mesh & mesh2d, Point3dTree & searchtree);
|
||||
|
||||
void SetGrading (const double grading);
|
||||
// void AppendPoint (const double x, const double y, const double reffac = 1., const bool hpref = false);
|
||||
void AppendPoint (const Point<D> & p, const double reffac = 1., const bool hpref = false);
|
||||
const Array<SplineSeg<D>*> & GetSplines () const
|
||||
{ return splines; }
|
||||
|
||||
int GetNSplines (void) const { return splines.Size(); }
|
||||
string GetSplineType (const int i) const { return splines[i]->GetType(); }
|
||||
SplineSeg<D> & GetSpline (const int i) {return *splines[i];}
|
||||
const SplineSeg<D> & GetSpline (const int i) const {return *splines[i];}
|
||||
|
||||
void GetBoundingBox (Box<D> & box) const;
|
||||
Box<D> GetBoundingBox () const
|
||||
{ Box<D> box; GetBoundingBox (box); return box; }
|
||||
|
||||
int GetNP () const { return geompoints.Size(); }
|
||||
const GeomPoint<D> & GetPoint(int i) const { return geompoints[i]; }
|
||||
|
||||
void SetGrading (const double grading);
|
||||
// void AppendPoint (const double x, const double y, const double reffac = 1., const bool hpref = false);
|
||||
void AppendPoint (const Point<D> & p, const double reffac = 1., const bool hpref = false);
|
||||
|
||||
void AppendLineSegment (const int n1, const int n2,
|
||||
const int leftdomain, const int rightdomain, const int bc = -1,
|
||||
const double reffac = 1.,
|
||||
const bool hprefleft = false, const bool hprefright = false,
|
||||
const int copyfrom = -1);
|
||||
void AppendSplineSegment (const int n1, const int n2, const int n3,
|
||||
void AppendLineSegment (const int n1, const int n2,
|
||||
const int leftdomain, const int rightdomain, const int bc = -1,
|
||||
const double reffac = 1.,
|
||||
const bool hprefleft = false, const bool hprefright = false,
|
||||
const int copyfrom = -1);
|
||||
void AppendCircleSegment (const int n1, const int n2, const int n3,
|
||||
const int leftdomain, const int rightdomain, const int bc = -1,
|
||||
const double reffac = 1.,
|
||||
const bool hprefleft = false, const bool hprefright = false,
|
||||
const int copyfrom = -1);
|
||||
void AppendDiscretePointsSegment (const Array< Point<D> > & points,
|
||||
const int leftdomain, const int rightdomain, const int bc = -1,
|
||||
const double reffac = 1.,
|
||||
const bool hprefleft = false, const bool hprefright = false,
|
||||
const int copyfrom = -1);
|
||||
void TestComment ( ifstream & infile ) ;
|
||||
void GetMaterial( const int domnr, char* & material );
|
||||
void AppendSplineSegment (const int n1, const int n2, const int n3,
|
||||
const int leftdomain, const int rightdomain, const int bc = -1,
|
||||
const double reffac = 1.,
|
||||
const bool hprefleft = false, const bool hprefright = false,
|
||||
const int copyfrom = -1);
|
||||
void AppendCircleSegment (const int n1, const int n2, const int n3,
|
||||
const int leftdomain, const int rightdomain, const int bc = -1,
|
||||
const double reffac = 1.,
|
||||
const bool hprefleft = false, const bool hprefright = false,
|
||||
const int copyfrom = -1);
|
||||
void AppendDiscretePointsSegment (const Array< Point<D> > & points,
|
||||
const int leftdomain, const int rightdomain, const int bc = -1,
|
||||
const double reffac = 1.,
|
||||
const bool hprefleft = false, const bool hprefright = false,
|
||||
const int copyfrom = -1);
|
||||
void TestComment ( ifstream & infile ) ;
|
||||
void GetMaterial( const int domnr, char* & material );
|
||||
|
||||
double GetDomainMaxh ( const int domnr );
|
||||
bool GetDomainQuadMeshing ( int domnr )
|
||||
{
|
||||
if ( quadmeshing.Size() ) return quadmeshing[domnr-1];
|
||||
else return false;
|
||||
}
|
||||
bool GetDomainTensorMeshing ( int domnr )
|
||||
{
|
||||
if ( tensormeshing.Size() ) return tensormeshing[domnr-1];
|
||||
else return false;
|
||||
}
|
||||
double GetDomainMaxh ( const int domnr );
|
||||
bool GetDomainQuadMeshing ( int domnr )
|
||||
{
|
||||
if ( quadmeshing.Size() ) return quadmeshing[domnr-1];
|
||||
else return false;
|
||||
}
|
||||
bool GetDomainTensorMeshing ( int domnr )
|
||||
{
|
||||
if ( tensormeshing.Size() ) return tensormeshing[domnr-1];
|
||||
else return false;
|
||||
}
|
||||
int GetDomainLayer ( int domnr )
|
||||
{
|
||||
if ( layer.Size() ) return layer[domnr-1];
|
||||
else return 1;
|
||||
}
|
||||
|
||||
string GetBCName ( const int bcnr ) const;
|
||||
string GetBCName ( const int bcnr ) const;
|
||||
|
||||
string * BCNamePtr ( const int bcnr );
|
||||
string * BCNamePtr ( const int bcnr );
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
void MeshFromSpline2D (SplineGeometry<2> & geometry,
|
||||
Mesh *& mesh,
|
||||
MeshingParameters & mp);
|
||||
void MeshFromSpline2D (SplineGeometry<2> & geometry,
|
||||
Mesh *& mesh,
|
||||
MeshingParameters & mp);
|
||||
|
||||
|
||||
|
||||
class SplineGeometry2d : public SplineGeometry<2>, public NetgenGeometry
|
||||
{
|
||||
public:
|
||||
virtual ~SplineGeometry2d();
|
||||
class SplineGeometry2d : public SplineGeometry<2>, public NetgenGeometry
|
||||
{
|
||||
public:
|
||||
virtual ~SplineGeometry2d();
|
||||
|
||||
virtual int GenerateMesh (Mesh*& mesh,
|
||||
int perfstepsstart, int perfstepsend, char* optstring);
|
||||
virtual int GenerateMesh (Mesh*& mesh,
|
||||
int perfstepsstart, int perfstepsend, char* optstring);
|
||||
|
||||
virtual const Refinement & GetRefinement () const;
|
||||
};
|
||||
virtual const Refinement & GetRefinement () const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // _FILE_SPLINEGEOMETRY
|
||||
|
@ -79,7 +79,16 @@ namespace netgen
|
||||
DLL_HEADER Ng_Element Ng_GetElement (int nr);
|
||||
|
||||
|
||||
|
||||
class Ng_Point
|
||||
{
|
||||
public:
|
||||
double * pt;
|
||||
double operator[] (int i)
|
||||
{ return pt[i]; }
|
||||
};
|
||||
|
||||
DLL_HEADER Ng_Point Ng_GetPoint (int nr);
|
||||
|
||||
|
||||
|
||||
@ -127,8 +136,7 @@ namespace netgen
|
||||
|
||||
template <int DIM>
|
||||
DLL_HEADER int Ng_GetElementIndex (int nr);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// Curved Elements:
|
||||
|
@ -155,6 +155,13 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
DLL_HEADER Ng_Point Ng_GetPoint (int nr)
|
||||
{
|
||||
Ng_Point ret;
|
||||
ret.pt = &mesh->Point(nr + PointIndex::BASE)(0);
|
||||
}
|
||||
|
||||
|
||||
template <>
|
||||
DLL_HEADER int Ng_GetElementIndex<1> (int nr)
|
||||
{
|
||||
@ -175,9 +182,6 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <>
|
||||
DLL_HEADER void Ng_MultiElementTransformation<3,3> (int elnr, int npts,
|
||||
const double * xi, int sxi,
|
||||
|
Loading…
Reference in New Issue
Block a user