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,
double ra, double elto0, Array<double> & points)
void CalcPartition (double l, double h, double h1, double h2,
double hcurve, double elto0, Array<double> & points)
{
int i, j, n, nel;
double sum, t, dt, fun, fperel, oldf, f;
@ -279,7 +279,7 @@ namespace netgen
t = 0.5 * dt;
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;
t += dt;
}
@ -294,7 +294,7 @@ namespace netgen
t = 0.5 * dt;
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;

View File

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

View File

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