2d examples

This commit is contained in:
Joachim Schoeberl 2009-07-24 23:14:31 +00:00
parent 8d0b9ddec2
commit 56ad80e09a
3 changed files with 24 additions and 19 deletions

View File

@ -264,8 +264,8 @@ namespace netgen
void CalcPartition (double l, double h, double r1, double r2, void CalcPartition (double l, double h, double h1, double h2,
double ra, double elto0, Array<double> & points) double hcurve, double elto0, Array<double> & points)
{ {
int i, j, n, nel; int i, j, n, nel;
double sum, t, dt, fun, fperel, oldf, f; double sum, t, dt, fun, fperel, oldf, f;
@ -279,7 +279,7 @@ namespace netgen
t = 0.5 * dt; t = 0.5 * dt;
for (i = 1; i <= n; i++) for (i = 1; i <= n; i++)
{ {
fun = min3 (h/ra, t/elto0 + h/r1, (l-t)/elto0 + h/r2); fun = min3 (hcurve, t/elto0 + h1, (l-t)/elto0 + h2);
sum += dt / fun; sum += dt / fun;
t += dt; t += dt;
} }
@ -294,7 +294,7 @@ namespace netgen
t = 0.5 * dt; t = 0.5 * dt;
for (j = 1; j <= n && i < nel; j++) for (j = 1; j <= n && i < nel; j++)
{ {
fun = min3 (h/ra, t/elto0 + h/r1, (l-t)/elto0 + h/r2); fun = min3 (hcurve, t/elto0 + h1, (l-t)/elto0 + h2);
f = oldf + dt / fun; f = oldf + dt / fun;

View File

@ -8,8 +8,8 @@
/**************************************************************************/ /**************************************************************************/
void CalcPartition (double l, double h, double r1, double r2, void CalcPartition (double l, double h, double h1, double h2,
double ra, double elto0, Array<double> & points); double hcurve, double elto0, Array<double> & points);
/* /*
Spline curves for 2D mesh generation Spline curves for 2D mesh generation
@ -23,7 +23,8 @@ class GeomPoint : public Point<D>
public: public:
/// refinement factor at point /// refinement factor at point
double refatpoint; double refatpoint;
/// max mesh-size at point
double hmax;
/// hp-refinement /// hp-refinement
bool hpref; bool hpref;
@ -49,6 +50,8 @@ public:
int rightdom; int rightdom;
/// refinement at line /// refinement at line
double reffak; double reffak;
/// maximal h;
double hmax;
/// boundary condition number /// boundary condition number
int bc; int bc;
/// copy spline mesh from other spline (-1.. do not copy) /// copy spline mesh from other spline (-1.. do not copy)
@ -297,7 +300,7 @@ void SplineSeg<D> :: Partition (double h, double elto0,
Mesh & mesh, Point3dTree & searchtree, int segnr) const Mesh & mesh, Point3dTree & searchtree, int segnr) const
{ {
int i, j; int i, j;
double l, r1, r2, ra; double l; // , r1, r2, ra;
double lold, dt, frac; double lold, dt, frac;
int n = 100; int n = 100;
Point<D> p, pold, mark, oldmark; Point<D> p, pold, mark, oldmark;
@ -305,12 +308,12 @@ void SplineSeg<D> :: Partition (double h, double elto0,
double edgelength, edgelengthold; double edgelength, edgelengthold;
l = Length(); l = Length();
r1 = StartPI().refatpoint; double h1 = min (StartPI().hmax, h/StartPI().refatpoint);
r2 = EndPI().refatpoint; double h2 = min (EndPI().hmax, h/EndPI().refatpoint);
ra = reffak; double hcurve = min (hmax, h/reffak);
// cout << "Partition, l = " << l << ", h = " << h << endl; // cout << "Partition, l = " << l << ", h = " << h << endl;
CalcPartition (l, h, r1, r2, ra, elto0, curvepoints); CalcPartition (l, h, h1, h2, hcurve, elto0, curvepoints);
// cout << "curvepoints = " << curvepoints << endl; // cout << "curvepoints = " << curvepoints << endl;
dt = 1.0 / n; dt = 1.0 / n;

View File

@ -13,11 +13,13 @@
namespace netgen namespace netgen
{ {
//using namespace netgen;
template<int D> template<int D>
void SplineGeometry<D> :: LoadDataV2 ( ifstream & infile ) void SplineGeometry<D> :: LoadDataV2 ( ifstream & infile )
{ {
// new parser by Astrid Sinwel
PrintMessage (1, "Load 2D Geometry V2"); PrintMessage (1, "Load 2D Geometry V2");
int nump, leftdom, rightdom; int nump, leftdom, rightdom;
Point<D> x; Point<D> x;
@ -114,6 +116,7 @@ void SplineGeometry<D> :: LoadDataV2 ( ifstream & infile )
infilepoints.Append ( GeomPoint<D>(x, hd) ); infilepoints.Append ( GeomPoint<D>(x, hd) );
infilepoints.Last().hpref = flags.GetDefineFlag ("hpref"); infilepoints.Last().hpref = flags.GetDefineFlag ("hpref");
infilepoints.Last().hmax = flags.GetNumFlag ("maxh", 1e99);
TestComment(infile); TestComment(infile);
infile.get(ch); infile.get(ch);
@ -246,8 +249,8 @@ void SplineGeometry<D> :: LoadDataV2 ( ifstream & infile )
int (flags.GetDefineFlag ("hprefright")); int (flags.GetDefineFlag ("hprefright"));
splines.Last()->copyfrom = int (flags.GetNumFlag ("copy", -1)); splines.Last()->copyfrom = int (flags.GetNumFlag ("copy", -1));
splines.Last()->reffak = flags.GetNumFlag ("ref", 1 ); splines.Last()->reffak = flags.GetNumFlag ("ref", 1 );
if ( hd != 1 ) splines.Last()->hmax = flags.GetNumFlag ("maxh", 1e99 );
splines.Last()->reffak = hd; if ( hd != 1 ) splines.Last()->reffak = hd;
if ( flags.StringFlagDefined("bcname") ) if ( flags.StringFlagDefined("bcname") )
{ {
@ -414,9 +417,7 @@ template<int D>
SplineGeometry<D> :: ~SplineGeometry() SplineGeometry<D> :: ~SplineGeometry()
{ {
for(int i=0; i<splines.Size(); i++) for(int i=0; i<splines.Size(); i++)
{ delete splines[i];
delete splines[i];
}
splines.DeleteAll(); splines.DeleteAll();
geompoints.DeleteAll(); geompoints.DeleteAll();
for (int i=0; i<materials.Size(); i++) for (int i=0; i<materials.Size(); i++)
@ -764,6 +765,7 @@ void SplineGeometry<D> :: LoadDataNew ( ifstream & infile )
int (flags.GetDefineFlag ("hprefright")); int (flags.GetDefineFlag ("hprefright"));
splines.Last()->copyfrom = int (flags.GetNumFlag ("copy", -1)); splines.Last()->copyfrom = int (flags.GetNumFlag ("copy", -1));
splines.Last()->reffak = flags.GetNumFlag ("ref", 1 ); splines.Last()->reffak = flags.GetNumFlag ("ref", 1 );
splines.Last()->hmax = flags.GetNumFlag ("maxh", 1e99 );
if ( flags.StringFlagDefined("bcname") ) if ( flags.StringFlagDefined("bcname") )
{ {