From 78a2bba758c7be860250a9255e1105bcb995e5da Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 14 Nov 2013 11:10:11 +0000 Subject: [PATCH] 22404: EDF SMESH Regression : GHS3D quadratic mesh fails with Netgen 1D2D (second order option) Fix for the second order mesh --- src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx | 88 +++++++++++---------------- 1 file changed, 34 insertions(+), 54 deletions(-) diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx index 5059526..48c0314 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx @@ -27,33 +27,27 @@ #include "GHS3DPlugin_GHS3D.hxx" #include "GHS3DPlugin_Hypothesis.hxx" -#include - -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - +#include #include #include -#include #include - #include - +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include #include +#include #include #include #include @@ -64,7 +58,6 @@ #include #include #include -#include #include #include #include @@ -74,9 +67,10 @@ #include #include #include -#include +#include #include +#include #include #ifdef WIN32 @@ -86,18 +80,8 @@ #endif #include -//#include - - #define castToNode(n) static_cast( n ); -#ifdef _DEBUG_ -#define DUMP(txt) \ -// std::cout << txt -#else -#define DUMP(txt) -#endif - extern "C" { #ifndef WIN32 @@ -346,7 +330,11 @@ static int findShapeID(SMESH_Mesh& mesh, SMESHDS_Mesh* meshDS = mesh.GetMeshDS(); // face the nodes belong to - const SMDS_MeshElement * face = meshDS->FindFace(node1,node2,node3); + vector nodes(3); + nodes[0] = node1; + nodes[1] = node2; + nodes[2] = node3; + const SMDS_MeshElement * face = meshDS->FindElement( nodes, SMDSAbs_Face, /*noMedium=*/true); if ( !face ) return isTmpFace(node1, node2, node3) ? HOLE_ID : invalidID; #ifdef _DEBUG_ @@ -384,25 +372,22 @@ static int findShapeID(SMESH_Mesh& mesh, if ( toMeshHoles ) return meshDS->ShapeToIndex( solid1 ); - //////////// UNCOMMENT AS SOON AS - //////////// http://tracker.dev.opencascade.org/view.php?id=23129 - //////////// IS SOLVED // - Are we at a hole boundary face? - // if ( shells(1).IsSame( BRepTools::OuterShell( solid1 )) ) - // { // - No, but maybe a hole is bound by two shapes? Does shells(1) touches another shell? - // bool touch = false; - // TopExp_Explorer eExp( shells(1), TopAbs_EDGE ); - // // check if any edge of shells(1) belongs to another shell - // for ( ; eExp.More() && !touch; eExp.Next() ) { - // ansIt = mesh.GetAncestors( eExp.Current() ); - // for ( ; ansIt.More() && !touch; ansIt.Next() ) { - // if ( ansIt.Value().ShapeType() == TopAbs_SHELL ) - // touch = ( !ansIt.Value().IsSame( shells(1) )); - // } - // } - // if (!touch) - // return meshDS->ShapeToIndex( solid1 ); - // } + if ( shells(1).IsSame( BRepClass3d::OuterShell( solid1 )) ) + { // - No, but maybe a hole is bound by two shapes? Does shells(1) touches another shell? + bool touch = false; + TopExp_Explorer eExp( shells(1), TopAbs_EDGE ); + // check if any edge of shells(1) belongs to another shell + for ( ; eExp.More() && !touch; eExp.Next() ) { + ansIt = mesh.GetAncestors( eExp.Current() ); + for ( ; ansIt.More() && !touch; ansIt.Next() ) { + if ( ansIt.Value().ShapeType() == TopAbs_SHELL ) + touch = ( !ansIt.Value().IsSame( shells(1) )); + } + } + if (!touch) + return meshDS->ShapeToIndex( solid1 ); + } } // find orientation of geom face within the first solid TopExp_Explorer fExp( solid1, TopAbs_FACE ); @@ -427,7 +412,6 @@ static int findShapeID(SMESH_Mesh& mesh, // get normale to geomFace at any node bool geomNormalOK = false; gp_Vec geomNormal; - const SMDS_MeshNode* nodes[3] = { node1, node2, node3 }; SMESH_MesherHelper helper( mesh ); helper.SetSubShape( geomFace ); for ( int i = 0; !geomNormalOK && i < 3; ++i ) { @@ -1178,9 +1162,6 @@ static bool readGMFFile(const char* theFile, std::cout << "isQuadMesh: " << isQuadMesh << std::endl; #endif - // if ( theHelper->GetSubShapeID() != 0 && hasGeom ) - // theHelper->IsQuadraticSubMesh( theHelper->GetSubShape() ); - // --------------------------------- // Read generated elements and nodes // --------------------------------- @@ -3639,8 +3620,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, { MESSAGE("GHS3DPlugin_GHS3D::Compute()"); - //SMESHDS_Mesh* meshDS = theMesh.GetMeshDS(); - TopoDS_Shape theShape = theHelper->GetSubShape(); + theHelper->IsQuadraticSubMesh( theHelper->GetSubShape() ); // a unique working file name // to avoid access to the same files by eg different users -- 2.39.2