X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_CompositeHexa_3D.cxx;h=4c73b4ebd4d32f8c705ea247d75cfca453991f17;hb=d1fa9ee8675e125e79f1994c9effabba47223516;hp=d04f77c55e6dc301943432a79bf067d54936a376;hpb=40b2818f18601091d81e0d9d749a3fd6808c31ce;p=modules%2Fsmesh.git diff --git a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx index d04f77c55..4c73b4ebd 100644 --- a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx @@ -1,24 +1,22 @@ -// SMESH SMESH : implementaion of SMESH idl descriptions +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE // -// 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 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 + +// SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_CompositeHexa_3D.cxx // Module : SMESH // Created : Tue Nov 25 11:04:59 2008 @@ -206,7 +204,7 @@ public: //** Access to member fields **// private: - bool error(std::string& text, int code = COMPERR_ALGO_FAILED) + bool error(const std::string& text, int code = COMPERR_ALGO_FAILED) { myError = SMESH_ComputeError::New( code, text ); return false; } bool error(const SMESH_ComputeErrorPtr& err) @@ -252,7 +250,7 @@ StdMeshers_CompositeHexa_3D::StdMeshers_CompositeHexa_3D(int hypId, int studyId, :SMESH_3D_Algo(hypId, studyId, gen) { _name = "CompositeHexa_3D"; - _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type + _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type } //================================================================================ @@ -417,7 +415,7 @@ bool StdMeshers_CompositeHexa_3D::Compute(SMESH_Mesh& theMesh, // ---------------------------- // Add internal nodes of a box // ---------------------------- - // projection points of internal nodes on box subshapes by which + // projection points of internal nodes on box sub-shapes by which // coordinates of internal nodes are computed vector pointsOnShapes( SMESH_Block::ID_Shell ); @@ -514,7 +512,7 @@ bool StdMeshers_CompositeHexa_3D::Compute(SMESH_Mesh& theMesh, //purpose : auxilary for Evaluate //======================================================================= int GetNb2d(_QuadFaceGrid* QFG, SMESH_Mesh& theMesh, - MapShapeNbElems& aResMap) + MapShapeNbElems& aResMap) { int nb2d = 0; _QuadFaceGrid::TChildIterator aCI = QFG->GetChildren(); @@ -539,8 +537,8 @@ int GetNb2d(_QuadFaceGrid* QFG, SMESH_Mesh& theMesh, //================================================================================ bool StdMeshers_CompositeHexa_3D::Evaluate(SMESH_Mesh& theMesh, - const TopoDS_Shape& theShape, - MapShapeNbElems& aResMap) + const TopoDS_Shape& theShape, + MapShapeNbElems& aResMap) { SMESH_MesherHelper aTool(theMesh); bool _quadraticMesh = aTool.IsQuadraticSubMesh(theShape); @@ -636,22 +634,22 @@ bool StdMeshers_CompositeHexa_3D::Evaluate(SMESH_Mesh& theMesh, int nb0 = 0; SMESH_subMesh *sm = theMesh.GetSubMesh(exp.Current()); if( sm ) { - MapShapeNbElemsItr anIt = aResMap.find(sm); - if( anIt == aResMap.end() ) continue; - std::vector aVec = (*anIt).second; - nb0 = aVec[SMDSEntity_Node]; + MapShapeNbElemsItr anIt = aResMap.find(sm); + if( anIt == aResMap.end() ) continue; + std::vector aVec = (*anIt).second; + nb0 = aVec[SMDSEntity_Node]; } int j = 1; for(; j<=BndEdges.Length(); j++) { - if( BndEdges.Value(j) == exp.Current() ) { - // internal edge => remove it - BndEdges.Remove(j); - nb0d_in += nb0; - break; - } + if( BndEdges.Value(j) == exp.Current() ) { + // internal edge => remove it + BndEdges.Remove(j); + nb0d_in += nb0; + break; + } } if( j > BndEdges.Length() ) { - BndEdges.Append(exp.Current()); + BndEdges.Append(exp.Current()); } //if( BndEdges.Contains(exp.Current()) ) { //BndEdges.Remove( exp.Current() ); @@ -801,7 +799,7 @@ bool _QuadFaceGrid::AddContinuousFace( const _QuadFaceGrid& other ) int iMyCommon; if ( mySides.Contain( otherSide, &iMyCommon ) ) { // check if normals of two faces are collinear at all vertices of a otherSide - const double angleTol = PI / 180 / 2; + const double angleTol = M_PI / 180. / 2.; int iV, nbV = otherSide.NbVertices(), nbCollinear = 0; for ( iV = 0; iV < nbV; ++iV ) { @@ -988,6 +986,13 @@ bool _QuadFaceGrid::LoadGrid( SMESH_Mesh& mesh ) if ( !myGrid.empty() ) return true; + SMESHDS_SubMesh* faceSubMesh = mesh.GetSubMesh( myFace )->GetSubMeshDS(); + // check that all faces are quadrangular + SMDS_ElemIteratorPtr fIt = faceSubMesh->GetElements(); + while ( fIt->more() ) + if ( fIt->next()->NbNodes() % 4 > 0 ) + return error("Non-quadrangular mesh faces are not allowed on sides of a composite block"); + myIndexer._xSize = 1 + mySides.GetSide( Q_BOTTOM )->GetNbSegments( mesh ); myIndexer._ySize = 1 + mySides.GetSide( Q_LEFT )->GetNbSegments( mesh ); @@ -998,10 +1003,8 @@ bool _QuadFaceGrid::LoadGrid( SMESH_Mesh& mesh ) // store the rest nodes row by row - SMESHDS_SubMesh* faceSubMesh = mesh.GetSubMesh( myFace )->GetSubMeshDS(); - - SMDS_MeshNode dummy(0,0,0); - const SMDS_MeshElement* firstQuad = &dummy;// most left face above the last row of found nodes + const SMDS_MeshNode* dummy = mesh.GetMeshDS()->AddNode(0,0,0); + const SMDS_MeshElement* firstQuad = dummy; // most left face above the last row of found nodes int nbFoundNodes = myIndexer._xSize; while ( nbFoundNodes != myGrid.size() ) @@ -1068,7 +1071,7 @@ bool _QuadFaceGrid::LoadGrid( SMESH_Mesh& mesh ) n1up = n2up; } } - + mesh.GetMeshDS()->RemoveNode(dummy); DumpGrid(); // debug return true;