X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_Hexa_3D.cxx;h=53877e2abdbd5399bc727f0abeefa31171c454e7;hb=1ce54e1c128c2e3e5caf2a57daf92489c419fd6e;hp=7dadb9c2503f056e3c603a3e95979acf9f819678;hpb=385d4cede5f752d0eec26c306f3b5e14511e2a3d;p=modules%2Fsmesh.git diff --git a/src/StdMeshers/StdMeshers_Hexa_3D.cxx b/src/StdMeshers/StdMeshers_Hexa_3D.cxx index 7dadb9c25..53877e2ab 100644 --- a/src/StdMeshers/StdMeshers_Hexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_Hexa_3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2020 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 @@ -77,6 +77,7 @@ StdMeshers_Hexa_3D::StdMeshers_Hexa_3D(int hypId, SMESH_Gen * gen) _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type _requireShape = false; _compatibleHypothesis.push_back("ViscousLayers"); + _quadAlgo = new StdMeshers_Quadrangle_2D( gen->GetANewId(), _gen ); } //============================================================================= @@ -87,6 +88,8 @@ StdMeshers_Hexa_3D::StdMeshers_Hexa_3D(int hypId, SMESH_Gen * gen) StdMeshers_Hexa_3D::~StdMeshers_Hexa_3D() { + delete _quadAlgo; + _quadAlgo = 0; } //============================================================================= @@ -164,7 +167,7 @@ namespace // map of (node parameter on EDGE) to (column (vector) of nodes) TParam2ColumnMap _u2nodesMap; - // node column's taken form _u2nodesMap taking into account sub-shape orientation + // node column's taken from _u2nodesMap taking into account sub-shape orientation vector _columns; // columns of normalized parameters of nodes within the unitary cube @@ -231,7 +234,7 @@ namespace for ( int i = 1; i < 6; ++i ) { if ( !quad[i] ) continue; - for ( unsigned iS = 0; iS < quad[i]->side.size(); ++iS ) + for ( size_t iS = 0; iS < quad[i]->side.size(); ++iS ) { const StdMeshers_FaceSidePtr side2 = quad[i]->side[iS]; if (( side->FirstVertex().IsSame( side2->FirstVertex() ) || @@ -244,9 +247,9 @@ namespace if ( iS != Q_BOTTOM ) { vector< FaceQuadStruct::Side > newSides; - for ( unsigned j = iS; j < quad[i]->side.size(); ++j ) + for ( size_t j = iS; j < quad[i]->side.size(); ++j ) newSides.push_back( quad[i]->side[j] ); - for ( unsigned j = 0; j < iS; ++j ) + for ( size_t j = 0; j < iS; ++j ) newSides.push_back( quad[i]->side[j] ); quad[i]->side.swap( newSides ); } @@ -363,7 +366,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, if ( exp.Next(), exp.More() ) return error(COMPERR_BAD_SHAPE, "More than one SHELL in the geometry"); - TopTools_IndexedMapOfShape FF; + TopTools_IndexedMapOfShape FF, EE; TopExp::MapShapes( aShape, TopAbs_FACE, FF); if ( FF.Extent() != 6) { @@ -375,14 +378,23 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, // Find sides of a cube // --------------------- - + + // tool creating quadratic elements if needed + SMESH_MesherHelper helper (aMesh); + _quadraticMesh = helper.IsQuadraticSubMesh(aShape); + + TopExp::MapShapes( aShape, TopAbs_EDGE, EE ); + SMESH_MesherHelper* faceHelper = ( EE.Size() == 12 ) ? 0 : &helper; + FaceQuadStructPtr quad[ 6 ]; - StdMeshers_Quadrangle_2D quadAlgo( _gen->GetANewId(), _gen); for ( int i = 0; i < 6; ++i ) { - if ( !( quad[i] = FaceQuadStructPtr( quadAlgo.CheckNbEdges( aMesh, FF( i+1 ), - /*considerMesh=*/true)))) - return error( quadAlgo.GetComputeError() ); + if ( faceHelper ) + faceHelper->SetSubShape( FF( i+1 )); + if ( !( quad[i] = FaceQuadStructPtr( _quadAlgo->CheckNbEdges( aMesh, FF( i+1 ), + /*considerMesh=*/true, + faceHelper)))) + return error( _quadAlgo->GetComputeError() ); if ( quad[i]->side.size() != 4 ) return error( COMPERR_BAD_SHAPE, "Not a quadrangular box side" ); } @@ -437,10 +449,6 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, // Check presence of regular grid mesh on FACEs of the cube // ------------------------------------------------------------ - // tool creating quadratic elements if needed - SMESH_MesherHelper helper (aMesh); - _quadraticMesh = helper.IsQuadraticSubMesh(aShape); - for ( int i = 0; i < 6; ++i ) { const TopoDS_Face& F = aCubeSide[i]._quad->face; @@ -513,8 +521,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, if ( proxymesh ) for ( int i = 0; i < 6; ++i ) - for ( unsigned j = 0; j < aCubeSide[i]._columns.size(); ++j) - for ( unsigned k = 0; k < aCubeSide[i]._columns[j].size(); ++k) + for ( size_t j = 0; j < aCubeSide[i]._columns.size(); ++j) + for ( size_t k = 0; k < aCubeSide[i]._columns[j].size(); ++k) { const SMDS_MeshNode* & n = aCubeSide[i]._columns[j][k]; n = proxymesh->GetProxyNode( n ); @@ -534,18 +542,24 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, _FaceGrid* fFront = & aCubeSide[ B_FRONT ]; _FaceGrid* fBack = & aCubeSide[ B_BACK ]; - // compute normalized parameters of nodes on sides (PAL23189) - computeIJK( *fBottom, COO_X, COO_Y, /*z=*/0. ); - computeIJK( *fRight, COO_Y, COO_Z, /*x=*/1. ); - computeIJK( *fTop, COO_X, COO_Y, /*z=*/1. ); - computeIJK( *fLeft, COO_Y, COO_Z, /*x=*/0. ); - computeIJK( *fFront, COO_X, COO_Z, /*y=*/0. ); - computeIJK( *fBack, COO_X, COO_Z, /*y=*/1. ); - // cube size measured in nb of nodes - int x, xSize = fBottom->_columns.size() , X = xSize - 1; - int y, ySize = fLeft->_columns.size() , Y = ySize - 1; - int z, zSize = fLeft->_columns[0].size(), Z = zSize - 1; + size_t x, xSize = fBottom->_columns.size() , X = xSize - 1; + size_t y, ySize = fLeft->_columns.size() , Y = ySize - 1; + size_t z, zSize = fLeft->_columns[0].size(), Z = zSize - 1; + + // check sharing of FACEs (IPAL54417) + if ( fFront ->_columns.size() != xSize || + fBack ->_columns.size() != xSize || + fTop ->_columns.size() != xSize || + + fRight ->_columns.size() != ySize || + fTop ->_columns[0].size() != ySize || + fBottom->_columns[0].size() != ySize || + + fRight ->_columns[0].size() != zSize || + fFront ->_columns[0].size() != zSize || + fBack ->_columns[0].size() != zSize ) + return error( COMPERR_BAD_SHAPE, "Not sewed faces" ); // columns of internal nodes "rising" from nodes of fBottom _Indexer colIndex( xSize, ySize ); @@ -583,6 +597,14 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, } } + // compute normalized parameters of nodes on sides (PAL23189) + computeIJK( *fBottom, COO_X, COO_Y, /*z=*/0. ); + computeIJK( *fRight, COO_Y, COO_Z, /*x=*/1. ); + computeIJK( *fTop, COO_X, COO_Y, /*z=*/1. ); + computeIJK( *fLeft, COO_Y, COO_Z, /*x=*/0. ); + computeIJK( *fFront, COO_X, COO_Z, /*y=*/0. ); + computeIJK( *fBack, COO_X, COO_Z, /*y=*/1. ); + // projection points of the internal node on cube sub-shapes by which // coordinates of the internal node are computed vector pointsOnShapes( SMESH_Block::ID_Shell );