X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_Mesh.cxx;h=4f2110a35501acd15fa31bbc4fb038ce3d107860;hb=aa5c100cf71c5a37f71c1ed3b66215e00fa95973;hp=4648b5a3d21a8b150de2aab3eac416a2638f0667;hpb=ddd20dd94358856385f639219bbdfbd1e14239d7;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index 4648b5a3d..4f2110a35 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -1,31 +1,30 @@ -// SMESH SMESH : implementaion of SMESH idl descriptions +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// SMESH SMESH : implementaion of SMESH idl descriptions // File : SMESH_Mesh.cxx // Author : Paul RASCLE, EDF // Module : SMESH // $Header$ - +// #include "SMESH_Mesh.hxx" #include "SMESH_subMesh.hxx" #include "SMESH_Gen.hxx" @@ -210,46 +209,59 @@ const TopoDS_Solid& SMESH_Mesh::PseudoShape() void SMESH_Mesh::Clear() { - // clear sub-meshes; get ready to re-compute as a side-effect + // clear mesh data + _myMeshDS->ClearMesh(); - if ( SMESH_subMesh *sm = GetSubMeshContaining( GetShapeToMesh() ) ) - { + // update compute state of submeshes + if ( SMESH_subMesh *sm = GetSubMeshContaining( GetShapeToMesh() ) ) { SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true, /*complexShapeFirst=*/false); - while ( smIt->more() ) - { + while ( smIt->more() ) { sm = smIt->next(); - TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType(); - if ( shapeType == TopAbs_VERTEX || shapeType < TopAbs_SOLID ) - // all other shapes depends on vertices so they are already cleaned - sm->ComputeStateEngine( SMESH_subMesh::CLEAN ); - // to recompute even if failed sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); } } - // clear entities not on sub-meshes - - SMDS_VolumeIteratorPtr vIt = _myMeshDS->volumesIterator(); - while ( vIt->more() ) - _myMeshDS->RemoveFreeElement( vIt->next(), 0 ); - - SMDS_FaceIteratorPtr fIt = _myMeshDS->facesIterator(); - while ( fIt->more() ) - _myMeshDS->RemoveFreeElement( fIt->next(), 0 ); - - SMDS_EdgeIteratorPtr eIt = _myMeshDS->edgesIterator(); - while ( eIt->more() ) - _myMeshDS->RemoveFreeElement( eIt->next(), 0 ); - - SMDS_NodeIteratorPtr nIt = _myMeshDS->nodesIterator(); - while ( nIt->more() ) { - const SMDS_MeshNode * node = nIt->next(); - if ( node->NbInverseElements() == 0 ) - _myMeshDS->RemoveFreeNode( node, 0 ); - else - _myMeshDS->RemoveNode(node); - } +// // clear sub-meshes; get ready to re-compute as a side-effect + +// if ( SMESH_subMesh *sm = GetSubMeshContaining( GetShapeToMesh() ) ) +// { +// SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true, +// /*complexShapeFirst=*/false); +// while ( smIt->more() ) +// { +// sm = smIt->next(); +// TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType(); +// if ( shapeType == TopAbs_VERTEX || shapeType < TopAbs_SOLID ) +// // all other shapes depends on vertices so they are already cleaned +// sm->ComputeStateEngine( SMESH_subMesh::CLEAN ); +// // to recompute even if failed +// sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); +// } +// } + +// // clear entities not on sub-meshes + +// SMDS_VolumeIteratorPtr vIt = _myMeshDS->volumesIterator(); +// while ( vIt->more() ) +// _myMeshDS->RemoveFreeElement( vIt->next(), 0 ); + +// SMDS_FaceIteratorPtr fIt = _myMeshDS->facesIterator(); +// while ( fIt->more() ) +// _myMeshDS->RemoveFreeElement( fIt->next(), 0 ); + +// SMDS_EdgeIteratorPtr eIt = _myMeshDS->edgesIterator(); +// while ( eIt->more() ) +// _myMeshDS->RemoveFreeElement( eIt->next(), 0 ); + +// SMDS_NodeIteratorPtr nIt = _myMeshDS->nodesIterator(); +// while ( nIt->more() ) { +// const SMDS_MeshNode * node = nIt->next(); +// if ( node->NbInverseElements() == 0 ) +// _myMeshDS->RemoveFreeNode( node, 0 ); +// else +// _myMeshDS->RemoveNode(node); +// } } //======================================================================= @@ -596,24 +608,28 @@ SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const //======================================================================= /*! * \brief Return the hypothesis assigned to the shape - * \param aSubShape - the shape to check - * \param aFilter - the hypothesis filter - * \param andAncestors - flag to check hypos assigned to ancestors of the shape - * \retval SMESH_Hypothesis* - the first hypo passed through aFilter + * \param aSubShape - the shape to check + * \param aFilter - the hypothesis filter + * \param andAncestors - flag to check hypos assigned to ancestors of the shape + * \param assignedTo - to return the shape the found hypo is assigned to + * \retval SMESH_Hypothesis* - the first hypo passed through aFilter */ //======================================================================= const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape & aSubShape, const SMESH_HypoFilter& aFilter, - const bool andAncestors) const + const bool andAncestors, + TopoDS_Shape* assignedTo) const { { const std::list& hypList = _myMeshDS->GetHypothesis(aSubShape); std::list::const_iterator hyp = hypList.begin(); for ( ; hyp != hypList.end(); hyp++ ) { const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp ); - if ( aFilter.IsOk( h, aSubShape)) + if ( aFilter.IsOk( h, aSubShape)) { + if ( assignedTo ) *assignedTo = aSubShape; return h; + } } } if ( andAncestors ) @@ -625,8 +641,10 @@ const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape & aSubS std::list::const_iterator hyp = hypList.begin(); for ( ; hyp != hypList.end(); hyp++ ) { const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp ); - if (aFilter.IsOk( h, it.Value() )) + if (aFilter.IsOk( h, it.Value() )) { + if ( assignedTo ) *assignedTo = it.Value(); return h; + } } } }