X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_QuadToTriaAdaptor.cxx;h=1832f48e778e815474a8a009c5aaccce10350bfb;hp=4c96220ea5297581e5a1ef7dedbd289ec2c88a00;hb=38a77c4a9810f4715212368ac53315689ba9150f;hpb=f5016d85b7b4b88623723027a1585c6414c4dc66 diff --git a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx index 4c96220ea..1832f48e7 100644 --- a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx +++ b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,11 +25,11 @@ #include "StdMeshers_QuadToTriaAdaptor.hxx" #include "SMDS_SetIterator.hxx" - +#include "SMESHDS_GroupBase.hxx" #include "SMESH_Algo.hxx" -#include "SMESH_MesherHelper.hxx" #include "SMESH_Group.hxx" -#include "SMESHDS_GroupBase.hxx" +#include "SMESH_MeshAlgos.hxx" +#include "SMESH_MesherHelper.hxx" #include #include @@ -40,6 +40,7 @@ #include #include #include + #include "utilities.h" #include @@ -118,7 +119,7 @@ namespace bool tooClose = ( angle < 15. * M_PI / 180. ); // Check if pyramids collide - if ( !tooClose && baI * baJ > 0 ) + if ( !tooClose && ( baI * baJ > 0 ) && ( nI * nJ > 0 )) { // find out if nI points outside of PrmI or inside int dInd = baseNodesIndI[1] - baseNodesIndI[0]; @@ -149,8 +150,8 @@ namespace TIDSortedElemSet emptySet, avoidSet; int i1, i2; while ( const SMDS_MeshElement* f = - SMESH_MeshEditor::FindFaceInSet( baseNodes[0], baseNodes[1], - emptySet, avoidSet, &i1, &i2 )) + SMESH_MeshAlgos::FindFaceInSet( baseNodes[0], baseNodes[1], + emptySet, avoidSet, &i1, &i2 )) { avoidSet.insert( f ); @@ -542,7 +543,7 @@ bool StdMeshers_QuadToTriaAdaptor::CheckIntersection (const gp_Pnt& P, const SMDS_MeshElement* NotCheckedFace) { if ( !myElemSearcher ) - myElemSearcher = SMESH_MeshEditor(&aMesh).GetElementSearcher(); + myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *aMesh.GetMeshDS() ); SMESH_ElementSearcher* searcher = const_cast(myElemSearcher); //SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); @@ -730,9 +731,9 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh, if ( myElemSearcher ) delete myElemSearcher; if ( aProxyMesh ) - myElemSearcher = SMESH_MeshEditor(&aMesh).GetElementSearcher( aProxyMesh->GetFaces(aShape)); + myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS, aProxyMesh->GetFaces(aShape)); else - myElemSearcher = SMESH_MeshEditor(&aMesh).GetElementSearcher(); + myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS ); const SMESHDS_SubMesh * aSubMeshDSFace; Handle(TColgp_HArray1OfPnt) PN = new TColgp_HArray1OfPnt(1,5); @@ -756,7 +757,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh, { bool isRev = false; if ( helper.NbAncestors( aShapeFace, aMesh, aShape.ShapeType() ) > 1 ) - isRev = SMESH_Algo::IsReversedSubMesh( TopoDS::Face(aShapeFace), meshDS ); + isRev = helper.IsReversedSubMesh( TopoDS::Face(aShapeFace) ); SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSFace->GetElements(); while ( iteratorElem->more() ) // loop on elements on a geometrical face @@ -879,7 +880,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh, delete myElemSearcher; myElemSearcher = - SMESH_MeshEditor(&aMesh).GetElementSearcher( aProxyMesh->GetFaces(aShape)); + SMESH_MeshAlgos::GetElementSearcher( *meshDS, aProxyMesh->GetFaces(aShape)); } } } @@ -937,13 +938,13 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh) helper.IsQuadraticSubMesh(aMesh.GetShapeToMesh()); helper.SetElementsOnShape( true ); - if ( !myElemSearcher ) - myElemSearcher = SMESH_MeshEditor(&aMesh).GetElementSearcher(); - SMESH_ElementSearcher* searcher = const_cast(myElemSearcher); - SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); SMESH_ProxyMesh::SubMesh* prxSubMesh = getProxySubMesh(); + if ( !myElemSearcher ) + myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS ); + SMESH_ElementSearcher* searcher = const_cast(myElemSearcher); + SMDS_FaceIteratorPtr fIt = meshDS->facesIterator(/*idInceasingOrder=*/true); while( fIt->more()) { @@ -1098,7 +1099,21 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh) // if the face belong to the group of skinFaces, do not build a pyramid outside if (groupDS && groupDS->Contains(face)) + { intersected[0] = false; + } + else if ( intersected[0] && intersected[1] ) // check if one of pyramids is in a hole + { + gp_Pnt P ( PC.XYZ() + tmpDir.XYZ() * 0.5 * PC.Distance( intPnt[0] )); + if ( searcher->GetPointState( P ) == TopAbs_OUT ) + intersected[0] = false; + else + { + P = ( PC.XYZ() - tmpDir.XYZ() * 0.5 * PC.Distance( intPnt[1] )); + if ( searcher->GetPointState( P ) == TopAbs_OUT ) + intersected[1] = false; + } + } // Create one or two pyramids @@ -1150,7 +1165,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh& int i, j, k, myShapeID = myPyramids[0]->GetNode(4)->getshapeId(); if ( myElemSearcher ) delete myElemSearcher; - myElemSearcher = SMESH_MeshEditor(&aMesh).GetElementSearcher(); + myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS ); SMESH_ElementSearcher* searcher = const_cast(myElemSearcher); set nodesToMove; @@ -1181,7 +1196,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh& while ( vIt->more() ) { const SMDS_MeshElement* PrmJ = vIt->next(); - if ( SMESH_Algo::GetCommonNodes( PrmI, PrmJ ).size() > 1 ) + if ( SMESH_MeshAlgos::GetCommonNodes( PrmI, PrmJ ).size() > 1 ) checkedPyrams.insert( PrmJ ); } } @@ -1275,7 +1290,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh& nodesToMove.insert( aNode1 ); nodesToMove.insert( aNode2 ); } - // fix intersections that could appear after apex movement + // fix intersections that can appear after apex movement MergeAdjacent( PrmI, nodesToMove ); MergeAdjacent( PrmJ, nodesToMove );