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,11 +3,14 @@
/**************************************************************************/
/* File: algprim.hh */
/* File: algprim.hpp */
/* Author: Joachim Schoeberl */
/* Date: 1. Dez. 95 */
/**************************************************************************/
namespace netgen
{
/*
Quadric Surfaces (Plane, Sphere, Cylinder)
@ -430,7 +433,7 @@ public:
/// ...end
}

View File

@ -8,6 +8,10 @@
/* Date: 11. Mar. 98 */
/**************************************************************************/
namespace netgen
{
/*
brick geometry, has several surfaces
@ -117,4 +121,6 @@ public:
virtual void Reduce (const BoxSphere<3> & box);
};
}
#endif

View File

@ -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

View File

@ -7,6 +7,9 @@
/* Date: 27. Nov. 97 */
/**************************************************************************/
namespace netgen
{
/**
Constructive Solid Geometry
*/
@ -312,7 +315,7 @@ public:
virtual const Refinement & GetRefinement () const;
};
}
#endif

View File

@ -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

View File

@ -7,6 +7,10 @@
/* Date: 24. Jul. 96 */
/**************************************************************************/
namespace netgen
{
/*
2D Curve repesentation
@ -56,4 +60,8 @@ public:
///
virtual void NormalVector (const Point<2> & p, Vec<2> & n) const;
};
}
#endif

View File

@ -7,6 +7,11 @@
/* Date: 01. Okt. 95 */
/**************************************************************************/
namespace netgen
{
/*
Edge - following function and
@ -99,6 +104,7 @@ public:
};
}
#endif

View File

@ -7,6 +7,10 @@
/* Date: 14. Oct. 96 */
/**************************************************************************/
namespace netgen
{
/*
Explicit 2D Curve repesentation
@ -103,7 +107,7 @@ public:
virtual void UnReduce ();
};
}
#endif

View File

@ -1,6 +1,8 @@
#ifndef _EXTRUSION_HPP
#define _EXTRUSION_HPP
namespace netgen
{
class Extrusion;
@ -148,5 +150,6 @@ public:
};
}
#endif //_EXTRUSION_HPP

View File

@ -7,6 +7,10 @@
/* Date: 14. Oct. 96 */
/**************************************************************************/
namespace netgen
{
/*
Generalized Cylinder
@ -61,4 +65,6 @@ public:
virtual void UnReduce ();
};
}
#endif

View File

@ -8,6 +8,10 @@
/* Date: 1. Aug. 99 */
/**************************************************************************/
namespace netgen
{
/**
Identify surfaces for periodic b.c. or
thin domains
@ -201,4 +205,6 @@ public:
const Surface * surf);
};
}
#endif

View File

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

View File

@ -1,6 +1,9 @@
#ifndef FILE_MESHSURF
#define FILE_MESHSURF
namespace netgen
{
///
class Meshing2Surfaces : public Meshing2
{
@ -87,6 +90,7 @@ public:
};
}
#endif

View File

@ -8,6 +8,9 @@
/* Date: 19. Mar. 2000 */
/**************************************************************************/
namespace netgen
{
/*
Polyhedral primitive
@ -96,4 +99,6 @@ protected:
// void CalcData();
};
}
#endif

View File

@ -1,6 +1,9 @@
#ifndef _REVOLUTION_HPP
#define _REVOLUTION_HPP
namespace netgen
{
class Revolution;
class RevolutionFace : public Surface
@ -144,6 +147,7 @@ public:
};
}
#endif

View File

@ -7,6 +7,10 @@
/* Date: 25. Sep. 99 */
/**************************************************************************/
namespace netgen
{
/**
Control for local refinement
*/
@ -74,5 +78,7 @@ public:
void SetMeshSize (class Mesh & mesh, double globalh);
};
}
#endif

View File

@ -7,6 +7,10 @@
/* Date: 1. Dez. 95 */
/**************************************************************************/
namespace netgen
{
/*
Constructive Solid Model (csg)
@ -237,5 +241,6 @@ public:
}
};
}
#endif

View File

@ -8,6 +8,9 @@
/* Date: 01. Okt. 95 */
/**************************************************************************/
namespace netgen
{
/*
Special Point Calculation
@ -169,6 +172,8 @@ protected:
Array<Point<3> > & pts);
};
}
#endif

View File

@ -1,3 +1,6 @@
namespace netgen
{
///
class splinesegment3d
{
@ -90,3 +93,7 @@ class splinetube : public Surface
///
virtual void Print (ostream & str) const;
};
}

View File

@ -8,7 +8,8 @@
/**************************************************************************/
namespace netgen
{
// class DenseMatrix;
// class Box3dSphere;
@ -372,5 +373,6 @@ extern void ProjectToEdge (const Surface * f1,
Point<3> & hp);
}
#endif

View File

@ -7,6 +7,10 @@
/* Date: 2. Mar. 98 */
/**************************************************************************/
namespace netgen
{
/**
Triangulated approxiamtion to true surface
*/
@ -54,4 +58,6 @@ public:
friend class CSGeometry;
};
}
#endif

View File

@ -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++)
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);
}
}

View File

@ -8,6 +8,9 @@
/**************************************************************************/
namespace netgen
{
class Refinement2d : public Refinement
{
const SplineGeometry2d & geometry;
@ -42,7 +45,7 @@ public:
};
}

View File

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

View File

@ -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

View File

@ -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)
{

View File

@ -13,12 +13,14 @@ in geom2d only 2D - Geometry classes (with material properties etc.)
#ifndef _FILE_SPLINEGEOMETRY
#define _FILE_SPLINEGEOMETRY
#include "../csg/csgparser.hpp"
namespace netgen
{
///
extern void LoadBoundarySplines (const char * filename,
Array < GeomPoint<2> > & geompoints,
@ -44,6 +46,7 @@ class SplineGeometry
Array<double> maxh;
Array<bool> quadmeshing;
Array<bool> tensormeshing;
Array<int> layer;
private:
void AppendSegment(SplineSeg<D> * spline, const int leftdomain, const int rightdomain,
@ -121,6 +124,11 @@ public:
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;
@ -147,5 +155,6 @@ public:
virtual const Refinement & GetRefinement () const;
};
}
#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:
/// xi..... DIM_EL local coordinates
/// 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 <>
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,