store is_curved in 2D elements

This commit is contained in:
Joachim Schoeberl 2015-04-27 11:18:22 +02:00
parent 631b519676
commit 82435b59c4
8 changed files with 36 additions and 4 deletions

View File

@ -81,6 +81,7 @@ namespace netgen
Ng_Vertices vertices;
Ng_Edges edges;
Ng_Faces faces;
bool is_curved;
};

View File

@ -49,6 +49,8 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<1> (int nr) const
ret.faces.num = 0;
ret.faces.ptr = NULL;
ret.is_curved = mesh->GetCurvedElements().IsSegmentCurved(nr);
return ret;
}
@ -72,6 +74,9 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<2> (int nr) const
ret.faces.num = MeshTopology::GetNFaces (el.GetType());
ret.faces.ptr = (T_FACE2*)mesh->GetTopology().GetSurfaceElementFacesPtr (nr);
// ret.is_curved = mesh->GetCurvedElements().IsSurfaceElementCurved(nr);
ret.is_curved = el.IsCurved();
return ret;
}
@ -95,5 +100,7 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<3> (int nr) const
ret.faces.num = MeshTopology::GetNFaces (el.GetType());
ret.faces.ptr = (T_FACE2*)mesh->GetTopology().GetElementFacesPtr (nr);
ret.is_curved = mesh->GetCurvedElements().IsElementCurved(nr);
return ret;
}

View File

@ -1150,10 +1150,14 @@ void Ng_HPRefinement (int levels, double parameter, bool setorders,
void Ng_HighOrder (int order, bool rational)
{
NgLock meshlock (mesh->MajorMutex(), true);
/*
mesh -> GetCurvedElements().BuildCurvedElements
(&const_cast<Refinement&> (ng_geometry -> GetRefinement()),
order, rational);
*/
mesh->BuildCurvedElements
(&const_cast<Refinement&> (ng_geometry -> GetRefinement()),
order, rational);
mesh -> SetNextMajorTimeStamp();
}

View File

@ -524,7 +524,7 @@ namespace netgen
if (Det(mat) == 0) continue;
CalcInverse (mat, inv);
sol = inv * rhs;
if (sol(0) >= 0 && sol(0) <= 1 & sol(1) >= 0 && sol(1) <= 1)
if ( (sol(0) >= 0) && (sol(0) <= 1) && (sol(1) >= 0) && (sol(1) <= 1))
{ cnt++; }
}
@ -554,7 +554,7 @@ namespace netgen
if (Det(mat) == 0) continue;
CalcInverse (mat, inv);
sol = inv * rhs;
if (sol(0) >= 0 && sol(0) <= 1 & sol(1) >= 0 && sol(1) <= 1)
if ((sol(0) >= 0) && (sol(0) <= 1) && (sol(1) >= 0) && (sol(1) <= 1))
{ cnt++; }
}
}

View File

@ -5518,6 +5518,17 @@ namespace netgen
clusters->Update();
}
void Mesh :: BuildCurvedElements (const Refinement * ref, int aorder, bool arational)
{
GetCurvedElements().BuildCurvedElements (ref, aorder, arational);
for (SurfaceElementIndex sei = 0; sei < GetNSE(); sei++)
{
(*this)[sei].SetCurved (GetCurvedElements().IsSurfaceElementCurved (sei));
}
SetNextMajorTimeStamp();
}
void Mesh :: SetMaterial (int domnr, const char * mat)
{

View File

@ -663,6 +663,8 @@ namespace netgen
class CurvedElements & GetCurvedElements () const
{ return *curvedelems; }
void BuildCurvedElements (const class Refinement * ref, int aorder, bool arational = false);
const class AnisotropicClusters & GetClusters () const
{ return *clusters; }

View File

@ -172,6 +172,7 @@ namespace netgen
orderx = ordery = 1;
refflag = 1;
strongrefflag = false;
is_curved = false;
}
@ -197,6 +198,7 @@ namespace netgen
orderx = ordery = 1;
refflag = 1;
strongrefflag = false;
is_curved = false;
}
Element2d :: Element2d (ELEMENT_TYPE atyp)
@ -216,6 +218,7 @@ namespace netgen
orderx = ordery = 1;
refflag = 1;
strongrefflag = false;
is_curved = false;
}
@ -240,6 +243,7 @@ namespace netgen
deleted = 0;
visible = 1;
orderx = ordery = 1;
is_curved = false;
}
Element2d :: Element2d (int pi1, int pi2, int pi3, int pi4)

View File

@ -304,7 +304,7 @@ namespace netgen
// Set a new property for each element, to
// control whether it is visible or not
bool visible:1; // element visible
bool is_curved:1; // element is (high order) curved
/// order for hp-FEM
unsigned int orderx:6;
unsigned int ordery:6;
@ -493,6 +493,9 @@ namespace netgen
bool TestStrongRefinementFlag () const
{ return strongrefflag; }
bool IsCurved () const { return is_curved; }
void SetCurved (bool acurved) { is_curved = acurved; }
SurfaceElementIndex NextElement() { return next; }