From d245f797f1b69aca678fa372391275d7042faa10 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 9 Oct 2020 11:44:21 +0300 Subject: [PATCH] #19926 [CEA 19782] renumbering meshes --- doc/salome/examples/filters_ex39.py | 12 +- .../gui/SMESH/images/block_renumber_hyp.png | Bin 0 -> 27071 bytes .../gui/SMESH/input/3d_meshing_hypo.rst | 42 ++ doc/salome/gui/SMESH/input/about_hypo.rst | 4 +- .../SMESH/input/max_element_volume_hypo.rst | 14 - .../SMESH/input/tui_defining_hypotheses.rst | 14 + idl/SMESH_BasicHypothesis.idl | 19 + resources/CMakeLists.txt | 1 + resources/StdMeshers.xml.in | 7 + resources/mesh_tree_hypo_renumber.png | Bin 0 -> 250 bytes src/SMESH/SMESH_Mesh.cxx | 10 + src/SMESH/SMESH_Mesh.hxx | 4 + src/SMESH_I/SMESH_Gen_i.hxx | 8 +- src/SMESH_I/SMESH_Gen_i_1.cxx | 27 +- src/SMESH_I/SMESH_Mesh_i.cxx | 17 +- src/SMESH_SWIG/StdMeshersBuilder.py | 9 + src/SMESH_SWIG/smeshBuilder.py | 5 +- src/StdMeshers/CMakeLists.txt | 3 + src/StdMeshers/StdMeshers_BlockRenumber.cxx | 324 +++++++++++ src/StdMeshers/StdMeshers_BlockRenumber.hxx | 170 ++++++ .../StdMeshers_CompositeHexa_3D.cxx | 251 ++++++++- .../StdMeshers_CompositeHexa_3D.hxx | 9 +- src/StdMeshers/StdMeshers_Hexa_3D.cxx | 359 ++++++++++-- src/StdMeshers/StdMeshers_Hexa_3D.hxx | 2 + src/StdMeshersGUI/CMakeLists.txt | 2 + src/StdMeshersGUI/StdMeshersGUI.cxx | 7 +- .../StdMeshersGUI_BlockRenumberCreator.cxx | 515 ++++++++++++++++++ .../StdMeshersGUI_BlockRenumberCreator.h | 89 +++ src/StdMeshersGUI/StdMeshers_images.ts | 8 + src/StdMeshersGUI/StdMeshers_msg_en.ts | 59 ++ src/StdMeshers_I/CMakeLists.txt | 2 + .../StdMeshers_BlockRenumber_i.cxx | 189 +++++++ .../StdMeshers_BlockRenumber_i.hxx | 76 +++ src/StdMeshers_I/StdMeshers_i.cxx | 3 + 34 files changed, 2160 insertions(+), 101 deletions(-) create mode 100644 doc/salome/gui/SMESH/images/block_renumber_hyp.png create mode 100644 doc/salome/gui/SMESH/input/3d_meshing_hypo.rst delete mode 100644 doc/salome/gui/SMESH/input/max_element_volume_hypo.rst create mode 100644 resources/mesh_tree_hypo_renumber.png create mode 100644 src/StdMeshers/StdMeshers_BlockRenumber.cxx create mode 100644 src/StdMeshers/StdMeshers_BlockRenumber.hxx create mode 100644 src/StdMeshersGUI/StdMeshersGUI_BlockRenumberCreator.cxx create mode 100644 src/StdMeshersGUI/StdMeshersGUI_BlockRenumberCreator.h create mode 100644 src/StdMeshers_I/StdMeshers_BlockRenumber_i.cxx create mode 100644 src/StdMeshers_I/StdMeshers_BlockRenumber_i.hxx diff --git a/doc/salome/examples/filters_ex39.py b/doc/salome/examples/filters_ex39.py index 2d3c907d6..6a2ddd507 100644 --- a/doc/salome/examples/filters_ex39.py +++ b/doc/salome/examples/filters_ex39.py @@ -1,4 +1,4 @@ -# Elements of a domain +# "Elements of a domain" filter and "Renumber" hypothesis import salome, SMESH salome.salome_init() @@ -22,7 +22,15 @@ mesh = smesh.Mesh( boxes ) mesh.Segment(box1).NumberOfSegments( 5 ) # to have different nb of elements on the boxes mesh.Segment(box2).NumberOfSegments( 10 ) mesh.Quadrangle() -mesh.Hexahedron() +ijkAlgo = mesh.Hexahedron() + +# Use Renumber hypothesis to get hexahedra and nodes numbered like in a structured mesh. +# k axis of box1 will be ( 100,100,0 ) - ( 100,100,100 ) +# k axis of box2 will be ( 0,0,0 ) - (0,0,100), by default +v000 = geompy.MakeVertex( 100,100,0, theName='v000' ) # can use box sub-vertex or standalone one +v001 = geompy.GetVertexNearPoint( box1, geompy.MakeVertex(100,100,100), theName='v001') +ijkAlgo.Renumber([ smeshBuilder.BlockCS( box1, v000, v001 ) ]) + mesh.Compute() # Create filters with FT_ConnectedElements criterion by pointing a domain in different ways: diff --git a/doc/salome/gui/SMESH/images/block_renumber_hyp.png b/doc/salome/gui/SMESH/images/block_renumber_hyp.png new file mode 100644 index 0000000000000000000000000000000000000000..4c610f7874cd11d00980ce14a670d20a89f16861 GIT binary patch literal 27071 zcmbTd1z1#H+c%1dA_ywdAtK$~jFQsQ9n#(1NVjx{AYCHe(%mvNNHYxG%~|9BdCq&T z^L+1DUU~^Ld-klo_FDJ-s~!AFS`-Zh4+RMc2~F&ykQ@@yeO@G_d!|nwgI90!JHu3zo0#x65kXjVG??B8gF1qojbj2nd}x~X8GQP zzV=JV{XTj|mW?xHrl$kHGT#K9ZPc%aaBZmWvgq1f@eXrEF7s>}ye9F(5C{^NL}uLV zR9zzs#1MEwB2>WR%9oV5w=gW_jPzVvigwr;9Q1@lJWV7eWh?O|QG3a;?K6=l;GWvy zMl7I}JJ>LsUAmZ~kn@t6{NTh@*0s*Rz?evJe6OdcZ0;f`jm2?0CAhv;k^2kr?XsR@ zWgVY7E1pkWmt4_vtm{V|cM~y}cIm9F%I%&!VoO{f04)9+q0oi#Kz!m)M4oiPU?6t5=|%f4oLi!kY$ zHTo+Jl1SLRk9@AE_?}I-NI$#veS~hHR=HsIgszd1=1)D{1ogdB&c8$BXH}!Cu7;A~ zlRKW~?j0VMYJZ)6k)Es}^g&ow!9IV=1hsZ*^^>6817xIcHOjVFYm(k=b)Q{myppY|E6Rywl(f%>4M({ zyI)e&H8E4RG@7y6TWKh`&Xw;c!KiB4@_QYI`4!|#Ulp<5E5Xua%8>1bY}jN@`&}bf z&A8jFPV=#QOKS_icH6d0G8@<6B|A9iCeBva`K&nIj8=3Y#NyOgG!y;xn-Q$snLWMU zM)_v3loe9(#UgH%+aE(<4!QW8zD7YtHumMjaKbB0`MV9R=e%`XF?+<0l=YtX5Tj+k zw)+5&RGQG!`$)pY_AKzXT`j(Rf$3iGm#A1X{p&*CP@-kCj{5_kKnymZGaGmU^w2@=o_8 z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mBg>-i4LTV$#o_&sdNhWSxj#9=3&nsuB-VYn`?;f>7-;3J9H| zm0^ikDh6-5J(-;{nL%WG^U*(nhdd80}Efv?CU_b~@3aF$jLw$UmpK)>@sP>?k zGpUgMc);=bp4LtebJg}hQCVhA&NT`O3Q3P$?{^nb5kC@;ecEE+;RX|CdhrEh(xop; zZwJ%?S~av(UjXo3EHCfxEv#TB9pw<*0ipkAl-4a;{=O%sV;g=ABqJ*q=N(j4RJ0#C zOf8k(_nUauBkq)P`nL-M`wXD^!bw+A@14#L4v620GqeePl7VmpEF0wwEyi0jYZ8%B z2t8Zz@A-ba3{jZVcuC#a^YWvTkJ90i{vi}Q7#utv3hxFh-sWs03NxJQ8C29gun-cDXhHxUB_o}%tFmnc7*1m}OL0=C${OL9V2r&Kqz8GB$gMSHqh z&mZe3=YZ#{^pGa&5)cKU{%7ph|5mzm`_^o78+adr(>|VX$-YjUKZGtmxC@@Z1W{Ac KR4kP@5B*=qw4%cR literal 0 HcmV?d00001 diff --git a/doc/salome/gui/SMESH/input/3d_meshing_hypo.rst b/doc/salome/gui/SMESH/input/3d_meshing_hypo.rst new file mode 100644 index 000000000..bef317c09 --- /dev/null +++ b/doc/salome/gui/SMESH/input/3d_meshing_hypo.rst @@ -0,0 +1,42 @@ +.. _a3d_meshing_hypo_page: + +********************* +3D Meshing Hypotheses +********************* + +.. _max_element_volume_hypo: + +Max Element Volume hypothesis +############################# + +**Max Element Volume** hypothesis is applied for meshing of 3D objects composing your geometrical object. Definition of this hypothesis consists of setting the **maximum volume** of 3D meshing elements (depending on the chosen meshing algorithm it can be **hexahedrons** or **tetrahedrons**), which will compose the mesh of these 3D objects. + +.. image:: ../images/a-maxelvolume.png + :align: center + +**See Also** a sample TUI Script of a :ref:`tui_max_element_volume` operation. + +.. _block_renumber_hypo: + +Renumber hypothesis +################### + +**Renumber** hypothesis is applied for meshing of 3D objects along with **Hexahedron (i,j,k)** algorithm. + +Order and hence numbering of hexahedral elements in the structured mesh generated by **Hexahedron (ijk)** algorithm depends on the order of faces in a block geometry. Nodes are not in a structured order, since geometrical edges and faces are discretized before construction of hexahedra. **Renumber** hypothesis allows for getting hexahedra and nodes ordered like in a structured grid. + +.. image:: ../images/block_renumber_hyp.png + :align: center + +**Renumber** hypothesis allows to define direction of **i, j** and **k** axes of a block. For that you specify two vertices of the block + +* **Vertex (0,0,0)** located at the origin of the block local coordinate system. +* **Vertex (0,0,1)** located at the end of **k** axis of the block. + +Axes **i** and **j** are found automatically using the right-hand rule. + +For blocks with edges parallel to the axes of global coordinate system, their local coordinate system by default is defined as having axes parallel to the global ones. So, for such blocks specification of vertices is optional, it is enough just to assign **Renumber** hypothesis. + +**See Also** a sample TUI Script of a :ref:`tui_block_renumber` operation. + + diff --git a/doc/salome/gui/SMESH/input/about_hypo.rst b/doc/salome/gui/SMESH/input/about_hypo.rst index df935f3d7..a4609d905 100644 --- a/doc/salome/gui/SMESH/input/about_hypo.rst +++ b/doc/salome/gui/SMESH/input/about_hypo.rst @@ -16,7 +16,7 @@ In **MESH** there are: * :ref:`a1d_meshing_hypo_page` for meshing of **edges** * :ref:`a2d_meshing_hypo_page` for meshing of **faces** -* :ref:`3D Hypothesis ` for meshing of **volumes** +* :ref:`a3d_meshing_hypo_page` for meshing of **volumes** * :ref:`additional_hypo_page` **Table of Contents** @@ -26,6 +26,6 @@ In **MESH** there are: 1d_meshing_hypo.rst 2d_meshing_hypo.rst - 3D: Max Element Volume hypothesis + 3d_meshing_hypo.rst additional_hypo.rst diff --git a/doc/salome/gui/SMESH/input/max_element_volume_hypo.rst b/doc/salome/gui/SMESH/input/max_element_volume_hypo.rst deleted file mode 100644 index 5f835fc6b..000000000 --- a/doc/salome/gui/SMESH/input/max_element_volume_hypo.rst +++ /dev/null @@ -1,14 +0,0 @@ -.. _max_element_volume_hypo_page: - -***************************** -Max Element Volume hypothesis -***************************** - -**Max Element Volume** hypothesis is applied for meshing of 3D objects composing your geometrical object. Definition of this hypothesis consists of setting the **maximum volume** of 3D meshing elements (depending on the chosen meshing algorithm it can be **hexahedrons** or **tetrahedrons**), which will compose the mesh of these 3D objects. - -.. image:: ../images/a-maxelvolume.png - :align: center - -**See Also** a sample TUI Script of a :ref:`tui_max_element_volume` operation. - - diff --git a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.rst b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.rst index facc0fdc1..fd676a358 100644 --- a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.rst +++ b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.rst @@ -34,6 +34,10 @@ and hypotheses. * :ref:`tui_max_element_volume` hypothesis * :ref:`Viscous layers ` hypotheses +* Hexahedron (i,j,k) 3D algorithm + + * :ref:`tui_block_renumber` + * :ref:`tui_projection` * :ref:`Extrusion 3D ` algorithm * :ref:`Radial Prism ` algorithm @@ -136,6 +140,16 @@ Length from Edges :download:`Download this script <../../../examples/defining_hypotheses_ex07.py>` +.. _tui_block_renumber: + +Renumber 3D hypothesis +====================== + +.. literalinclude:: ../../../examples/filters_ex39.py + :language: python + +:download:`Download this script <../../../examples/filters_ex39.py>` + Defining Additional Hypotheses ############################## diff --git a/idl/SMESH_BasicHypothesis.idl b/idl/SMESH_BasicHypothesis.idl index 0f7edc5f6..a6b6882cc 100644 --- a/idl/SMESH_BasicHypothesis.idl +++ b/idl/SMESH_BasicHypothesis.idl @@ -1089,6 +1089,25 @@ module StdMeshers raises (SALOME::SALOME_Exception); }; + + /*! + * interface of "Renumber" hypothesis used by Hexahedron(ijk) algorithm + * to renumber mesh of a block to be structured-like + */ + struct BlockCS // Local coordinate system of a block + { + GEOM::GEOM_Object solid; + GEOM::GEOM_Object vertex000; + GEOM::GEOM_Object vertex001; + }; + typedef sequence blockcs_array; + + interface StdMeshers_BlockRenumber : SMESH::SMESH_Hypothesis + { + void SetBlocksOrientation( in blockcs_array blockCS ); + blockcs_array GetBlocksOrientation(); + }; + /*! * StdMeshers_SegmentAroundVertex_0D: interface of "SegmentAroundVertex" algorithm */ diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index fe0d107fb..1a5619a10 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -203,6 +203,7 @@ SET(SMESH_RESOURCES_FILES mesh_tree_hypo_projection_2d.png mesh_tree_hypo_projection_3d.png mesh_tree_hypo_quadratic.png + mesh_tree_hypo_renumber.png mesh_tree_hypo_segment.png mesh_tree_hypo_source_3d_shape.png mesh_tree_hypo_source_edge.png diff --git a/resources/StdMeshers.xml.in b/resources/StdMeshers.xml.in index d70cdd45e..8baf92e0a 100644 --- a/resources/StdMeshers.xml.in +++ b/resources/StdMeshers.xml.in @@ -226,6 +226,11 @@ icon-id ="mesh_hypo_length.png" dim ="3"/> + + @@ -390,11 +395,13 @@ input ="QUAD" output ="HEXA,PENTA" need-geom="false" + hypos ="BlockRenumber" opt-hypos="ViscousLayers" dim ="3"> Hexa_3D=Hexahedron(algo=smeshBuilder.Hexa) ViscousLayers=ViscousLayers(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetFaces(1),SetFaces(2),SetMethod(),SetGroupName()) + BlockRenumber=Renumber(GetBlocksOrientation()) diff --git a/resources/mesh_tree_hypo_renumber.png b/resources/mesh_tree_hypo_renumber.png new file mode 100644 index 0000000000000000000000000000000000000000..0d2714f9043afd5532f92db8d29f0ac1696d622e GIT binary patch literal 250 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&pIwi-TW;an6V27NAhOr;B5V#`&$2cJnqE2sqzYRB<{l zvBqg~X+(?WjCR`$4^b|GT{8Ov5;VPZj;7B|y&=%Zz|-Y!bdhQEqy9rdd#w|;$TxjH z*^nja`dMy9!?TkY`7TDC6dS9lJ)uGCu+-&mYw&16rXT-qpIbhox<_c pmYm2u8SQybX7VJDWga~1!#}qf9$!ShapeToMesh() ); } +//======================================================================= +//function : GetShapeByEntry +//purpose : return TopoDS_Shape by its study entry +//======================================================================= + +TopoDS_Shape SMESH_Mesh::GetShapeByEntry(const std::string& entry) const +{ + return _callUp ? _callUp->GetShapeByEntry( entry ) : TopoDS_Shape(); +} + //============================================================================= /*! * diff --git a/src/SMESH/SMESH_Mesh.hxx b/src/SMESH/SMESH_Mesh.hxx index 27b54ed47..18c11c894 100644 --- a/src/SMESH/SMESH_Mesh.hxx +++ b/src/SMESH/SMESH_Mesh.hxx @@ -214,6 +214,9 @@ class SMESH_EXPORT SMESH_Mesh bool IsNotConformAllowed() const; bool IsMainShape(const TopoDS_Shape& theShape) const; + + TopoDS_Shape GetShapeByEntry(const std::string& entry) const; + /*! * \brief Return list of ancestors of theSubShape in the order * that lower dimension shapes come first @@ -342,6 +345,7 @@ class SMESH_EXPORT SMESH_Mesh virtual void HypothesisModified( int hypID, bool updateIcons )=0; virtual void Load()=0; virtual bool IsLoaded()=0; + virtual TopoDS_Shape GetShapeByEntry(const std::string& entry)=0; virtual ~TCallUp() {} }; void SetCallUp( TCallUp * upCaller ); diff --git a/src/SMESH_I/SMESH_Gen_i.hxx b/src/SMESH_I/SMESH_Gen_i.hxx index d6cb5b130..3c2e62f5d 100644 --- a/src/SMESH_I/SMESH_Gen_i.hxx +++ b/src/SMESH_I/SMESH_Gen_i.hxx @@ -116,13 +116,15 @@ public: // Get CORBA object corresponding to the SALOMEDS::SObject static CORBA::Object_var SObjectToObject( SALOMEDS::SObject_ptr theSObject ); // Get the SALOMEDS::SObject corresponding to a CORBA object - static SALOMEDS::SObject_ptr ObjectToSObject(CORBA::Object_ptr theObject); + static SALOMEDS::SObject_ptr ObjectToSObject( CORBA::Object_ptr theObject ); // Get the SALOMEDS::Study from naming service static SALOMEDS::Study_var getStudyServant(); // Get GEOM Object corresponding to TopoDS_Shape - GEOM::GEOM_Object_ptr ShapeToGeomObject (const TopoDS_Shape& theShape ); + static GEOM::GEOM_Object_ptr ShapeToGeomObject( const TopoDS_Shape& theShape ); // Get TopoDS_Shape corresponding to GEOM_Object - TopoDS_Shape GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject); + static TopoDS_Shape GeomObjectToShape( GEOM::GEOM_Object_ptr theGeomObject ); + // Get GEOM Object by its study entry + static GEOM::GEOM_Object_ptr GetGeomObjectByEntry( const std::string& entry ); // Default constructor SMESH_Gen_i(); diff --git a/src/SMESH_I/SMESH_Gen_i_1.cxx b/src/SMESH_I/SMESH_Gen_i_1.cxx index 4c78e2316..d7d61bcaf 100644 --- a/src/SMESH_I/SMESH_Gen_i_1.cxx +++ b/src/SMESH_I/SMESH_Gen_i_1.cxx @@ -236,8 +236,8 @@ template static inline T* objectToServant( CORBA::Object_ptr theIOR GEOM::GEOM_Object_ptr SMESH_Gen_i::ShapeToGeomObject (const TopoDS_Shape& theShape ) { GEOM::GEOM_Object_var aShapeObj; - if ( !theShape.IsNull() ) { - GEOM_Client* aClient = GetShapeReader(); + if ( !theShape.IsNull() && mySMESHGen ) { + GEOM_Client* aClient = mySMESHGen->GetShapeReader(); TCollection_AsciiString IOR; if ( aClient && aClient->Find( theShape, IOR )) { @@ -257,9 +257,9 @@ GEOM::GEOM_Object_ptr SMESH_Gen_i::ShapeToGeomObject (const TopoDS_Shape& theSha TopoDS_Shape SMESH_Gen_i::GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject) { TopoDS_Shape S; - if ( !theGeomObject->_is_nil() && !theGeomObject->_non_existent() ) + if ( mySMESHGen && !theGeomObject->_is_nil() && !theGeomObject->_non_existent() ) { - GEOM_Client* aClient = GetShapeReader(); + GEOM_Client* aClient = mySMESHGen->GetShapeReader(); GEOM::GEOM_Gen_var aGeomEngine = GetGeomEngine( theGeomObject ); if ( aClient && !aGeomEngine->_is_nil () ) S = aClient->GetShape( aGeomEngine, theGeomObject ); @@ -267,6 +267,25 @@ TopoDS_Shape SMESH_Gen_i::GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject) return S; } +//================================================================================ +/*! + * \brief Get GEOM Object by its study entry + */ +//================================================================================ + +GEOM::GEOM_Object_ptr SMESH_Gen_i::GetGeomObjectByEntry( const std::string& entry ) +{ + GEOM::GEOM_Object_var go; + if ( !entry.empty() && mySMESHGen ) + { + SALOMEDS::SObject_wrap so = mySMESHGen->getStudyServant()->FindObjectID( entry.c_str() ); + CORBA::Object_var obj = SObjectToObject( so ); + go = GEOM::GEOM_Object::_narrow( obj ); + } + return go._retn(); +} + + //======================================================================= //function : publish //purpose : diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 2e9130d67..8a4313de5 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -3435,12 +3435,17 @@ namespace { SMESH_Mesh_i* _mesh; TCallUp_i(SMESH_Mesh_i* mesh):_mesh(mesh) {} - virtual void RemoveGroup (const int theGroupID) { _mesh->removeGroup( theGroupID ); } - virtual void HypothesisModified( int hypID, - bool updIcons) { _mesh->onHypothesisModified( hypID, - updIcons ); } - virtual void Load () { _mesh->Load(); } - virtual bool IsLoaded() { return _mesh->IsLoaded(); } + void RemoveGroup (const int theGroupID) override { _mesh->removeGroup( theGroupID ); } + void HypothesisModified( int hypID, + bool updIcons) override { _mesh->onHypothesisModified( hypID, + updIcons ); } + void Load () override { _mesh->Load(); } + bool IsLoaded() override { return _mesh->IsLoaded(); } + TopoDS_Shape GetShapeByEntry(const std::string& entry) override + { + GEOM::GEOM_Object_var go = SMESH_Gen_i::GetGeomObjectByEntry( entry ); + return SMESH_Gen_i::GeomObjectToShape( go ); + } }; } diff --git a/src/SMESH_SWIG/StdMeshersBuilder.py b/src/SMESH_SWIG/StdMeshersBuilder.py index 14bf30414..0759332e9 100644 --- a/src/SMESH_SWIG/StdMeshersBuilder.py +++ b/src/SMESH_SWIG/StdMeshersBuilder.py @@ -916,8 +916,17 @@ class StdMeshersBuilder_Hexahedron(Mesh_Algorithm): """ Mesh_Algorithm.__init__(self) self.Create(mesh, geom, Hexa) + self.renumHypothesis = 0 pass + def Renumber(self, blockCSList=[] ): + if isinstance( blockCSList, StdMeshers.BlockCS ): + blockCSList = [blockCSList] + if not self.renumHypothesis: + self.renumHypothesis = self.Hypothesis("BlockRenumber", blockCSList, UseExisting=0) + self.renumHypothesis.SetBlocksOrientation( blockCSList ) + return self.renumHypothesis + pass # end of StdMeshersBuilder_Hexahedron class class StdMeshersBuilder_Projection1D(Mesh_Algorithm): diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index 21456eed4..b40bc6d1e 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -38,8 +38,9 @@ SMESH.MED_MINOR_7 = 27 # back compatibility SMESH.MED_MINOR_8 = 28 # back compatibility SMESH.MED_MINOR_9 = 29 # back compatibility -from SMESH import * -from salome.smesh.smesh_algorithm import Mesh_Algorithm +from SMESH import * +from salome.smesh.smesh_algorithm import Mesh_Algorithm +from StdMeshers import BlockCS import SALOME import SALOMEDS diff --git a/src/StdMeshers/CMakeLists.txt b/src/StdMeshers/CMakeLists.txt index 87e4db8eb..3f7dc1af7 100644 --- a/src/StdMeshers/CMakeLists.txt +++ b/src/StdMeshers/CMakeLists.txt @@ -64,6 +64,7 @@ SET(_link_LIBRARIES SMESHDS SMESHUtils ${TBB_LIBS} + ${Boost_LIBRARIES} ) IF(SALOME_SMESH_ENABLE_MEFISTO) @@ -131,6 +132,7 @@ SET(StdMeshers_HEADERS StdMeshers_QuadFromMedialAxis_1D2D.hxx StdMeshers_PolygonPerFace_2D.hxx StdMeshers_PolyhedronPerSolid_3D.hxx + StdMeshers_BlockRenumber.hxx ) IF(SALOME_SMESH_ENABLE_MEFISTO) @@ -197,6 +199,7 @@ SET(StdMeshers_SOURCES StdMeshers_QuadFromMedialAxis_1D2D.cxx StdMeshers_PolygonPerFace_2D.cxx StdMeshers_PolyhedronPerSolid_3D.cxx + StdMeshers_BlockRenumber.cxx ) IF(SALOME_SMESH_ENABLE_MEFISTO) diff --git a/src/StdMeshers/StdMeshers_BlockRenumber.cxx b/src/StdMeshers/StdMeshers_BlockRenumber.cxx new file mode 100644 index 000000000..bc2e63a43 --- /dev/null +++ b/src/StdMeshers/StdMeshers_BlockRenumber.cxx @@ -0,0 +1,324 @@ +// 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 +// +// 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, 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 +// 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 +// + +// File : StdMeshers_BlockRenumber.cxx +// Author : Edward AGAPOV, OCC +// Module : SMESH + +#include "StdMeshers_BlockRenumber.hxx" + +#include "SMDS_EdgePosition.hxx" +#include "SMDS_FacePosition.hxx" +#include "SMESHDS_Mesh.hxx" +#include "SMESHDS_SubMesh.hxx" +#include "SMESH_Algo.hxx" +#include "SMESH_Mesh.hxx" +#include "SMESH_MesherHelper.hxx" +#include "SMESH_TryCatch.hxx" + +#include +#include +#include +#include + +#include +#include + +//============================================================================= +/*! + * Constructor + */ +//============================================================================= + +StdMeshers_BlockRenumber::StdMeshers_BlockRenumber(int hypId, SMESH_Gen * gen) + :SMESH_Hypothesis(hypId, gen) +{ + _name = "BlockRenumber"; + _param_algo_dim = 3; // is used by StdMeshers_Hexa_3D and StdMeshers_CompositeHexa_3D +} + +//================================================================================ +/*! + * \brief Set local CS of blocks + */ +//================================================================================ + +void StdMeshers_BlockRenumber::SetBlocksOrientation( std::vector< StdMeshers_BlockCS > & blockCS ) +{ + if ( _blockCS != blockCS ) + { + NotifySubMeshesHypothesisModification(); + _blockCS.swap( blockCS ); + _solids2vertices.Clear(); + } +} + +//================================================================================ +/* + * Return true and vertices if block orientation is defined for a given solid + */ +//================================================================================ + +bool StdMeshers_BlockRenumber::IsSolidIncluded( SMESH_Mesh& mesh, + const TopoDS_Shape& solid, + TopoDS_Vertex& vertex000, + TopoDS_Vertex& vertex001 ) const +{ + bool result = false; + vertex000.Nullify(); + vertex001.Nullify(); + + if ( _solids2vertices.IsEmpty() ) + { + StdMeshers_BlockRenumber* me = const_cast(this); + for ( StdMeshers_BlockCS& bcs : me->_blockCS ) + { + TopoDS_Shape so = mesh.GetShapeByEntry( bcs._solid ); + TopoDS_Shape s000 = mesh.GetShapeByEntry( bcs._vertex000 ); + TopoDS_Shape s001 = mesh.GetShapeByEntry( bcs._vertex001 ); + TopoDS_Vertex v000 = StdMeshers_RenumberHelper::GetVertexAtPoint( so, s000 ); + TopoDS_Vertex v001 = StdMeshers_RenumberHelper::GetVertexAtPoint( so, s001 ); + if ( !v000.IsNull() && !v001.IsNull() ) + { + me->_solids2vertices.Bind( so, std::make_pair( v000, v001 )); + if ( so.IsSame( solid )) + { + result = true; + vertex000 = v000; + vertex001 = v001; + } + } + } + } + else if ( !solid.IsNull() ) + { + if (( result = _solids2vertices.IsBound( solid ))) + { + auto vvPairPtr = _solids2vertices.Seek( solid ); + vertex000 = vvPairPtr->first; + vertex001 = vvPairPtr->second; + } + } + return result; +} + +//======================================================================= +//function : CheckHypothesis +//purpose : +//======================================================================= + +SMESH_ComputeErrorPtr StdMeshers_BlockRenumber::CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) const +{ + SMESH_Comment errorTxt; + for ( size_t i = 0; i < _blockCS.size() && errorTxt.empty(); ++i ) + { + TopoDS_Shape solid = aMesh.GetShapeByEntry( _blockCS[i]._solid ); + TopoDS_Shape v000 = aMesh.GetShapeByEntry( _blockCS[i]._vertex000 ); + TopoDS_Shape v001 = aMesh.GetShapeByEntry( _blockCS[i]._vertex001 ); + v000 = StdMeshers_RenumberHelper::GetVertexAtPoint( solid, v000 ); + v001 = StdMeshers_RenumberHelper::GetVertexAtPoint( solid, v001 ); + + if ( solid.IsNull() || solid.ShapeType() != TopAbs_SOLID ) + errorTxt << "Can't find a SOLID by entry '" << _blockCS[i]._solid << "'"; + else if ( v000.IsNull() || v000.ShapeType() != TopAbs_VERTEX ) + errorTxt << "Can't find a VERTEX by entry '" << _blockCS[i]._vertex000 << "'"; + else if ( v001.IsNull() || v001.ShapeType() != TopAbs_VERTEX ) + errorTxt << "Can't find a VERTEX by entry '" << _blockCS[i]._vertex001 << "'"; + else if ( !SMESH_MesherHelper::IsSubShape( v000, solid )) + errorTxt << "VERTEX '" << _blockCS[i]._vertex001 << "' does not belong to SOLID '" + << _blockCS[i]._solid << "'"; + else if ( !SMESH_MesherHelper::IsSubShape( v001, solid )) + errorTxt << "VERTEX '" << _blockCS[i]._vertex001 << "' does not belong to SOLID '" + << _blockCS[i]._solid << "'"; + else if ( SMESH_MesherHelper::Count( solid, TopAbs_VERTEX, true ) == 8 && + SMESH_MesherHelper::GetCommonAncestor( v000, v001, aMesh, TopAbs_EDGE ).IsNull() ) + errorTxt << "Vertices '" << _blockCS[i]._vertex000 << "' and '" << _blockCS[i]._vertex001 + << "' are not connected by an edge"; + } + + SMESH_ComputeErrorPtr error; + if ( !errorTxt.empty() ) + { + error = SMESH_ComputeError::New( COMPERR_BAD_PARMETERS, + SMESH_Comment("Renumber hypothesis: ") << errorTxt ); + } + return error; +} + +//======================================================================= +//function : StdMeshers_RenumberHelper +//purpose : constructor +//======================================================================= + +StdMeshers_RenumberHelper::StdMeshers_RenumberHelper( SMESH_Mesh& mesh, + const StdMeshers_BlockRenumber* hyp) + : _mesh( &mesh ), _hyp( hyp ), _newOldNodes( 2, nullptr ) +{ +} + +//======================================================================= +//function : GetVertex000 +//purpose : Find default vertex at (0,0,0) local position +//======================================================================= + +TopoDS_Vertex StdMeshers_RenumberHelper::GetVertex000( const TopTools_MapOfShape& cornerVertices ) +{ + TopoDS_Vertex v000; + if ( cornerVertices.Extent() < 8 ) + return TopoDS_Vertex(); + + double minVal = DBL_MAX, minX = DBL_MAX, val; + for ( auto it = cornerVertices.cbegin(); it != cornerVertices.cend(); ++it ) + { + gp_Pnt P = BRep_Tool::Pnt( TopoDS::Vertex( *it )); + val = P.X() + P.Y() + P.Z(); + if ( val < minVal || ( val == minVal && P.X() < minX )) + { + v000 = TopoDS::Vertex( *it ); + minVal = val; + minX = P.X(); + } + } + return v000; +} + +//======================================================================= +//function : GetVertex000 +//purpose : Find default vertex at (0,0,0) local position +//======================================================================= + +TopoDS_Vertex StdMeshers_RenumberHelper::GetVertexAtPoint( const TopoDS_Shape& solid, + const TopoDS_Shape& point ) +{ + if ( !solid.IsNull() && !point.IsNull() && point.ShapeType() == TopAbs_VERTEX ) + { + gp_Pnt p = BRep_Tool::Pnt( TopoDS::Vertex( point )); + double tol = Precision::Confusion(); + for ( TopExp_Explorer exp( solid, TopAbs_VERTEX ); exp.More(); exp.Next() ) + { + const TopoDS_Vertex& v = TopoDS::Vertex( exp.Current() ); + if ( v.IsSame( point ) || p.IsEqual( BRep_Tool::Pnt( v ), tol )) + return v; + } + } + return TopoDS_Vertex(); +} + +//================================================================================ +/* + * Create a copy of an old node and remember this couple of nodes for replacement + */ +//================================================================================ + +void StdMeshers_RenumberHelper::AddReplacingNode( const SMDS_MeshNode* & oldNode ) +{ + SMESHDS_Mesh* mesh = _mesh->GetMeshDS(); + SMESH_NodeXYZ oldXYZ = oldNode; + SMDS_MeshNode* newNode = mesh->AddNode( oldXYZ.X(), oldXYZ.Y(), oldXYZ.Z() ); + _newOldNodes.front() = newNode; + _newOldNodes.back() = oldNode; + _nodesToMerge.push_back( _newOldNodes ); + oldNode = newNode; + + int shapeID = oldXYZ->GetShapeID(); + const TopoDS_Shape& shape = mesh->IndexToShape( shapeID ); + if ( !shape.IsNull() ) + switch ( shape.ShapeType() ) + { + case TopAbs_FACE: + if ( SMDS_FacePositionPtr pos = oldXYZ->GetPosition() ) + mesh->SetNodeOnFace( newNode, shapeID, pos->GetUParameter(), pos->GetVParameter() ); + break; + case TopAbs_EDGE: + if ( SMDS_EdgePositionPtr pos = oldXYZ->GetPosition() ) + mesh->SetNodeOnEdge( newNode, shapeID, pos->GetUParameter() ); + break; + case TopAbs_VERTEX: + mesh->SetNodeOnVertex( newNode, shapeID ); + break; + default: + mesh->SetNodeInVolume( newNode, shapeID ); + } +} + +//================================================================================ +/* + * Replace old nodes by new ones + */ +//================================================================================ + +void StdMeshers_RenumberHelper::DoReplaceNodes() +{ + SMESH_MeshEditor( _mesh ).MergeNodes( _nodesToMerge ); +} + +//============================================================================= +/*! + * Persistence + */ +//============================================================================= + +ostream & StdMeshers_BlockRenumber::SaveTo(ostream & save) +{ + boost::archive::text_oarchive archive( save ); + archive << *this; + + return save; +} + +//============================================================================= +/*! + * Persistence + */ +//============================================================================= + +istream & StdMeshers_BlockRenumber::LoadFrom(istream & load) +{ + SMESH_TRY; + + boost::archive::text_iarchive archive( load ); + archive >> *this; + + SMESH_CATCH( SMESH::doNothing ); + + return load; +} + +namespace boost { + namespace serialization { + + //======================================================================= + //function : serialize + //purpose : serialize StdMeshers_BlockCS + //======================================================================= + + template + void serialize(Archive & ar, StdMeshers_BlockCS & blockCS, const unsigned int version) + { + ar & blockCS._solid; + ar & blockCS._vertex000; + ar & blockCS._vertex001; + } + + } // namespace serialization +} // namespace boost diff --git a/src/StdMeshers/StdMeshers_BlockRenumber.hxx b/src/StdMeshers/StdMeshers_BlockRenumber.hxx new file mode 100644 index 000000000..f68b17ecd --- /dev/null +++ b/src/StdMeshers/StdMeshers_BlockRenumber.hxx @@ -0,0 +1,170 @@ +// 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 +// +// 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, 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 +// 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 : implementation of SMESH idl descriptions +// File : StdMeshers_BlockRenumber.hxx +// Author : Edward AGAPOV, OCC +// Module : SMESH +// +#ifndef _SMESH_BlockRenumber_HXX_ +#define _SMESH_BlockRenumber_HXX_ + +#include "SMESH_StdMeshers.hxx" + +#include "SMESH_ComputeError.hxx" +#include "SMESH_Hypothesis.hxx" +#include "SMESH_MeshEditor.hxx" + +#include +#include +#include + +#include +#include + +class SMESH_Mesh; +class TopoDS_Shape; +class TopoDS_TShape; +class TopoDS_Vertex; + +// ========================================================= +struct StdMeshers_BlockCS // Local coordinate system of a block +{ + std::string _solid; + std::string _vertex000; + std::string _vertex001; + + bool operator==( const StdMeshers_BlockCS& other ) const + { + return ( _solid == other._solid && + _vertex000 == other._vertex000 && + _vertex001 == other._vertex001 ); + } +}; + +// ========================================================= +/*! + * \class 3D Hypothesis used by Hexahedron(ijk) algorithm + * to renumber mesh of a block to be structured-like + */ +// ========================================================= + +class STDMESHERS_EXPORT StdMeshers_BlockRenumber : public SMESH_Hypothesis +{ +public: + StdMeshers_BlockRenumber(int hypId, SMESH_Gen * gen); + + void SetBlocksOrientation( std::vector< StdMeshers_BlockCS > & blockCS ); + + const std::vector< StdMeshers_BlockCS > & GetBlocksOrientation() const { return _blockCS; } + + virtual std::ostream & SaveTo(std::ostream & save) override; + virtual std::istream & LoadFrom(std::istream & load) override; + + /*! + * \brief Initialize Fineness by the mesh built on the geometry + * \param theMesh - the built mesh + * \param theShape - the geometry of interest + * \retval bool - true if parameter values have been successfully defined + */ + bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape) override + { return false; } + + /*! + * \brief Initialize my parameter values by default parameters. + * \retval bool - true if parameter values have been successfully defined + */ + bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0) override + { return false; } + + public: + + /*! + * \brief Check validity of parameter + */ + SMESH_ComputeErrorPtr CheckHypothesis(SMESH_Mesh& theMesh, const TopoDS_Shape& theShape) const; + + /*! + * \brief Return true and vertices if block orientation is defined for a given solid + */ + bool IsSolidIncluded( SMESH_Mesh& mesh, + const TopoDS_Shape& solid, + TopoDS_Vertex& vertex000, + TopoDS_Vertex& vertex001 ) const; + + private: + + // Persistence: define both input and output at once + friend class boost::serialization::access; + template void serialize( Archive & ar, const unsigned int version ) + { + ar & _blockCS; + } + + protected: + + std::vector< StdMeshers_BlockCS > _blockCS; + + typedef NCollection_DataMap< TopoDS_Shape, std::pair< TopoDS_Vertex, TopoDS_Vertex > > TSolid2VV; + TSolid2VV _solids2vertices; // shapes defined by _blockCS, non-persistent +}; + +// ========================================================= +/*! + * \brief Help in using StdMeshers_BlockRenumber + */ +class StdMeshers_RenumberHelper +{ +public: + + StdMeshers_RenumberHelper( SMESH_Mesh& mesh, + const StdMeshers_BlockRenumber* hyp); + /*! + * \brief Find default vertex at (0,0,0) local position + */ + static TopoDS_Vertex GetVertex000( const TopTools_MapOfShape& cornerVertices ); + + /*! + * \brief Find a vertex of a solid located at the given point + */ + static TopoDS_Vertex GetVertexAtPoint( const TopoDS_Shape& solid, const TopoDS_Shape& point ); + + /*! + * \brief Create a copy of an old node and remember this couple of nodes for replacement + */ + void AddReplacingNode( const SMDS_MeshNode* & oldNode ); + + /*! + * \brief Replace old nodes by new ones + */ + void DoReplaceNodes(); + +private: + + SMESH_Mesh* _mesh; + const StdMeshers_BlockRenumber* _hyp; + + SMESH_MeshEditor::TListOfListOfNodes _nodesToMerge; + std::list< const SMDS_MeshNode* > _newOldNodes; +}; + +#endif diff --git a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx index 8f624c777..2e697303a 100644 --- a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx @@ -38,6 +38,8 @@ #include "SMESH_MeshAlgos.hxx" #include "SMESH_MesherHelper.hxx" #include "SMESH_subMesh.hxx" +#include "StdMeshers_BlockRenumber.hxx" +#include "StdMeshers_FaceSide.hxx" #include "StdMeshers_ViscousLayers.hxx" #include @@ -61,6 +63,7 @@ #include #include #include +#include using namespace std; @@ -180,6 +183,8 @@ public: //** Methods to find and orient faces of 6 sides of the box **// TChildIterator GetChildren() const { return TChildIterator( myChildren.begin(), myChildren.end()); } + bool Contain( const TopoDS_Vertex& vertex ) const { return mySides.Contain( vertex ); } + public: //** Loading and access to mesh **// //!< Load nodes of a mesh @@ -271,7 +276,7 @@ private: //================================================================================ StdMeshers_CompositeHexa_3D::StdMeshers_CompositeHexa_3D(int hypId, SMESH_Gen* gen) - :SMESH_3D_Algo(hypId, gen) + :SMESH_3D_Algo(hypId, gen), _blockRenumberHyp( nullptr ) { _name = "CompositeHexa_3D"; _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type @@ -287,6 +292,7 @@ bool StdMeshers_CompositeHexa_3D::CheckHypothesis(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, Hypothesis_Status& aStatus) { + _blockRenumberHyp = nullptr; aStatus = HYP_OK; return true; } @@ -545,6 +551,163 @@ namespace return faceFound; } + //================================================================================ + /*! + * \brief Rearrange block sides according to StdMeshers_BlockRenumber hypothesis + */ + //================================================================================ + + bool arrangeForRenumber( list< _QuadFaceGrid >& blockSides, + const TopTools_MapOfShape& cornerVertices, + SMESH_Mesh* mesh, + TopoDS_Vertex& v000, + TopoDS_Vertex& v001 ) + { + if ( v000.IsNull() ) + { + // block CS is not defined; + // renumber only if the block has an edge parallel to an axis of global CS + + v000 = StdMeshers_RenumberHelper::GetVertex000( cornerVertices ); + } + + Bnd_B3d bbox; + for ( auto it = cornerVertices.cbegin(); it != cornerVertices.cend(); ++it ) + bbox.Add( BRep_Tool::Pnt( TopoDS::Vertex( *it ))); + double tol = 1e-5 * Sqrt( bbox.SquareExtent() ); + + // get block edges starting at v000 + + std::vector< const _FaceSide* > edgesAtV000; + std::vector< gp_Vec > edgeDir; + std::vector< int > iParallel; // 0 - none, 1 - X, 2 - Y, 3 - Z + TopTools_MapOfShape lastVertices; + for ( _QuadFaceGrid & quad: blockSides ) + { + for ( int iS = 0; iS < 4 && edgesAtV000.size() < 3; ++iS ) + { + const _FaceSide* side = & quad.GetSide( iS ); + TopoDS_Vertex v1 = side->FirstVertex(), v2 = side->LastVertex(); + if (( v1.IsSame( v000 ) && !lastVertices.Contains( v2 )) || + ( v2.IsSame( v000 ) && !lastVertices.Contains( v1 ))) + { + bool reverse = v2.IsSame( v000 ); + if ( reverse ) + std::swap( v1, v2 ); + lastVertices.Add( v2 ); + + edgesAtV000.push_back( side ); + + gp_Pnt pf = BRep_Tool::Pnt( v1 ); + gp_Pnt pl = BRep_Tool::Pnt( v2 ); + gp_Vec vec( pf, pl ); + edgeDir.push_back( vec ); + + iParallel.push_back( 0 ); + if ( !v001.IsNull() ) + { + if ( quad.IsComplex() ) + for ( _QuadFaceGrid::TChildIterator chIt = quad.GetChildren(); chIt.more(); ) + { + const _QuadFaceGrid& child = chIt.next(); + if ( child.GetSide( iS ).Contain( v001 )) + { + iParallel.back() = 3; + break; + } + } + else if ( side->Contain( v001 )) + iParallel.back() = 3; + } + else + { + bool isStraight = true; + std::list< TopoDS_Edge > edges; + for ( int iE = 0; true; ++iE ) + { + TopoDS_Edge edge = side->Edge( iE ); + if ( edge.IsNull() ) + break; + edges.push_back( edge ); + if ( isStraight ) + isStraight = SMESH_Algo::IsStraight( edge ); + } + // is parallel to a GCS axis? + if ( isStraight ) + { + int nbDiff = (( Abs( vec.X() ) > tol ) + + ( Abs( vec.Y() ) > tol ) + + ( Abs( vec.Z() ) > tol ) ); + if ( nbDiff == 1 ) + iParallel.back() = ( Abs( vec.X() ) > tol ) ? 1 : ( Abs( vec.Y() ) > tol ) ? 2 : 3; + } + else + { + TopoDS_Face nullFace; + StdMeshers_FaceSide fSide( nullFace, edges, mesh, true, true ); + edgeDir.back() = gp_Vec( pf, fSide.Value3d( reverse ? 0.99 : 0.01 )); + } + } + } + } + } + if ( std::accumulate( iParallel.begin(), iParallel.end(), 0 ) == 0 ) + return false; + + // find edge OZ and edge OX + const _FaceSide* edgeOZ = nullptr, *edgeOY = nullptr, *edgeOX = nullptr; + auto iZIt = std::find( iParallel.begin(), iParallel.end(), 3 ); + if ( iZIt != iParallel.end() ) + { + int i = std::distance( iParallel.begin(), iZIt ); + edgeOZ = edgesAtV000[ i ]; + int iE1 = SMESH_MesherHelper::WrapIndex( i + 1, edgesAtV000.size() ); + int iE2 = SMESH_MesherHelper::WrapIndex( i + 2, edgesAtV000.size() ); + if (( edgeDir[ iE1 ] ^ edgeDir[ iE2 ] ) * edgeDir[ i ] < 0 ) + std::swap( iE1, iE2 ); + edgeOX = edgesAtV000[ iE1 ]; + edgeOY = edgesAtV000[ iE2 ]; + } + else + { + for ( size_t i = 0; i < edgesAtV000.size(); ++i ) + { + if ( !iParallel[ i ] ) + continue; + int iE1 = SMESH_MesherHelper::WrapIndex( i + 1, edgesAtV000.size() ); + int iE2 = SMESH_MesherHelper::WrapIndex( i + 2, edgesAtV000.size() ); + if (( edgeDir[ iE1 ] ^ edgeDir[ iE2 ] ) * edgeDir[ i ] < 0 ) + std::swap( iE1, iE2 ); + edgeOZ = edgesAtV000[ iParallel[i] == 1 ? iE2 : iE1 ]; + edgeOX = edgesAtV000[ iParallel[i] == 1 ? i : iE1 ]; + edgeOY = edgesAtV000[ iParallel[i] == 1 ? iE1 : i ]; + break; + } + } + + if ( !edgeOZ || !edgeOX || !edgeOY ) + return false; + + TopoDS_Vertex v100 = edgeOX->LastVertex(); + if ( v100.IsSame( v000 )) + v100 = edgeOX->FirstVertex(); + + // Find the left quad, one including v000 but not v100 + + for ( auto quad = blockSides.begin(); quad != blockSides.end(); ++quad ) + { + if ( quad->Contain( v000 ) && !quad->Contain( v100 )) // it's a left quad + { + if ( quad != blockSides.begin() ) + blockSides.splice( blockSides.begin(), blockSides, quad ); + blockSides.front().SetBottomSide( *edgeOZ ); // edgeOY + + return true; + } + } + return false; + } + } // namespace //================================================================================ @@ -557,6 +720,7 @@ bool StdMeshers_CompositeHexa_3D::findBoxFaces( const TopoDS_Shape& shape, list< _QuadFaceGrid >& boxFaces, SMESH_Mesh& mesh, SMESH_ProxyMesh& proxyMesh, + bool& toRenumber, _QuadFaceGrid * & fBottom, _QuadFaceGrid * & fTop, _QuadFaceGrid * & fFront, @@ -609,6 +773,22 @@ bool StdMeshers_CompositeHexa_3D::findBoxFaces( const TopoDS_Shape& shape, for ( exp.Init( shape, TopAbs_FACE); exp.More(); exp.Next(), ++boxFace ) boxFace->Init( TopoDS::Face( exp.Current() ), proxyMesh ); } + + toRenumber = _blockRenumberHyp; + if ( toRenumber ) + { + TopoDS_Vertex v000, v001; + _blockRenumberHyp->IsSolidIncluded( mesh, shape, v000, v001 ); + + toRenumber = arrangeForRenumber( boxFaces, cornerVertices, &mesh, v000, v001 ); + + if ( toRenumber ) + { + mesh.GetMeshDS()->Modified(); + mesh.GetMeshDS()->CompactMesh(); // remove numbering holes + } + } + // ---------------------------------------- // Find out position of faces within a box // ---------------------------------------- @@ -686,8 +866,9 @@ bool StdMeshers_CompositeHexa_3D::Compute(SMESH_Mesh& theMesh, // Try to find 6 side faces // ------------------------- list< _QuadFaceGrid > boxFaceContainer; + bool toRenumber = false; _QuadFaceGrid *fBottom, *fTop, *fFront, *fBack, *fLeft, *fRight; - if ( ! findBoxFaces( theShape, boxFaceContainer, theMesh, *proxyMesh, + if ( ! findBoxFaces( theShape, boxFaceContainer, theMesh, *proxyMesh, toRenumber, fBottom, fTop, fFront, fBack, fLeft, fRight)) return false; @@ -711,6 +892,8 @@ bool StdMeshers_CompositeHexa_3D::Compute(SMESH_Mesh& theMesh, fRight ->ComputeIJK( COO_Y, COO_Z, /*x=*/1. ); fTop ->ComputeIJK( COO_X, COO_Y, /*z=*/1. ); + StdMeshers_RenumberHelper renumHelper( theMesh, _blockRenumberHyp ); + int x, xSize = fBottom->GetNbHoriSegments(*proxyMesh) + 1, X = xSize - 1; int y, ySize = fBottom->GetNbVertSegments(*proxyMesh) + 1, Y = ySize - 1; int z, zSize = fFront ->GetNbVertSegments(*proxyMesh) + 1, Z = zSize - 1; @@ -768,8 +951,23 @@ bool StdMeshers_CompositeHexa_3D::Compute(SMESH_Mesh& theMesh, gp_XYZ params; // normalized parameters of an internal node within the unit box - for ( x = 1; x < xSize-1; ++x ) + if ( toRenumber ) + for ( y = 0; y < ySize; ++y ) + { + vector< const SMDS_MeshNode* >& columnXy = columns[ colIndex( X, y )]; + for ( z = 0; z < zSize; ++z ) + renumHelper.AddReplacingNode( columnXy[ z ] ); + } + + for ( x = X-1; x > 0; --x ) { + if ( toRenumber ) + { + vector< const SMDS_MeshNode* >& columnX0 = columns[ colIndex( x, 0 )]; + for ( z = 0; z < zSize; ++z ) + renumHelper.AddReplacingNode( columnX0[ z ] ); + } + const double rX = x / double(X); for ( y = 1; y < ySize-1; ++y ) { @@ -788,6 +986,10 @@ bool StdMeshers_CompositeHexa_3D::Compute(SMESH_Mesh& theMesh, // points projections on horizontal faces pointsOnShapes[ SMESH_Block::ID_Fxy0 ] = fBottom->GetXYZ( x, y ); pointsOnShapes[ SMESH_Block::ID_Fxy1 ] = fTop ->GetXYZ( x, y ); + + if ( toRenumber ) + renumHelper.AddReplacingNode( column[ 0 ] ); + for ( z = 1; z < zSize-1; ++z ) // z loop { // compute normalized parameters of an internal node within the unit box @@ -832,16 +1034,35 @@ bool StdMeshers_CompositeHexa_3D::Compute(SMESH_Mesh& theMesh, //cout << "Params: ( "<< params.X()<<", "<& columnXY = columns[ colIndex( x, Y )]; + for ( z = 0; z < zSize; ++z ) + renumHelper.AddReplacingNode( columnXY[ z ] ); } - } + } // for ( x = X-1; x > 0; --x ) + + if ( toRenumber ) + for ( y = 0; y < ySize; ++y ) + { + vector< const SMDS_MeshNode* >& column0Y = columns[ colIndex( 0, y )]; + for ( z = 0; z < zSize; ++z ) + renumHelper.AddReplacingNode( column0Y[ z ] ); + } + + // faces no more needed, free memory boxFaceContainer.clear(); // ---------------- // Add hexahedrons // ---------------- - for ( x = 0; x < xSize-1; ++x ) { + for ( x = xSize-2; true; --x ) { for ( y = 0; y < ySize-1; ++y ) { vector< const SMDS_MeshNode* >& col00 = columns[ colIndex( x, y )]; vector< const SMDS_MeshNode* >& col10 = columns[ colIndex( x+1, y )]; @@ -850,11 +1071,22 @@ bool StdMeshers_CompositeHexa_3D::Compute(SMESH_Mesh& theMesh, for ( z = 0; z < zSize-1; ++z ) { // bottom face normal of a hexa mush point outside the volume - helper.AddVolume(col00[z], col01[z], col11[z], col10[z], - col00[z+1], col01[z+1], col11[z+1], col10[z+1]); + helper.AddVolume(col10[z], col11[z], col11[z+1], col10[z+1], + col00[z], col01[z], col01[z+1], col00[z+1]); } } + if ( x == 0) + break; + } + if ( toRenumber ) + renumHelper.DoReplaceNodes(); + + if ( _blockRenumberHyp ) + { + return error( _blockRenumberHyp->CheckHypothesis( theMesh, theShape )); + } + return true; } @@ -875,7 +1107,8 @@ bool StdMeshers_CompositeHexa_3D::Evaluate(SMESH_Mesh& theMesh, // ------------------------- list< _QuadFaceGrid > boxFaceContainer; _QuadFaceGrid *fBottom, *fTop, *fFront, *fBack, *fLeft, *fRight; - if ( ! findBoxFaces( theShape, boxFaceContainer, theMesh, *proxyMesh, + bool toRenumber = false; + if ( ! findBoxFaces( theShape, boxFaceContainer, theMesh, *proxyMesh, toRenumber, fBottom, fTop, fFront, fBack, fLeft, fRight)) return false; diff --git a/src/StdMeshers/StdMeshers_CompositeHexa_3D.hxx b/src/StdMeshers/StdMeshers_CompositeHexa_3D.hxx index 695624fe5..9a17e2b81 100644 --- a/src/StdMeshers/StdMeshers_CompositeHexa_3D.hxx +++ b/src/StdMeshers/StdMeshers_CompositeHexa_3D.hxx @@ -29,6 +29,7 @@ class SMESH_Mesh; class SMESH_ProxyMesh; +class StdMeshers_BlockRenumber; class StdMeshers_FaceSide; class TopoDS_Edge; class TopoDS_Face; @@ -44,7 +45,8 @@ class STDMESHERS_EXPORT StdMeshers_CompositeHexa_3D: public SMESH_3D_Algo { public: StdMeshers_CompositeHexa_3D(int hypId, SMESH_Gen* gen); - //virtual ~StdMeshers_CompositeHexa_3D(); + + void SetHypothesis( const StdMeshers_BlockRenumber* hyp ) { _blockRenumberHyp = hyp; } virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); @@ -56,18 +58,21 @@ public: const TopoDS_Shape& aShape, Hypothesis_Status& aStatus); -private: + private: bool findBoxFaces( const TopoDS_Shape& shape, std::list< _QuadFaceGrid >& boxFaceContainer, SMESH_Mesh& mesh, SMESH_ProxyMesh& proxyMesh, + bool& toRenumber, _QuadFaceGrid * & fBottom, _QuadFaceGrid * & fTop, _QuadFaceGrid * & fFront, _QuadFaceGrid * & fBack, _QuadFaceGrid * & fLeft, _QuadFaceGrid * & fRight); + + const StdMeshers_BlockRenumber* _blockRenumberHyp; }; #endif diff --git a/src/StdMeshers/StdMeshers_Hexa_3D.cxx b/src/StdMeshers/StdMeshers_Hexa_3D.cxx index 53877e2ab..26b22cae1 100644 --- a/src/StdMeshers/StdMeshers_Hexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_Hexa_3D.cxx @@ -28,6 +28,13 @@ // #include "StdMeshers_Hexa_3D.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMESH_Comment.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" +#include "SMESH_MesherHelper.hxx" +#include "SMESH_subMesh.hxx" +#include "StdMeshers_BlockRenumber.hxx" #include "StdMeshers_CompositeHexa_3D.hxx" #include "StdMeshers_FaceSide.hxx" #include "StdMeshers_HexaFromSkin_3D.hxx" @@ -36,23 +43,19 @@ #include "StdMeshers_Quadrangle_2D.hxx" #include "StdMeshers_ViscousLayers.hxx" -#include "SMESH_Comment.hxx" -#include "SMESH_Gen.hxx" -#include "SMESH_Mesh.hxx" -#include "SMESH_MesherHelper.hxx" -#include "SMESH_subMesh.hxx" - -#include "SMDS_MeshNode.hxx" - +#include +#include #include #include -#include #include +#include #include #include "utilities.h" #include "Utils_ExceptHandlers.hxx" +#include + typedef SMESH_Comment TComm; using namespace std; @@ -77,6 +80,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"); + _compatibleHypothesis.push_back("BlockRenumber"); _quadAlgo = new StdMeshers_Quadrangle_2D( gen->GetANewId(), _gen ); } @@ -114,7 +118,8 @@ bool StdMeshers_Hexa_3D::CheckHypothesis return false; */ - _viscousLayersHyp = NULL; + _viscousLayersHyp = nullptr; + _blockRenumberHyp = nullptr; const list& hyps = GetUsedHypothesis(aMesh, aShape, /*ignoreAuxiliary=*/false); @@ -129,13 +134,25 @@ bool StdMeshers_Hexa_3D::CheckHypothesis aStatus = HYP_OK; for ( ; h != hyps.end(); ++h ) { - if ( !(_viscousLayersHyp = dynamic_cast< const StdMeshers_ViscousLayers*> ( *h ))) - break; + if ( !_viscousLayersHyp && + (_viscousLayersHyp = dynamic_cast< const StdMeshers_ViscousLayers*> ( *h ))) + continue; + if ( !_blockRenumberHyp && + (_blockRenumberHyp = dynamic_cast< const StdMeshers_BlockRenumber*> ( *h ))) + continue; + break; } - if ( !_viscousLayersHyp ) + if ((int) hyps.size() != (bool)_viscousLayersHyp + (bool)_blockRenumberHyp ) aStatus = HYP_INCOMPATIBLE; else - error( _viscousLayersHyp->CheckHypothesis( aMesh, aShape, aStatus )); + { + if ( _viscousLayersHyp ) + if ( !error( _viscousLayersHyp->CheckHypothesis( aMesh, aShape, aStatus ))) + aStatus = HYP_BAD_PARAMETER; + + if ( _blockRenumberHyp && aStatus == HYP_OK ) + error( _blockRenumberHyp->CheckHypothesis( aMesh, aShape )); + } return aStatus == HYP_OK; } @@ -202,26 +219,6 @@ namespace int operator()(const int x, const int y) const { return y * _xSize + x; } }; - //================================================================================ - /*! - * \brief Appends a range of node columns from a map to another map - */ - template< class TMapIterator > - void append( TParam2ColumnMap& toMap, TMapIterator from, TMapIterator to ) - { - const SMDS_MeshNode* lastNode = toMap.rbegin()->second[0]; - const SMDS_MeshNode* firstNode = from->second[0]; - if ( lastNode == firstNode ) - from++; - double u = toMap.rbegin()->first; - for (; from != to; ++from ) - { - u += 1; - TParam2ColumnMap::iterator u2nn = toMap.insert( toMap.end(), make_pair ( u, TNodeColumn())); - u2nn->second.swap( from->second ); - } - } - //================================================================================ /*! * \brief Finds FaceQuadStruct having a side equal to a given one and rearranges @@ -260,6 +257,204 @@ namespace } return foundQuad; } + + //================================================================================ + /*! + * \brief Put quads to aCubeSide in the order of enum EBoxSides + */ + //================================================================================ + + bool arrangeQuads( FaceQuadStructPtr quad[ 6 ], _FaceGrid aCubeSide[ 6 ], bool reverseBottom ) + { + swap( aCubeSide[B_BOTTOM]._quad, quad[0] ); + if ( reverseBottom ) + swap( aCubeSide[B_BOTTOM]._quad->side[ Q_RIGHT],// direct the bottom normal inside cube + aCubeSide[B_BOTTOM]._quad->side[ Q_LEFT ] ); + + aCubeSide[B_FRONT]._quad = getQuadWithBottom( aCubeSide[B_BOTTOM]._quad->side[Q_BOTTOM], quad ); + aCubeSide[B_RIGHT]._quad = getQuadWithBottom( aCubeSide[B_BOTTOM]._quad->side[Q_RIGHT ], quad ); + aCubeSide[B_BACK ]._quad = getQuadWithBottom( aCubeSide[B_BOTTOM]._quad->side[Q_TOP ], quad ); + aCubeSide[B_LEFT ]._quad = getQuadWithBottom( aCubeSide[B_BOTTOM]._quad->side[Q_LEFT ], quad ); + if ( aCubeSide[B_FRONT ]._quad ) + aCubeSide[B_TOP]._quad = getQuadWithBottom( aCubeSide[B_FRONT ]._quad->side[Q_TOP ], quad ); + + for ( int i = 1; i < 6; ++i ) + if ( !aCubeSide[i]._quad ) + return false; + return true; + } + + //================================================================================ + /*! + * \brief Rearrange block sides according to StdMeshers_BlockRenumber hypothesis + */ + //================================================================================ + + bool arrangeForRenumber( _FaceGrid blockSide[ 6 ], + TopoDS_Vertex& v000, + TopoDS_Vertex& v001 ) + { + std::swap( blockSide[B_BOTTOM]._quad->side[ Q_RIGHT],// restore after arrangeQuads() + blockSide[B_BOTTOM]._quad->side[ Q_LEFT ] ); + + // find v000 + TopTools_MapOfShape cornerVertices; + cornerVertices.Add( blockSide[B_BOTTOM]._quad->side[Q_BOTTOM].grid->LastVertex() ); + cornerVertices.Add( blockSide[B_BOTTOM]._quad->side[Q_BOTTOM].grid->FirstVertex() ); + cornerVertices.Add( blockSide[B_BOTTOM]._quad->side[Q_TOP ].grid->LastVertex() ); + cornerVertices.Add( blockSide[B_BOTTOM]._quad->side[Q_TOP ].grid->FirstVertex() ); + cornerVertices.Add( blockSide[B_TOP ]._quad->side[Q_BOTTOM].grid->FirstVertex() ); + cornerVertices.Add( blockSide[B_TOP ]._quad->side[Q_BOTTOM].grid->LastVertex() ); + cornerVertices.Add( blockSide[B_TOP ]._quad->side[Q_TOP ].grid->FirstVertex() ); + cornerVertices.Add( blockSide[B_TOP ]._quad->side[Q_TOP ].grid->LastVertex() ); + + if ( v000.IsNull() ) + { + // block CS is not defined; + // renumber only if the block has an edge parallel to an axis of global CS + + v000 = StdMeshers_RenumberHelper::GetVertex000( cornerVertices ); + } + + Bnd_B3d bbox; + for ( auto it = cornerVertices.cbegin(); it != cornerVertices.cend(); ++it ) + bbox.Add( BRep_Tool::Pnt( TopoDS::Vertex( *it ))); + double tol = 1e-5 * Sqrt( bbox.SquareExtent() ); + + // get block edges starting at v000 + + std::vector< StdMeshers_FaceSidePtr > edgesAtV000; + std::vector< gp_Vec > edgeDir; + std::vector< int > iParallel; // 0 - none, 1 - X, 2 - Y, 3 - Z + TopTools_MapOfShape lastVertices; + for ( int iQ = 0; iQ < 6; ++iQ ) + { + FaceQuadStructPtr quad = blockSide[iQ]._quad; + for ( size_t iS = 0; iS < quad->side.size() && edgesAtV000.size() < 3; ++iS ) + { + StdMeshers_FaceSidePtr edge = quad->side[iS]; + TopoDS_Vertex v1 = edge->FirstVertex(), v2 = edge->LastVertex(); + if (( v1.IsSame( v000 ) && !lastVertices.Contains( v2 )) || + ( v2.IsSame( v000 ) && !lastVertices.Contains( v1 ))) + { + bool reverse = v2.IsSame( v000 ); + if ( reverse ) + std::swap( v1, v2 ); + lastVertices.Add( v2 ); + + edgesAtV000.push_back( edge ); + + gp_Pnt pf = BRep_Tool::Pnt( v1 ); + gp_Pnt pl = BRep_Tool::Pnt( v2 ); + gp_Vec vec( pf, pl ); + edgeDir.push_back( vec ); + + iParallel.push_back( 0 ); + if ( !v001.IsNull() ) + { + if ( v001.IsSame( v2 )) + iParallel.back() = 3; + } + else + { + bool isStraight = true; + for ( int iE = 0; iE < edge->NbEdges() && isStraight; ++iE ) + isStraight = SMESH_Algo::IsStraight( edge->Edge( iE )); + + // is parallel to a GCS axis? + if ( isStraight ) + { + int nbDiff = (( Abs( vec.X() ) > tol ) + + ( Abs( vec.Y() ) > tol ) + + ( Abs( vec.Z() ) > tol ) ); + if ( nbDiff == 1 ) + iParallel.back() = ( Abs( vec.X() ) > tol ) ? 1 : ( Abs( vec.Y() ) > tol ) ? 2 : 3; + } + else + { + edgeDir.back() = gp_Vec( pf, edge->Value3d( reverse ? 0.99 : 0.01 )); + } + } + } + } + } + if ( std::accumulate( iParallel.begin(), iParallel.end(), 0 ) == 0 ) + return false; + + // find edge OZ and edge OX + StdMeshers_FaceSidePtr edgeOZ, edgeOX; + auto iZIt = std::find( iParallel.begin(), iParallel.end(), 3 ); + if ( iZIt != iParallel.end() ) + { + int i = std::distance( iParallel.begin(), iZIt ); + edgeOZ = edgesAtV000[ i ]; + int iE1 = SMESH_MesherHelper::WrapIndex( i + 1, edgesAtV000.size() ); + int iE2 = SMESH_MesherHelper::WrapIndex( i + 2, edgesAtV000.size() ); + if (( edgeDir[ iE1 ] ^ edgeDir[ iE2 ] ) * edgeDir[ i ] < 0 ) + std::swap( iE1, iE2 ); + edgeOX = edgesAtV000[ iE1 ]; + } + else + { + for ( size_t i = 0; i < edgesAtV000.size(); ++i ) + { + if ( !iParallel[ i ] ) + continue; + int iE1 = SMESH_MesherHelper::WrapIndex( i + 1, edgesAtV000.size() ); + int iE2 = SMESH_MesherHelper::WrapIndex( i + 2, edgesAtV000.size() ); + if (( edgeDir[ iE1 ] ^ edgeDir[ iE2 ] ) * edgeDir[ i ] < 0 ) + std::swap( iE1, iE2 ); + edgeOZ = edgesAtV000[ iParallel[i] == 1 ? iE2 : iE1 ]; + edgeOX = edgesAtV000[ iParallel[i] == 1 ? i : iE1 ]; + break; + } + } + + if ( !edgeOZ || !edgeOX ) + return false; + + TopoDS_Vertex v100 = edgeOX->LastVertex(); + if ( v100.IsSame( v000 )) + v100 = edgeOX->FirstVertex(); + + // Find the left quad, one including v000 but not v100 + + for ( int iQ = 0; iQ < 6; ++iQ ) + { + FaceQuadStructPtr quad = blockSide[iQ]._quad; + bool hasV000 = false, hasV100 = false; + for ( size_t iS = 0; iS < quad->side.size(); ++iS ) + { + StdMeshers_FaceSidePtr edge = quad->side[iS]; + if ( edge->FirstVertex().IsSame( v000 ) || edge->LastVertex().IsSame( v000 )) + hasV000 = true; + if ( edge->FirstVertex().IsSame( v100 ) || edge->LastVertex().IsSame( v100 )) + hasV100 = true; + } + if ( hasV000 && !hasV100 ) + { + // orient the left quad + for ( int i = 0; i < 4; ++i ) + { + if ( quad->side[Q_BOTTOM].grid->Edge(0).IsSame( edgeOZ->Edge(0) )) + break; + quad->shift( 1, true ); + } + + FaceQuadStructPtr quads[ 6 ]; + quads[0].swap( blockSide[iQ]._quad ); + for ( int i = 1, j = 0; i < 6; ++i, ++j ) + if ( blockSide[ j ]._quad ) + quads[ i ].swap( blockSide[ j ]._quad ); + else + --i; + + return arrangeQuads( quads, blockSide, false/* true*/ ); + } + } + return false; + } + //================================================================================ /*! * \brief Returns true if the 1st base node of sideGrid1 belongs to sideGrid2 @@ -371,9 +566,11 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, if ( FF.Extent() != 6) { static StdMeshers_CompositeHexa_3D compositeHexa(_gen->GetANewId(), _gen); + compositeHexa.SetHypothesis( _blockRenumberHyp ); if ( !compositeHexa.Compute( aMesh, aShape )) return error( compositeHexa.GetComputeError() ); - return true; + + return _blockRenumberHyp ? error( _blockRenumberHyp->CheckHypothesis( aMesh, aShape )) : true; } // Find sides of a cube @@ -399,22 +596,11 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, return error( COMPERR_BAD_SHAPE, "Not a quadrangular box side" ); } + // put quads in a proper order _FaceGrid aCubeSide[ 6 ]; + if ( !arrangeQuads( quad, aCubeSide, true )) + return error( COMPERR_BAD_SHAPE ); - swap( aCubeSide[B_BOTTOM]._quad, quad[0] ); - swap( aCubeSide[B_BOTTOM]._quad->side[ Q_RIGHT],// direct the normal of bottom quad inside cube - aCubeSide[B_BOTTOM]._quad->side[ Q_LEFT ] ); - - aCubeSide[B_FRONT]._quad = getQuadWithBottom( aCubeSide[B_BOTTOM]._quad->side[Q_BOTTOM], quad ); - aCubeSide[B_RIGHT]._quad = getQuadWithBottom( aCubeSide[B_BOTTOM]._quad->side[Q_RIGHT ], quad ); - aCubeSide[B_BACK ]._quad = getQuadWithBottom( aCubeSide[B_BOTTOM]._quad->side[Q_TOP ], quad ); - aCubeSide[B_LEFT ]._quad = getQuadWithBottom( aCubeSide[B_BOTTOM]._quad->side[Q_LEFT ], quad ); - if ( aCubeSide[B_FRONT ]._quad ) - aCubeSide[B_TOP]._quad = getQuadWithBottom( aCubeSide[B_FRONT ]._quad->side[Q_TOP ], quad ); - - for ( int i = 1; i < 6; ++i ) - if ( !aCubeSide[i]._quad ) - return error( COMPERR_BAD_SHAPE ); // Make viscous layers // -------------------- @@ -446,6 +632,22 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, } } + // Arrange sides according to _blockRenumberHyp + bool toRenumber = _blockRenumberHyp; + if ( toRenumber ) + { + TopoDS_Vertex v000, v001; + _blockRenumberHyp->IsSolidIncluded( aMesh, aShape, v000, v001 ); + + toRenumber = arrangeForRenumber( aCubeSide, v000, v001 ); + + if ( toRenumber ) + { + meshDS->Modified(); + meshDS->CompactMesh(); // remove numbering holes + } + } + // Check presence of regular grid mesh on FACEs of the cube // ------------------------------------------------------------ @@ -605,6 +807,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, computeIJK( *fFront, COO_X, COO_Z, /*y=*/0. ); computeIJK( *fBack, COO_X, COO_Z, /*y=*/1. ); + StdMeshers_RenumberHelper renumHelper( aMesh, _blockRenumberHyp ); + // 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 ); @@ -620,8 +824,25 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, pointsOnShapes[ SMESH_Block::ID_V111 ] = fTop->GetXYZ( X, Y ); gp_XYZ params; // normalized parameters of an internal node within the unit box - for ( x = 1; x < xSize-1; ++x ) + for ( x = 0; x < xSize; ++x ) { + if ( toRenumber ) + { + vector< const SMDS_MeshNode* >& columnX0 = columns[ colIndex( x, 0 )]; + for ( z = 0; z < zSize; ++z ) + renumHelper.AddReplacingNode( columnX0[ z ] ); + if ( x == 0 || x == X ) + { + for ( y = 1; y < ySize; ++y ) + { + vector< const SMDS_MeshNode* >& column0Y = columns[ colIndex( x, y )]; + for ( z = 0; z < zSize; ++z ) + renumHelper.AddReplacingNode( column0Y[ z ] ); + } + continue; + } + } + const double rX = x / double(X); for ( y = 1; y < ySize-1; ++y ) { @@ -641,6 +862,10 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, // projection points on horizontal faces pointsOnShapes[ SMESH_Block::ID_Fxy0 ] = fBottom->GetXYZ( x, y ); pointsOnShapes[ SMESH_Block::ID_Fxy1 ] = fTop ->GetXYZ( x, y ); + + if ( toRenumber ) + renumHelper.AddReplacingNode( column[ 0 ] ); + for ( z = 1; z < zSize-1; ++z ) // z loop { const double rZ = z / double(Z); @@ -673,13 +898,23 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, gp_XYZ coords; SMESH_Block::ShellPoint( params, pointsOnShapes, coords ); column[ z ] = helper.AddNode( coords.X(), coords.Y(), coords.Z() ); - } + + } // z loop + if ( toRenumber ) + renumHelper.AddReplacingNode( column[ Z ] ); + + } // y loop + if ( toRenumber ) + { + vector< const SMDS_MeshNode* >& columnX0 = columns[ colIndex( x, Y )]; + for ( z = 0; z < zSize; ++z ) + renumHelper.AddReplacingNode( columnX0[ z ] ); } - } + } // x loop // side data no more needed, free memory for ( int i = 0; i < 6; ++i ) - aCubeSide[i]._columns.clear(); + SMESHUtils::FreeVector( aCubeSide[i]._columns ); // 5) Create hexahedrons // --------------------- @@ -693,11 +928,25 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, for ( z = 0; z < zSize-1; ++z ) { // bottom face normal of a hexa mush point outside the volume - helper.AddVolume(col00[z], col01[z], col11[z], col10[z], - col00[z+1], col01[z+1], col11[z+1], col10[z+1]); + if ( toRenumber ) + helper.AddVolume(col00[z], col01[z], col01[z+1], col00[z+1], + col10[z], col11[z], col11[z+1], col10[z+1]); + else + helper.AddVolume(col00[z], col01[z], col11[z], col10[z], + col00[z+1], col01[z+1], col11[z+1], col10[z+1]); } } } + + if ( toRenumber ) + renumHelper.DoReplaceNodes(); + + + if ( _blockRenumberHyp ) + { + return error( _blockRenumberHyp->CheckHypothesis( aMesh, aShape )); + } + return true; } diff --git a/src/StdMeshers/StdMeshers_Hexa_3D.hxx b/src/StdMeshers/StdMeshers_Hexa_3D.hxx index a743d4754..16315e0d7 100644 --- a/src/StdMeshers/StdMeshers_Hexa_3D.hxx +++ b/src/StdMeshers/StdMeshers_Hexa_3D.hxx @@ -37,6 +37,7 @@ class SMESH_MesherHelper; class StdMeshers_Quadrangle_2D; class StdMeshers_ViscousLayers; +class StdMeshers_BlockRenumber; class STDMESHERS_EXPORT StdMeshers_Hexa_3D : public SMESH_3D_Algo { @@ -64,6 +65,7 @@ public: protected: const StdMeshers_ViscousLayers* _viscousLayersHyp; + const StdMeshers_BlockRenumber* _blockRenumberHyp; StdMeshers_Quadrangle_2D* _quadAlgo; }; diff --git a/src/StdMeshersGUI/CMakeLists.txt b/src/StdMeshersGUI/CMakeLists.txt index c0f1c390f..d423dd2a3 100644 --- a/src/StdMeshersGUI/CMakeLists.txt +++ b/src/StdMeshersGUI/CMakeLists.txt @@ -81,6 +81,7 @@ SET(_moc_HEADERS StdMeshersGUI_RadioButtonsGrpWdg.h StdMeshersGUI_PropagationHelperWdg.h StdMeshersGUI_NameCheckableGrpWdg.h + StdMeshersGUI_BlockRenumberCreator.h ) IF(SALOME_USE_PLOT2DVIEWER) @@ -117,6 +118,7 @@ SET(_other_SOURCES StdMeshersGUI_RadioButtonsGrpWdg.cxx StdMeshersGUI_PropagationHelperWdg.cxx StdMeshersGUI_NameCheckableGrpWdg.cxx + StdMeshersGUI_BlockRenumberCreator.cxx ) IF(SALOME_USE_PLOT2DVIEWER) diff --git a/src/StdMeshersGUI/StdMeshersGUI.cxx b/src/StdMeshersGUI/StdMeshersGUI.cxx index 511874583..406c14de9 100644 --- a/src/StdMeshersGUI/StdMeshersGUI.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI.cxx @@ -24,10 +24,11 @@ // Author : Alexander SOLOVYOV, Open CASCADE S.A.S. // SMESH includes // -#include "StdMeshersGUI_StdHypothesisCreator.h" -#include "StdMeshersGUI_NbSegmentsCreator.h" +#include "StdMeshersGUI_BlockRenumberCreator.h" #include "StdMeshersGUI_CartesianParamCreator.h" +#include "StdMeshersGUI_NbSegmentsCreator.h" #include "StdMeshersGUI_QuadrangleParamWdg.h" +#include "StdMeshersGUI_StdHypothesisCreator.h" //============================================================================= /*! GetHypothesisCreator @@ -45,6 +46,8 @@ extern "C" return new StdMeshersGUI_CartesianParamCreator( aHypType ); else if ( aHypType=="QuadrangleParams" ) return new StdMeshersGUI_QuadrangleParamCreator( aHypType ); + else if ( aHypType=="BlockRenumber") + return new StdMeshersGUI_BlockRenumberCreator( aHypType ); else return new StdMeshersGUI_StdHypothesisCreator( aHypType ); } diff --git a/src/StdMeshersGUI/StdMeshersGUI_BlockRenumberCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_BlockRenumberCreator.cxx new file mode 100644 index 000000000..9aacd166d --- /dev/null +++ b/src/StdMeshersGUI/StdMeshersGUI_BlockRenumberCreator.cxx @@ -0,0 +1,515 @@ +// 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 +// +// 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, 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 +// 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 +// +// File : StdMeshersGUI_BlockRenumberCreator.cxx +// Author : Open CASCADE S.A.S. + +#include "StdMeshersGUI_BlockRenumberCreator.h" + +#include "SMESHGUI.h" +#include "SMESHGUI_Utils.h" +#include "SMESHGUI_VTKUtils.h" +#include "SMESHGUI_HypothesesUtils.h" + +#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SPACING 6 +#define MARGIN 11 + +namespace { + + //================================================================================ + /*! + * \brief Textual representation of GEOM_Object in QTreeWidget + */ + //================================================================================ + + QString toText( const GEOM::GEOM_Object_var& theGO, + const QString & /*theLabel*/, + QString& theEntry ) + { + QString txt; + if ( !theGO->_is_nil() ) + { + CORBA::String_var name = theGO->GetName(); + CORBA::String_var entry = theGO->GetStudyEntry(); + theEntry = entry.in(); + + txt = name.in(); + //txt = theLabel + name.in() + " [" + theEntry + "]"; + //txt += " ";//" ("; + //txt += entry.in(); + //txt += ")"; + } + return txt; + } + + //================================================================================ + /*! + * \brief Find GEOM_Object by study entry + */ + //================================================================================ + + GEOM::GEOM_Object_var toGeom( const QString& entry ) + { + return SMESH::EntryToInterface( entry ); + } + + + //================================================================================ + /*! + * \brief Find GEOM_Object in the tree + */ + //================================================================================ + + QTreeWidgetItem* findSolidInTree( const GEOM::GEOM_Object_var& go, QTreeWidget* tree ) + { + if ( go->_is_nil() || !tree ) + return nullptr; + + for ( int i = 0; i < tree->topLevelItemCount(); ++i ) + { + QTreeWidgetItem* item = tree->topLevelItem( i ); + if ( item->data( 1, Qt::UserRole ).toString() == SMESH::toQStr( go->GetStudyEntry() )) + return item; + } + return nullptr; + } +} + +//================================================================================ +/*! + * \brief StdMeshersGUI_BlockRenumberCreator constructor + */ +//================================================================================ + +StdMeshersGUI_BlockRenumberCreator::StdMeshersGUI_BlockRenumberCreator(const QString& aHypType) + : StdMeshersGUI_StdHypothesisCreator( aHypType ), + mySolidFilter( "", TopAbs_SOLID, 1, TopAbs_SOLID ), + myVertexFilter( "", TopAbs_VERTEX, 1, TopAbs_VERTEX ) +{ +} + +//================================================================================ +/*! + * \brief StdMeshersGUI_BlockRenumberCreator destructor + */ +//================================================================================ + +StdMeshersGUI_BlockRenumberCreator::~StdMeshersGUI_BlockRenumberCreator() +{ + SMESHGUI::selectionMgr()->clearFilters(); +} + +//================================================================================ +/*! + * \brief Create widgets + */ +//================================================================================ + +QFrame* StdMeshersGUI_BlockRenumberCreator::buildFrame() +{ + QFrame* fr = new QFrame(); + //fr->setMinimumWidth(460); + + QGridLayout* frLayout = new QGridLayout( fr ); + frLayout->setSpacing( SPACING ); + frLayout->setMargin( MARGIN ); + + // name + myName = 0; + int row = 0; + if( isCreation() ) + { + myName = new QLineEdit( fr ); + frLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), fr ), row, 0 ); + frLayout->addWidget( myName, row, 1 ); + row++; + } + + QGroupBox* groupBox = new QGroupBox( tr( "BLOCK_CS_GROUPBOX" ), fr ); + frLayout->addWidget( groupBox, row, 0, 1, 2 ); + + QGridLayout* layout = new QGridLayout( groupBox ); + layout->setSpacing( SPACING ); + layout->setMargin( MARGIN ); + layout->setColumnStretch( 0, 1 ); + + // tree + row = 0; + myBlockTree = new QTreeWidget( groupBox ); + myBlockTree->setColumnCount( 2 ); + myBlockTree->header()->hide(); + // myBlockTree->setHeaderLabels( QStringList() + // << tr("COLUMN_BLOCK") << tr("COLUMN_V000") << tr("COLUMN_V001")); + layout->addWidget( myBlockTree, row, 0, row + 7, 1 ); + + // selection widgets + myButGroup = new QButtonGroup( groupBox ); + myButGroup->setExclusive( true ); + QLabel* label[3] = { new QLabel( tr( "SOLID" ), groupBox ), + new QLabel( tr( "V000" ), groupBox ), + new QLabel( tr( "V001" ), groupBox ) }; + QIcon icon( SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT"))); + for ( int i = 0; i < 3; ++i ) + { + myShapeSelectBut[i] = new QPushButton( icon, "", groupBox ); + myLineEdit [i] = new QLineEdit( groupBox ); + layout->addWidget( label[i], row, 1 ); + layout->addWidget( myShapeSelectBut[i], row, 2 ); + layout->addWidget( myLineEdit[i], row, 3 ); + myShapeSelectBut[i]->setCheckable( true ); + myButGroup->addButton( myShapeSelectBut[i], i ); + row++; + } + + // buttons + myAddBut = new QPushButton( tr("ADD"), groupBox ); + myModifBut = new QPushButton( tr("MODIFY"), groupBox ); + myRemoveBut = new QPushButton( tr("SMESH_REMOVE"), groupBox ); + layout->addWidget( myAddBut, row, 1, 1, 3 ); + row++; + layout->addWidget( myModifBut, row, 1, 1, 3 ); + row++; + layout->addWidget( myRemoveBut, row, 1, 1, 3 ); + row++; + layout->setRowStretch( row, 1 ); + + LightApp_SelectionMgr* selMgr = SMESH::GetSelectionMgr( SMESHGUI::GetSMESHGUI() ); + + connect( selMgr, SIGNAL( currentSelectionChanged()), SLOT( onSelectionChange())); + connect( myBlockTree, SIGNAL( itemSelectionChanged() ), SLOT( onTreeSelectionChange())); + connect( myShapeSelectBut[0], SIGNAL( clicked(bool)), SLOT( onSelectBtnClick() )); + connect( myShapeSelectBut[1], SIGNAL( clicked(bool)), SLOT( onSelectBtnClick() )); + connect( myShapeSelectBut[2], SIGNAL( clicked(bool)), SLOT( onSelectBtnClick() )); + connect( myAddBut, SIGNAL( clicked() ), SLOT( onAddBtnClick() )); + connect( myModifBut, SIGNAL( clicked() ), SLOT( onModifBtnClick() )); + connect( myRemoveBut, SIGNAL( clicked() ), SLOT( onRemoveBtnClick() )); + + return fr; +} + +//================================================================================ +/*! + * \brief Set myGO's to the tree + */ +//================================================================================ + +void StdMeshersGUI_BlockRenumberCreator::setBlockToTree(QTreeWidgetItem* solidItem) +{ + if ( !myGO[0]->_is_nil() && !myGO[1]->_is_nil() && !myGO[2]->_is_nil() ) + { + if ( !solidItem ) solidItem = new QTreeWidgetItem( myBlockTree ); + solidItem->setExpanded( true ); + QTreeWidgetItem* item = solidItem; + + QFont boldFont = item->font( 0 ); + boldFont.setBold( true ); + + QString entry, label[3] = { tr("BLOCK_LABEL"), tr("V000_LABEL"), tr("V001_LABEL") }; + for ( int i = 0; i < 3; ++i ) + { + if ( i > 0 && ! (item = solidItem->child( i - 1 ))) + item = new QTreeWidgetItem( solidItem ); + + item->setText( 0, label[i] ); + item->setText( 1, toText( myGO[i], label[i], entry )); + item->setData( 1, Qt::UserRole, entry ); + item->setFont( 1, boldFont ); + item->setToolTip( 1, entry ); + } + myBlockTree->resizeColumnToContents( 0 ); + myBlockTree->resizeColumnToContents( 1 ); + } + for ( int i = 0; i < 3; ++i ) + { + myGO[i] = GEOM::GEOM_Object::_nil(); + myLineEdit[i]->setText(""); + } +} + +//================================================================================ +/*! + * \brief Transfer parameters from hypothesis to widgets + */ +//================================================================================ + +void StdMeshersGUI_BlockRenumberCreator::retrieveParams() const +{ + StdMeshersGUI_BlockRenumberCreator* me = const_cast( this ); + + StdMeshers::StdMeshers_BlockRenumber_var h = + StdMeshers::StdMeshers_BlockRenumber::_narrow( initParamsHypothesis() ); + + if( myName ) + me->myName->setText( hypName() ); + + me->myBlockTree->clear(); + + StdMeshers::blockcs_array_var blkArray = h->GetBlocksOrientation(); + for ( CORBA::ULong i = 0; i < blkArray->length(); ++i ) + { + me->myGO[0] = GEOM::GEOM_Object::_duplicate( blkArray[i].solid.in() ); + me->myGO[1] = GEOM::GEOM_Object::_duplicate( blkArray[i].vertex000.in() ); + me->myGO[2] = GEOM::GEOM_Object::_duplicate( blkArray[i].vertex001.in() ); + me->setBlockToTree(); + } + + me->myShapeSelectBut[0]->click(); + + me->updateButtons(); +} + +//================================================================================ +/*! + * \brief Transfer parameters from widgets to hypothesis + */ +//================================================================================ + +QString StdMeshersGUI_BlockRenumberCreator::storeParams() const +{ + StdMeshers::StdMeshers_BlockRenumber_var h = + StdMeshers::StdMeshers_BlockRenumber::_narrow( hypothesis() ); + + try + { + if( isCreation() ) + SMESH::SetName( SMESH::FindSObject( h ), myName->text().toUtf8().constData() ); + + StdMeshers::blockcs_array_var array = new StdMeshers::blockcs_array(); + array->length( myBlockTree->topLevelItemCount() ); + + for ( int i = 0; i < myBlockTree->topLevelItemCount(); ++i ) + { + StdMeshers::BlockCS& bcs = array[i]; + QTreeWidgetItem* item0 = myBlockTree->topLevelItem( i ); + QTreeWidgetItem* item1 = item0->child( 0 ); + QTreeWidgetItem* item2 = item0->child( 1 ); + + bcs.solid = toGeom( item0->data( 1, Qt::UserRole ).toString() )._retn(); + bcs.vertex000 = toGeom( item1->data( 1, Qt::UserRole ).toString() )._retn(); + bcs.vertex001 = toGeom( item2->data( 1, Qt::UserRole ).toString() )._retn(); + } + h->SetBlocksOrientation( array ); + + } + catch(const SALOME::SALOME_Exception& ex) + { + SalomeApp_Tools::QtCatchCorbaException(ex); + } + return ""; +} + +//================================================================================ +/*! + * \brief Take selected object + */ +//================================================================================ + +void StdMeshersGUI_BlockRenumberCreator::onSelectionChange() +{ + SALOME_ListIO list; + SMESHGUI::GetSMESHGUI()->selectionMgr()->selectedObjects( list ); + + int shapeID = myButGroup->checkedId(); + if ( shapeID < 0 || shapeID > 2 ) + shapeID = 0; + + myGO[ shapeID ] = GEOM::GEOM_Object::_nil(); + myLineEdit[ shapeID ]->clear(); + + if ( list.IsEmpty() ) + return; + + Handle(SALOME_InteractiveObject) io = list.First(); + if ( !io->hasEntry() ) + return; + + myGO[ shapeID ] = SMESH::IObjectToInterface( io ); + + if ( !myGO[ shapeID ]->_is_nil() ) + myLineEdit[ shapeID ]->setText( SMESH::toQStr( myGO[ shapeID ]->GetName() )); + + updateButtons(); +} + +//================================================================================ +/*! + * \brief Display selected block CS in myLineEdit's + */ +//================================================================================ + +void StdMeshersGUI_BlockRenumberCreator::onTreeSelectionChange() +{ + QList items = myBlockTree->selectedItems(); + for ( QTreeWidgetItem* item : items ) + { + if ( item->parent() ) + item = item->parent(); + + QTreeWidgetItem* items[3] = { item, item->child( 0 ), item->child( 1 ) }; + if ( items[1] && items[2] ) + for ( int i = 0; i < 3; ++i ) + { + myGO[i] = toGeom( items[i]->data( 1, Qt::UserRole ).toString() ); + myLineEdit[i]->setText( items[i]->text( 1 )); + } + + break; + } + + updateButtons(); +} + +//================================================================================ +/*! + * \brief Activate/deactivate buttons + */ +//================================================================================ + +void StdMeshersGUI_BlockRenumberCreator::updateButtons() +{ + bool isSolidInTree = findSolidInTree( myGO[0], myBlockTree ); + myAddBut ->setEnabled( !isSolidInTree && + !myGO[0]->_is_nil() && !myGO[1]->_is_nil() && !myGO[2]->_is_nil() ); + myModifBut ->setEnabled( isSolidInTree ); + myRemoveBut->setEnabled( !myBlockTree->selectedItems().isEmpty() || + myBlockTree->topLevelItemCount() == 1 ); +} + +//================================================================================ +/*! + * \brief Install filter upon activation of another object selection + */ +//================================================================================ + +void StdMeshersGUI_BlockRenumberCreator::onSelectBtnClick() +{ + int shapeID = myButGroup->checkedId(); + LightApp_SelectionMgr* selMgr = SMESHGUI::selectionMgr(); + selMgr->clearFilters(); + selMgr->installFilter( shapeID > 0 ? &myVertexFilter : &mySolidFilter ); +} + +//================================================================================ +/*! + * \brief Add shapes to the tree + */ +//================================================================================ + +void StdMeshersGUI_BlockRenumberCreator::onAddBtnClick() +{ + setBlockToTree(); + updateButtons(); +} + +//================================================================================ +/*! + * \brief Modify a current block + */ +//================================================================================ + +void StdMeshersGUI_BlockRenumberCreator::onModifBtnClick() +{ + if ( QTreeWidgetItem* item = findSolidInTree( myGO[0], myBlockTree )) + { + setBlockToTree( item ); + } + updateButtons(); +} + +//================================================================================ +/*! + * \brief Remove selected block from the tree + */ +//================================================================================ + +void StdMeshersGUI_BlockRenumberCreator::onRemoveBtnClick() +{ + QList items = myBlockTree->selectedItems(); + if ( items.isEmpty() && myBlockTree->topLevelItemCount() == 1 ) + items.push_back( myBlockTree->topLevelItem( 0 )); + + for ( QTreeWidgetItem* item : items ) + { + if ( item->parent() ) + item = item->parent(); + delete item; + } + + updateButtons(); +} + + +//================================================================================ +/*! + * \brief Validate parameters + */ +//================================================================================ + +bool StdMeshersGUI_BlockRenumberCreator::checkParams( QString& msg ) const +{ + return true; +} + +//================================================================================ +/*! + * \brief Returns a name of help page + */ +//================================================================================ + +QString StdMeshersGUI_BlockRenumberCreator::helpPage() const +{ + return "block_renumber.html"; +} + +//================================================================================ +/*! + * \brief Type name + */ +//================================================================================ + +QString StdMeshersGUI_BlockRenumberCreator::hypTypeName( const QString& ) const +{ + return "BLOCK_RENUMBER"; +} diff --git a/src/StdMeshersGUI/StdMeshersGUI_BlockRenumberCreator.h b/src/StdMeshersGUI/StdMeshersGUI_BlockRenumberCreator.h new file mode 100644 index 000000000..f3fe31d4f --- /dev/null +++ b/src/StdMeshersGUI/StdMeshersGUI_BlockRenumberCreator.h @@ -0,0 +1,89 @@ +// 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 +// +// 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, 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 +// 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 +// + +// File : StdMeshersGUI_BlockRenumberCreator.h +// Author : Open CASCADE S.A.S. +// +#ifndef STDMESHERSGUI_BlockRenumberCreator_H +#define STDMESHERSGUI_BlockRenumberCreator_H + +#include "SMESH_NumberFilter.hxx" +#include "SMESH_StdMeshersGUI.hxx" +#include "StdMeshersGUI_StdHypothesisCreator.h" + +#include +#include CORBA_SERVER_HEADER(GEOM_Gen) +//#include CORBA_SERVER_HEADER(SMESH_Hypothesis) + +class QButtonGroup; +class QLineEdit; +class QString; +class QTreeWidget; +class QTreeWidgetItem; + +class STDMESHERSGUI_EXPORT StdMeshersGUI_BlockRenumberCreator : public StdMeshersGUI_StdHypothesisCreator +{ + Q_OBJECT + +public: + StdMeshersGUI_BlockRenumberCreator( const QString& aHypType ); + ~StdMeshersGUI_BlockRenumberCreator(); + + virtual bool checkParams( QString& ) const override; + virtual QString helpPage() const override; + virtual QString hypTypeName( const QString& ) const override; + +protected: + virtual QFrame* buildFrame() override; + virtual void retrieveParams() const override; + virtual QString storeParams() const override; + +private slots: + void onSelectionChange(); + void onTreeSelectionChange(); + void updateButtons(); + void onSelectBtnClick(); + void onAddBtnClick(); + void onModifBtnClick(); + void onRemoveBtnClick(); + +private: + + void setBlockToTree( QTreeWidgetItem* item = 0 ); + + QLineEdit* myName; + QTreeWidget* myBlockTree; + + QPushButton* myShapeSelectBut[3]; + QButtonGroup* myButGroup; + QLineEdit* myLineEdit[3]; + + QPushButton* myAddBut; + QPushButton* myModifBut; + QPushButton* myRemoveBut; + + GEOM::GEOM_Object_var myGO[3]; + + SMESH_NumberFilter mySolidFilter, myVertexFilter; +}; + +#endif // STDMESHERSGUI_BlockRenumberCreator_H diff --git a/src/StdMeshersGUI/StdMeshers_images.ts b/src/StdMeshersGUI/StdMeshers_images.ts index 681bf7bed..3b41151ac 100644 --- a/src/StdMeshersGUI/StdMeshers_images.ts +++ b/src/StdMeshersGUI/StdMeshers_images.ts @@ -99,6 +99,10 @@ ICON_DLG_START_END_LENGTH mesh_hypo_length.png + + ICON_DLG_BLOCK_RENUMBER + mesh_tree_hypo_renumber.png + ICON_SELECT select1.png @@ -291,6 +295,10 @@ ICON_SMESH_TREE_HYPO_QuadraticMesh mesh_tree_hypo_quadratic.png + + ICON_SMESH_TREE_HYPO_BlockRenumber + mesh_tree_hypo_renumber.png + ICON_SMESH_TREE_HYPO_SegmentLengthAroundVertex mesh_tree_hypo_length.png diff --git a/src/StdMeshersGUI/StdMeshers_msg_en.ts b/src/StdMeshersGUI/StdMeshers_msg_en.ts index 0c0509f19..1af404162 100644 --- a/src/StdMeshersGUI/StdMeshers_msg_en.ts +++ b/src/StdMeshersGUI/StdMeshers_msg_en.ts @@ -508,6 +508,14 @@ this one for this mesh/sub-mesh. SMESH_QUAD_TYPE Type + + SMESH_BLOCK_RENUMBER_TITLE + Hypothesis Construction + + + SMESH_BLOCK_RENUMBER_HYPOTHESIS + Renumber + StdMeshersGUI_QuadrangleParamWdg @@ -679,4 +687,55 @@ this one for this mesh/sub-mesh. Chain %1 (%2 edges) + + StdMeshersGUI_BlockRenumberCreator + + BLOCK_CS_GROUPBOX + Block coordinate system + + + SOLID + Solid + + + V000 + Vertex (0,0,0) + + + V001 + Vertex (0,0,1) + + + ADD + Add + + + MODIFY + Modify + + + COLUMN_BLOCK + Block + + + COLUMN_V000 + Vertex (0,0,0) + + + COLUMN_V001 + Vertex (0,0,1) + + + BLOCK_LABEL + Block: + + + V000_LABEL + Vertex (0,0,0): + + + V001_LABEL + Vertex (0,0,1): + + diff --git a/src/StdMeshers_I/CMakeLists.txt b/src/StdMeshers_I/CMakeLists.txt index e4e0f27f4..8dbfc245d 100644 --- a/src/StdMeshers_I/CMakeLists.txt +++ b/src/StdMeshers_I/CMakeLists.txt @@ -119,6 +119,7 @@ SET(StdMeshersEngine_HEADERS StdMeshers_Cartesian_3D_i.hxx StdMeshers_PolygonPerFace_2D_i.hxx StdMeshers_PolyhedronPerSolid_3D_i.hxx + StdMeshers_BlockRenumber_i.hxx ) IF(SALOME_SMESH_ENABLE_MEFISTO) SET(StdMeshersEngine_HEADERS ${StdMeshersEngine_HEADERS} StdMeshers_MEFISTO_2D_i.hxx) @@ -175,6 +176,7 @@ SET(StdMeshersEngine_SOURCES StdMeshers_Adaptive1D_i.cxx StdMeshers_PolygonPerFace_2D_i.cxx StdMeshers_PolyhedronPerSolid_3D_i.cxx + StdMeshers_BlockRenumber_i.cxx ) IF(SALOME_SMESH_ENABLE_MEFISTO) diff --git a/src/StdMeshers_I/StdMeshers_BlockRenumber_i.cxx b/src/StdMeshers_I/StdMeshers_BlockRenumber_i.cxx new file mode 100644 index 000000000..7c517cab6 --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_BlockRenumber_i.cxx @@ -0,0 +1,189 @@ +// 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 +// +// 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, 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 +// 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_I : idl implementation based on 'SMESH' unit's classes +// File : StdMeshers_BlockRenumber_i.cxx +// Author : Edward AGAPOV +// Module : SMESH +// $Header$ +// +#include "StdMeshers_ObjRefUlils.hxx" +#include "StdMeshers_BlockRenumber_i.hxx" +#include "SMESH_Gen_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_PythonDump.hxx" + +#include "Utils_CorbaException.hxx" + +//============================================================================= +/*! + * StdMeshers_BlockRenumber_i::StdMeshers_BlockRenumber_i + * + * Constructor + */ +//============================================================================= + +StdMeshers_BlockRenumber_i::StdMeshers_BlockRenumber_i( PortableServer::POA_ptr thePOA, + ::SMESH_Gen* theGenImpl ) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ) +{ + myBaseImpl = new ::StdMeshers_BlockRenumber( theGenImpl->GetANewId(), + theGenImpl ); +} + +//================================================================================ +/*! + * \brief Set orientation of blocks + */ +//================================================================================ + +void StdMeshers_BlockRenumber_i::SetBlocksOrientation( const StdMeshers::blockcs_array& blockCS ) +{ + try { + SMESH_Comment dump; + CORBA::String_var entry; + std::vector< StdMeshers_BlockCS > bcsVec( blockCS.length() ); + for ( size_t i = 0; i < bcsVec.size(); i++ ) + { + StdMeshers_BlockCS& bcs = bcsVec[i]; + if ( !CORBA::is_nil( blockCS[i].solid ) && + !CORBA::is_nil( blockCS[i].vertex000 )&& + !CORBA::is_nil( blockCS[i].vertex001 )) + { + entry = blockCS[i].solid->GetStudyEntry(); + bcs._solid = entry.in(); + entry = blockCS[i].vertex000->GetStudyEntry(); + bcs._vertex000 = entry.in(); + entry = blockCS[i].vertex001->GetStudyEntry(); + bcs._vertex001 = entry.in(); + + if ( !dump.empty() ) dump << ",\n "; + dump << "StdMeshers.BlockCS( " + << bcs._solid << ", " << bcs._vertex000 << ", " << bcs._vertex001 + << " )"; + } + } + this->GetImpl()->SetBlocksOrientation( bcsVec ); + + // Update Python script + SMESH::TPythonDump() << _this() << ".SetBlocksOrientation([ " << dump << " ])"; + } + catch ( SALOME_Exception& S_ex ) { + THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM ); + } +} + +//================================================================================ +/*! + * \brief Return orientation of blocks + */ +//================================================================================ + +StdMeshers::blockcs_array* StdMeshers_BlockRenumber_i::GetBlocksOrientation() +{ + const std::vector< StdMeshers_BlockCS >& bcsVec = this->GetImpl()->GetBlocksOrientation(); + StdMeshers::blockcs_array_var bcsArray = new StdMeshers::blockcs_array(); + bcsArray->length( bcsVec.size() ); + TopoDS_Shape nullShape; + for ( size_t i = 0; i < bcsVec.size(); ++i ) + { + bcsArray[i].solid = + StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject( bcsVec[i]._solid, nullShape ); + bcsArray[i].vertex000 = + StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject( bcsVec[i]._vertex000, nullShape ); + bcsArray[i].vertex001 = + StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject( bcsVec[i]._vertex001, nullShape ); + } + return bcsArray._retn(); +} + +//================================================================================ +/*! + * \brief Return geom entries + */ +//================================================================================ + +bool StdMeshers_BlockRenumber_i::getObjectsDependOn( std::vector< std::string > & entryArray, + std::vector< int > & subIDArray ) const +{ + const std::vector< StdMeshers_BlockCS >& bcsVec = + const_cast(this)->GetImpl()->GetBlocksOrientation(); + entryArray.reserve( entryArray.capacity() + 3 * bcsVec.size()); + for ( size_t i = 0; i < bcsVec.size(); ++i ) + { + entryArray.push_back( bcsVec[i]._solid ); + entryArray.push_back( bcsVec[i]._vertex000 ); + entryArray.push_back( bcsVec[i]._vertex001 ); + } + return !bcsVec.empty(); +} + +//================================================================================ +/*! + * \brief Update geom entries for a new geometry + */ +//================================================================================ + +bool StdMeshers_BlockRenumber_i::setObjectsDependOn( std::vector< std::string > & entryArray, + std::vector< int > & subIDArray ) +{ + std::vector< StdMeshers_BlockCS > bcsVec( entryArray.size() / 3 ); + for ( size_t i = 0; i + 2 < entryArray.size(); i += 3 ) + { + StdMeshers_BlockCS& bcs = bcsVec[i]; + bcs._solid = entryArray[ i ]; + bcs._vertex000 = entryArray[ i + 1 ]; + bcs._vertex001 = entryArray[ i + 2 ]; + } + this->GetImpl()->SetBlocksOrientation( bcsVec ); + return true; +} + + +//============================================================================= +/*! + * StdMeshers_BlockRenumber_i::GetImpl + * + * Get implementation + */ +//============================================================================= + +::StdMeshers_BlockRenumber* StdMeshers_BlockRenumber_i::GetImpl() +{ + return ( ::StdMeshers_BlockRenumber* )myBaseImpl; +} + +//================================================================================ +/*! + * \brief Verify whether hypothesis supports given entity type + * \param type - dimension (see SMESH::Dimension enumeration) + * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise + * + * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration) + */ +//================================================================================ +CORBA::Boolean StdMeshers_BlockRenumber_i::IsDimSupported( SMESH::Dimension type ) +{ + return type == SMESH::DIM_3D; +} + diff --git a/src/StdMeshers_I/StdMeshers_BlockRenumber_i.hxx b/src/StdMeshers_I/StdMeshers_BlockRenumber_i.hxx new file mode 100644 index 000000000..42291fd04 --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_BlockRenumber_i.hxx @@ -0,0 +1,76 @@ +// 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 +// +// 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, 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 +// 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 +// + +// File : StdMeshers_BlockRenumber_i.hxx +// Author : Edward AGAPOV +// Module : SMESH +// +#ifndef _SMESH_BlockRenumber_I_HXX_ +#define _SMESH_BlockRenumber_I_HXX_ + +#include "SMESH_StdMeshers_I.hxx" + +#include +#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) + +#include "SMESH_Hypothesis_i.hxx" +#include "StdMeshers_BlockRenumber.hxx" + +class SMESH_Gen; + +// ========================================================= +/*! + * \class 3D Hypothesis used by Hexahedron(ijk) algorithm + * to renumber mesh of a block to be structured-like + */ +// ========================================================= + +class STDMESHERS_I_EXPORT StdMeshers_BlockRenumber_i: + public virtual POA_StdMeshers::StdMeshers_BlockRenumber, + public virtual SMESH_Hypothesis_i +{ +public: + + StdMeshers_BlockRenumber_i( PortableServer::POA_ptr thePOA, + ::SMESH_Gen* theGenImpl ); + + // Set orientation of blocks + void SetBlocksOrientation( const StdMeshers::blockcs_array& blockCS ) override; + + // Return orientation of blocks + StdMeshers::blockcs_array* GetBlocksOrientation() override; + + + // Get implementation + ::StdMeshers_BlockRenumber* GetImpl(); + + // Verify whether hypothesis supports given entity type + CORBA::Boolean IsDimSupported( SMESH::Dimension type ) override; + + // Methods for copying mesh definition to other geometry + bool getObjectsDependOn( std::vector< std::string > & entryArray, + std::vector< int > & subIDArray ) const override; + bool setObjectsDependOn( std::vector< std::string > & entryArray, + std::vector< int > & subIDArray ) override; +}; + +#endif diff --git a/src/StdMeshers_I/StdMeshers_i.cxx b/src/StdMeshers_I/StdMeshers_i.cxx index 2bd9e4eda..9038d2f58 100644 --- a/src/StdMeshers_I/StdMeshers_i.cxx +++ b/src/StdMeshers_I/StdMeshers_i.cxx @@ -34,6 +34,7 @@ #include "StdMeshers_Adaptive1D_i.hxx" #include "StdMeshers_Arithmetic1D_i.hxx" #include "StdMeshers_AutomaticLength_i.hxx" +#include "StdMeshers_BlockRenumber_i.hxx" #include "StdMeshers_CartesianParameters3D_i.hxx" #include "StdMeshers_Cartesian_3D_i.hxx" #include "StdMeshers_CompositeSegment_1D_i.hxx" @@ -207,6 +208,8 @@ STDMESHERS_I_EXPORT aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "CartesianParameters3D") == 0) aCreator = new StdHypothesisCreator_i; + else if (strcmp(aHypName, "BlockRenumber") == 0) + aCreator = new StdHypothesisCreator_i; // Algorithms else if (strcmp(aHypName, "Regular_1D") == 0)