From 82435b59c4a490c176a9b4292b28c6bd88496fdf Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Mon, 27 Apr 2015 11:18:22 +0200 Subject: [PATCH] store is_curved in 2D elements --- libsrc/include/nginterface_v2.hpp | 1 + libsrc/include/nginterface_v2_impl.hpp | 7 +++++++ libsrc/interface/nginterface.cpp | 6 +++++- libsrc/meshing/adfront2.cpp | 4 ++-- libsrc/meshing/meshclass.cpp | 11 +++++++++++ libsrc/meshing/meshclass.hpp | 2 ++ libsrc/meshing/meshtype.cpp | 4 ++++ libsrc/meshing/meshtype.hpp | 5 ++++- 8 files changed, 36 insertions(+), 4 deletions(-) diff --git a/libsrc/include/nginterface_v2.hpp b/libsrc/include/nginterface_v2.hpp index 5c5db905..c537e1f0 100644 --- a/libsrc/include/nginterface_v2.hpp +++ b/libsrc/include/nginterface_v2.hpp @@ -81,6 +81,7 @@ namespace netgen Ng_Vertices vertices; Ng_Edges edges; Ng_Faces faces; + bool is_curved; }; diff --git a/libsrc/include/nginterface_v2_impl.hpp b/libsrc/include/nginterface_v2_impl.hpp index 7495d7bb..42b34f74 100644 --- a/libsrc/include/nginterface_v2_impl.hpp +++ b/libsrc/include/nginterface_v2_impl.hpp @@ -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; } diff --git a/libsrc/interface/nginterface.cpp b/libsrc/interface/nginterface.cpp index f763aad0..60ba47be 100644 --- a/libsrc/interface/nginterface.cpp +++ b/libsrc/interface/nginterface.cpp @@ -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 (ng_geometry -> GetRefinement()), order, rational); + */ + mesh->BuildCurvedElements + (&const_cast (ng_geometry -> GetRefinement()), + order, rational); mesh -> SetNextMajorTimeStamp(); } diff --git a/libsrc/meshing/adfront2.cpp b/libsrc/meshing/adfront2.cpp index 17d54176..647de0b4 100644 --- a/libsrc/meshing/adfront2.cpp +++ b/libsrc/meshing/adfront2.cpp @@ -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++; } } } diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index 0efefb5a..1b94011b 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -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) { diff --git a/libsrc/meshing/meshclass.hpp b/libsrc/meshing/meshclass.hpp index 79dc043f..f07b6e9b 100644 --- a/libsrc/meshing/meshclass.hpp +++ b/libsrc/meshing/meshclass.hpp @@ -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; } diff --git a/libsrc/meshing/meshtype.cpp b/libsrc/meshing/meshtype.cpp index 72befa71..b617d0f1 100644 --- a/libsrc/meshing/meshtype.cpp +++ b/libsrc/meshing/meshtype.cpp @@ -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) diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index 1e679107..2f38751e 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -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; }