diff --git a/idl/SMESH_BasicHypothesis.idl b/idl/SMESH_BasicHypothesis.idl index 1d2c9261f..a4bb746a6 100644 --- a/idl/SMESH_BasicHypothesis.idl +++ b/idl/SMESH_BasicHypothesis.idl @@ -813,6 +813,16 @@ module StdMeshers * Returns entries of shapes defining enforced nodes */ SMESH::string_array GetEnfVertices(); + + /*! + * Set corner vertices + */ + void SetCorners( in SMESH::long_array vertexIDs ); + + /*! + * Return IDs of corner vertices + */ + SMESH::long_array GetCorners(); }; /*! diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index d98bb8fc1..1e9c1471a 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -93,12 +93,12 @@ namespace SMESH_Gen::~SMESH_Gen() { - std::map < int, SMESH_Hypothesis * >::iterator i_hyp = _studyContext->mapHypothesis.begin(); - for ( ; i_hyp != _studyContext->mapHypothesis.end(); ++i_hyp ) - { - if ( _Hyp* h = static_cast< _Hyp*>( i_hyp->second )) - h->NullifyGen(); - } + std::map < int, SMESH_Hypothesis * >::iterator i_hyp = _studyContext->mapHypothesis.begin(); + for ( ; i_hyp != _studyContext->mapHypothesis.end(); ++i_hyp ) + { + if ( _Hyp* h = static_cast< _Hyp*>( i_hyp->second )) + h->NullifyGen(); + } delete _studyContext->myDocument; delete _studyContext; } diff --git a/src/SMESHGUI/CMakeLists.txt b/src/SMESHGUI/CMakeLists.txt index fe5553be4..2cdeb50e6 100644 --- a/src/SMESHGUI/CMakeLists.txt +++ b/src/SMESHGUI/CMakeLists.txt @@ -145,6 +145,7 @@ SET(_moc_HEADERS SMESHGUI_DisplayEntitiesDlg.h SMESHGUI_SplitBiQuad.h SMESHGUI_IdPreview.h + SMESHGUI_PreVisualObj.h ) # header files / no moc processing diff --git a/src/SMESHGUI/SMESHGUI_PreVisualObj.cxx b/src/SMESHGUI/SMESHGUI_PreVisualObj.cxx index f1aebce8d..a01e907db 100644 --- a/src/SMESHGUI/SMESHGUI_PreVisualObj.cxx +++ b/src/SMESHGUI/SMESHGUI_PreVisualObj.cxx @@ -22,12 +22,17 @@ #include "SMESHGUI_PreVisualObj.h" -#include +#include #include SMESHGUI_PreVisualObj::SMESHGUI_PreVisualObj() { - myMesh = new SMDS_Mesh(); + myMesh = new SMESHDS_Mesh(0,true); +} + +SMDS_Mesh* SMESHGUI_PreVisualObj::GetMesh() const +{ + return myMesh; } bool SMESHGUI_PreVisualObj::Update( int theIsClear = true ) diff --git a/src/SMESHGUI/SMESHGUI_PreVisualObj.h b/src/SMESHGUI/SMESHGUI_PreVisualObj.h index 83745e40f..33dc79e41 100644 --- a/src/SMESHGUI/SMESHGUI_PreVisualObj.h +++ b/src/SMESHGUI/SMESHGUI_PreVisualObj.h @@ -29,6 +29,8 @@ #include "SMESH_Object.h" +class SMESHDS_Mesh; + /*! * \brief Incarnation of SMESH_VisualObj allowing usage of SMESH_Actor * to show arbitrary mesh data. SMESHGUI_PreVisualObj encapsulates @@ -37,13 +39,14 @@ */ class SMESHGUI_EXPORT SMESHGUI_PreVisualObj : public SMESH_VisualObj { - mutable SMDS_Mesh* myMesh; - bool myEntitiesFlag; - unsigned int myEntitiesState; + mutable SMESHDS_Mesh* myMesh; + bool myEntitiesFlag; + unsigned int myEntitiesState; public: SMESHGUI_PreVisualObj(); - virtual SMDS_Mesh* GetMesh() const { return myMesh; } + virtual SMDS_Mesh* GetMesh() const; + SMESHDS_Mesh* GetMeshDS() const { return myMesh; } virtual bool Update( int theIsClear ); virtual bool NulData() { return false; } diff --git a/src/SMESHUtils/SMESH_Indexer.hxx b/src/SMESHUtils/SMESH_Indexer.hxx index ff5628bbe..161e69b5f 100644 --- a/src/SMESHUtils/SMESH_Indexer.hxx +++ b/src/SMESHUtils/SMESH_Indexer.hxx @@ -82,7 +82,7 @@ struct SMESH_Indexer3D * the directions. Any combination of these transformations is allowed. * * The following code picks up a transformation such that two known array items - * appear in a desired positions: + * appear in desired positions: * \code * for ( int ori = 0; ori < SMESH_OrientedIndexer::MAX_ORI+1; ++ori ) * { diff --git a/src/SMESH_I/SMESH_PythonDump.cxx b/src/SMESH_I/SMESH_PythonDump.cxx index 5c9163bf4..6a88325b1 100644 --- a/src/SMESH_I/SMESH_PythonDump.cxx +++ b/src/SMESH_I/SMESH_PythonDump.cxx @@ -244,25 +244,6 @@ namespace SMESH return *this; } - template - void DumpArray(const TArray& theArray, TPythonDump & theStream) - { - if ( theArray.length() == 0 ) - { - theStream << "[]"; - } - else - { - theStream << "[ "; - for (CORBA::ULong i = 1; i <= theArray.length(); i++) { - theStream << theArray[i-1]; - if ( i < theArray.length() ) - theStream << ", "; - } - theStream << " ]"; - } - } - TPythonDump& TPythonDump::operator<<(const SMESH::long_array& theArg) { diff --git a/src/SMESH_I/SMESH_PythonDump.hxx b/src/SMESH_I/SMESH_PythonDump.hxx index 587b2bd6b..a6dfb7669 100644 --- a/src/SMESH_I/SMESH_PythonDump.hxx +++ b/src/SMESH_I/SMESH_PythonDump.hxx @@ -239,6 +239,27 @@ namespace SMESH TPythonDump& operator<<(const std::string& theArg); + + template + static TStream& DumpArray(const TArray& theArray, TStream & theStream) + { + if ( theArray.length() == 0 ) + { + theStream << "[]"; + } + else + { + theStream << "[ "; + for (CORBA::ULong i = 1; i <= theArray.length(); i++) { + theStream << theArray[i-1]; + if ( i < theArray.length() ) + theStream << ", "; + } + theStream << " ]"; + } + return theStream; + } + static const char* SMESHGenName() { return "smeshgen"; } static const char* MeshEditorName() { return "mesh_editor"; } static const char* NotPublishedObjectName(); diff --git a/src/SMESH_SWIG/StdMeshersBuilder.py b/src/SMESH_SWIG/StdMeshersBuilder.py index d50665f4e..858820238 100644 --- a/src/SMESH_SWIG/StdMeshersBuilder.py +++ b/src/SMESH_SWIG/StdMeshersBuilder.py @@ -726,7 +726,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm): pass def QuadrangleParameters(self, quadType=StdMeshers.QUAD_STANDARD, triangleVertex=0, - enfVertices=[],enfPoints=[],UseExisting=0): + enfVertices=[],enfPoints=[],corners=[],UseExisting=0): """ Defines "QuadrangleParameters" hypothesis quadType defines the algorithm of transition between differently descretized @@ -762,6 +762,13 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm): or triples of values ([[x1,y1,z1], [x2,y2,z2], ...]). In the case if the defined QuadrangleParameters() refer to a sole face, all given points must lie on this face, else the mesher fails. + corners: list of vertices that should be used as quadrangle corners. + The parameter can be useful for faces with more than four vertices, + since in some cases Quadrangle Mapping algorithm chooses corner vertices + differently than it is desired. + A hypothesis can be global and define corners for all CAD faces that + require it, but be sure that each specified vertex is a corner in all + faces the hypothesis will be applied to. UseExisting: if *True* - searches for the existing hypothesis created with the same parameters, else (default) - Create a new one """ @@ -774,6 +781,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm): if isinstance( enfVertices, int ) and not enfPoints and not UseExisting: # a call of old syntax, before inserting enfVertices and enfPoints before UseExisting UseExisting, enfVertices = enfVertices, [] + pStructs, xyz = [], [] for p in enfPoints: if isinstance( p, SMESH.PointStruct ): @@ -791,6 +799,10 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm): self.params = self.Hypothesis("QuadrangleParams", [quadType,vertexID,entries,xyz], UseExisting = UseExisting, CompareMethod=compFun) pass + + if corners and isinstance( corners[0], GEOM._objref_GEOM_Object ): + corners = [ self.mesh.geompyD.GetSubShapeID( self.mesh.geom, v ) for v in corners ] + if self.params.GetQuadType() != quadType: self.params.SetQuadType(quadType) if vertexID > 0: @@ -799,6 +811,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm): for v in enfVertices: AssureGeomPublished( self.mesh, v ) self.params.SetEnforcedNodes( enfVertices, pStructs ) + self.params.SetCorners( corners ) return self.params def QuadranglePreference(self, reversed=False, UseExisting=0): diff --git a/src/StdMeshers/StdMeshers_FixedPoints1D.cxx b/src/StdMeshers/StdMeshers_FixedPoints1D.cxx index 81759f911..28432c8bf 100644 --- a/src/StdMeshers/StdMeshers_FixedPoints1D.cxx +++ b/src/StdMeshers/StdMeshers_FixedPoints1D.cxx @@ -60,7 +60,7 @@ StdMeshers_FixedPoints1D::~StdMeshers_FixedPoints1D() */ //============================================================================= -void StdMeshers_FixedPoints1D::SetPoints(std::vector& listParams) +void StdMeshers_FixedPoints1D::SetPoints(const std::vector& listParams) throw(SALOME_Exception) { _params = listParams; @@ -73,7 +73,7 @@ void StdMeshers_FixedPoints1D::SetPoints(std::vector& listParams) */ //============================================================================= -void StdMeshers_FixedPoints1D::SetNbSegments(std::vector& listNbSeg) +void StdMeshers_FixedPoints1D::SetNbSegments(const std::vector& listNbSeg) throw(SALOME_Exception) { _nbsegs = listNbSeg; diff --git a/src/StdMeshers/StdMeshers_FixedPoints1D.hxx b/src/StdMeshers/StdMeshers_FixedPoints1D.hxx index 56366cb00..f8c42810d 100644 --- a/src/StdMeshers/StdMeshers_FixedPoints1D.hxx +++ b/src/StdMeshers/StdMeshers_FixedPoints1D.hxx @@ -41,10 +41,10 @@ public: StdMeshers_FixedPoints1D(int hypId, SMESH_Gen* gen); virtual ~StdMeshers_FixedPoints1D(); - void SetPoints(std::vector& listParams) + void SetPoints(const std::vector& listParams) throw(SALOME_Exception); - void SetNbSegments(std::vector& listNbSeg) + void SetNbSegments(const std::vector& listNbSeg) throw(SALOME_Exception); const std::vector& GetPoints() const { return _params; } diff --git a/src/StdMeshers/StdMeshers_Prism_3D.cxx b/src/StdMeshers/StdMeshers_Prism_3D.cxx index 4d02c40bb..2db5afa7b 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.cxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.cxx @@ -5363,15 +5363,34 @@ void StdMeshers_Sweeper::fillZColumn( TZColumn& zColumn, void StdMeshers_Sweeper::prepareTopBotDelaunay() { + SMESH_MesherHelper* helper[2] = { myHelper, myHelper }; + SMESH_MesherHelper botHelper( *myHelper->GetMesh() ); + SMESH_MesherHelper topHelper( *myHelper->GetMesh() ); + const SMDS_MeshNode* intBotNode = 0; + const SMDS_MeshNode* intTopNode = 0; + if ( myHelper->HasSeam() || myHelper->HasDegeneratedEdges() ) // use individual helpers + { + botHelper.SetSubShape( myBotFace ); + topHelper.SetSubShape( myTopFace ); + helper[0] = & botHelper; + helper[1] = & topHelper; + if ( !myIntColumns.empty() ) + { + TNodeColumn& nodes = *myIntColumns[ myIntColumns.size()/2 ]; + intBotNode = nodes[0]; + intTopNode = nodes.back(); + } + } + UVPtStructVec botUV( myBndColumns.size() ); UVPtStructVec topUV( myBndColumns.size() ); for ( size_t i = 0; i < myBndColumns.size(); ++i ) { TNodeColumn& nodes = *myBndColumns[i]; botUV[i].node = nodes[0]; - botUV[i].SetUV( myHelper->GetNodeUV( myBotFace, nodes[0] )); + botUV[i].SetUV( helper[0]->GetNodeUV( myBotFace, nodes[0], intBotNode )); topUV[i].node = nodes.back(); - topUV[i].SetUV( myHelper->GetNodeUV( myTopFace, nodes.back() )); + topUV[i].SetUV( helper[1]->GetNodeUV( myTopFace, nodes.back(), intTopNode )); botUV[i].node->setIsMarked( true ); } TopoDS_Edge dummyE;