From 55138dfa2581fbdfbffcb4f49ab35e7f0e769a2e Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 8 Aug 2007 13:29:22 +0000 Subject: [PATCH] PAL16229 (Issue in order to mesh with Hexahedron algorithms) do not check shape topology in CheckHypothesis() --- src/StdMeshers/StdMeshers_Hexa_3D.cxx | 5 +++-- src/StdMeshers/StdMeshers_Prism_3D.cxx | 16 ++++++++-------- src/StdMeshers/StdMeshers_Projection_3D.cxx | 17 ++++++++++++++--- src/StdMeshers/StdMeshers_RadialPrism_3D.cxx | 9 +++++---- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/src/StdMeshers/StdMeshers_Hexa_3D.cxx b/src/StdMeshers/StdMeshers_Hexa_3D.cxx index c5a57cdba..d1567ae08 100644 --- a/src/StdMeshers/StdMeshers_Hexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_Hexa_3D.cxx @@ -118,6 +118,7 @@ bool StdMeshers_Hexa_3D::CheckHypothesis SMESH_Hypothesis::Hypothesis_Status& aStatus) { // check nb of faces in the shape +/* PAL16229 aStatus = SMESH_Hypothesis::HYP_BAD_GEOMETRY; int nbFaces = 0; for (TopExp_Explorer exp(aShape, TopAbs_FACE); exp.More(); exp.Next()) @@ -125,7 +126,7 @@ bool StdMeshers_Hexa_3D::CheckHypothesis break; if ( nbFaces != 6 ) return false; - +*/ aStatus = SMESH_Hypothesis::HYP_OK; return true; } @@ -193,7 +194,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, meshFaces.push_back(aSubMesh); } if (meshFaces.size() != 6) - return error(COMPERR_BAD_SHAPE, TComm(meshFaces.size())<<" instead of 6 faces in block"); + return error(COMPERR_BAD_SHAPE, TComm(meshFaces.size())<<" instead of 6 faces in a block"); // 0.2 - is each face meshed with Quadrangle_2D? (so, with a wire of 4 edges) diff --git a/src/StdMeshers/StdMeshers_Prism_3D.cxx b/src/StdMeshers/StdMeshers_Prism_3D.cxx index 267f0033f..6d28721e3 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.cxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.cxx @@ -185,7 +185,7 @@ bool StdMeshers_Prism_3D::CheckHypothesis(SMESH_Mesh& a SMESH_Hypothesis::Hypothesis_Status& aStatus) { // Check shape geometry - +/* PAL16229 aStatus = SMESH_Hypothesis::HYP_BAD_GEOMETRY; // find not quadrangle faces @@ -216,7 +216,7 @@ bool StdMeshers_Prism_3D::CheckHypothesis(SMESH_Mesh& a if ( nbFace != nbEdge + 2 ) RETURN_BAD_RESULT("Bad nb of faces: " << nbFace << " but must be " << nbEdge + 2); } - +*/ // no hypothesis aStatus = SMESH_Hypothesis::HYP_OK; return true; @@ -553,8 +553,8 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top() paramHint = prevTNode.GetParams(); if ( !myBlock.ComputeParameters( bN.GetCoords(), bN.ChangeParams(), ID_BOT_FACE, paramHint )) - return error(TCom("Can't compute normalized parameters ") - << "for node " << botNode->GetID() << " on the face #"<< botSM->GetId() ); + return error(TCom("Can't compute normalized parameters for node ") + << botNode->GetID() << " on the face #"<< botSM->GetId() ); prevTNode = bN; } // create node column @@ -608,8 +608,8 @@ bool StdMeshers_Prism_3D::projectBottomToTop() paramHint = prevTNode.GetParams(); if ( !myBlock.ComputeParameters( bN.GetCoords(), bN.ChangeParams(), ID_BOT_FACE, paramHint )) - return error(TCom("Can't compute normalized parameters ") - << "for node " << botNode->GetID() << " on the face #"<< botSM->GetId() ); + return error(TCom("Can't compute normalized parameters for node ") + << botNode->GetID() << " on the face #"<< botSM->GetId() ); prevTNode = bN; // compute top node coords gp_XYZ topXYZ; gp_XY topUV; @@ -875,11 +875,11 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper, // detect bad cases if ( nbNotQuad > 0 && nbNotQuad != 2 ) return error(COMPERR_BAD_SHAPE, - TCom("More than 2 not quadrilateral faces ") + TCom("More than 2 not quadrilateral faces: ") < 2 ) return error(COMPERR_BAD_INPUT_MESH, - TCom("More than 2 faces meshed with not quadrangle elements ") + TCom("More than 2 faces with not quadrangle elements: ") <::const_iterator itl; const list &hyps = GetUsedHypothesis(aMesh, aShape); @@ -206,14 +207,24 @@ bool StdMeshers_Projection_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aS srcShell = TopoDS::Shell( exp.Current() ); if ( nbShell != 1 ) return error(COMPERR_BAD_SHAPE, - SMESH_Comment("Shape must have 1 shell but not") << nbShell); + SMESH_Comment("Source shape must have 1 shell but not ") << nbShell); exp.Init( aShape, TopAbs_SHELL ); for ( nbShell = 0; exp.More(); exp.Next(), ++nbShell ) tgtShell = TopoDS::Shell( exp.Current() ); if ( nbShell != 1 ) return error(COMPERR_BAD_SHAPE, - SMESH_Comment("Shape must have 1 shell but not") << nbShell); + SMESH_Comment("Target shape must have 1 shell but not ") << nbShell); + + // Check that shapes are blocks + if ( TAssocTool::Count( tgtShell, TopAbs_FACE , 1 ) != 6 || + TAssocTool::Count( tgtShell, TopAbs_EDGE , 1 ) != 12 || + TAssocTool::Count( tgtShell, TopAbs_WIRE , 1 ) != 6 ) + return error(COMPERR_BAD_SHAPE, "Target shape is not a block"); + if ( TAssocTool::Count( srcShell, TopAbs_FACE , 1 ) != 6 || + TAssocTool::Count( srcShell, TopAbs_EDGE , 1 ) != 12 || + TAssocTool::Count( srcShell, TopAbs_WIRE , 1 ) != 6 ) + return error(COMPERR_BAD_SHAPE, "Source shape is not a block"); // Assure that mesh on a source shape is computed diff --git a/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx b/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx index eab107c76..128b32077 100644 --- a/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx +++ b/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx @@ -98,13 +98,14 @@ bool StdMeshers_RadialPrism_3D::CheckHypothesis(SMESH_Mesh& SMESH_Hypothesis::Hypothesis_Status& aStatus) { // check aShape that must have 2 shells +/* PAL16229 if ( TAssocTool::Count( aShape, TopAbs_SOLID, 0 ) != 1 || TAssocTool::Count( aShape, TopAbs_SHELL, 0 ) != 2 ) { aStatus = HYP_BAD_GEOMETRY; return false; } - +*/ myNbLayerHypo = 0; myDistributionHypo = 0; @@ -167,7 +168,7 @@ bool StdMeshers_RadialPrism_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& a if ( !outerShell.IsSame( It.Value() )) innerShell = It.Value(); if ( nbShells != 2 ) - return error(COMPERR_BAD_SHAPE, SMESH_Comment("Must be 2 shells but not")<