Merge branch 'some_fixes' into 'master'

Some fixes

See merge request jschoeberl/netgen!171
This commit is contained in:
Joachim Schöberl 2019-06-26 11:04:55 +00:00
commit db9e2b96e7
4 changed files with 68 additions and 5 deletions

View File

@ -1089,7 +1089,7 @@ namespace netgen
if (ind > 0) if (ind > 0)
{ {
if(mesh->SurfaceElement(ind).GetType()==QUAD) if(mesh->SurfaceElement(ind).GetType()==QUAD || mesh->SurfaceElement(ind).GetType()==TRIG6)
{ {
lami[0] = lam3[0]; lami[0] = lam3[0];
lami[1] = lam3[1]; lami[1] = lam3[1];

View File

@ -123,6 +123,8 @@ namespace netgen
if (mesh2.cd3names[i]) cd3names[i] = new string(*mesh2.cd3names[i]); if (mesh2.cd3names[i]) cd3names[i] = new string(*mesh2.cd3names[i]);
else cd3names[i] = 0; else cd3names[i] = 0;
numvertices = mesh2.numvertices;
return *this; return *this;
} }
@ -3324,8 +3326,8 @@ namespace netgen
for (int i = 0; i < segments.Size(); i++) for (int i = 0; i < segments.Size(); i++)
{ {
const Segment & seg = segments[i]; const Segment & seg = segments[i];
pused.Set (seg[0]); for (int j = 0; j < seg.GetNP(); j++)
pused.Set (seg[1]); pused.Set (seg[j]);
} }
for (int i = 0; i < openelements.Size(); i++) for (int i = 0; i < openelements.Size(); i++)
@ -3389,8 +3391,8 @@ namespace netgen
for (int i = 0; i < segments.Size(); i++) for (int i = 0; i < segments.Size(); i++)
{ {
Segment & seg = segments[i]; Segment & seg = segments[i];
seg[0] = op2np[seg[0]]; for (int j = 0; j < seg.GetNP(); j++)
seg[1] = op2np[seg[1]]; seg[j] = op2np[seg[j]];
} }
for (int i = 1; i <= openelements.Size(); i++) for (int i = 1; i <= openelements.Size(); i++)
@ -4789,6 +4791,42 @@ namespace netgen
//(*testout) << "col1 " << col1 << " col2 " << col2 << " col3 " << col3 << " rhs " << rhs << endl; //(*testout) << "col1 " << col1 << " col2 " << col2 << " col3 " << col3 << " rhs " << rhs << endl;
//(*testout) << "sol " << sol << endl; //(*testout) << "sol " << sol << endl;
if (SurfaceElement(element).GetType() ==TRIG6)
{
netgen::Point<2> lam(1./3,1./3);
Vec<3> rhs;
Vec<2> deltalam;
netgen::Point<3> x;
Mat<3,2> Jac,Jact;
double delta=1;
bool retval;
int i = 0;
const int maxits = 30;
while(delta > 1e-16 && i<maxits)
{
curvedelems->CalcSurfaceTransformation(lam,element-1,x,Jac);
rhs = p-x;
Jac.Solve(rhs,deltalam);
lam += deltalam;
delta = deltalam.Length2();
i++;
//(*testout) << "pcie i " << i << " delta " << delta << " p " << p << " x " << x << " lam " << lam << endl;
//<< "Jac " << Jac << endl;
}
if(i==maxits)
return false;
sol.X() = lam(0);
sol.Y() = lam(1);
}
if (sol.X() >= -eps && sol.Y() >= -eps && if (sol.X() >= -eps && sol.Y() >= -eps &&
sol.X() + sol.Y() <= 1+eps) sol.X() + sol.Y() <= 1+eps)
{ {

View File

@ -10,6 +10,16 @@ namespace netgen
mesh.CalcSurfacesOfNode(); mesh.CalcSurfacesOfNode();
bool secondorder = mesh.GetNP() > mesh.GetNV();
if (secondorder)
{
for (SurfaceElementIndex ei = 0; ei < mesh.GetNSE(); ei++)
mesh[ei].SetType(TRIG);
}
mesh.Compress();
const char * optstr = mp.optimize2d.c_str(); const char * optstr = mp.optimize2d.c_str();
int optsteps = mp.optsteps2d; int optsteps = mp.optsteps2d;
@ -51,6 +61,13 @@ namespace netgen
cerr << "Optimization code " << optstr[j-1] << " not defined" << endl; cerr << "Optimization code " << optstr[j-1] << " not defined" << endl;
} }
} }
if (secondorder)
{
if (mesh.GetGeometry())
mesh.GetGeometry()->GetRefinement().MakeSecondOrder(mesh);
else
Refinement().MakeSecondOrder(mesh);
}
} }
} }

View File

@ -23,6 +23,14 @@ namespace netgen
INDEX_2_HASHTABLE<PointIndex> between(mesh.GetNP() + 5); INDEX_2_HASHTABLE<PointIndex> between(mesh.GetNP() + 5);
for (SegmentIndex si = 0; si < mesh.GetNSeg(); si++)
{
auto & seg = mesh[si];
if (seg.GetType() == SEGMENT3)
between.Set(INDEX_2::Sort(seg[0],seg[1]), seg[2]);
}
for (SurfaceElementIndex sei = 0; sei < mesh.GetNSE(); sei++) for (SurfaceElementIndex sei = 0; sei < mesh.GetNSE(); sei++)
{ {
const Element2d & el = mesh[sei]; const Element2d & el = mesh[sei];