X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_Projection_1D2D.cxx;h=63fc73dc9ae518f145fa3b2b6bd9d39e891a47c7;hp=efe6bf034819dd7a5c7a696f65812988343d9b55;hb=f90e1ea49e27e4188ba8bff184ec45f28fd3574a;hpb=bd4e115a78b52e3fbc016e5e30bb0e19b2a9e7d6 diff --git a/src/StdMeshers/StdMeshers_Projection_1D2D.cxx b/src/StdMeshers/StdMeshers_Projection_1D2D.cxx index efe6bf034..63fc73dc9 100644 --- a/src/StdMeshers/StdMeshers_Projection_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_1D2D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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 @@ -6,7 +6,7 @@ // 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 @@ -27,6 +27,7 @@ #include "SMESH_Gen.hxx" #include "SMESH_MesherHelper.hxx" +#include "SMESH_subMesh.hxx" #include "SMESH_subMeshEventListener.hxx" #include "StdMeshers_FaceSide.hxx" #include "StdMeshers_ProjectionSource2D.hxx" @@ -69,7 +70,7 @@ namespace * \brief Structure used to temporary remove EventProparatorToEdges from faceSubMesh * in order to prevent propagation of CLEAN event from FACE to EDGEs during * StdMeshers_Projection_1D2D::Compute(). The CLEAN event is emmited by Pattern mapper - * and causes removal of faces generated on adjacent FACEs. + * and causes removal of faces generated on adjacent FACEs. */ struct UnsetterOfEventProparatorToEdges { @@ -107,9 +108,13 @@ bool StdMeshers_Projection_1D2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape { UnsetterOfEventProparatorToEdges eventBarrier( theMesh.GetSubMesh( theShape )); + // 1) Project faces + if ( !StdMeshers_Projection_2D::Compute(theMesh, theShape)) return false; + // 2) Create segments + SMESHDS_Mesh * meshDS = theMesh.GetMeshDS(); SMESHDS_SubMesh * faceSubMesh = meshDS->MeshElements( theShape ); @@ -119,6 +124,38 @@ bool StdMeshers_Projection_1D2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape SMESH_MesherHelper helper( theMesh ); helper.SetSubShape( theShape ); + if ( _quadraticMesh ) + { + // 2a) Move some medium nodes from FACE to EDGES. They are on FACE because + // EDGEs are discreteized later than FACE, in this case. + + SMESH_MesherHelper posFixer( theMesh ); + posFixer.ToFixNodeParameters( true ); + SMDS_ElemIteratorPtr fIt = faceSubMesh->GetElements(); + vector< const SMDS_MeshNode* > nodes; + double dummyU, tol = 1e-7; + while ( fIt->more() ) // loop on mesh faces created by StdMeshers_Projection_2D + { + const SMDS_MeshElement* f = fIt->next(); + //if ( !f->IsQuadratic() ) continue; + nodes.assign( SMDS_MeshElement::iterator( f->interlacedNodesElemIterator() ), + SMDS_MeshElement::iterator() ); + nodes.push_back( nodes[0] ); + for ( size_t i = 2; i < nodes.size(); i += 2 ) + { + pair idType = helper.GetMediumPos( nodes[i], nodes[i-2] ); + if ( idType.second == TopAbs_EDGE && + idType.first != nodes[i-1]->getshapeId() ) + { + faceSubMesh->RemoveNode( nodes[i-1], /*isDeleted=*/false ); + meshDS->SetNodeOnEdge( (SMDS_MeshNode*) nodes[i-1], idType.first ); + posFixer.SetSubShape( idType.first ); + posFixer.CheckNodeU( TopoDS::Edge( posFixer.GetSubShape() ), + nodes[i-1], dummyU=0., tol, /*force=*/true ); + } + } + } + } TopoDS_Face F = TopoDS::Face( theShape ); TError err; TSideVector wires = StdMeshers_FaceSide::GetFaceWires( F, theMesh, @@ -172,7 +209,7 @@ bool StdMeshers_Projection_1D2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape meshDS->SetMeshElementOnShape( e, edgeID ); } } - } + } return true; } @@ -194,7 +231,7 @@ bool StdMeshers_Projection_1D2D::Evaluate(SMESH_Mesh& theMesh, if ( !srcMesh ) srcMesh = & theMesh; SMESH_subMesh* srcFaceSM = srcMesh->GetSubMesh( srcFace ); - typedef StdMeshers_ProjectionUtils SPU; + namespace SPU = StdMeshers_ProjectionUtils; SPU::TShapeShapeMap shape2ShapeMap; SPU::InitVertexAssociation( _sourceHypo, shape2ShapeMap ); if ( !SPU::FindSubShapeAssociation( theShape, &theMesh, srcFace, srcMesh, shape2ShapeMap))