namespaces, layers for 2D geometry

This commit is contained in:
Joachim Schoeberl 2009-09-07 11:50:13 +00:00
parent c429a6cc6c
commit 975d220350
29 changed files with 2608 additions and 2465 deletions

View File

@ -3,30 +3,33 @@
/**************************************************************************/ /**************************************************************************/
/* File: algprim.hh */ /* File: algprim.hpp */
/* Author: Joachim Schoeberl */ /* Author: Joachim Schoeberl */
/* Date: 1. Dez. 95 */ /* Date: 1. Dez. 95 */
/**************************************************************************/ /**************************************************************************/
/* namespace netgen
{
Quadric Surfaces (Plane, Sphere, Cylinder) /*
*/ Quadric Surfaces (Plane, Sphere, Cylinder)
*/
/** /**
A quadric surface. A quadric surface.
surface defined by surface defined by
cxx x^2 + cyy y^2 + czz z^2 + cxy x y + cxz x z + cyz y z + 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. cx x + cy y + cz z + c1 = 0.
**/ **/
class QuadraticSurface : public OneSurfacePrimitive class QuadraticSurface : public OneSurfacePrimitive
{ {
protected: protected:
double cxx, cyy, czz, cxy, cxz, cyz, cx, cy, cz, c1; double cxx, cyy, czz, cxy, cxz, cyz, cx, cy, cz, c1;
public: public:
virtual double CalcFunctionValue (const Point<3> & point) const; virtual double CalcFunctionValue (const Point<3> & point) const;
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const; virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const; virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
@ -35,7 +38,7 @@ public:
const { return 0; } const { return 0; }
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box)
const { return DOES_INTERSECT; } const { return DOES_INTERSECT; }
*/ */
virtual double HesseNorm () const { return cxx + cyy + czz; } virtual double HesseNorm () const { return cxx + cyy + czz; }
virtual Point<3> GetSurfacePoint () const; virtual Point<3> GetSurfacePoint () const;
@ -44,12 +47,12 @@ public:
virtual void Print (ostream & ist) const; virtual void Print (ostream & ist) const;
virtual void Read (istream & ist); virtual void Read (istream & ist);
void PrintCoeff (ostream & ost) const; void PrintCoeff (ostream & ost) const;
}; };
/// A Plane (i.e., the plane and everything behind it). /// A Plane (i.e., the plane and everything behind it).
class Plane : public QuadraticSurface class Plane : public QuadraticSurface
{ {
/// a point in the plane /// a point in the plane
Point<3> p; Point<3> p;
/// outward normal vector /// outward normal vector
@ -57,7 +60,7 @@ class Plane : public QuadraticSurface
double eps_base; double eps_base;
public: public:
/// ///
Plane (const Point<3> & ap, Vec<3> an); Plane (const Point<3> & ap, Vec<3> an);
@ -107,19 +110,19 @@ public:
(TriangleApproximation & tas, (TriangleApproximation & tas,
const Box<3> & boundingbox, double facets) const; const Box<3> & boundingbox, double facets) const;
}; };
// typedef Plane Plane; // typedef Plane Plane;
/// ///
class Sphere : public QuadraticSurface class Sphere : public QuadraticSurface
{ {
/// ///
Point<3> c; Point<3> c;
/// ///
double r; double r;
public: public:
/// ///
Sphere (const Point<3> & ac, double ar); Sphere (const Point<3> & ac, double ar);
@ -162,12 +165,12 @@ public:
virtual void GetTriangleApproximation (TriangleApproximation & tas, virtual void GetTriangleApproximation (TriangleApproximation & tas,
const Box<3> & bbox, const Box<3> & bbox,
double facets) const; double facets) const;
}; };
/// ///
class Cylinder : public QuadraticSurface class Cylinder : public QuadraticSurface
{ {
/// ///
Point<3> a, b; Point<3> a, b;
/// ///
@ -175,7 +178,7 @@ class Cylinder : public QuadraticSurface
/// ///
Vec<3> vab; Vec<3> vab;
public: public:
Cylinder (const Point<3> & aa, const Point<3> & ab, double ar); Cylinder (const Point<3> & aa, const Point<3> & ab, double ar);
Cylinder (Array<double> & coeffs); Cylinder (Array<double> & coeffs);
@ -213,16 +216,16 @@ public:
virtual void GetTriangleApproximation (TriangleApproximation & tas, virtual void GetTriangleApproximation (TriangleApproximation & tas,
const Box<3> & bbox, const Box<3> & bbox,
double facets) const; double facets) const;
}; };
/// ///
class EllipticCylinder : public QuadraticSurface class EllipticCylinder : public QuadraticSurface
{ {
private: private:
/// ///
Point<3> a; Point<3> a;
/// ///
@ -231,7 +234,7 @@ private:
Vec<3> vab, t0vec, t1vec; Vec<3> vab, t0vec, t1vec;
/// ///
double vabl, t0, t1; double vabl, t0, t1;
public: public:
/// ///
EllipticCylinder (const Point<3> & aa, EllipticCylinder (const Point<3> & aa,
const Vec<3> & avl, const Vec<3> & avs); const Vec<3> & avl, const Vec<3> & avs);
@ -259,26 +262,26 @@ public:
double /* rad */) const; double /* rad */) const;
private: private:
void CalcData(); void CalcData();
}; };
/// ///
class Ellipsoid : public QuadraticSurface class Ellipsoid : public QuadraticSurface
{ {
private: private:
/// ///
Point<3> a; Point<3> a;
/// ///
Vec<3> v1, v2, v3; Vec<3> v1, v2, v3;
/// ///
double rmin; double rmin;
public: public:
/// ///
Ellipsoid (const Point<3> & aa, Ellipsoid (const Point<3> & aa,
const Vec<3> & av1, const Vec<3> & av1,
@ -297,9 +300,9 @@ public:
const Box<3> & bbox, const Box<3> & bbox,
double facets) const; double facets) const;
private: private:
void CalcData(); void CalcData();
}; };
@ -308,9 +311,9 @@ private:
/// ///
class Cone : public QuadraticSurface class Cone : public QuadraticSurface
{ {
/// ///
Point<3> a, b; Point<3> a, b;
/// ///
@ -319,7 +322,7 @@ class Cone : public QuadraticSurface
Vec<3> vab, t0vec, t1vec; Vec<3> vab, t0vec, t1vec;
/// ///
double vabl, t0, t1; double vabl, t0, t1;
public: public:
/// ///
Cone (const Point<3> & aa, const Point<3> & ab, double ara, double arb); Cone (const Point<3> & aa, const Point<3> & ab, double ara, double arb);
/// ///
@ -342,9 +345,9 @@ public:
const Box<3> & bbox, const Box<3> & bbox,
double facets) const; double facets) const;
private: private:
void CalcData(); void CalcData();
}; };
@ -353,13 +356,13 @@ private:
/// Torus /// Torus
/// Lorenzo Codecasa (codecasa@elet.polimi.it) /// Lorenzo Codecasa (codecasa@elet.polimi.it)
/// April 27th, 2005 /// April 27th, 2005
/// ///
/// begin... /// begin...
class Torus : public OneSurfacePrimitive class Torus : public OneSurfacePrimitive
{ {
/// center of the torus /// center of the torus
Point<3> c; Point<3> c;
/// vector normal to the symmetry plane of the torus /// vector normal to the symmetry plane of the torus
@ -369,7 +372,7 @@ class Torus : public OneSurfacePrimitive
/// Small radius of the torus /// Small radius of the torus
double r; double r;
public: public:
/// OK /// OK
Torus (const Point<3> & ac, const Vec<3> & an, double aR, double ar); Torus (const Point<3> & ac, const Vec<3> & an, double aR, double ar);
/// OK /// OK
@ -425,12 +428,12 @@ public:
virtual void Print (ostream & ist) const; virtual void Print (ostream & ist) const;
/// OK /// OK
virtual void Read (istream & ist); virtual void Read (istream & ist);
}; };
/// ...end
/// ...end
}

View File

@ -8,21 +8,25 @@
/* Date: 11. Mar. 98 */ /* Date: 11. Mar. 98 */
/**************************************************************************/ /**************************************************************************/
/* namespace netgen
{
/*
brick geometry, has several surfaces brick geometry, has several surfaces
*/ */
class Parallelogram3d : public Surface class Parallelogram3d : public Surface
{ {
Point<3> p1, p2, p3, p4; Point<3> p1, p2, p3, p4;
Vec<3> v12, v13; Vec<3> v12, v13;
Vec<3> n; Vec<3> n;
public: public:
Parallelogram3d (Point<3> ap1, Point<3> ap2, Point<3> ap3); Parallelogram3d (Point<3> ap1, Point<3> ap2, Point<3> ap3);
virtual ~Parallelogram3d (); virtual ~Parallelogram3d ();
@ -42,19 +46,19 @@ public:
const Box<3> & boundingbox, const Box<3> & boundingbox,
double facets) const; double facets) const;
protected: protected:
void CalcData(); void CalcData();
}; };
class Brick : public Primitive class Brick : public Primitive
{ {
Point<3> p1, p2, p3, p4; Point<3> p1, p2, p3, p4;
Vec<3> v12, v13, v14; Vec<3> v12, v13, v14;
// Array<OneSurfacePrimitive*> faces; // Array<OneSurfacePrimitive*> faces;
Array<Plane*> faces; Array<Plane*> faces;
public: public:
Brick (Point<3> ap1, Point<3> ap2, Point<3> ap3, Point<3> ap4); Brick (Point<3> ap1, Point<3> ap2, Point<3> ap3, Point<3> ap4);
virtual ~Brick (); virtual ~Brick ();
static Primitive * CreateDefault (); static Primitive * CreateDefault ();
@ -101,20 +105,22 @@ public:
virtual void Reduce (const BoxSphere<3> & box); virtual void Reduce (const BoxSphere<3> & box);
virtual void UnReduce (); virtual void UnReduce ();
protected: protected:
void CalcData(); void CalcData();
}; };
class OrthoBrick : public Brick class OrthoBrick : public Brick
{ {
protected: protected:
Point<3> pmin, pmax; Point<3> pmin, pmax;
public: public:
OrthoBrick (const Point<3> & ap1, const Point<3> & ap2); OrthoBrick (const Point<3> & ap1, const Point<3> & ap2);
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const; virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
virtual void Reduce (const BoxSphere<3> & box); virtual void Reduce (const BoxSphere<3> & box);
}; };
}
#endif #endif

View File

@ -13,8 +13,10 @@
#include <geometry2d.hpp> #include <geometry2d.hpp>
namespace netgen
{
#include "surface.hpp" #include "surface.hpp"
#include "solid.hpp" #include "solid.hpp"
#include "identify.hpp" #include "identify.hpp"
@ -22,16 +24,8 @@ namespace netgen
#include "csgeom.hpp" #include "csgeom.hpp"
#include "csgparser.hpp" #include "csgparser.hpp"
#ifndef SMALLLIB
#define _INCLUDE_MORE
#endif
//#ifdef LINUX
#define _INCLUDE_MORE
//#endif
#ifdef _INCLUDE_MORE
#include "triapprox.hpp" #include "triapprox.hpp"
#include "algprim.hpp" #include "algprim.hpp"
#include "brick.hpp" #include "brick.hpp"
#include "spline3d.hpp" #include "spline3d.hpp"
@ -45,7 +39,6 @@ namespace netgen
#include "specpoin.hpp" #include "specpoin.hpp"
#include "edgeflw.hpp" #include "edgeflw.hpp"
#include "meshsurf.hpp" #include "meshsurf.hpp"
#endif
}
#endif #endif

View File

@ -7,21 +7,24 @@
/* Date: 27. Nov. 97 */ /* Date: 27. Nov. 97 */
/**************************************************************************/ /**************************************************************************/
/** namespace netgen
{
/**
Constructive Solid Geometry Constructive Solid Geometry
*/ */
class TriangleApproximation; class TriangleApproximation;
class TATriangle; class TATriangle;
/** /**
A top level object is an entity to be meshed. A top level object is an entity to be meshed.
I can be either a solid, or one surface patch of a solid. I can be either a solid, or one surface patch of a solid.
*/ */
class TopLevelObject class TopLevelObject
{ {
Solid * solid; Solid * solid;
Surface * surface; Surface * surface;
@ -33,7 +36,7 @@ class TopLevelObject
int bc; // for surface patches, only int bc; // for surface patches, only
string bcname; string bcname;
public: public:
TopLevelObject (Solid * asolid, TopLevelObject (Solid * asolid,
Surface * asurface = NULL); Surface * asurface = NULL);
@ -79,26 +82,26 @@ public:
void SetBCName (string abc) { bcname = abc; } void SetBCName (string abc) { bcname = abc; }
const string GetBCName () const { return bcname; } const string GetBCName () const { return bcname; }
}; };
/** /**
CSGeometry has the whole geometric information CSGeometry has the whole geometric information
*/ */
class CSGeometry : public NetgenGeometry class CSGeometry : public NetgenGeometry
{ {
private: private:
/// all surfaces /// all surfaces
SYMBOLTABLE<Surface*> surfaces; SYMBOLTABLE<Surface*> surfaces;
public: public:
/// primitive of surface /// primitive of surface
Array<const Primitive*> surf2prim; Array<const Primitive*> surf2prim;
private: private:
Array<Surface*> delete_them; Array<Surface*> delete_them;
/// all named solids /// all named solids
@ -140,7 +143,7 @@ private:
/// filename of inputfile /// filename of inputfile
string filename; string filename;
public: public:
CSGeometry (); CSGeometry ();
CSGeometry (const string & afilename); CSGeometry (const string & afilename);
~CSGeometry (); ~CSGeometry ();
@ -310,9 +313,9 @@ public:
int perfstepsstart, int perfstepsend, char* optstring); int perfstepsstart, int perfstepsend, char* optstring);
virtual const Refinement & GetRefinement () const; virtual const Refinement & GetRefinement () const;
}; };
}
#endif #endif

View File

@ -2,10 +2,9 @@
#define _CSGPARSER_HPP #define _CSGPARSER_HPP
namespace netgen
{
//namespace netgen
//{
enum TOKEN_TYPE enum TOKEN_TYPE
{ {
TOK_MINUS = '-', TOK_LP = '(', OK_RP = ')', TOK_LSP = '[', TOK_RSP = ']', TOK_MINUS = '-', TOK_LP = '(', OK_RP = ')', TOK_LSP = '[', TOK_RSP = ']',
@ -94,14 +93,9 @@
//} }
#endif
#endif // _CSGPARSER_HPP

View File

@ -7,16 +7,20 @@
/* Date: 24. Jul. 96 */ /* Date: 24. Jul. 96 */
/**************************************************************************/ /**************************************************************************/
/* namespace netgen
{
/*
2D Curve repesentation 2D Curve repesentation
*/ */
/// ///
class Curve2d : public Manifold class Curve2d : public Manifold
{ {
public: public:
/// ///
@ -25,8 +29,8 @@ class Curve2d : public Manifold
virtual void NormalVector (const Point<2> & p, Vec<2> & n) 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; Point<2> center;
@ -41,12 +45,12 @@ class CircleCurve2d : public Curve2d
virtual void NormalVector (const Point<2> & p, Vec<2> & n) const; virtual void NormalVector (const Point<2> & p, Vec<2> & n) const;
}; };
/// ///
class QuadraticCurve2d : public Curve2d class QuadraticCurve2d : public Curve2d
{ {
/// ///
double cxx, cyy, cxy, cx, cy, c; double cxx, cyy, cxy, cx, cy, c;
public: public:
/// ///
QuadraticCurve2d (); QuadraticCurve2d ();
/// ///
@ -55,5 +59,9 @@ public:
virtual void Project (Point<2> & p) const; virtual void Project (Point<2> & p) const;
/// ///
virtual void NormalVector (const Point<2> & p, Vec<2> & n) const; virtual void NormalVector (const Point<2> & p, Vec<2> & n) const;
}; };
}
#endif #endif

View File

@ -7,20 +7,25 @@
/* Date: 01. Okt. 95 */ /* Date: 01. Okt. 95 */
/**************************************************************************/ /**************************************************************************/
/* namespace netgen
{
/*
Edge - following function and Edge - following function and
Projection to edge of implicitly given edge Projection to edge of implicitly given edge
*/ */
/** /**
Calculates edges. Calculates edges.
The edges of a solid geometry are computed. Special The edges of a solid geometry are computed. Special
points have to be given. points have to be given.
*/ */
extern void CalcEdges (const CSGeometry & geometry, extern void CalcEdges (const CSGeometry & geometry,
const Array<SpecialPoint> & specpoints, const Array<SpecialPoint> & specpoints,
double h, Mesh & mesh); double h, Mesh & mesh);
@ -28,8 +33,8 @@ extern void CalcEdges (const CSGeometry & geometry,
class EdgeCalculation class EdgeCalculation
{ {
const CSGeometry & geometry; const CSGeometry & geometry;
Array<SpecialPoint> & specpoints; Array<SpecialPoint> & specpoints;
Point3dTree * searchtree; Point3dTree * searchtree;
@ -38,7 +43,7 @@ class EdgeCalculation
double ideps; double ideps;
public: public:
EdgeCalculation (const CSGeometry & ageometry, EdgeCalculation (const CSGeometry & ageometry,
Array<SpecialPoint> & aspecpoints); Array<SpecialPoint> & aspecpoints);
@ -49,7 +54,7 @@ public:
void Calc(double h, Mesh & mesh); void Calc(double h, Mesh & mesh);
private: private:
void CalcEdges1 (double h, Mesh & mesh); void CalcEdges1 (double h, Mesh & mesh);
@ -94,11 +99,12 @@ private:
void FindClosedSurfaces (double h, Mesh & mesh); void FindClosedSurfaces (double h, Mesh & mesh);
public: public:
bool point_on_edge_problem; bool point_on_edge_problem;
}; };
}
#endif #endif

View File

@ -7,18 +7,22 @@
/* Date: 14. Oct. 96 */ /* Date: 14. Oct. 96 */
/**************************************************************************/ /**************************************************************************/
/*
namespace netgen
{
/*
Explicit 2D Curve repesentation Explicit 2D Curve repesentation
*/ */
/// ///
class ExplicitCurve2d : public Curve2d class ExplicitCurve2d : public Curve2d
{ {
public: public:
/// ///
ExplicitCurve2d (); ExplicitCurve2d ();
@ -59,12 +63,12 @@ public:
virtual void Reduce (const Point<2> & /* p */, double /* rad */) { }; virtual void Reduce (const Point<2> & /* p */, double /* rad */) { };
/// ///
virtual void UnReduce () { }; virtual void UnReduce () { };
}; };
/// ///
class BSplineCurve2d : public ExplicitCurve2d class BSplineCurve2d : public ExplicitCurve2d
{ {
/// ///
Array<Point<2> > points; Array<Point<2> > points;
/// ///
@ -72,7 +76,7 @@ class BSplineCurve2d : public ExplicitCurve2d
/// ///
int redlevel; int redlevel;
public: public:
/// ///
BSplineCurve2d (); BSplineCurve2d ();
/// ///
@ -101,9 +105,9 @@ public:
virtual void Reduce (const Point<2> & p, double rad); virtual void Reduce (const Point<2> & p, double rad);
/// ///
virtual void UnReduce (); virtual void UnReduce ();
}; };
}
#endif #endif

View File

@ -1,12 +1,14 @@
#ifndef _EXTRUSION_HPP #ifndef _EXTRUSION_HPP
#define _EXTRUSION_HPP #define _EXTRUSION_HPP
namespace netgen
class Extrusion;
class ExtrusionFace : public Surface
{ {
private:
class Extrusion;
class ExtrusionFace : public Surface
{
private:
const SplineSeg<2> * profile; const SplineSeg<2> * profile;
const SplineGeometry<3> * path; const SplineGeometry<3> * path;
Vec<3> glob_z_direction; Vec<3> glob_z_direction;
@ -30,18 +32,18 @@ private:
mutable Point<3> latest_point3d; mutable Point<3> latest_point3d;
private: private:
void Orthogonalize(const Vec<3> & v1, Vec<3> & v2) const; void Orthogonalize(const Vec<3> & v1, Vec<3> & v2) const;
void Init(void); void Init(void);
public: public:
double CalcProj(const Point<3> & point3d, Point<2> & point2d, double CalcProj(const Point<3> & point3d, Point<2> & point2d,
int seg) const; int seg) const;
void CalcProj(const Point<3> & point3d, Point<2> & point2d, void CalcProj(const Point<3> & point3d, Point<2> & point2d,
int & seg, double & t) const; int & seg, double & t) const;
public: public:
ExtrusionFace(const SplineSeg<2> * profile_in, ExtrusionFace(const SplineSeg<2> * profile_in,
const SplineGeometry<3> * path_in, const SplineGeometry<3> * path_in,
const Vec<3> & z_direction); const Vec<3> & z_direction);
@ -100,13 +102,13 @@ public:
Vec<3> & ex, Vec<3> & ey, Vec<3> & ez, Vec<3> & ex, Vec<3> & ey, Vec<3> & ez,
Vec<3> & dex, Vec<3> & dey, Vec<3> & dez) const; Vec<3> & dex, Vec<3> & dey, Vec<3> & dez) const;
}; };
class Extrusion : public Primitive class Extrusion : public Primitive
{ {
private: private:
const SplineGeometry<3> & path; const SplineGeometry<3> & path;
const SplineGeometry<2> & profile; const SplineGeometry<2> & profile;
@ -116,7 +118,7 @@ private:
mutable int latestfacenum; mutable int latestfacenum;
public: public:
Extrusion(const SplineGeometry<3> & path_in, Extrusion(const SplineGeometry<3> & path_in,
const SplineGeometry<2> & profile_in, const SplineGeometry<2> & profile_in,
const Vec<3> & z_dir); const Vec<3> & z_dir);
@ -146,7 +148,8 @@ public:
virtual void Reduce (const BoxSphere<3> & box); virtual void Reduce (const BoxSphere<3> & box);
virtual void UnReduce (); virtual void UnReduce ();
}; };
}
#endif //_EXTRUSION_HPP #endif //_EXTRUSION_HPP

View File

@ -7,16 +7,20 @@
/* Date: 14. Oct. 96 */ /* Date: 14. Oct. 96 */
/**************************************************************************/ /**************************************************************************/
/* namespace netgen
{
/*
Generalized Cylinder Generalized Cylinder
*/ */
/// ///
class GeneralizedCylinder : public Surface class GeneralizedCylinder : public Surface
{ {
/// ///
ExplicitCurve2d & crosssection; ExplicitCurve2d & crosssection;
/// ///
@ -29,7 +33,7 @@ class GeneralizedCylinder : public Surface
/// ///
Point<3> cp; Point<3> cp;
public: public:
/// ///
GeneralizedCylinder (ExplicitCurve2d & acrosssection, GeneralizedCylinder (ExplicitCurve2d & acrosssection,
Point<3> ap, Vec<3> ae1, Vec<3> ae2); Point<3> ap, Vec<3> ae1, Vec<3> ae2);
@ -59,6 +63,8 @@ public:
virtual void Reduce (const BoxSphere<3> & box); virtual void Reduce (const BoxSphere<3> & box);
/// ///
virtual void UnReduce (); virtual void UnReduce ();
}; };
}
#endif #endif

View File

@ -6,24 +6,28 @@
/* File: identify.hh */ /* File: identify.hh */
/* Author: Joachim Schoeberl */ /* Author: Joachim Schoeberl */
/* Date: 1. Aug. 99 */ /* Date: 1. Aug. 99 */
/**************************************************************************/ /**************************************************************************/
/**
namespace netgen
{
/**
Identify surfaces for periodic b.c. or Identify surfaces for periodic b.c. or
thin domains thin domains
*/ */
class SpecialPoint; class SpecialPoint;
class Identification class Identification
{ {
protected: protected:
const CSGeometry & geom; const CSGeometry & geom;
// identified faces, index sorted // identified faces, index sorted
INDEX_2_HASHTABLE<int> identfaces; INDEX_2_HASHTABLE<int> identfaces;
int nr; int nr;
public: public:
Identification (int anr, const CSGeometry & ageom); Identification (int anr, const CSGeometry & ageom);
virtual ~Identification (); virtual ~Identification ();
virtual void Print (ostream & ost) const = 0; virtual void Print (ostream & ost) const = 0;
@ -67,14 +71,14 @@ public:
virtual void GetIdentifiedFaces (Array<INDEX_2> & idfaces) const; 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 class PeriodicIdentification : public Identification
{ {
const Surface * s1; const Surface * s1;
const Surface * s2; const Surface * s2;
public: public:
PeriodicIdentification (int anr, PeriodicIdentification (int anr,
const CSGeometry & ageom, const CSGeometry & ageom,
const Surface * as1, const Surface * as1,
@ -96,13 +100,13 @@ public:
virtual void BuildSurfaceElements (Array<class Segment> & segs, virtual void BuildSurfaceElements (Array<class Segment> & segs,
class Mesh & mesh, class Mesh & mesh,
const Surface * surf); const Surface * surf);
}; };
/// ///
class TopLevelObject; class TopLevelObject;
class CloseSurfaceIdentification : public Identification class CloseSurfaceIdentification : public Identification
{ {
const Surface * s1; const Surface * s1;
const Surface * s2; const Surface * s2;
const TopLevelObject * domain; const TopLevelObject * domain;
@ -126,7 +130,7 @@ class CloseSurfaceIdentification : public Identification
Vec<3> direction; Vec<3> direction;
/// ///
bool usedirection; bool usedirection;
public: public:
CloseSurfaceIdentification (int anr, CloseSurfaceIdentification (int anr,
const CSGeometry & ageom, const CSGeometry & ageom,
const Surface * as1, const Surface * as1,
@ -171,15 +175,15 @@ public:
{ return *s1;} { return *s1;}
const Surface & GetSurface2(void) const const Surface & GetSurface2(void) const
{ return *s2;} { return *s2;}
}; };
class CloseEdgesIdentification : public Identification class CloseEdgesIdentification : public Identification
{ {
const Surface * facet; const Surface * facet;
const Surface * s1; const Surface * s1;
const Surface * s2; const Surface * s2;
public: public:
CloseEdgesIdentification (int anr, CloseEdgesIdentification (int anr,
const CSGeometry & ageom, const CSGeometry & ageom,
const Surface * afacet, const Surface * afacet,
@ -199,6 +203,8 @@ public:
virtual void BuildSurfaceElements (Array<class Segment> & segs, virtual void BuildSurfaceElements (Array<class Segment> & segs,
class Mesh & mesh, class Mesh & mesh,
const Surface * surf); const Surface * surf);
}; };
}
#endif #endif

View File

@ -7,16 +7,23 @@
/* Date: 7. Aug. 96 */ /* Date: 7. Aug. 96 */
/**************************************************************************/ /**************************************************************************/
/** namespace netgen
Basis class for manifolds in 2d and 3d
*/
class Manifold
{ {
public:
/**
Basis class for manifolds in 2d and 3d
*/
class Manifold
{
public:
/// ///
Manifold (); Manifold ();
/// ///
virtual ~Manifold (); virtual ~Manifold ();
}; };
}
#endif #endif

View File

@ -1,19 +1,22 @@
#ifndef FILE_MESHSURF #ifndef FILE_MESHSURF
#define FILE_MESHSURF #define FILE_MESHSURF
/// namespace netgen
class Meshing2Surfaces : public Meshing2
{ {
///
class Meshing2Surfaces : public Meshing2
{
/// ///
const Surface & surface; const Surface & surface;
public: public:
/// ///
// Meshing2Surfaces (const Surface & asurf); // Meshing2Surfaces (const Surface & asurf);
/// ///
Meshing2Surfaces (const Surface & asurf, const Box<3> & aboundingbox); Meshing2Surfaces (const Surface & asurf, const Box<3> & aboundingbox);
protected: protected:
/// ///
virtual void DefineTransformation (const Point3d & p1, const Point3d & p2, virtual void DefineTransformation (const Point3d & p1, const Point3d & p2,
const PointGeomInfo * geominfo1, const PointGeomInfo * geominfo1,
@ -30,17 +33,17 @@ protected:
double h); double h);
/// ///
virtual double CalcLocalH (const Point3d & p, double gh) const; virtual double CalcLocalH (const Point3d & p, double gh) const;
}; };
/// ///
class MeshOptimize2dSurfaces : public MeshOptimize2d class MeshOptimize2dSurfaces : public MeshOptimize2d
{ {
/// ///
const CSGeometry & geometry; const CSGeometry & geometry;
public: public:
/// ///
MeshOptimize2dSurfaces (const CSGeometry & ageometry); MeshOptimize2dSurfaces (const CSGeometry & ageometry);
@ -50,15 +53,15 @@ public:
virtual void ProjectPoint2 (INDEX surfind, INDEX surfind2, Point<3> & p) const; virtual void ProjectPoint2 (INDEX surfind, INDEX surfind2, Point<3> & p) const;
/// ///
virtual void GetNormalVector(INDEX surfind, const Point<3> & p, Vec<3> & n) const; virtual void GetNormalVector(INDEX surfind, const Point<3> & p, Vec<3> & n) const;
}; };
class RefinementSurfaces : public Refinement class RefinementSurfaces : public Refinement
{ {
const CSGeometry & geometry; const CSGeometry & geometry;
public: public:
RefinementSurfaces (const CSGeometry & ageometry); RefinementSurfaces (const CSGeometry & ageometry);
virtual ~RefinementSurfaces (); virtual ~RefinementSurfaces ();
@ -85,8 +88,9 @@ public:
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 #endif

View File

@ -8,14 +8,17 @@
/* Date: 19. Mar. 2000 */ /* Date: 19. Mar. 2000 */
/**************************************************************************/ /**************************************************************************/
/* namespace netgen
{
/*
Polyhedral primitive Polyhedral primitive
*/ */
class Polyhedra : public Primitive class Polyhedra : public Primitive
{ {
class Face { class Face {
public: public:
int pnums[3]; int pnums[3];
@ -43,7 +46,7 @@ class Polyhedra : public Primitive
double eps_base1; double eps_base1;
public: public:
Polyhedra (); Polyhedra ();
virtual ~Polyhedra (); virtual ~Polyhedra ();
static Primitive * CreateDefault (); static Primitive * CreateDefault ();
@ -91,9 +94,11 @@ public:
void GetPolySurfs(Array < Array<int> * > & polysurfs); void GetPolySurfs(Array < Array<int> * > & polysurfs);
protected: protected:
int FaceBoxIntersection (int fnr, const BoxSphere<3> & box) const; int FaceBoxIntersection (int fnr, const BoxSphere<3> & box) const;
// void CalcData(); // void CalcData();
}; };
}
#endif #endif

View File

@ -1,11 +1,14 @@
#ifndef _REVOLUTION_HPP #ifndef _REVOLUTION_HPP
#define _REVOLUTION_HPP #define _REVOLUTION_HPP
class Revolution; namespace netgen
class RevolutionFace : public Surface
{ {
private:
class Revolution;
class RevolutionFace : public Surface
{
private:
bool isfirst, islast; bool isfirst, islast;
const SplineSeg<2> * spline; const SplineSeg<2> * spline;
bool deletable; bool deletable;
@ -22,16 +25,16 @@ private:
Array < Point<2>* > checklines_start; Array < Point<2>* > checklines_start;
Array < Vec<2>* > checklines_normal; Array < Vec<2>* > checklines_normal;
private: private:
void Init (void); void Init (void);
public: public:
void CalcProj(const Point<3> & point3d, Point<2> & point2d) const; void CalcProj(const Point<3> & point3d, Point<2> & point2d) const;
void CalcProj(const Point<3> & point3d, Point<2> & point2d, void CalcProj(const Point<3> & point3d, Point<2> & point2d,
const Vec<3> & vector3d, Vec<2> & vector2d) const; const Vec<3> & vector3d, Vec<2> & vector2d) const;
void CalcProj0(const Vec<3> & point3d_minus_p0, Point<2> & point2d) const; void CalcProj0(const Vec<3> & point3d_minus_p0, Point<2> & point2d) const;
public: public:
RevolutionFace(const SplineSeg<2> & spline_in, RevolutionFace(const SplineSeg<2> & spline_in,
const Point<3> & p, const Point<3> & p,
const Vec<3> & vec, const Vec<3> & vec,
@ -75,20 +78,20 @@ public:
void GetRawData(Array<double> & data) const; void GetRawData(Array<double> & data) const;
}; };
/* /*
Primitive of revolution Primitive of revolution
*/ */
class Revolution : public Primitive class Revolution : public Primitive
{ {
private: private:
Point<3> p0,p1; Point<3> p0,p1;
Vec<3> v_axis; Vec<3> v_axis;
const SplineGeometry<2> & splinecurve; const SplineGeometry<2> & splinecurve;
@ -103,7 +106,7 @@ private:
mutable int intersecting_face; mutable int intersecting_face;
public: public:
Revolution(const Point<3> & p0_in, Revolution(const Point<3> & p0_in,
const Point<3> & p1_in, const Point<3> & p1_in,
const SplineGeometry<2> & spline_in); const SplineGeometry<2> & spline_in);
@ -142,8 +145,9 @@ public:
virtual void UnReduce (); virtual void UnReduce ();
}; };
}
#endif #endif

View File

@ -7,38 +7,42 @@
/* Date: 25. Sep. 99 */ /* Date: 25. Sep. 99 */
/**************************************************************************/ /**************************************************************************/
/** namespace netgen
{
/**
Control for local refinement Control for local refinement
*/ */
/** /**
Singular Face. Singular Face.
Causes a bounday layer mesh refinement. Causes a bounday layer mesh refinement.
All elements in subdomain domnr will get a boundary layer All elements in subdomain domnr will get a boundary layer
on faces sharing the solid sol on faces sharing the solid sol
*/ */
class SingularFace class SingularFace
{ {
public: public:
int domnr; int domnr;
const Solid *sol; const Solid *sol;
double factor; double factor;
// Array<Point<3> > points; // Array<Point<3> > points;
// Array<INDEX_2> segms; // Array<INDEX_2> segms;
public: public:
SingularFace (int adomnr, const Solid * asol, double sf) SingularFace (int adomnr, const Solid * asol, double sf)
: domnr(adomnr), sol(asol), factor(sf) { ; } : domnr(adomnr), sol(asol), factor(sf) { ; }
const Solid * GetSolid() const { return sol; } const Solid * GetSolid() const { return sol; }
int GetDomainNr () const { return domnr; } int GetDomainNr () const { return domnr; }
}; };
/// ///
class SingularEdge class SingularEdge
{ {
public: public:
double beta; double beta;
int domnr; int domnr;
const CSGeometry& geom; const CSGeometry& geom;
@ -48,31 +52,33 @@ public:
double factor; double factor;
double maxhinit; double maxhinit;
public: public:
SingularEdge (double abeta, int adomnr, SingularEdge (double abeta, int adomnr,
const CSGeometry & ageom, const CSGeometry & ageom,
const Solid * asol1, const Solid * asol2, double sf, const Solid * asol1, const Solid * asol2, double sf,
const double maxh_at_initialization = -1); const double maxh_at_initialization = -1);
void FindPointsOnEdge (class Mesh & mesh); void FindPointsOnEdge (class Mesh & mesh);
void SetMeshSize (class Mesh & mesh, double globalh); void SetMeshSize (class Mesh & mesh, double globalh);
}; };
/// ///
class SingularPoint class SingularPoint
{ {
public: public:
double beta; double beta;
const Solid *sol1, *sol2, *sol3; const Solid *sol1, *sol2, *sol3;
Array<Point<3> > points; Array<Point<3> > points;
double factor; double factor;
public: public:
SingularPoint (double abeta, const Solid * asol1, const Solid * asol2, SingularPoint (double abeta, const Solid * asol1, const Solid * asol2,
const Solid * asol3, double sf); const Solid * asol3, double sf);
void FindPoints (class Mesh & mesh); void FindPoints (class Mesh & mesh);
void SetMeshSize (class Mesh & mesh, double globalh); void SetMeshSize (class Mesh & mesh, double globalh);
}; };
}
#endif #endif

View File

@ -7,34 +7,38 @@
/* Date: 1. Dez. 95 */ /* Date: 1. Dez. 95 */
/**************************************************************************/ /**************************************************************************/
/* namespace netgen
{
/*
Constructive Solid Model (csg) Constructive Solid Model (csg)
*/ */
class Solid; class Solid;
class SolidIterator class SolidIterator
{ {
public: public:
SolidIterator () { ; } SolidIterator () { ; }
virtual ~SolidIterator () { ; } virtual ~SolidIterator () { ; }
virtual void Do (Solid * sol) = 0; virtual void Do (Solid * sol) = 0;
}; };
class Solid class Solid
{ {
public: public:
typedef enum optyp1 { TERM, TERM_REF, SECTION, UNION, SUB, ROOT /*, DUMMY */ } optyp; typedef enum optyp1 { TERM, TERM_REF, SECTION, UNION, SUB, ROOT /*, DUMMY */ } optyp;
private: private:
char * name; char * name;
Primitive * prim; Primitive * prim;
Solid * s1, * s2; Solid * s1, * s2;
@ -45,7 +49,7 @@ private:
// static int cntnames; // static int cntnames;
public: public:
Solid (Primitive * aprim); Solid (Primitive * aprim);
Solid (optyp aop, Solid * as1, Solid * as2 = NULL); Solid (optyp aop, Solid * as1, Solid * as2 = NULL);
~Solid (); ~Solid ();
@ -151,7 +155,7 @@ public:
} }
protected: protected:
/// ///
void RecBoundaries (const Point<3> & p, Array<int> & bounds, void RecBoundaries (const Point<3> & p, Array<int> & bounds,
@ -196,24 +200,24 @@ protected:
friend class ClearVisitedIt; friend class ClearVisitedIt;
friend class RemoveDummyIterator; friend class RemoveDummyIterator;
friend class CSGeometry; friend class CSGeometry;
}; };
inline ostream & operator<< (ostream & ost, const Solid & sol) inline ostream & operator<< (ostream & ost, const Solid & sol)
{ {
sol.Print (ost); sol.Print (ost);
return ost; return ost;
} }
class ReducePrimitiveIterator : public SolidIterator class ReducePrimitiveIterator : public SolidIterator
{ {
const BoxSphere<3> & box; const BoxSphere<3> & box;
public: public:
ReducePrimitiveIterator (const BoxSphere<3> & abox) ReducePrimitiveIterator (const BoxSphere<3> & abox)
: SolidIterator(), box(abox) { ; } : SolidIterator(), box(abox) { ; }
virtual ~ReducePrimitiveIterator () { ; } virtual ~ReducePrimitiveIterator () { ; }
@ -222,12 +226,12 @@ public:
if (sol -> GetPrimitive()) if (sol -> GetPrimitive())
sol -> GetPrimitive() -> Reduce (box); sol -> GetPrimitive() -> Reduce (box);
} }
}; };
class UnReducePrimitiveIterator : public SolidIterator class UnReducePrimitiveIterator : public SolidIterator
{ {
public: public:
UnReducePrimitiveIterator () { ; } UnReducePrimitiveIterator () { ; }
virtual ~UnReducePrimitiveIterator () { ; } virtual ~UnReducePrimitiveIterator () { ; }
virtual void Do (Solid * sol) virtual void Do (Solid * sol)
@ -235,7 +239,8 @@ public:
if (sol -> GetPrimitive()) if (sol -> GetPrimitive())
sol -> GetPrimitive() -> UnReduce (); sol -> GetPrimitive() -> UnReduce ();
} }
}; };
}
#endif #endif

View File

@ -8,19 +8,22 @@
/* Date: 01. Okt. 95 */ /* Date: 01. Okt. 95 */
/**************************************************************************/ /**************************************************************************/
/* namespace netgen
Special Point Calculation
*/
class Surface;
class Solid;
/// Special point.
class SpecialPoint
{ {
public:
/*
Special Point Calculation
*/
class Surface;
class Solid;
/// Special point.
class SpecialPoint
{
public:
/// coordinates /// coordinates
Point<3> p; Point<3> p;
/// tangential to edge /// tangential to edge
@ -56,21 +59,21 @@ public:
{ {
return ( (s1 == as1 && s2 == as2) || (s1 == as2 && s2 == as1) ); return ( (s1 == as1 && s2 == as2) || (s1 == as2 && s2 == as1) );
} }
}; };
inline ostream & operator<< (ostream & ost, const SpecialPoint & sp) inline ostream & operator<< (ostream & ost, const SpecialPoint & sp)
{ {
sp.Print (ost); sp.Print (ost);
return ost; return ost;
} }
/// ///
class SpecialPointCalculation class SpecialPointCalculation
{ {
private: private:
/// ///
const CSGeometry * geometry; const CSGeometry * geometry;
/// ///
@ -87,7 +90,7 @@ private:
double ideps; double ideps;
public: public:
/// ///
SpecialPointCalculation (); SpecialPointCalculation ();
@ -103,7 +106,7 @@ public:
Array<MeshPoint> & points, Array<MeshPoint> & points,
Array<SpecialPoint> & specpoints); Array<SpecialPoint> & specpoints);
protected: protected:
/// ///
void CalcSpecialPointsRec (const Solid * sol, int layer, void CalcSpecialPointsRec (const Solid * sol, int layer,
const BoxSphere<3> & box, const BoxSphere<3> & box,
@ -167,7 +170,9 @@ protected:
const Plane * plane2, const Plane * plane2,
const QuadraticSurface * quadratic, const QuadraticSurface * quadratic,
Array<Point<3> > & pts); Array<Point<3> > & pts);
}; };
}
#endif #endif

View File

@ -1,5 +1,8 @@
/// namespace netgen
class splinesegment3d {
///
class splinesegment3d
{ {
/// ///
Point<3> p1, p2, p3; Point<3> p1, p2, p3;
@ -20,8 +23,8 @@ class splinesegment3d
const Point<3> & P3() const { return p3; } const Point<3> & P3() const { return p3; }
}; };
/// ///
class spline3d class spline3d
{ {
/// ///
Array<splinesegment3d *> segments; Array<splinesegment3d *> segments;
@ -49,14 +52,14 @@ class spline3d
const Point<3> & P3(int i) const { return segments.Get(i)->P3(); } const Point<3> & P3(int i) const { return segments.Get(i)->P3(); }
}; };
/// ///
class splinetube : public Surface class splinetube : public Surface
{ {
/// ///
const spline3d & middlecurve; const spline3d & middlecurve;
/// ///
double r; double r;
/// Vec<3> ex, ey, ez; /// Vec<3> ex, ey, ez;
Vec<2> e2x, e2y; Vec<2> e2x, e2y;
/// ///
Point<3> cp; Point<3> cp;
@ -74,7 +77,7 @@ class splinetube : public Surface
/// ///
virtual void Project (Point<3> & p) 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 /// 0 .. no, 1 .. yes, 2 .. maybe
virtual int BoxInSolid (const BoxSphere<3> & box) const; virtual int BoxInSolid (const BoxSphere<3> & box) const;
@ -90,3 +93,7 @@ class splinetube : public Surface
/// ///
virtual void Print (ostream & str) const; virtual void Print (ostream & str) const;
}; };
}

View File

@ -8,13 +8,14 @@
/**************************************************************************/ /**************************************************************************/
namespace netgen
{
// class DenseMatrix;
// class Box3dSphere;
class TriangleApproximation;
// class DenseMatrix; /**
// class Box3dSphere;
class TriangleApproximation;
/**
Basis class for implicit surface geometry. Basis class for implicit surface geometry.
This class is used for generation of surface meshes This class is used for generation of surface meshes
in NETGEN as well as for mesh refinement in FEPP. in NETGEN as well as for mesh refinement in FEPP.
@ -23,9 +24,9 @@ class TriangleApproximation;
class Surface class Surface
{ {
protected: protected:
/// invert normal vector /// invert normal vector
bool inverse; bool inverse;
/// maximal h in surface /// maximal h in surface
@ -37,7 +38,7 @@ protected:
/// ///
string bcname; string bcname;
public: public:
Surface (); Surface ();
/** @name Tangential plane. /** @name Tangential plane.
The tangential plane is used for surface mesh generation. The tangential plane is used for surface mesh generation.
@ -45,7 +46,7 @@ public:
virtual ~Surface(); virtual ~Surface();
protected: protected:
/** @name Points in the surface defining tangential plane. /** @name Points in the surface defining tangential plane.
Tangential plane is taken in p1, the local x-axis Tangential plane is taken in p1, the local x-axis
is directed to p2. is directed to p2.
@ -65,7 +66,7 @@ protected:
/// outer normal direction /// outer normal direction
Vec<3> ez; Vec<3> ez;
//@} //@}
public: public:
void SetName (const char * aname); void SetName (const char * aname);
const char * Name () const { return name; } const char * Name () const { return name; }
@ -196,22 +197,22 @@ public:
}; };
inline ostream & operator<< (ostream & ost, const Surface & surf) inline ostream & operator<< (ostream & ost, const Surface & surf)
{ {
surf.Print(ost); surf.Print(ost);
return ost; return ost;
} }
typedef enum { IS_OUTSIDE = 0, IS_INSIDE = 1, DOES_INTERSECT = 2} typedef enum { IS_OUTSIDE = 0, IS_INSIDE = 1, DOES_INTERSECT = 2}
INSOLID_TYPE; INSOLID_TYPE;
class DummySurface : public Surface class DummySurface : public Surface
{ {
virtual double CalcFunctionValue (const Point<3> & point) const virtual double CalcFunctionValue (const Point<3> & point) const
{ return 0; } { return 0; }
@ -229,14 +230,14 @@ class DummySurface : public Surface
virtual void Print (ostream & ost) const virtual void Print (ostream & ost) const
{ ost << "dummy surface"; } { ost << "dummy surface"; }
}; };
class Primitive class Primitive
{ {
public: public:
Primitive (); Primitive ();
@ -319,14 +320,14 @@ public:
virtual Primitive * Copy () const; virtual Primitive * Copy () const;
virtual void Transform (Transformation<3> & trans); virtual void Transform (Transformation<3> & trans);
}; };
class OneSurfacePrimitive : public Surface, public Primitive class OneSurfacePrimitive : public Surface, public Primitive
{ {
public: public:
OneSurfacePrimitive(); OneSurfacePrimitive();
~OneSurfacePrimitive(); ~OneSurfacePrimitive();
@ -354,23 +355,24 @@ public:
virtual int GetNSurfaces() const; virtual int GetNSurfaces() const;
virtual Surface & GetSurface (int i = 0); virtual Surface & GetSurface (int i = 0);
virtual const Surface & GetSurface (int i = 0) const; virtual const Surface & GetSurface (int i = 0) const;
}; };
/** /**
Projects point to edge. Projects point to edge.
The point hp is projected to the edge descibed by f1 and f2. The point hp is projected to the edge descibed by f1 and f2.
It is assumed that the edge is non-degenerated, and the It is assumed that the edge is non-degenerated, and the
(generalized) Newton method converges. (generalized) Newton method converges.
*/ */
extern void ProjectToEdge (const Surface * f1, extern void ProjectToEdge (const Surface * f1,
const Surface * f2, const Surface * f2,
Point<3> & hp); Point<3> & hp);
}
#endif #endif

View File

@ -7,16 +7,20 @@
/* Date: 2. Mar. 98 */ /* Date: 2. Mar. 98 */
/**************************************************************************/ /**************************************************************************/
/**
Triangulated approxiamtion to true surface
*/
namespace netgen
class TATriangle
{ {
/**
Triangulated approxiamtion to true surface
*/
class TATriangle
{
int pi[3]; int pi[3];
int surfind; int surfind;
public: public:
TATriangle () { ; } TATriangle () { ; }
TATriangle (int si, int pi1, int pi2, int pi3) TATriangle (int si, int pi1, int pi2, int pi3)
@ -27,16 +31,16 @@ public:
int & operator[] (int i) { return pi[i]; } int & operator[] (int i) { return pi[i]; }
const int & operator[] (int i) const { return pi[i]; } const int & operator[] (int i) const { return pi[i]; }
}; };
class TriangleApproximation class TriangleApproximation
{ {
Array<Point<3> > points; Array<Point<3> > points;
Array<Vec<3> > normals; Array<Vec<3> > normals;
Array<TATriangle> trigs; Array<TATriangle> trigs;
public: public:
TriangleApproximation(); TriangleApproximation();
int GetNP () const { return points.Size(); } int GetNP () const { return points.Size(); }
int GetNT () const { return trigs.Size(); } int GetNT () const { return trigs.Size(); }
@ -52,6 +56,8 @@ public:
void RemoveUnusedPoints (); void RemoveUnusedPoints ();
friend class CSGeometry; friend class CSGeometry;
}; };
}
#endif #endif

View File

@ -195,20 +195,33 @@ namespace netgen
Meshing2 meshing (Box<3> (pmin, pmax)); 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++) for (PointIndex pi = PointIndex::BASE; pi < bnp+PointIndex::BASE; pi++)
if ( (*mesh)[pi].GetLayer() == geometry.GetDomainLayer(domnr))
{
meshing.AddPoint ( (*mesh)[pi], pi); meshing.AddPoint ( (*mesh)[pi], pi);
cnt++;
compress[pi] = cnt;
}
PointGeomInfo gi; PointGeomInfo gi;
gi.trignum = 1; gi.trignum = 1;
for (SegmentIndex si = 0; si < mesh->GetNSeg(); si++) for (SegmentIndex si = 0; si < mesh->GetNSeg(); si++)
{ {
if ( (*mesh)[si].domin == domnr) 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) 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);
}
} }

View File

@ -8,11 +8,14 @@
/**************************************************************************/ /**************************************************************************/
class Refinement2d : public Refinement namespace netgen
{ {
class Refinement2d : public Refinement
{
const SplineGeometry2d & geometry; const SplineGeometry2d & geometry;
public: public:
Refinement2d (const SplineGeometry2d & ageometry); Refinement2d (const SplineGeometry2d & ageometry);
virtual ~Refinement2d (); virtual ~Refinement2d ();
@ -39,10 +42,10 @@ public:
virtual void ProjectToEdge (Point<3> & p, int surfi1, int surfi2, virtual void ProjectToEdge (Point<3> & p, int surfi1, int surfi2,
const EdgePointGeomInfo & egi) const; const EdgePointGeomInfo & egi) const;
}; };
}

View File

@ -10,11 +10,10 @@
#include <myadt.hpp> #include <myadt.hpp>
#include <gprim.hpp> #include <gprim.hpp>
namespace netgen
{
#include "spline.hpp" #include "spline.hpp"
#include "splinegeometry.hpp" #include "splinegeometry.hpp"
#include "geom2dmesh.hpp" #include "geom2dmesh.hpp"
}
#endif #endif

View File

@ -7,6 +7,9 @@
/* Date: 24. Jul. 96 */ /* Date: 24. Jul. 96 */
/**************************************************************************/ /**************************************************************************/
namespace netgen
{
void CalcPartition (double l, double h, double h1, double h2, void CalcPartition (double l, double h, double h1, double h2,
double hcurve, double elto0, Array<double> & points); double hcurve, double elto0, Array<double> & points);
@ -60,6 +63,14 @@ public:
bool hpref_left; bool hpref_left;
/// perfrom anisotropic refinement (hp-refinement) to edge /// perfrom anisotropic refinement (hp-refinement) to edge
bool hpref_right; bool hpref_right;
///
int layer;
SplineSeg ()
{
layer = 1;
}
/// calculates length of curve /// calculates length of curve
virtual double Length () const; 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); Vec<3> v (1e-4*h, 1e-4*h, 1e-4*h);
searchtree.GetIntersecting (oldmark3 - v, oldmark3 + v, locsearch); 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); 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; for (PointIndex pk = PointIndex::BASE;
pk < mesh.GetNP()+PointIndex::BASE; pk++) pk < mesh.GetNP()+PointIndex::BASE; pk++)
@ -363,20 +382,15 @@ void SplineSeg<D> :: Partition (double h, double elto0,
if (pi1 == -1) if (pi1 == -1)
{ {
pi1 = mesh.AddPoint(oldmark3); pi1 = mesh.AddPoint(oldmark3, layer);
searchtree.Insert (oldmark3, pi1); searchtree.Insert (oldmark3, pi1);
} }
if (pi2 == -1) if (pi2 == -1)
{ {
pi2 = mesh.AddPoint(mark3); pi2 = mesh.AddPoint(mark3, layer);
searchtree.Insert (mark3, pi2); searchtree.Insert (mark3, pi2);
} }
/*
cout << "pi1 = " << pi1 << endl;
cout << "pi2 = " << pi2 << endl;
cout << "leftdom = " << leftdom << ", rightdom = " << rightdom << endl;
*/
Segment seg; Segment seg;
seg.edgenr = segnr; seg.edgenr = segnr;
seg.si = bc; // segnr; seg.si = bc; // segnr;
@ -854,6 +868,9 @@ typedef CircleSeg<2> CircleSegment;
typedef DiscretePointsSeg<2> DiscretePointsSegment; typedef DiscretePointsSeg<2> DiscretePointsSegment;
}
#endif #endif

View File

@ -295,6 +295,8 @@ void SplineGeometry<D> :: LoadDataV2 ( ifstream & infile )
quadmeshing = false; quadmeshing = false;
tensormeshing.SetSize ( numdomains ); tensormeshing.SetSize ( numdomains );
tensormeshing = false; tensormeshing = false;
layer.SetSize ( numdomains );
layer = 1;
TestComment ( infile ); TestComment ( infile );
@ -329,6 +331,7 @@ void SplineGeometry<D> :: LoadDataV2 ( ifstream & infile )
maxh[domainnr-1] = flags.GetNumFlag ( "maxh", 1000); maxh[domainnr-1] = flags.GetNumFlag ( "maxh", 1000);
if (flags.GetDefineFlag("quad")) quadmeshing[domainnr-1] = true; if (flags.GetDefineFlag("quad")) quadmeshing[domainnr-1] = true;
if (flags.GetDefineFlag("tensor")) tensormeshing[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); pmax(j) = bbox.PMax()(j);
} }
if (printmessage_importance>0)
cout << "searchtree from " << pmin << " to " << pmax << endl;
Point3dTree searchtree (pmin, pmax); 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++) for (int i = 0; i < splines.Size(); i++)
if (splines[i]->copyfrom == -1) if (splines[i]->copyfrom == -1)
{ {

View File

@ -13,29 +13,31 @@ in geom2d only 2D - Geometry classes (with material properties etc.)
#ifndef _FILE_SPLINEGEOMETRY #ifndef _FILE_SPLINEGEOMETRY
#define _FILE_SPLINEGEOMETRY #define _FILE_SPLINEGEOMETRY
#include "../csg/csgparser.hpp" #include "../csg/csgparser.hpp"
///
extern void LoadBoundarySplines (const char * filename, namespace netgen
{
///
extern void LoadBoundarySplines (const char * filename,
Array < GeomPoint<2> > & geompoints, Array < GeomPoint<2> > & geompoints,
Array < SplineSeg<2>* > & splines, Array < SplineSeg<2>* > & splines,
double & elto0); double & elto0);
/// ///
extern void PartitionBoundary (const Array < SplineSeg<2>* > & splines, extern void PartitionBoundary (const Array < SplineSeg<2>* > & splines,
double h, double elto0, double h, double elto0,
Mesh & mesh2d); Mesh & mesh2d);
// allow to turn off messages: cover all couts !! // allow to turn off messages: cover all couts !!
extern int printmessage_importance; extern int printmessage_importance;
template < int D > template < int D >
class SplineGeometry class SplineGeometry
{ {
Array < GeomPoint<D> > geompoints; Array < GeomPoint<D> > geompoints;
Array < SplineSeg<D>* > splines; Array < SplineSeg<D>* > splines;
double elto0; double elto0;
@ -44,14 +46,15 @@ class SplineGeometry
Array<double> maxh; Array<double> maxh;
Array<bool> quadmeshing; Array<bool> quadmeshing;
Array<bool> tensormeshing; Array<bool> tensormeshing;
Array<int> layer;
private: private:
void AppendSegment(SplineSeg<D> * spline, const int leftdomain, const int rightdomain, void AppendSegment(SplineSeg<D> * spline, const int leftdomain, const int rightdomain,
const int bc, const int bc,
const double reffac, const bool hprefleft, const bool hprefright, const double reffac, const bool hprefleft, const bool hprefright,
const int copyfrom); const int copyfrom);
public: public:
~SplineGeometry(); ~SplineGeometry();
int Load (const Array<double> & raw_data, const int startpos = 0); int Load (const Array<double> & raw_data, const int startpos = 0);
@ -121,31 +124,37 @@ public:
if ( tensormeshing.Size() ) return tensormeshing[domnr-1]; if ( tensormeshing.Size() ) return tensormeshing[domnr-1];
else return false; 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, void MeshFromSpline2D (SplineGeometry<2> & geometry,
Mesh *& mesh, Mesh *& mesh,
MeshingParameters & mp); MeshingParameters & mp);
class SplineGeometry2d : public SplineGeometry<2>, public NetgenGeometry class SplineGeometry2d : public SplineGeometry<2>, public NetgenGeometry
{ {
public: public:
virtual ~SplineGeometry2d(); virtual ~SplineGeometry2d();
virtual int GenerateMesh (Mesh*& mesh, virtual int GenerateMesh (Mesh*& mesh,
int perfstepsstart, int perfstepsend, char* optstring); int perfstepsstart, int perfstepsend, char* optstring);
virtual const Refinement & GetRefinement () const; virtual const Refinement & GetRefinement () const;
}; };
}
#endif // _FILE_SPLINEGEOMETRY #endif // _FILE_SPLINEGEOMETRY

View File

@ -80,6 +80,15 @@ namespace netgen
class Ng_Point
{
public:
double * pt;
double operator[] (int i)
{ return pt[i]; }
};
DLL_HEADER Ng_Point Ng_GetPoint (int nr);
@ -130,7 +139,6 @@ namespace netgen
/// Curved Elements: /// Curved Elements:
/// xi..... DIM_EL local coordinates /// xi..... DIM_EL local coordinates
/// sxi ... step xi /// sxi ... step xi

View File

@ -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 <> template <>
DLL_HEADER int Ng_GetElementIndex<1> (int nr) DLL_HEADER int Ng_GetElementIndex<1> (int nr)
{ {
@ -175,9 +182,6 @@ namespace netgen
} }
template <> template <>
DLL_HEADER void Ng_MultiElementTransformation<3,3> (int elnr, int npts, DLL_HEADER void Ng_MultiElementTransformation<3,3> (int elnr, int npts,
const double * xi, int sxi, const double * xi, int sxi,