X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_ProxyMesh.cxx;h=fd4f470b1484e3b1eb405df741420b9490d06d91;hb=a5f7916fb6386e1f54a9a39073e83a703b29fc48;hp=a4e4f5998b9c114fbddd472efb2cc778772b2290;hpb=bd4e115a78b52e3fbc016e5e30bb0e19b2a9e7d6;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_ProxyMesh.cxx b/src/SMESH/SMESH_ProxyMesh.cxx index a4e4f5998..fd4f470b1 100644 --- a/src/SMESH/SMESH_ProxyMesh.cxx +++ b/src/SMESH/SMESH_ProxyMesh.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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 @@ -178,6 +178,21 @@ const SMDS_MeshNode* SMESH_ProxyMesh::GetProxyNode( const SMDS_MeshNode* node ) return proxy; } +//================================================================================ +/*! + * \brief Returns number of proxy sub-meshes + */ +//================================================================================ + +int SMESH_ProxyMesh::NbProxySubMeshes() const +{ + int nb = 0; + for ( size_t i = 0; i < _subMeshes.size(); ++i ) + nb += bool( _subMeshes[i] ); + + return nb; +} + namespace { //================================================================================ @@ -329,7 +344,7 @@ SMESH_ProxyMesh::SubMesh* SMESH_ProxyMesh::getProxySubMesh(int index) if ( int(_subMeshes.size()) <= index ) _subMeshes.resize( index+1, 0 ); if ( !_subMeshes[index] ) - _subMeshes[index] = new SubMesh( index ); + _subMeshes[index] = newSubmesh( index ); return _subMeshes[index]; } @@ -408,24 +423,24 @@ void SMESH_ProxyMesh::takeTmpElemsInMesh( SMESH_ProxyMesh* proxyMesh ) //================================================================================ /*! - * \brief Removes tmp faces from the _mesh + * \brief Removes tmp elements from the _mesh */ //================================================================================ -void SMESH_ProxyMesh::removeTmpElement( const SMDS_MeshElement* face ) +void SMESH_ProxyMesh::removeTmpElement( const SMDS_MeshElement* elem ) { - if ( face && face->GetID() > 0 ) + if ( elem && elem->GetID() > 0 ) { - set< const SMDS_MeshElement* >::iterator i = _elemsInMesh.find( face ); + set< const SMDS_MeshElement* >::iterator i = _elemsInMesh.find( elem ); if ( i != _elemsInMesh.end() ) { - GetMeshDS()->RemoveFreeElement( face, 0 ); + GetMeshDS()->RemoveFreeElement( elem, 0 ); _elemsInMesh.erase( i ); } } else { - delete face; + delete elem; } } @@ -435,9 +450,9 @@ void SMESH_ProxyMesh::removeTmpElement( const SMDS_MeshElement* face ) */ //================================================================================ -void SMESH_ProxyMesh::storeTmpElement( const SMDS_MeshElement* face ) +void SMESH_ProxyMesh::storeTmpElement( const SMDS_MeshElement* elem ) { - _elemsInMesh.insert( face ); + _elemsInMesh.insert( elem ); } //================================================================================ @@ -499,18 +514,20 @@ void SMESH_ProxyMesh::SubMesh::Clear() //================================================================================ /*! - * \brief Return number of elements in a proxy submesh + * \brief Return number of elements in a proxy sub-mesh. The method is meaningful + * for a sub-mesh containing tmp faces. */ //================================================================================ int SMESH_ProxyMesh::SubMesh::NbElements() const { - return _elements.size(); + return _uvPtStructVec.empty() ? _elements.size() : _uvPtStructVec.size() - 1; } //================================================================================ /*! - * \brief Return elements of a proxy submesh + * \brief Return elements of a proxy sub-mesh. The method is meaningful + * for a sub-mesh containing tmp faces. */ //================================================================================ @@ -520,6 +537,39 @@ SMDS_ElemIteratorPtr SMESH_ProxyMesh::SubMesh::GetElements() const ( new SMDS_ElementVectorIterator( _elements.begin(), _elements.end() )); } +//================================================================================ +/*! + * \brief Return number of nodes in a proxy sub-mesh. The method is meaningful + * for a sub-mesh containing nodes of 2D viscous layer. + */ +//================================================================================ + +int SMESH_ProxyMesh::SubMesh::NbNodes() const +{ + return _uvPtStructVec.size(); +} + +//================================================================================ +/*! + * \brief Return nodes of a proxy sub-mesh. The method is meaningful + * for a sub-mesh containing nodes of 2D viscous layer. + */ +//================================================================================ + +SMDS_NodeIteratorPtr SMESH_ProxyMesh::SubMesh::GetNodes() const +{ + if ( !_uvPtStructVec.empty() ) + return SMDS_NodeIteratorPtr ( new SMDS_SetIterator + < SMDS_pNode, + UVPtStructVec::const_iterator, + UVPtStruct::NodeAccessor > + ( _uvPtStructVec.begin(), _uvPtStructVec.end() )); + + return SMDS_NodeIteratorPtr + ( new SMDS_SetIterator< SMDS_pNode, std::vector< SMDS_pElement >::const_iterator> + ( _elements.begin(), _elements.end() )); +} + //================================================================================ /*! * \brief Store an element