From: vsr Date: Wed, 18 Dec 2013 16:18:55 +0000 (+0000) Subject: Merge from V7_3_BR branch 18/12/2013 X-Git-Tag: V7_4_0a1~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e0454dbc54cdd9192c2b8ccdf772af419a47e851;p=modules%2Fhexablock.git Merge from V7_3_BR branch 18/12/2013 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 966facd..b3e2c68 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ CMAKE_POLICY(SET CMP0003 NEW) STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC) SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7) -SET(${PROJECT_NAME_UC}_MINOR_VERSION 2) +SET(${PROJECT_NAME_UC}_MINOR_VERSION 3) SET(${PROJECT_NAME_UC}_PATCH_VERSION 0) SET(${PROJECT_NAME_UC}_VERSION ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION}) diff --git a/HEXABLOCK_version.h.in b/HEXABLOCK_version.h.in index b2dc846..d448bd6 100755 --- a/HEXABLOCK_version.h.in +++ b/HEXABLOCK_version.h.in @@ -24,8 +24,23 @@ HEXABLOCK_VERSION is (major << 16) + (minor << 8) + patch. */ -#define HEXABLOCK_VERSION_STR "@VERSION@" -#define HEXABLOCK_VERSION @XVERSION@ -#define HEXABLOCK_DEVELOPMENT @VERSION_DEV@ + +/*! + Specify version of SALOME HEXABLOCK module, as follows + +HEXABLOCK_VERSION_MAJOR : (integer) number identifying major version +HEXABLOCK_VERSION_MINOR : (integer) number identifying minor version +HEXABLOCK_VERSION_MAINTENANCE : (integer) number identifying maintenance version +HEXABLOCK_VERSION_STR : (string) complete version number "major.minor.maintenance" +HEXABLOCK_VERSION : (hex) complete version number (major << 16) + (minor << 8) + maintenance +HEXABLOCK_DEVELOPMENT : (integer) indicates development version when set to 1 + */ + +#define HEXABLOCK_VERSION_MAJOR @SALOMEHEXABLOCK_MAJOR_VERSION@ +#define HEXABLOCK_VERSION_MINOR @SALOMEHEXABLOCK_MINOR_VERSION@ +#define HEXABLOCK_VERSION_MAINTENANCE @SALOMEHEXABLOCK_PATCH_VERSION@ +#define HEXABLOCK_VERSION_STR "@SALOMEHEXABLOCK_VERSION@" +#define HEXABLOCK_VERSION @SALOMEHEXABLOCK_XVERSION@ +#define HEXABLOCK_DEVELOPMENT @SALOMEHEXABLOCK_VERSION_DEV@ #endif // __HEXABLOCK_VERSION_H__ diff --git a/bin/runAppli.in b/bin/runAppli.in index 08cfde0..559d021 100755 --- a/bin/runAppli.in +++ b/bin/runAppli.in @@ -21,8 +21,8 @@ if [ -z "${KERNEL_ROOT_DIR}" ] ; then export KERNEL_ROOT_DIR=@KERNEL_ROOT_DIR@ fi -if [ -z "${HEXA_ROOT_DIR}" ] ; then -export HEXA_ROOT_DIR=@prefix@ +if [ -z "${HEXABLOCK_ROOT_DIR}" ] ; then +export HEXABLOCK_ROOT_DIR=@CMAKE_INSTALL_PREFIX@ fi searchFreePort() { diff --git a/doc/_static/gui_addshape.png b/doc/_static/gui_addshape.png new file mode 100644 index 0000000..a093009 Binary files /dev/null and b/doc/_static/gui_addshape.png differ diff --git a/doc/conf.py.in b/doc/conf.py.in index ef8a962..c5f403f 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -77,6 +77,11 @@ release = '@SALOMEHEXABLOCK_VERSION@' # for source files. exclude_trees = [] +# A list of glob-style patterns that should be excluded when looking for source +# files. They are matched against the source file names relative to the +# source directory, using slashes as directory separators on all platforms. +exclude_patterns = ['**/CVS'] + # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None diff --git a/doc/gui_add_geometry.rst b/doc/gui_add_geometry.rst new file mode 100644 index 0000000..9b0343a --- /dev/null +++ b/doc/gui_add_geometry.rst @@ -0,0 +1,29 @@ +:tocdepth: 3 + +.. _guiaddgeometry: + +============================ +Add a geometry to a document +============================ + +Only geometries added to a document can be used by that document. +Vertices, Edges and Quadrangles of the model of blocks of a document can only be associated to those of a geometry that +has already been added to that document. + +To add a geometry to a document: + +- *1-* Import the geometry (.brep, .step, ...) in the GEOM Module +- *2-* Activate HexaBlock +- *3-* Open your document or create a new one +- *4-* In the **Main Menu** select **Association -> Add geometry** +- *5-* Select the imported geometry and click the **Apply** button of the **Add geometry** Dialog Box + + + .. image:: _static/gui_addshape.png + :align: center + +.. centered:: + Adding geometry to a document + + +TUI command: :ref:`tuiaddgeometry` \ No newline at end of file diff --git a/doc/interactive.rst b/doc/interactive.rst index 2b507e5..2bf64fa 100644 --- a/doc/interactive.rst +++ b/doc/interactive.rst @@ -65,6 +65,7 @@ It provides the toolset allowing to: gui_modify_elmts.rst gui_modify_symmetry.rst gui_association.rst + gui_add_geometry.rst gui_asso_quad_to_geom.rst gui_asso_vertex_to_geom.rst gui_groups.rst diff --git a/doc/python.rst b/doc/python.rst index dbc72ed..762cf5b 100644 --- a/doc/python.rst +++ b/doc/python.rst @@ -32,6 +32,7 @@ By the links below you can find sample scripts for all operations provided by He tui_modify_elmts.rst tui_quad_revolution.rst tui_association.rst + tui_add_geometry.rst tui_asso_quad_to_geom.rst tui_asso_vertex_to_geom.rst tui_groups.rst diff --git a/doc/tui_add_geometry.rst b/doc/tui_add_geometry.rst new file mode 100644 index 0000000..6e7ba0e --- /dev/null +++ b/doc/tui_add_geometry.rst @@ -0,0 +1,22 @@ +:tocdepth: 3 + + +.. _tuiaddgeometry: + +============================ +Add a geometry to a document +============================ + +To add a geometry to a document in python mode, you need the following arguments: + +- *doc* : the document +- *geom* : the geometry +- *shape_name* : the name of the geometry + +Use the function **addShape**:: + + doc = hexablock.addDocument (doc_name) + geom = geompy.ImportBREP (shape_name + ".brep") + shape = hexablock.addShape (doc, geom , shape_name) + +GUI command: :ref:`guiaddgeometry` diff --git a/src/HEXABLOCK/CMakeLists.txt b/src/HEXABLOCK/CMakeLists.txt index 602cd3d..88fd8f7 100644 --- a/src/HEXABLOCK/CMakeLists.txt +++ b/src/HEXABLOCK/CMakeLists.txt @@ -69,6 +69,7 @@ SET(HEXABLOCKEngine_HEADERS HexHexa.hxx HexMatrix.hxx HexQuad.hxx + HexQpattern.hxx HexVertex.hxx HexLaw.hxx HexCloner.hxx @@ -105,6 +106,7 @@ SET(HEXABLOCKEngine_SOURCES HexVertex.cxx HexEdge.cxx HexQuad.cxx + HexQpattern.cxx HexHexa.cxx HexHexa_disco.cxx HexVector.cxx diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx index c243f38..63ebc65 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx @@ -941,6 +941,7 @@ void HEXABLOCKGUI::createAndFillDockWidget() _dwInputPanel = new QDockWidget(aParent); _dwInputPanel->setVisible(false); _dwInputPanel->setWindowTitle("Input Panel"); + _dwInputPanel->setObjectName("InputPanelDockWidget"); // _dwInputPanel->setMinimumWidth(DWINPUT_MINIMUM_WIDTH); // --- force a minimum until display // _treeViewDelegate = new DocumentDelegate(_dwInputPanel); @@ -951,6 +952,7 @@ void HEXABLOCKGUI::createAndFillDockWidget() _dwPattern->setVisible(false); _dwPattern->setWindowTitle("Model"); _dwPattern->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display + _dwPattern->setObjectName("ModelDockWidget"); QFrame* patternFrame = new QFrame(_dwPattern); patternFrame->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); @@ -985,6 +987,7 @@ void HEXABLOCKGUI::createAndFillDockWidget() _dwGroups->setVisible(false); _dwGroups->setWindowTitle("Groups"); _dwGroups->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display + _dwGroups->setObjectName("GroupsDockWidget"); _groupsTreeView = new QTreeView(_dwGroups); _groupsTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers); // _groupsTreeView->setItemDelegate(_treeViewDelegate); @@ -996,6 +999,7 @@ void HEXABLOCKGUI::createAndFillDockWidget() _dwMesh->setVisible(false); _dwMesh->setWindowTitle("Mesh"); _dwMesh->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display + _dwMesh->setObjectName("MeshDockWidget"); _meshTreeView = new QTreeView(_dwMesh); _meshTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers); _meshTreeView->setSelectionMode(QAbstractItemView::SingleSelection); diff --git a/src/HEXABLOCKGUI/MyDlgRef/CMakeLists.txt b/src/HEXABLOCKGUI/MyDlgRef/CMakeLists.txt index d3fa128..3708385 100644 --- a/src/HEXABLOCKGUI/MyDlgRef/CMakeLists.txt +++ b/src/HEXABLOCKGUI/MyDlgRef/CMakeLists.txt @@ -51,58 +51,11 @@ SET(_other_SOURCES # uic files / to be processed by pyuic SET(_pyuic_files - DlgRef_1List1Spin1Btn_QTD.ui - DlgRef_1Sel1Check1List_QTD.ui - DlgRef_1Sel1Check1Sel_QTD.ui - DlgRef_1Sel1Check_QTD.ui - DlgRef_1Sel1List1Check3Btn_QTD.ui - DlgRef_1Sel1Spin1Check_QTD.ui - DlgRef_1Sel1Spin_QTD.ui - DlgRef_1Sel2Spin1View1Check_QTD.ui DlgRef_1Sel2Spin_QTD.ui - DlgRef_1Sel3Check_QTD.ui DlgRef_1Sel3Spin_QTD.ui - DlgRef_1Sel3Spin1Check_QTD.ui - DlgRef_1Sel4Spin2Check_QTD.ui - DlgRef_1Sel4Spin_QTD.ui - DlgRef_1Sel5Spin1Check_QTD.ui - DlgRef_1Sel5Spin_QTD.ui - DlgRef_1Sel_QTD.ui - DlgRef_1SelExt_QTD.ui - DlgRef_1Spin_QTD.ui - DlgRef_2Sel1List1Check_QTD.ui - DlgRef_2Sel1List2Check_QTD.ui - DlgRef_2Sel1List_QTD.ui - DlgRef_2Sel1Spin2Check_QTD.ui DlgRef_2Sel1Spin_QTD.ui - DlgRef_2Sel1SpinInt_QTD.ui - DlgRef_2Sel2List_QTD.ui - DlgRef_2Sel2Spin1Check_QTD.ui - DlgRef_2Sel2Spin3Check_QTD.ui - DlgRef_2Sel2Spin_QTD.ui - DlgRef_2Sel3Spin2Rb_QTD.ui - DlgRef_2Sel3Spin_QTD.ui - DlgRef_2Sel4Spin1Check_QTD.ui DlgRef_2Sel_QTD.ui - DlgRef_2SelExt_QTD.ui - DlgRef_2Spin_QTD.ui - DlgRef_3Check_QTD.ui - DlgRef_3Radio_QTD.ui - DlgRef_3Radio1Sel1Spin_QTD.ui - DlgRef_3Sel1Check_QTD.ui - DlgRef_3Sel1Spin_QTD.ui - DlgRef_3Sel2Spin_QTD.ui - DlgRef_3Sel3Spin1Check_QTD.ui - DlgRef_3Sel3Spin2Check_QTD.ui - DlgRef_3Sel4Spin2Check_QTD.ui - DlgRef_3Sel_QTD.ui - DlgRef_3Spin1Check_QTD.ui DlgRef_3Spin_QTD.ui - DlgRef_4Sel1List1Check_QTD.ui - DlgRef_4Sel1List_QTD.ui - DlgRef_4Sel1Spin2Check_QTD.ui - DlgRef_4Sel1Spin3Check_QTD.ui - DlgRef_6Sel_QTD.ui DlgRef_Skeleton_QTD.ui ) diff --git a/src/HEXABLOCKGUI/MyDlgRef/MyDlgRef.hxx b/src/HEXABLOCKGUI/MyDlgRef/MyDlgRef.hxx index 2b28da7..4497749 100644 --- a/src/HEXABLOCKGUI/MyDlgRef/MyDlgRef.hxx +++ b/src/HEXABLOCKGUI/MyDlgRef/MyDlgRef.hxx @@ -22,7 +22,7 @@ #define MYGEOM_MYDLGREF_HXX #if defined WIN32 -# if defined MYDLGREF_EXPORTS || defined MYDlgRef_EXPORTS +# if defined MYDLGREF_EXPORTS || defined MyDlgRef_EXPORTS # define MYDLGREF_EXPORT __declspec( dllexport ) # else # define MYDLGREF_EXPORT __declspec( dllimport ) diff --git a/src/HEXABLOCKGUI/resources/SalomeApp.xml.in b/src/HEXABLOCKGUI/resources/SalomeApp.xml.in index a003c8e..16ab98d 100755 --- a/src/HEXABLOCKGUI/resources/SalomeApp.xml.in +++ b/src/HEXABLOCKGUI/resources/SalomeApp.xml.in @@ -24,15 +24,15 @@ - +
- +
- +
diff --git a/src/TEST_PY/cas_2013/cas_2013.py b/src/TEST_PY/cas_2013/cas_2013.py new file mode 100755 index 0000000..55d61fa --- /dev/null +++ b/src/TEST_PY/cas_2013/cas_2013.py @@ -0,0 +1,167 @@ +# !/bin/python +# -*- coding: latin-1 -*- +# Hexa : Creation d'hexaedres + +import hexablock +import os + +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 + +doc = hexablock.addDocument ("default") +vx = doc.addVector (1,0,0) +vy = doc.addVector (0,1,0) +vz = doc.addVector (0,0,1) + +vxy = doc.addVector (1,1,0) + +nbr_files = 0 + + +# ======================================================= save_vtk +def save_vtk () : + + global nbr_files + nom = "lecas%d.vtk" % nbr_files + nbr_files += 1 + doc.saveVtk (nom) + +# ======================================================= carre +def carre (x) : + return x*x + +# ======================================================= get_center +def get_center (quad) : + px = 0 + py = 0 + pz = 0 + for nv in range (4) : + vertex = quad.getVertex (nv) + px += vertex.getX() / 4 + py += vertex.getY() / 4 + pz += vertex.getZ() / 4 + return [ px, py, pz ] +# ======================================================= nearest +def nearest (grid, vertex) : + nbre = grid.countVertex() + dmin = 1e+6 + result = None + px = vertex.getX() + py = vertex.getY() + pz = vertex.getZ() + for nro in range (nbre) : + v1 = grid.getVertex (nro) + d2 = carre(px-v1.getX()) + carre(py-v1.getY()) + carre(pz-v1.getZ()) + if (d2 < dmin) : + result = v1 + dmin = d2 + + print vertex.getName () , px, py, pz, " -> ", result.getName() + return result + +# ======================================================= nearest_quad +def nearest_quad (grid, quad) : + dmin = 1e+16 + result = None + [ox, oy, oz] = get_center (quad) + nbre = grid.countQuad () + for nro in range (nbre) : + q1 = grid.getQuad (nro) + if q1 != None : + [px, py, pz] = get_center (q1) + d2 = carre(px-ox) + carre(py-oy) + carre(pz-oz) + if (d2 < dmin) : + result = q1 + dmin = d2 + + print quad.getName () , px, py, pz, " -> ", result.getName() + return result + +# ======================================================= insert_cylinder +def insert_cylinder (plaque, nx, ny) : + + hexa = plaque.getHexaIJK (nx, ny, 0) + xmin = 666 ; ymin = xmin ; zmin = xmin + xmax = -666 ; ymax = xmax ; zmax = xmax + + tabv1 = [] + for nv in range (8) : + node = hexa.getVertex (nv) + xmin = min (xmin, node.getX()) ; xmax = max (xmax, node.getX()) + ymin = min (ymin, node.getY()) ; ymax = max (ymax, node.getY()) + zmin = min (zmin, node.getZ()) ; zmax = max (zmax, node.getZ()) + tabv1.append (node) + + doc.removeHexa (hexa) + save_vtk () + + dx = (xmax - xmin)/2 + dz = (zmax - zmin)/2 + xorig = (xmin + xmax)/2 + yorig = (ymin + ymax)/2 + zorig = (zmin + zmax)/2 - dz + + orig = doc.addVertex (xorig, yorig, zorig) + nr = 1 + na = 4 + nh = 1 + rext = dx + rint = rext/2 + haut = 1 + angle = 360 + pipe = doc.makePipeUni (orig, vxy,vz, rint,rext,angle,haut, nr,na,nh) + + hexablock.what () + + tabquad = [] + tabv0 = [] + for nq in range (4) : + quad = pipe.getQuadJK (1, nq, 0) + tabquad.append (quad) + + print " .. tabquad[0] = ", tabquad[0].getName () + cible = nearest_quad (plaque, tabquad[0]) + tabquad[0]. setColor (5) + cible . setColor (5) + save_vtk () + + va1 = tabquad[0].getVertex (0) + va2 = tabquad[0].getVertex (1) + vb1 = cible.nearestVertex (va1) + vb2 = cible.nearestVertex (va2) + doc.setLevel (1) + doc.joinQuadsUni (tabquad, cible, va1, vb1, va2, vb2, 1) + hexablock.what () + save_vtk () + + return + doc.setLevel (1) + for nv in range (8) : + ier = doc.mergeVertices (tabv0[nv], tabv1[nv]) + print "ier = ", ier + save_vtk () + + +# ======================================================= test_2013 +def test_2013 () : + + orig = doc.addVertex (0,0,0) + + lx = 3 + ly = lx + lz = 1 + nx = 3 + ny = nx + nz = 1 + + plaque = doc.makeCartesianUni (orig, vx,vy,vz, lx, ly, lz, nx,ny,nz) + save_vtk () + + insert_cylinder (plaque, 1, 1) + return doc + +# ================================================================= Begin + +doc = test_2013 () +doc.addLaws (0.1, True) + +mesh_hexas = hexablock.mesh (doc)