STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
SET(${PROJECT_NAME_UC}_MAJOR_VERSION 8)
-SET(${PROJECT_NAME_UC}_MINOR_VERSION 3)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 4)
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})
# Specific to BLSURFPLUGIN:
SET(SALOME_BLSURFPLUGIN_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/blsurfplugin" CACHE PATH
"Install path: SALOME BLSURFPLUGIN specific data")
-SET(SALOME_BLSURFPLUGIN_INSTALL_TESTS ${SALOME_INSTALL_BINS})
+SET(SALOME_BLSURFPLUGIN_INSTALL_TESTS "${SALOME_INSTALL_BINS}/test")
MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.py")
-INSTALL(FILES ${files} DESTINATION ${SALOME_INSTALL_DOC}/examples/BLSURFPLUGIN)
+# FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.py")
+
+INCLUDE(examples.set)
+
+SET(COMPONENT_NAME BLSURFPLUGIN)
+
+SET(TEST_INSTALL_DIRECTORY ${SALOME_BLSURFPLUGIN_INSTALL_TESTS})
+
+# make test
+SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
+
+FOREACH(tfile ${EXAMPLE_NAMES})
+ SET(TEST_NAME ${COMPONENT_NAME}_${tfile})
+ ADD_TEST(NAME ${TEST_NAME}
+ COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_SOURCE_DIR}/doc/salome/examples/testme.py ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py)
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ENVIRONMENT "${tests_env}")
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+ INSTALL(FILES ${tfile}.py DESTINATION ${SALOME_INSTALL_DOC}/examples/BLSURFPLUGIN)
+ENDFOREACH()
+
+# salome test
+FOREACH(tfile ${EXAMPLE_NAMES})
+ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py
+ DESTINATION ${TEST_INSTALL_DIRECTORY})
+ENDFOREACH()
+
+INSTALL(FILES examples.set DESTINATION ${TEST_INSTALL_DIRECTORY})
\ No newline at end of file
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
Multi_Translation_1 = geompy.MakeMultiTranslation2D(Partition_1, OX, 1, 10, OY, 1, 10)
+Multi_Translation_glued = geompy.MakeGlueEdges(Multi_Translation_1, 1e-7)
geompy.addToStudy( Face_3, 'Face_3' )
geompy.addToStudy( Vertex_2, 'Vertex_2' )
geompy.addToStudy( Partition_1, 'Partition_1' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
-geompy.addToStudy( Multi_Translation_1, 'Multi-Translation_1' )
+geompy.addToStudy( Multi_Translation_1, 'Multi_Translation_1' )
+geompy.addToStudy( Multi_Translation_glued, 'Multi_Translation_glued' )
# The mesh on the geometry with internal vertices
-cadsurfMesh_internal = smesh.Mesh(Multi_Translation_1, "cadsurfMesh_internal")
+cadsurfMesh_internal = smesh.Mesh(Multi_Translation_glued, "cadsurfMesh_internal")
algo2d = cadsurfMesh_internal.Triangle(algo=smeshBuilder.MG_CADSurf)
algo2d.SetPhySize( 0.1 )
--- /dev/null
+# Copyright (C) 2016 CEA/DEN, EDF R&D
+#
+# 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
+#
+
+SET(EXAMPLE_NAMES
+ blsurfdemo
+ periodicity_prepro
+)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import salome
+import math
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+simple = False
+
+r = 10
+dist = 10
+
+p1 = geompy.MakeVertex(0., 0., 0.)
+p2 = geompy.MakeVertex(100., 100., 100.)
+box = geompy.MakeBoxTwoPnt(p1, p2)
+geompy.addToStudy(box, "box")
+
+p3 = geompy.MakeVertex(25., 5., 25.)
+sphere1 = geompy.MakeSpherePntR(p3, 15.)
+geompy.addToStudy(sphere1, "sphere1")
+
+sphere1_trans = geompy.MakeTranslation(sphere1, 0, 100, 0)
+geompy.addToStudy(sphere1_trans, "sphere1_trans")
+
+sphere1_trans = geompy.MakeTranslation(sphere1, 0, 100, 0)
+geompy.addToStudy(sphere1_trans, "sphere1_trans")
+
+p4 = geompy.MakeVertex(5, 50, 90)
+sphere2 = geompy.MakeSpherePntR(p4, 20.)
+
+sphere2_trans = geompy.MakeTranslation(sphere2, 100, 0, 0)
+geompy.addToStudy(sphere2_trans, "sphere2_trans")
+
+sphere2_trans2 = geompy.MakeTranslation(sphere2, 0, 0, -100)
+geompy.addToStudy(sphere2_trans2, "sphere2_trans2")
+
+sphere2_trans3 = geompy.MakeTranslation(sphere2, 100, 0, -100)
+geompy.addToStudy(sphere2_trans3, "sphere2_trans3")
+
+if simple:
+ part = box
+else:
+ part = geompy.MakePartition([box], [sphere1, sphere1_trans, sphere2, sphere2_trans, sphere2_trans2, sphere2_trans3])
+geompy.addToStudy(part, "part")
+
+Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+left_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vy, GEOM.ST_ON)
+left = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(left, left_faces)
+geompy.addToStudyInFather(part, left, "left")
+
+right_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vy, p2, GEOM.ST_ON)
+right = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(right, right_faces)
+geompy.addToStudyInFather(part, right, "right")
+
+back_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vx, GEOM.ST_ON)
+back = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(back, back_faces)
+geompy.addToStudyInFather(part, back, "back")
+
+front_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vx, p2, GEOM.ST_ON)
+front = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(front, front_faces)
+geompy.addToStudyInFather(part, front, "front")
+
+bottom_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vz, GEOM.ST_ON)
+bottom = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(bottom, bottom_faces)
+geompy.addToStudyInFather(part, bottom, "bottom")
+
+top_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vz, p2, GEOM.ST_ON)
+top = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(top, top_faces)
+geompy.addToStudyInFather(part, top, "top")
+
+sources = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(sources, left_faces)
+geompy.UnionList(sources, back_faces)
+geompy.UnionList(sources, top_faces)
+geompy.addToStudyInFather(part, sources, "sources")
+
+# Mesh
+# ====
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+Mesh = smesh.Mesh(part, "Mesh")
+
+algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
+algo2d.SetGeometricMesh( 1 )
+algo2d.SetAngleMesh( 4 )
+algo2d.SetPhySize( 8 )
+algo2d.SetVerbosity(1)
+
+# Periodicity
+#algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
+algo2d.AddPreCadFacesPeriodicity(left, right)
+algo2d.AddPreCadFacesPeriodicity(front, back)
+algo2d.AddPreCadFacesPeriodicity(bottom, top)
+
+gr_left = Mesh.Group(left)
+gr_right = Mesh.Group(right)
+gr_front = Mesh.Group(front)
+gr_back = Mesh.Group(back)
+gr_bottom = Mesh.Group(bottom)
+gr_top = Mesh.Group(top)
+
+Mesh.Compute()
+
+left_translated = Mesh.TranslateObjectMakeMesh( gr_left, SMESH.DirStruct( SMESH.PointStruct ( 0, 100, 0 )), 0, 'left_translated' )
+front_translated = Mesh.TranslateObjectMakeMesh( gr_front, SMESH.DirStruct( SMESH.PointStruct ( -100, 0, 0 )), 0, 'front_translated' )
+bottom_translated = Mesh.TranslateObjectMakeMesh( gr_bottom, SMESH.DirStruct( SMESH.PointStruct ( 0, 0, 100 )), 0, 'bottom_translated' )
+
+def checkProjection(gr, mesh_translated, tol=1e-7):
+ name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
+ mesh_source = smesh.CopyMesh(gr, gr.GetName())
+ mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
+ ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
+ coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
+ mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
+ mesh_nodes = mesh_check.GetNodesId()
+ if len(ll_coincident_nodes) != mesh_translated.NbNodes():
+ non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
+ mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
+ raise Exception("Projection failed for %s"%name)
+
+checkProjection(gr_right, left_translated)
+checkProjection(gr_back, front_translated)
+checkProjection(gr_top, bottom_translated)
+
+salome.sg.updateObjBrowser()
+
+++ /dev/null
-# -*- coding: utf-8 -*-
-
-import salome
-import math
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-simple = False
-
-r = 10
-dist = 10
-
-p1 = geompy.MakeVertex(0., 0., 0.)
-p2 = geompy.MakeVertex(100., 100., 100.)
-box = geompy.MakeBoxTwoPnt(p1, p2)
-geompy.addToStudy(box, "box")
-
-p3 = geompy.MakeVertex(25., 5., 25.)
-sphere1 = geompy.MakeSpherePntR(p3, 15.)
-geompy.addToStudy(sphere1, "sphere1")
-
-sphere1_trans = geompy.MakeTranslation(sphere1, 0, 100, 0)
-geompy.addToStudy(sphere1_trans, "sphere1_trans")
-
-sphere1_trans = geompy.MakeTranslation(sphere1, 0, 100, 0)
-geompy.addToStudy(sphere1_trans, "sphere1_trans")
-
-p4 = geompy.MakeVertex(5, 50, 90)
-sphere2 = geompy.MakeSpherePntR(p4, 20.)
-
-sphere2_trans = geompy.MakeTranslation(sphere2, 100, 0, 0)
-geompy.addToStudy(sphere2_trans, "sphere2_trans")
-
-sphere2_trans2 = geompy.MakeTranslation(sphere2, 0, 0, -100)
-geompy.addToStudy(sphere2_trans2, "sphere2_trans2")
-
-sphere2_trans3 = geompy.MakeTranslation(sphere2, 100, 0, -100)
-geompy.addToStudy(sphere2_trans3, "sphere2_trans3")
-
-if simple:
- part = box
-else:
- part = geompy.MakePartition([box], [sphere1, sphere1_trans, sphere2, sphere2_trans, sphere2_trans2, sphere2_trans3])
-geompy.addToStudy(part, "part")
-
-Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
-Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
-Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-left_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vy, GEOM.ST_ON)
-left = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(left, left_faces)
-geompy.addToStudyInFather(part, left, "left")
-
-right_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vy, p2, GEOM.ST_ON)
-right = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(right, right_faces)
-geompy.addToStudyInFather(part, right, "right")
-
-back_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vx, GEOM.ST_ON)
-back = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(back, back_faces)
-geompy.addToStudyInFather(part, back, "back")
-
-front_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vx, p2, GEOM.ST_ON)
-front = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(front, front_faces)
-geompy.addToStudyInFather(part, front, "front")
-
-bottom_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vz, GEOM.ST_ON)
-bottom = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(bottom, bottom_faces)
-geompy.addToStudyInFather(part, bottom, "bottom")
-
-top_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vz, p2, GEOM.ST_ON)
-top = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(top, top_faces)
-geompy.addToStudyInFather(part, top, "top")
-
-sources = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(sources, left_faces)
-geompy.UnionList(sources, back_faces)
-geompy.UnionList(sources, top_faces)
-geompy.addToStudyInFather(part, sources, "sources")
-
-# Mesh
-# ====
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-Mesh = smesh.Mesh(part, "Mesh")
-
-algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
-algo2d.SetGeometricMesh( 1 )
-algo2d.SetAngleMesh( 4 )
-algo2d.SetPhySize( 8 )
-algo2d.SetVerbosity(1)
-
-# Periodicity
-#algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
-algo2d.AddPreCadFacesPeriodicity(left, right)
-algo2d.AddPreCadFacesPeriodicity(front, back)
-algo2d.AddPreCadFacesPeriodicity(bottom, top)
-
-gr_left = Mesh.Group(left)
-gr_right = Mesh.Group(right)
-gr_front = Mesh.Group(front)
-gr_back = Mesh.Group(back)
-gr_bottom = Mesh.Group(bottom)
-gr_top = Mesh.Group(top)
-
-Mesh.Compute()
-
-left_translated = Mesh.TranslateObjectMakeMesh( gr_left, SMESH.DirStruct( SMESH.PointStruct ( 0, 100, 0 )), 0, 'left_translated' )
-front_translated = Mesh.TranslateObjectMakeMesh( gr_front, SMESH.DirStruct( SMESH.PointStruct ( -100, 0, 0 )), 0, 'front_translated' )
-bottom_translated = Mesh.TranslateObjectMakeMesh( gr_bottom, SMESH.DirStruct( SMESH.PointStruct ( 0, 0, 100 )), 0, 'bottom_translated' )
-
-def checkProjection(gr, mesh_translated, tol=1e-7):
- name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
- mesh_source = smesh.CopyMesh(gr, gr.GetName())
- mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
- ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
- coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
- mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
- mesh_nodes = mesh_check.GetNodesId()
- if len(ll_coincident_nodes) != mesh_translated.NbNodes():
- non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
- mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
- raise Exception("Projection failed for %s"%name)
-
-checkProjection(gr_right, left_translated)
-checkProjection(gr_back, front_translated)
-checkProjection(gr_top, bottom_translated)
-
-salome.sg.updateObjBrowser()
-
--- /dev/null
+# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+
+#!/usr/bin/env python
+
+import unittest, sys, os
+
+class SalomeSession(object):
+ def __init__(self, script):
+ import runSalome
+ run_script = "runSalome.py"
+ if sys.platform == 'win32':
+ module_dir = os.getenv("KERNEL_ROOT_DIR")
+ if module_dir: run_script = os.path.join(module_dir, "bin", "salome", run_script)
+ pass
+ sys.argv = [run_script]
+ sys.argv += ["--terminal"]
+ sys.argv += ["--modules=GEOM,MED,SMESH"]
+ sys.argv += ["%s" % script]
+ if sys.platform == 'win32':
+ main_module_path = sys.modules['__main__'].__file__
+ sys.modules['__main__'].__file__ = ''
+ clt, d = runSalome.main()
+ if sys.platform == 'win32':
+ sys.modules['__main__'].__file__ = main_module_path
+ return
+
+ def __del__(self):
+ port = os.getenv('NSPORT')
+ import killSalomeWithPort
+ killSalomeWithPort.killMyPort(port)
+ return
+ pass
+
+class MyTest(unittest.TestCase):
+ def testFunction(self):
+ SalomeSession(sys.argv[1])
+ pass
+
+unittest.main(argv=sys.argv[:1])
- <b>Mesh optimisation</b> - if checked, the mesh will be optimized in order to get better shaped elements.
-- <b>Allow Quadrangles</b> - if checked, allows the creation of quadrilateral elements.
+- <b>Elements type</b> - Type of the elements to generate the mesh with:
+
+ - Triangles: generate a mesh with only triangles.
+
+ - Quadrangle dominant: generate a mesh with a majority of quadrangles and a few triangles.
+
+ - Quadrangles: generate a mesh with only quadrangles.
- <b>Anisotropic</b> - if checked, this parameter defines the maximum anisotropic ratio of the metric governing the anisotropic meshing process.
The default value (0) means that the metric (and thus the generated elements) can be arbitrarily stretched.
\anchor tui_blsurf_periodicity_preCAD
<h2>Example of periodicity definition with preCAD</h2>
-\tui_script{test_periodicity_precad.py}
+\tui_script{periodicity_prepro.py}
*/
* Sets to create quadrilateral elements or not
*/
void SetQuadAllowed(in boolean allowed);
- boolean GetQuadAllowed();
+ void SetElementType(in long elementType);
+ long GetElementType();
/*!
* Sets angular deflection (in degrees) of a mesh face and edge from CAD surface
LIBRARY = "libBLSURFEngine.so"
+# ElementType enum
+Triangles, QuadrangleDominant, Quadrangles = 0, 1, 2
+
# Topology treatment way of MG-CADSurf
FromCAD, PreProcess, PreProcessPlus, PreCAD = 0,1,2,3
self.Parameters().ClearSizeMaps()
pass
- ## Sets QuadAllowed flag.
+ ## Sets QuadAllowed flag (DEPRECATED: use SetElementType)
# @param toAllow "allow quadrangles" flag value
+ # TODO: to remove in Salome 9
def SetQuadAllowed(self, toAllow=True):
self.Parameters().SetQuadAllowed(toAllow)
pass
+ ## Sets elements type
+ # @param theElementType: 0 (Triangles), 1 (QuadrangleDominant), 2 (Quadrangles)
+ def SetElementType(self, theElementType=Triangles):
+ self.Parameters().SetElementType(theElementType)
+ pass
+
## Defines hypothesis having several parameters
# @return hypothesis object
def Parameters(self):
#include <Precision.hxx>
#include <GeomLib_IsPlanarSurface.hxx>
-// kernel includes
-#include <Basics_OCCTVersion.hxx>
-
BLSURFPlugin_Attractor::BLSURFPlugin_Attractor ()
: _face(),
_attractorShape(),
return true;
}
+// check that i and j are inside the bounds of the grid to avoid out of bounds errors
+// in affectation of the grid's vectors
+void BLSURFPlugin_Attractor::avoidOutOfBounds(int& i, int& j){
+ if (i > _gridU)
+ i = _gridU;
+ if (i < 0)
+ i = 0;
+ if (j > _gridV)
+ j = _gridV;
+ if (j < 0)
+ j = 0;
+}
+
void BLSURFPlugin_Attractor::edgeInit(Handle(Geom_Surface) theSurf, const TopoDS_Edge& anEdge){
gp_Pnt2d P2;
double first;
Handle(Geom_Curve) aCurve3d = BRep_Tool::Curve (anEdge, first, last);
ShapeConstruct_ProjectCurveOnSurface curveProjector;
curveProjector.Init(theSurf, Precision::Confusion());
-#if OCC_VERSION_LARGE > 0x07010000
curveProjector.Perform (aCurve3d, first, last, aCurve2d);
-#else
- curveProjector.PerformAdvanced (aCurve3d, first, last, aCurve2d);
-#endif
-
+
int N = 1200;
for (i=0; i<=N; i++){
P2 = aCurve2d->Value(first + i * (last-first) / N);
i0 = floor( (P2.X() - _u1) * _gridU / (_u2 - _u1) + 0.5 );
j0 = floor( (P2.Y() - _v1) * _gridV / (_v2 - _v1) + 0.5 );
+
+ // Avoid out of bounds errors when the ends of the edge are outside the face
+ avoidOutOfBounds(i0, j0);
+
TPnt[0] = 0.;
TPnt[1] = i0;
TPnt[2] = j0;
int i = floor ( (u - _u1) * _gridU / (_u2 - _u1) + 0.5 );
int j = floor ( (v - _v1) * _gridV / (_v2 - _v1) + 0.5 );
+ // Avoid out of bounds errors in _DMap
+ avoidOutOfBounds(i, j);
+
return _DMap[i][j];
}
TTrialSet::iterator min;
TTrialSet::iterator found;
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(_face);
-
+
// While there are points in "Trial" (representing a kind of advancing front), loop on them -----------------------------------------------------------
while (_trial.size() > 0 ) {
min = _trial.begin(); // Get trial point with min distance from start
i0 = (*min)[1];
j0 = (*min)[2];
+ // Avoid out of bounds errors in _known affectations
+ avoidOutOfBounds(i0, j0);
_known[i0][j0] = true; // Move it to "Known"
_trial.erase(min); // Remove it from "Trial"
-
+
// Loop on neighbours of the trial min --------------------------------------------------------------------------------------------------------------
for (i=i0 - 1 ; i <= i0 + 1 ; i++){
if (!aSurf->IsUPeriodic()){ // Periodic conditions in U
}
ip = (i + _gridU + 1) % (_gridU+1); // We get a periodic index :
for (j=j0 - 1 ; j <= j0 + 1 ; j++){ // ip=modulo(i,N+2) so that i=-1->ip=N; i=0 -> ip=0 ; ... ; i=N+1 -> ip=0;
- if (!aSurf->IsVPeriodic()){ // Periodic conditions in V .
+ if (!aSurf->IsVPeriodic()){ // Periodic conditions in V .
if (j > _gridV ){
break; }
else if (j < 0){
bool init(); // Calculates the discrete points correponding to attractor
// and intialises the map of distances
+ void avoidOutOfBounds(int& i, int&j);
void edgeInit(Handle(Geom_Surface) aSurf, const TopoDS_Edge& anEdge);
double GetSize (double u, double v);
#include <Basics_Utils.hxx>
-#include <Basics_OCCTVersion.hxx>
#include <SMDS_EdgePosition.hxx>
#include <SMESHDS_Group.hxx>
double _gradation = BLSURFPlugin_Hypothesis::GetDefaultGradation();
double _use_volume_gradation = BLSURFPlugin_Hypothesis::GetDefaultUseVolumeGradation();
double _volume_gradation = BLSURFPlugin_Hypothesis::GetDefaultVolumeGradation();
- bool _quadAllowed = BLSURFPlugin_Hypothesis::GetDefaultQuadAllowed();
+ BLSURFPlugin_Hypothesis::ElementType _elementType = BLSURFPlugin_Hypothesis::GetDefaultElementType();
double _angleMesh = BLSURFPlugin_Hypothesis::GetDefaultAngleMesh();
double _chordalError = BLSURFPlugin_Hypothesis::GetDefaultChordalError(diagonal);
bool _anisotropic = BLSURFPlugin_Hypothesis::GetDefaultAnisotropic();
_use_volume_gradation = hyp->GetUseVolumeGradation();
if (hyp->GetVolumeGradation() > 0 && _use_volume_gradation )
_volume_gradation = hyp->GetVolumeGradation();
- _quadAllowed = hyp->GetQuadAllowed();
+ _elementType = hyp->GetElementType();
if (hyp->GetAngleMesh() > 0)
_angleMesh = hyp->GetAngleMesh();
if (hyp->GetChordalError() > 0)
for ( opIt = opts.begin(); opIt != opts.end(); ++opIt ){
MESSAGE("OptionValue: " << opIt->first.c_str() << ", value: " << opIt->second.c_str());
if ( !opIt->second.empty() ) {
- // With MeshGems 2.4-5, there are issues with periodicity and multithread
- // => As a temporary workaround, we enforce to use only one thread if periodicity is used.
+ // With MeshGems 2.4-5, there are issues with periodicity and multithread
+ // => As a temporary workaround, we enforce to use only one thread if periodicity is used.
if (opIt->first == "max_number_of_threads" && opIt->second != "1" && ! preCadFacesPeriodicityVector.empty()){
std::cout << "INFO: Disabling multithread to avoid periodicity issues" << std::endl;
set_param(css, opIt->first.c_str(), "1");
for ( opIt = custom_opts.begin(); opIt != custom_opts.end(); ++opIt )
if ( !opIt->second.empty() ) {
set_param(css, opIt->first.c_str(), opIt->second.c_str());
- }
+ }
const BLSURFPlugin_Hypothesis::TOptionValues& preCADopts = hyp->GetPreCADOptionValues();
for ( opIt = preCADopts.begin(); opIt != preCADopts.end(); ++opIt )
set_param(css, "max_size", _maxSizeRel ? val_to_string_rel(_maxSize).c_str() : val_to_string(_maxSize).c_str());
}
// anisotropic and quadrangle mesh requires disabling gradation
- if ( _anisotropic && _quadAllowed )
+ if ( _anisotropic && _elementType != BLSURFPlugin_Hypothesis::Triangles )
useGradation = false; // limitation of V1.3
if ( useGradation && _use_gradation )
set_param(css, "gradation", val_to_string(_gradation).c_str());
if ( useGradation && _use_volume_gradation )
set_param(css, "volume_gradation", val_to_string(_volume_gradation).c_str());
- set_param(css, "element_generation", _quadAllowed ? "quad_dominant" : "triangle");
+
+ // New since MeshGems 2.5: add full_quad
+ const char * element_generation = "";
+ switch ( _elementType )
+ {
+ case BLSURFPlugin_Hypothesis::Triangles:
+ element_generation = "triangle";
+ break;
+ case BLSURFPlugin_Hypothesis::QuadrangleDominant:
+ element_generation = "quad_dominant";
+ break;
+ case BLSURFPlugin_Hypothesis::Quadrangles:
+ element_generation = "full_quad";
+ break;
+ default: ;
+ }
+ set_param(css, "element_generation", element_generation);
set_param(css, "metric", _anisotropic ? "anisotropic" : "isotropic");
* (For this face, it will be called by cadsurf with your_face_object_ptr
* as last parameter.
*/
-#if OCC_VERSION_MAJOR < 7
- cad_face_t *fce = cad_face_new(c, iface, surf_fun, surfaces.back());
-#else
cad_face_t *fce = cad_face_new(c, iface, surf_fun, surfaces.back().get());
-#endif
/* by default a face has no tag (color).
The following call sets it to the same value as the Geom module ID : */
}
/* attach the edge to the current cadsurf face */
-#if OCC_VERSION_MAJOR < 7
- cad_edge_t *edg = cad_edge_new(fce, ic, tmin, tmax, curv_fun, curves.back());
-#else
cad_edge_t *edg = cad_edge_new(fce, ic, tmin, tmax, curv_fun, curves.back().get());
-#endif
/* by default an edge has no tag (color).
The following call sets it to the same value as the edge_id : */
// << "\t uv = ( " << uv[0] << ","<< uv[1] << " ) "
// << "\t u = " << nData.param
// << "\t ID = " << nData.node->GetID() << endl;
- dcad_edge_discretization_set_vertex_coordinates( dedge, iN+1, t, uv, nXYZ._xyz );
+ dcad_edge_discretization_set_vertex_coordinates( dedge, iN+1, t, uv, nXYZ.ChangeData() );
}
dcad_edge_discretization_set_property(dedge, DISTENE_DCAD_PROPERTY_REQUIRED);
}
{
meshDS->compactMesh();
}
- SMESH_TNodeXYZ nXYZ;
+ SMESH_NodeXYZ nXYZ;
nodeIt = meshDS->nodesIterator();
meshgems_integer i;
for ( i = 1; nodeIt->more(); ++i )
{
nXYZ.Set( nodeIt->next() );
- meshgems_mesh_set_vertex_coordinates( msh, i, nXYZ._xyz );
+ meshgems_mesh_set_vertex_coordinates( msh, i, nXYZ.ChangeData() );
}
// set nodes of faces
status_t size_on_surface(integer face_id, real *uv, real *size, void *user_data)
{
TId2ClsAttractorVec::iterator f2attVec;
- if (FaceId2PythonSmp.count(face_id) != 0){
+ if (FaceId2PythonSmp.count(face_id) != 0) {
assert(Py_IsInitialized());
PyGILState_STATE gstate;
gstate = PyGILState_Ensure();
bool _phySizeRel = BLSURFPlugin_Hypothesis::GetDefaultPhySizeRel();
//int _geometricMesh = BLSURFPlugin_Hypothesis::GetDefaultGeometricMesh();
double _angleMesh = BLSURFPlugin_Hypothesis::GetDefaultAngleMesh();
- bool _quadAllowed = BLSURFPlugin_Hypothesis::GetDefaultQuadAllowed();
+ BLSURFPlugin_Hypothesis::ElementType _elementType = BLSURFPlugin_Hypothesis::GetDefaultElementType();
if(_hypothesis) {
_physicalMesh = (int) _hypothesis->GetPhysicalMesh();
_phySizeRel = _hypothesis->IsPhySizeRel();
//_geometricMesh = (int) hyp->GetGeometricMesh();
if (_hypothesis->GetAngleMesh() > 0)
_angleMesh = _hypothesis->GetAngleMesh();
- _quadAllowed = _hypothesis->GetQuadAllowed();
+ _elementType = _hypothesis->GetElementType();
} else {
//0020968: EDF1545 SMESH: Problem in the creation of a mesh group on geometry
// GetDefaultPhySize() sometimes leads to computation failure
int nbQuad = 0;
int nbTria = (int) ( anArea/( ELen*ELen*sqrt(3.) / 4 ) );
int nbNodes = (int) ( ( nbTria*3 - (nb1d-1)*2 ) / 6 + 1 );
- if ( _quadAllowed )
+ if ( _elementType != BLSURFPlugin_Hypothesis::Quadrangles )
{
if ( nb1dVec.size() == 4 ) // quadrangle geom face
{
_gradation(GetDefaultGradation()),
_useVolumeGradation(GetDefaultUseVolumeGradation()),
_volumeGradation(GetDefaultVolumeGradation()),
- _quadAllowed(GetDefaultQuadAllowed()),
+ _elementType(GetDefaultElementType()),
_angleMesh(GetDefaultAngleMesh()),
_chordalError(GetDefaultChordalError()),
_anisotropic(GetDefaultAnisotropic()),
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetQuadAllowed(bool theVal) {
- if (theVal != _quadAllowed) {
- _quadAllowed = theVal;
+void BLSURFPlugin_Hypothesis::SetElementType(ElementType theElementType) {
+ if (theElementType != _elementType) {
+ _elementType = theElementType;
NotifySubMeshesHypothesisModification();
}
}
}
save << " " << (int) _topology << " " << (int) _physicalMesh << " " << (int) _geometricMesh << " " << _phySize << " "
- << _angleMesh << " " << _gradation << " " << (int) _quadAllowed << " " << _decimesh;
+ << _angleMesh << " " << _gradation << " " << (int) _elementType << " " << _decimesh;
save << " " << _minSize << " " << _maxSize << " " << _angleMesh << " " << _minSize << " " << _maxSize << " " << _verb;
save << " " << (int) _preCADMergeEdges << " " << _preCADRemoveNanoEdges << " " << (int) _preCADDiscardInput << " " << _preCADEpsNano ;
save << " " << (int) _enforcedInternalVerticesAllFaces;
isOK = static_cast<bool>(load >> i);
if (isOK)
- _quadAllowed = (bool) i;
+ _elementType = (ElementType) i;
else
load.clear(std::ios::badbit | load.rdstate());
GeometricalLocalSize
};
+ enum ElementType {
+ Triangles,
+ QuadrangleDominant,
+ Quadrangles
+ };
+
static const char* GetHypType(bool hasgeom)
{ return hasgeom ? "MG-CADSurf Parameters" : "MG-CADSurf Parameters_NOGEOM"; }
void SetVolumeGradation(double theGradation);
double GetVolumeGradation() const { return _volumeGradation; }
- void SetQuadAllowed(bool theVal);
- bool GetQuadAllowed() const { return _quadAllowed; }
+ void SetElementType(ElementType theElementType);
+ ElementType GetElementType() const { return _elementType; }
void SetAngleMesh(double theAngle);
double GetAngleMesh() const { return _angleMesh; }
static double GetDefaultGradation() { return 1.3; }
static bool GetDefaultUseVolumeGradation() { return false; }
static double GetDefaultVolumeGradation() { return 2; }
- static bool GetDefaultQuadAllowed() { return false; }
+ static ElementType GetDefaultElementType() { return Triangles; }
static double GetDefaultAngleMesh() { return 8.0; }
static double GetDefaultChordalError(double diagonal);
double _gradation;
bool _useVolumeGradation;
double _volumeGradation;
- bool _quadAllowed;
+ ElementType _elementType;
double _angleMesh;
double _chordalError;
bool _anisotropic;
* BLSURFPlugin_Hypothesis_i::SetQuadAllowed
*
* Set true or false
+ *
+ * DEPRACATED, kept for python script compatibility
+ *
+ * TO be removed in Salome 9
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue)
{
- this->GetImpl()->SetQuadAllowed(theValue);
- std::string theValueStr = theValue ? "True" : "False";
- SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )";
+ ::BLSURFPlugin_Hypothesis::ElementType theElementType = theValue ?
+ ::BLSURFPlugin_Hypothesis::QuadrangleDominant : ::BLSURFPlugin_Hypothesis::Triangles;
+ this->GetImpl()->SetElementType(theElementType);
+ SMESH::TPythonDump() << _this() << ".SetElementType( " << theElementType << " )";
}
//=============================================================================
/*!
- * BLSURFPlugin_Hypothesis_i::GetQuadAllowed
+ * BLSURFPlugin_Hypothesis_i::SetElementType
*
- * Get true or false
+ * Set ElementType
+ */
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetElementType(CORBA::Long theValue)
+{
+ this->GetImpl()->SetElementType((::BLSURFPlugin_Hypothesis::ElementType) theValue);
+ SMESH::TPythonDump() << _this() << ".SetElementType( " << theValue << " )";
+}
+//=============================================================================
+/*!
+ * BLSURFPlugin_Hypothesis_i::GetElementType
+ *
+ * Get ElementType
*/
//=============================================================================
-CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed()
+CORBA::Long BLSURFPlugin_Hypothesis_i::GetElementType()
{
- return this->GetImpl()->GetQuadAllowed();
+ return this->GetImpl()->GetElementType();
}
//=============================================================================
CORBA::Double GetVolumeGradation();
void SetQuadAllowed(CORBA::Boolean theValue);
- CORBA::Boolean GetQuadAllowed();
+
+ void SetElementType(CORBA::Long theValue);
+ CORBA::Long GetElementType();
void SetAngleMesh(CORBA::Double theValue);
CORBA::Double GetAngleMesh();
GeometricalLocalSize
};
+enum ElementType {
+ Triangles,
+ QuadrangleDominant,
+ Quadrangles
+};
+
enum Topology {
FromCAD = 0,
Process,
myTabWidget->setCurrentIndex( STD_TAB );
connect( myAdvWidget->addBtn, SIGNAL( clicked() ), this, SLOT( onAddOption() ) );
- connect( myStdWidget->myAllowQuadrangles, SIGNAL( stateChanged( int ) ), this, SLOT( onStateChange() ));
// Size Maps
connect( addMapButton, SIGNAL( clicked()), this, SLOT( onAddMap() ) );
myStdWidget->myVolumeGradation->setText("");
else
myStdWidget->myVolumeGradation->SetValue( data.myVolumeGradation );
- myStdWidget->myAllowQuadrangles->setChecked( data.myAllowQuadrangles );
+ foreach (QAbstractButton* button, myStdWidget->myButtonGroupElementType->buttons()) {
+ if (myStdWidget->myButtonGroupElementType->id(button) == data.myElementType) {
+ button->setChecked(true);
+ break;
+ }
+ }
+
if (data.myAngleMesh < 0)
myStdWidget->myAngleMesh->setText("");
else
h_data.myGradation = h->GetGradation();
h_data.myUseVolumeGradation = h->GetUseVolumeGradation();
h_data.myVolumeGradation = h->GetVolumeGradation();
- h_data.myAllowQuadrangles = h->GetQuadAllowed();
+ h_data.myElementType = h->GetElementType();
double angle = h->GetAngleMesh();
h_data.myAngleMesh = angle > 0 ? angle : -1.0;
double chordalError = h->GetChordalError();
if ( h->GetVolumeGradation() != h_data.myVolumeGradation )
h->SetVolumeGradation( h_data.myVolumeGradation <= 0 ? -1 : h_data.myVolumeGradation );
- if ( h->GetQuadAllowed() != h_data.myAllowQuadrangles )
- h->SetQuadAllowed( h_data.myAllowQuadrangles );
+ if ( h->GetElementType() != h_data.myElementType )
+ h->SetElementType( h_data.myElementType );
if ( (int) h_data.myGeometricMesh != DefaultGeom ) {
if ( h->GetAngleMesh() != h_data.myAngleMesh )
h_data.myGradation = h_data.myUseGradation ? myStdWidget->myGradation->GetValue() : -1.0;
h_data.myUseVolumeGradation = myStdWidget->myUseVolumeGradation->isChecked() && !myStdWidget->myVolumeGradation->text().isEmpty();
h_data.myVolumeGradation = h_data.myUseVolumeGradation ? myStdWidget->myVolumeGradation->GetValue() : -1. ;
- h_data.myAllowQuadrangles = myStdWidget->myAllowQuadrangles->isChecked();
+ h_data.myElementType = myStdWidget->myButtonGroupElementType->checkedId();
h_data.myAngleMesh = myStdWidget->myAngleMesh->text().isEmpty() ? -1.0 : myStdWidget->myAngleMesh->GetValue();
h_data.myChordalError = myStdWidget->myChordalError->text().isEmpty() ? -1.0 : myStdWidget->myChordalError->GetValue();
h_data.myAnisotropic = myStdWidget->myAnisotropic->isChecked();
guiHyp += tr("BLSURF_MAXSIZE") + " = "+ QString::number( h_data.myMaxSize ) + "; ";
guiHyp += tr("BLSURF_MAXSIZE") + " " + tr("BLSURF_SIZE_REL") + " = " + QString(h_data.myMaxSizeRel ? "yes" : "no") + "; ";
guiHyp += tr("BLSURF_GRADATION") + " = " + QString::number( h_data.myGradation ) + "; ";
- guiHyp += tr("BLSURF_ALLOW_QUADRANGLES") + " = " + QString(h_data.myAllowQuadrangles ? "yes" : "no") + "; ";
+ guiHyp += tr("BLSURF_ELEMENT_TYPE") + " = " + QString::number(h_data.myElementType) + "; ";
guiHyp += tr("BLSURF_ANGLE_MESH") + " = " + QString::number( h_data.myAngleMesh ) + "; ";
guiHyp += tr("BLSURF_CHORDAL_ERROR") + " = " + QString::number( h_data.myChordalError ) + "; ";
guiHyp += tr("BLSURF_ANISOTROPIC") + " = " + QString(h_data.myAnisotropic ? "yes" : "no") + "; ";
bool myAnisotropic, myOptimiseTinyEdges, myRemoveTinyEdges, myForceBadElementRemoval, myCorrectSurfaceIntersection;
double myAnisotropicRatio, myTinyEdgeLength, myTinyEdgeOptimisLength, myBadElementAspectRatio, myCorrectSurfaceIntersectionMaxCost;
bool myOptimizeMesh, myQuadraticMesh;
- bool myAllowQuadrangles, mySmpsurface,mySmpedge,mySmppoint,myEnforcedVertex,myInternalEnforcedVerticesAllFaces;
+ bool mySmpsurface,mySmpedge,mySmppoint,myEnforcedVertex,myInternalEnforcedVerticesAllFaces;
+ long myElementType;
// bool myPreCADMergeEdges, myPreCADProcess3DTopology, myPreCADDiscardInput;
// bool myGMFFileMode;
std::string myGMFFileName, myInternalEnforcedVerticesAllFacesGroup;
myTinyEdgeOptimisLength->setText("");
myCorrectSurfaceIntersectionMaxCost->setText("");
myBadElementAspectRatio->setText("");
+ myButtonGroupElementType->setId(myRadioButtonTriangles, Triangles);
+ myButtonGroupElementType->setId(myRadioButtonQuadrangleDominant, QuadrangleDominant);
+ myButtonGroupElementType->setId(myRadioButtonQuadrangles, Quadrangles);
}
BLSURFPluginGUI_StdWidget::~BLSURFPluginGUI_StdWidget()
<rect>
<x>0</x>
<y>0</y>
- <width>667</width>
- <height>342</height>
+ <width>723</width>
+ <height>399</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_5">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>BLSURF_GEOM_MESH_TOOLTIP</string>
</property>
<property name="currentText">
- <string>GLOBAL_SIZE</string>
+ <string>BLSURF_DEFAULT_USER</string>
</property>
<item>
<property name="text">
<string>BLSURF_MAIN_PARAMETERS</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
- <item row="2" column="0">
- <widget class="QCheckBox" name="myOptimizeMesh">
- <property name="toolTip">
- <string>BLSURF_OPTIMISATION_TOOLTIP</string>
- </property>
- <property name="text">
- <string>BLSURF_OPTIMISATION</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QCheckBox" name="myQuadraticMesh">
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="myUseGradation">
<property name="toolTip">
- <string>BLSURF_ELEMENT_ORDER_TOOLTIP</string>
+ <string>BLSURF_GRADATION_TOOLTIP</string>
</property>
<property name="text">
- <string>BLSURF_ELEMENT_ORDER</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="SMESHGUI_SpinBox" name="myGradation">
- <property name="enabled">
- <bool>false</bool>
+ <string>BLSURF_GRADATION</string>
</property>
</widget>
</item>
- <item row="4" column="0">
+ <item row="3" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</spacer>
</item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="myUseGradation">
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="myQuadraticMesh">
<property name="toolTip">
- <string>BLSURF_GRADATION_TOOLTIP</string>
+ <string>BLSURF_ELEMENT_ORDER_TOOLTIP</string>
</property>
<property name="text">
- <string>BLSURF_GRADATION</string>
+ <string>BLSURF_ELEMENT_ORDER</string>
</property>
</widget>
</item>
- <item row="3" column="0">
- <widget class="QCheckBox" name="myAllowQuadrangles">
+ <item row="1" column="1">
+ <widget class="SMESHGUI_SpinBox" name="myGradation">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="myOptimizeMesh">
<property name="toolTip">
- <string>BLSURF_ALLOW_QUADRANGLES_TOOLTIP</string>
+ <string>BLSURF_OPTIMISATION_TOOLTIP</string>
</property>
<property name="text">
- <string>BLSURF_ALLOW_QUADRANGLES</string>
+ <string>BLSURF_OPTIMISATION</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
- <item row="1" column="1">
+ <item row="1" column="1" rowspan="2">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>BLSURF_OTHER_PARAMETERS</string>
</layout>
</widget>
</item>
+ <item row="2" column="0">
+ <widget class="QGroupBox" name="groupBox_4">
+ <property name="title">
+ <string>BLSURF_ELEMENT_TYPE</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QRadioButton" name="myRadioButtonTriangles">
+ <property name="toolTip">
+ <string>BLSURF_TRIANGLES_TOOLTIP</string>
+ </property>
+ <property name="text">
+ <string>BLSURF_TRIANGLES</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">myButtonGroupElementType</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="myRadioButtonQuadrangleDominant">
+ <property name="toolTip">
+ <string>BLSURF_ALLOW_QUADRANGLES_TOOLTIP</string>
+ </property>
+ <property name="text">
+ <string>BLSURF_QUADRANGLE_DOMINANT</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">myButtonGroupElementType</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="myRadioButtonQuadrangles">
+ <property name="toolTip">
+ <string>BLSURF_QUADRANGLES_TOOLTIP</string>
+ </property>
+ <property name="text">
+ <string>BLSURF_QUADRANGLES</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">myButtonGroupElementType</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_6">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>3</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
</layout>
</widget>
<customwidgets>
<tabstop>myUseGradation</tabstop>
<tabstop>myGradation</tabstop>
<tabstop>myOptimizeMesh</tabstop>
- <tabstop>myAllowQuadrangles</tabstop>
<tabstop>myAnisotropic</tabstop>
<tabstop>myAnisotropicRatio</tabstop>
<tabstop>myOptimiseTinyEdges</tabstop>
<slot>onPhysicalMeshChanged()</slot>
<slot>onEditingFinished()</slot>
</slots>
+ <buttongroups>
+ <buttongroup name="myButtonGroupElementType"/>
+ </buttongroups>
</ui>
<translation>Maximum ratio between the lengths of two adjacent edges in 3D mesh.</translation>
</message>
<message>
- <source>BLSURF_ALLOW_QUADRANGLES</source>
- <translation>Allow Quadrangles</translation>
+ <source>BLSURF_ELEMENT_TYPE</source>
+ <translation>Elements type</translation>
+ </message>
+ <message>
+ <source>BLSURF_TRIANGLES</source>
+ <translation>Triangles</translation>
+ </message>
+ <message>
+ <source>BLSURF_QUADRANGLE_DOMINANT</source>
+ <translation>Quadrangle dominant</translation>
+ </message>
+ <message>
+ <source>BLSURF_QUADRANGLES</source>
+ <translation>Quadrangles</translation>
</message>
<message>
<source>BLSURF_ALLOW_QUADRANGLES_TOOLTIP</source>
<translation>To generate quadrangle dominant mesh</translation>
</message>
+ <message>
+ <source>BLSURF_TRIANGLES_TOOLTIP</source>
+ <translation>To generate triangles-only mesh</translation>
+ </message>
+ <message>
+ <source>BLSURF_QUADRANGLES_TOOLTIP</source>
+ <translation>To generate quadrangles-only mesh</translation>
+ </message>
<message>
<source>BLSURF_GEOMETRICAL_SIZE</source>
<translation>Geometrical size</translation>
<translation>Ratio maximum entre les longueurs de deux segments adjacents.</translation>
</message>
<message>
- <source>BLSURF_ALLOW_QUADRANGLES</source>
- <translation>Autoriser les quadrangles</translation>
+ <source>BLSURF_ELEMENT_TYPE</source>
+ <translation>Type d'éléments</translation>
+ </message>
+ <message>
+ <source>BLSURF_TRIANGLES</source>
+ <translation>Triangles</translation>
+ </message>
+ <message>
+ <source>BLSURF_QUADRANGLE_DOMINANT</source>
+ <translation>Quadrangles en majorité</translation>
+ </message>
+ <message>
+ <source>BLSURF_QUADRANGLES</source>
+ <translation>Quadrangles</translation>
</message>
<message>
<source>BLSURF_ALLOW_QUADRANGLES_TOOLTIP</source>
<translation>Générer un maillage à majorité de quadrangles</translation>
</message>
+ <message>
+ <source>BLSURF_TRIANGLES_TOOLTIP</source>
+ <translation>Générer un maillage en triangles uniquement</translation>
+ </message>
+ <message>
+ <source>BLSURF_QUADRANGLES_TOOLTIP</source>
+ <translation>Générer un maillage en quadrangles uniquement</translation>
+ </message>
<message>
<source>BLSURF_GEOMETRICAL_SIZE</source>
<translation> Taille géométrique </translation>
<name>BLSURFPluginGUI_AdvWidget</name>
<message>
<source>enforce_cad_edge_sizes</source>
- <translation>enforce_cad_edge_sizes</translation>
+ <translation>Force la taille des éléments par la CAO</translation>
</message>
<message>
<source>jacobian_rectification_respect_geometry</source>
- <translation> Priorité de la géométrie sur le Jacobien</translation>
+ <translation>Priorité de la géométrie sur le Jacobien</translation>
</message>
<message>
<source>max_number_of_points_per_patch</source>
</message>
<message>
<source>discard_input_topology</source>
- <translation>discard_input_topology</translation>
+ <translation>Ignorer la topologie</translation>
</message>
<message>
<source>process_3d_topology</source>
<translation>3D要素内の2本の隣接エッジ長間の最大比</translation>
</message>
<message>
- <source>BLSURF_ALLOW_QUADRANGLES</source>
- <translation>四角形を許可</translation>
+ <source>BLSURF_ELEMENT_TYPE</source>
+ <translation>要素タイプ</translation>
+ </message>
+ <message>
+ <source>BLSURF_TRIANGLES</source>
+ <translation>三角形要素</translation>
+ </message>
+ <message>
+ <source>BLSURF_QUADRANGLE_DOMINANT</source>
+ <translation>四辺形優位な</translation>
+ </message>
+ <message>
+ <source>BLSURF_QUADRANGLES</source>
+ <translation>四辺形要素</translation>
</message>
<message>
<source>BLSURF_ALLOW_QUADRANGLES_TOOLTIP</source>
<translation>ドミナント四角形要素の生成</translation>
</message>
+ <message>
+ <source>BLSURF_TRIANGLES_TOOLTIP</source>
+ <translation>三角形要素のみのメッシュ生成</translation>
+ </message>
+ <message>
+ <source>BLSURF_QUADRANGLES_TOOLTIP</source>
+ <translation>四辺形要素のみのメッシュ生成</translation>
+ </message>
<message>
<source>BLSURF_GEOMETRICAL_SIZE</source>
<translation>幾何サイズ</translation>
</message>
<message>
<source>max_number_of_threads</source>
- <translation type="unfinished">Maximal number of threads</translation>
+ <translation>最大スレッド数</translation>
</message>
<message>
<source>rectify_jacobian</source>
<translation>ヤコビアンの修正</translation>
</message>
<message>
- <source>use_deprecated_patch_mesher</source>
- <translation>use deprecated patch mesher</translation>
+ <source>use_deprecated_patch_mesher</source>
+ <translation>非推奨パッチメッシャの使用</translation>
</message>
<message>
<source>respect_geometry</source>
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-SET(BLSURFPLUGIN_TEST_FILES
- test_cadsurf_multithread.py
- test_enforced_internal_vertex.py
- test_enforced_vertex.py
- test_periodicity_2D_precad.py
- test_periodicity_precad.py
- test_periodicity_reflexion_2D_precad.py
- test_periodicity_reflexion_precad.py
- test_periodicity_with_points_2D_precad.py
- test_precad_intersections.py
- test_precad_keep_gaps.py
- test_proximity.py
- test_quadrangles_gradation.py
- test_remove_tiny_edges.py
- test_sphere.py
-)
-
-INSTALL(FILES ${BLSURFPLUGIN_TEST_FILES} DESTINATION ${SALOME_BLSURFPLUGIN_INSTALL_TESTS})
+INCLUDE(tests.set)
+
+SET(COMPONENT_NAME BLSURFPLUGIN)
+
+SET(TEST_INSTALL_DIRECTORY ${SALOME_BLSURFPLUGIN_INSTALL_TESTS})
+
+# make test
+SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
+
+FOREACH(tfile ${TEST_NAMES})
+ SET(TEST_NAME ${COMPONENT_NAME}_${tfile})
+ ADD_TEST(NAME ${TEST_NAME}
+ COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_SOURCE_DIR}/doc/salome/examples/testme.py ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py)
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ENVIRONMENT "${tests_env}")
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+ENDFOREACH()
+
+# salome test
+FOREACH(tfile ${TEST_NAMES})
+ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py
+ DESTINATION ${TEST_INSTALL_DIRECTORY})
+ENDFOREACH()
+
+INSTALL(FILES CTestTestfileInstall.cmake
+ DESTINATION ${TEST_INSTALL_DIRECTORY}
+ RENAME CTestTestfile.cmake)
+
+INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
\ No newline at end of file
--- /dev/null
+# Copyright (C) 2016 CEA/DEN, EDF R&D
+#
+# 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
+#
+
+INCLUDE(tests.set)
+INCLUDE(examples.set)
+
+SET(COMPONENT_NAME BLSURFPLUGIN)
+SET(SALOME_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py")
+SET(TIMEOUT 300)
+
+
+FOREACH(tfile ${TEST_NAMES} ${EXAMPLE_NAMES})
+ SET(TEST_NAME ${COMPONENT_NAME}_${tfile})
+ ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tfile}.py)
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+ENDFOREACH()
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import sys
+import salome
+
+salome.salome_init()
+
+import SMESH, SALOMEDS
+
+## Compute the minimum area of the faces of the mesh
+def getMinArea(mesh):
+ faces = mesh.GetElementsByType(SMESH.FACE)
+ areas = [mesh.GetArea(face) for face in faces]
+ return min(areas)
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+
+geompy = geomBuilder.New()
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Face_1 = geompy.MakeFaceHW(100, 100, 1)
+Circle_1 = geompy.MakeCircle(None, None, 20)
+geompy.addToStudy( O, 'O' )
+geompy.addToStudy( OX, 'OX' )
+geompy.addToStudy( OY, 'OY' )
+geompy.addToStudy( OZ, 'OZ' )
+geompy.addToStudy( Face_1, 'Face_1' )
+geompy.addToStudy( Circle_1, 'Circle_1' )
+
+###
+### SMESH component
+###
+
+from salome.smesh import smeshBuilder
+
+smesh = smeshBuilder.New()
+Mesh_1 = smesh.Mesh(Face_1)
+MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
+MG_CADSurf_Parameters_1.SetPhySize( 14.1421 )
+MG_CADSurf_Parameters_1.SetMinSize( 0.141421 )
+MG_CADSurf_Parameters_1.SetMaxSize( 28.2843 )
+MG_CADSurf_Parameters_1.SetChordalError( 7.07107 )
+#MG_CADSurf_Parameters_1.SetAttractorGeom( Face_1, Circle_1, 1, 14.1421, 5, 5 )
+
+Mesh_1.Compute()
+
+min_area_without_attractor = getMinArea(Mesh_1)
+
+print("min_area_without_attractor: ", min_area_without_attractor)
+
+MG_CADSurf_Parameters_1.SetAttractorGeom( Face_1, Circle_1, 1, 14.1421, 5, 5 )
+
+Mesh_1.Compute()
+
+min_area_with_attractor = getMinArea(Mesh_1)
+
+print("min_area_with_attractor: ", min_area_with_attractor)
+
+assert min_area_with_attractor < min_area_without_attractor
+
+assert min_area_with_attractor < 1
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(True)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import sys
+import salome
+
+salome.salome_init()
+
+import SMESH, SALOMEDS
+
+## Compute the minimum area of the faces of the mesh
+def getMinArea(mesh):
+ faces = mesh.GetElementsByType(SMESH.FACE)
+ areas = [mesh.GetArea(face) for face in faces]
+ return min(areas)
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+
+geompy = geomBuilder.New()
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Face_1 = geompy.MakeFaceHW(100, 100, 1)
+Box_1 = geompy.MakePrismVecH(Face_1, OZ, -100)
+# define the edge slightly longer than the face to test out of bounds case.
+P1 = geompy.MakeVertex(-50.5, 0, 0)
+P2 = geompy.MakeVertex(50.5, 0, 0)
+Edge_1 = geompy.MakeEdge(P1, P2)
+geompy.addToStudy( O, 'O' )
+geompy.addToStudy( OX, 'OX' )
+geompy.addToStudy( OY, 'OY' )
+geompy.addToStudy( OZ, 'OZ' )
+geompy.addToStudy( Face_1, 'Face_1' )
+geompy.addToStudy( Box_1, 'Box_1' )
+geompy.addToStudy( Edge_1, 'Edge_1' )
+
+sub_Face_1 = geompy.GetInPlace(Box_1, Face_1)
+geompy.addToStudyInFather(Box_1, sub_Face_1, "Face_1")
+
+###
+### SMESH component
+###
+
+from salome.smesh import smeshBuilder
+
+smesh = smeshBuilder.New()
+Mesh_1 = smesh.Mesh(Box_1)
+MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
+MG_CADSurf_Parameters_1.SetPhySize( 14.1421 )
+MG_CADSurf_Parameters_1.SetMinSize( 0.141421 )
+MG_CADSurf_Parameters_1.SetMaxSize( 28.2843 )
+MG_CADSurf_Parameters_1.SetChordalError( 7.07107 )
+#MG_CADSurf_Parameters_1.SetAttractorGeom( sub_Face_1, Edge_1, 1, 14.1421, 5, 5 )
+
+Mesh_1.Compute()
+
+min_area_without_attractor = getMinArea(Mesh_1)
+
+print("min_area_without_attractor: ", min_area_without_attractor)
+
+MG_CADSurf_Parameters_1.SetAttractorGeom( sub_Face_1, Edge_1, 1, 14.1421, 5, 5 )
+
+Mesh_1.Compute()
+
+min_area_with_attractor = getMinArea(Mesh_1)
+
+print("min_area_with_attractor: ", min_area_with_attractor)
+
+assert min_area_with_attractor < min_area_without_attractor
+
+assert min_area_with_attractor < 1
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(True)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import sys
+import salome
+
+salome.salome_init()
+
+import SMESH, SALOMEDS
+
+## Compute the minimum area of the faces of the mesh
+def getMinArea(mesh):
+ faces = mesh.GetElementsByType(SMESH.FACE)
+ areas = [mesh.GetArea(face) for face in faces]
+ return min(areas)
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+
+geompy = geomBuilder.New()
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+radius = 10
+height = 100
+Cylinder_1 = geompy.MakeCylinderRH(radius, height)
+
+p_half_height = geompy.MakeVertex(0, 0, height/2.)
+plane_z = geompy.MakePlane(p_half_height, OZ, 2.5*radius)
+
+Part_1 = geompy.MakePartition([Cylinder_1], [plane_z], Limit=geompy.ShapeType["FACE"])
+
+
+geompy.addToStudy( O, 'O' )
+geompy.addToStudy( OX, 'OX' )
+geompy.addToStudy( OY, 'OY' )
+geompy.addToStudy( OZ, 'OZ' )
+geompy.addToStudy( Part_1, 'Part_1' )
+
+
+p_edge_vert_opp_1 = geompy.MakeVertex(-radius, 0, 0)
+geompy.addToStudy( p_edge_vert_opp_1, 'p_edge_vert_opp_1' )
+
+edge_vert_opp_1 = geompy.MakePrismVecH(p_edge_vert_opp_1, OZ, height/2.)
+geompy.addToStudy( edge_vert_opp_1, 'edge_vert_opp_1' )
+
+p_edge_vert_opp_2 = geompy.MakeVertex(-radius, 0, height/4.)
+geompy.addToStudy( p_edge_vert_opp_2, 'p_edge_vert_opp_2' )
+
+p_face_cyl_1 = geompy.MakeVertex(0, radius, height/4.)
+p_face_cyl_2 = geompy.MakeVertex(0, radius, 3*height/4.)
+
+face_1 = geompy.GetFaceNearPoint(Part_1, p_face_cyl_1)
+face_2 = geompy.GetFaceNearPoint(Part_1, p_face_cyl_2)
+
+geompy.addToStudyInFather(Part_1, face_1, "face_1")
+geompy.addToStudyInFather(Part_1, face_2, "face_2")
+
+###
+### SMESH component
+###
+
+from salome.smesh import smeshBuilder
+
+smesh = smeshBuilder.New()
+Mesh_1 = smesh.Mesh(Part_1)
+MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
+MG_CADSurf_Parameters_1.SetPhySize( 14.1421 )
+MG_CADSurf_Parameters_1.SetMinSize( 0.141421 )
+MG_CADSurf_Parameters_1.SetMaxSize( 28.2843 )
+MG_CADSurf_Parameters_1.SetChordalError( 7.07107 )
+#MG_CADSurf_Parameters_1.SetAttractorGeom( sub_Face_1, Edge_1, 1, 14.1421, 5, 5 )
+
+ok = Mesh_1.Compute()
+
+if not ok:
+ raise Exception("Mesh not computed")
+
+min_area_without_attractor = getMinArea(Mesh_1)
+
+print("min_area_without_attractor: ", min_area_without_attractor)
+
+MG_CADSurf_Parameters_1.SetAttractorGeom( face_1, edge_vert_opp_1, 1, 14.1421, 5, 5 )
+# the attractor is not on the face. It is done on purpose to test this out of bounds case.
+MG_CADSurf_Parameters_1.SetAttractorGeom( face_2, p_edge_vert_opp_2, 1, 14.1421, 5, 5 )
+
+ok = Mesh_1.Compute()
+
+if not ok:
+ raise Exception("Mesh with attractors not computed")
+
+min_area_with_attractor = getMinArea(Mesh_1)
+
+print("min_area_with_attractor: ", min_area_with_attractor)
+
+assert min_area_with_attractor < min_area_without_attractor
+
+assert min_area_with_attractor < 1
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(True)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import salome
+import math
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+r = 10
+dist = 10
+dist_coin = 10.1
+
+p1 = geompy.MakeVertex(0., 0., 0.)
+p2 = geompy.MakeVertex(100., 100., 100.)
+box = geompy.MakeBoxTwoPnt(p1, p2)
+geompy.addToStudy(box, "box")
+
+p3 = geompy.MakeVertex(dist_coin, 0, dist_coin)
+geompy.addToStudy(p3, "p3")
+
+part = geompy.MakePartition([box], [p3])
+geompy.addToStudy(part, "part")
+
+left = geompy.GetFaceNearPoint(box, p3)
+geompy.addToStudyInFather(box, left, "left")
+
+
+# Mesh
+# ====
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+Mesh = smesh.Mesh(part, "Mesh")
+
+algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
+algo2d.SetGeometricMesh( 1 )
+algo2d.SetAngleMesh( 4 )
+algo2d.SetPhySize( 8 )
+
+algo2d.SetInternalEnforcedVertexAllFaces(True)
+
+Mesh.Compute()
+
+id_node = Mesh.FindNodeClosestTo(dist_coin, 0, dist_coin)
+
+x, y, z = Mesh.GetNodeXYZ(id_node)
+
+assert("%.2f, %.2f, %.2f"%(x, y, z) == "%.2f, %.2f, %.2f"%(dist_coin, 0, dist_coin))
+
+salome.sg.updateObjBrowser()
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import salome
+import math
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+dist_coin = 10.1
+
+p1 = geompy.MakeVertex(0., 0., 0.)
+p2 = geompy.MakeVertex(100., 100., 100.)
+box = geompy.MakeBoxTwoPnt(p1, p2)
+geompy.addToStudy(box, "box")
+
+p3 = geompy.MakeVertex(dist_coin, 0, dist_coin)
+geompy.addToStudy(p3, "p3")
+
+left = geompy.GetFaceNearPoint(box, p3)
+geompy.addToStudyInFather(box, left, "left")
+
+allEnforcedCoords = []
+allEnforcedCoords.append(( dist_coin, 0, dist_coin ))
+allEnforcedCoords.append(( 20, 0, 15.3 ))
+allEnforcedCoords.append(( 25, 1, 25.3 ))
+allEnforcedCoords.append(( 35, 1, 45.3 ))
+allEnforcedCoords.append(( 35, 1, 55.3 ))
+
+p4 = geompy.MakeVertex( *(allEnforcedCoords[1] ))
+p5 = geompy.MakeVertex( *(allEnforcedCoords[2] ))
+pp = geompy.MakeCompound( [p4,p5], theName="p4,p5" )
+p6 = geompy.MakeVertex( *(allEnforcedCoords[3] ), theName="p6")
+p7 = geompy.MakeVertex( *(allEnforcedCoords[4] ), theName="p7")
+
+xyz7 = allEnforcedCoords[4]
+
+# Mesh
+# ====
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+Mesh = smesh.Mesh(box, "Mesh")
+
+
+algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
+algo2d.SetGeometricMesh( 1 )
+algo2d.SetAngleMesh( 4 )
+algo2d.SetPhySize( 8 )
+
+algo2d.SetEnforcedVertex(left, dist_coin, 0, dist_coin)
+algo2d.AddEnforcedVertexGeom( pp )
+algo2d.AddEnforcedVertexGeom( p6 )
+algo2d.AddEnforcedVertex( *xyz7 )
+
+assert Mesh.Compute()
+assert not Mesh.FindCoincidentNodes( 1e-7 )
+
+for x,y,z in allEnforcedCoords:
+
+ id_node = Mesh.FindNodeClosestTo( x,y,z )
+ xn, yn, zn = Mesh.GetNodeXYZ( id_node )
+
+ # compare X and Z
+ assert "%.2f, %.2f"%(x, z) == "%.2f, %.2f"%( xn, zn ), \
+ "%.2f, %.2f, %.2f != %.2f, %.2f, %.2f"%( xn, yn, zn, x,y,z )
+
+
+salome.sg.updateObjBrowser()
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import os
+import sys
+import salome
+import time
+import multiprocessing
+
+salome.salome_init()
+
+cpu_count = multiprocessing.cpu_count()
+divider = min(4, cpu_count)/2.
+
+print ("Running test on workstation with %d available cores" % cpu_count)
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+
+geompy = geomBuilder.New()
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+flight_solid_brep_1 = geompy.ImportBREP(os.path.join(os.getenv("DATA_DIR"),"Shapes/Brep/flight_solid.brep" ))
+geompy.addToStudy( O, 'O' )
+geompy.addToStudy( OX, 'OX' )
+geompy.addToStudy( OY, 'OY' )
+geompy.addToStudy( OZ, 'OZ' )
+geompy.addToStudy( flight_solid_brep_1, 'flight_solid.brep_1' )
+
+###
+### SMESH component
+###
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+
+smesh = smeshBuilder.New()
+
+Mesh_1 = smesh.Mesh(flight_solid_brep_1)
+MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
+MG_CADSurf_Parameters_1.SetPhySize( 1 )
+MG_CADSurf_Parameters_1.SetMaxSize( 1 )
+MG_CADSurf_Parameters_1.SetGradation( 1.05 )
+MG_CADSurf_Parameters_1.SetAngleMesh( 1 )
+MG_CADSurf_Parameters_1.SetChordalError( 2.40018 )
+# 4 procs are used by default
+# => No need to set an option
+
+time0 = time.time()
+isDone = Mesh_1.Compute()
+time1 = time.time()
+
+time_multithread = time1-time0
+
+print ("Time in multi thread (%d cores): %.3s"%(cpu_count, time_multithread))
+
+Mesh_2 = smesh.Mesh(flight_solid_brep_1)
+MG_CADSurf = Mesh_2.Triangle(algo=smeshBuilder.MG_CADSurf)
+MG_CADSurf_Parameters_2 = MG_CADSurf.Parameters()
+MG_CADSurf_Parameters_2.SetPhySize( 1 )
+MG_CADSurf_Parameters_2.SetMaxSize( 1 )
+MG_CADSurf_Parameters_2.SetGradation( 1.05 )
+MG_CADSurf_Parameters_2.SetAngleMesh( 1 )
+MG_CADSurf_Parameters_2.SetChordalError( 2.40018 )
+# Use only one thread
+MG_CADSurf_Parameters_2.SetMaxNumberOfThreads( 1 )
+
+time2 = time.time()
+isDone = Mesh_2.Compute()
+time3 = time.time()
+
+time_singlethread = time3-time2
+print ("Time in single thread (1 proc): %.3s"%(time_singlethread))
+
+if cpu_count == 1:
+ print ("Warning: cannot validate test - only 1 cpu core is available")
+else:
+ assert time_multithread < time_singlethread/divider
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(True)
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+
+import sys
+import salome
+
+###
+### GEOM component
+###
+
+import math
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Face_1 = geompy.MakeFaceHW(10, 10, 1)
+geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
+Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
+vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
+Curve_1 = geompy.MakeInterpol(vertices, True, True)
+
+part = geompy.MakePartition([Face_1], [Curve_1], Limit=geompy.ShapeType["FACE"])
+geompy.addToStudy(part, "part")
+
+Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+p1 = geompy.MakeVertex(-5, -5, 0)
+p2 = geompy.MakeVertex(5, 5, 0)
+left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
+left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(left, left_edges)
+geompy.addToStudyInFather(part, left, "left")
+
+right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
+right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(right, right_edges)
+geompy.addToStudyInFather(part, right, "right")
+
+bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
+bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(bottom, bottom_edges)
+geompy.addToStudyInFather(part, bottom, "bottom")
+
+top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
+top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(top, top_edges)
+geompy.addToStudyInFather(part, top, "top")
+
+source_face = geompy.GetFaceNearPoint(part, p1)
+geompy.addToStudyInFather(part, source_face, "source_face")
+
+
+# Mesh
+# ====
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+Mesh = smesh.Mesh(part, "Mesh")
+
+algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
+algo2d.SetGeometricMesh( 1 )
+algo2d.SetAngleMesh( 4 )
+algo2d.SetPhySize( 8 )
+#algo2d.SetGradation(1.05)
+
+# Periodicity
+#algo2d.SetVerbosity(10)
+algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
+algo2d.AddPreCadEdgesPeriodicity(left, right)
+algo2d.AddPreCadEdgesPeriodicity(bottom, top)
+
+
+Mesh.Compute()
+
+gr_left = Mesh.Group(left)
+gr_right = Mesh.Group(right)
+gr_bottom = Mesh.Group(bottom)
+gr_top = Mesh.Group(top)
+
+Mesh.Compute()
+
+left_translated = Mesh.TranslateObjectMakeMesh( gr_left, SMESH.DirStruct( SMESH.PointStruct ( 10, 0, 0 )), 0, 'left_translated' )
+bottom_translated = Mesh.TranslateObjectMakeMesh( gr_bottom, SMESH.DirStruct( SMESH.PointStruct ( 0, 10, 0 )), 0, 'bottom_translated' )
+
+def checkProjection(gr, mesh_translated, tol=1e-7):
+ name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
+ mesh_source = smesh.CopyMesh(gr, gr.GetName())
+ mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
+ ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
+ coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
+ mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
+ mesh_nodes = mesh_check.GetNodesId()
+ if len(ll_coincident_nodes) != mesh_translated.NbNodes():
+ non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
+ mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
+ raise Exception("Projection failed for %s"%name)
+
+checkProjection(gr_right, left_translated)
+checkProjection(gr_top, bottom_translated)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+
+import sys
+import salome
+
+###
+### GEOM component
+###
+
+import math
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Face_1 = geompy.MakeFaceHW(10, 10, 1)
+geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
+Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
+vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
+Curve_1 = geompy.MakeInterpol(vertices, True, True)
+
+part = geompy.MakePartition([Face_1], [Curve_1], Limit=geompy.ShapeType["FACE"])
+geompy.addToStudy(part, "part")
+
+Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+p1 = geompy.MakeVertex(-5, -5, 0)
+p2 = geompy.MakeVertex(5, 5, 0)
+left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
+left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(left, left_edges)
+geompy.addToStudyInFather(part, left, "left")
+
+right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
+right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(right, right_edges)
+geompy.addToStudyInFather(part, right, "right")
+
+bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
+bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(bottom, bottom_edges)
+geompy.addToStudyInFather(part, bottom, "bottom")
+
+top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
+top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(top, top_edges)
+geompy.addToStudyInFather(part, top, "top")
+
+source_face = geompy.GetFaceNearPoint(part, p1)
+geompy.addToStudyInFather(part, source_face, "source_face")
+
+# To define a rotation, we have to set at least 3 source vertices not aligned.
+p_bas_gauche = geompy.MakeVertex(-5, -5, 0)
+geompy.addToStudy(p_bas_gauche, "p_bas_gauche")
+p_bas_mil = geompy.MakeVertex(0, -4, 0)
+geompy.addToStudy(p_bas_mil, "p_bas_mil")
+p_bas_droite = geompy.MakeVertex(5, -5, 0)
+geompy.addToStudy(p_bas_droite, "p_bas_droite")
+
+# Target vertices
+p_mil_droite = geompy.MakeVertex(4, 0, 0)
+geompy.addToStudy(p_mil_droite, "p_mil_droite")
+p_haut_droite = geompy.MakeVertex(5, 5, 0)
+geompy.addToStudy(p_haut_droite, "p_haut_droite")
+
+# Mesh
+# ====
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+Mesh = smesh.Mesh(part, "Mesh")
+
+algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
+algo2d.SetGeometricMesh( 1 )
+algo2d.SetAngleMesh( 4 )
+algo2d.SetPhySize( 8 )
+#algo2d.SetGradation(1.05)
+
+#algo2d.SetOptionValue( 'debug', '1' )
+#algo2d.SetPreCADOptionValue( 'debug', '1' )
+
+# Periodicity
+#algo2d.SetVerbosity(10)
+algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
+algo2d.AddPreCadEdgesPeriodicity(bottom, right, [p_bas_droite, p_bas_mil, p_bas_gauche], [p_bas_droite, p_mil_droite, p_haut_droite])
+
+
+Mesh.Compute()
+
+gr_left = Mesh.Group(left)
+gr_right = Mesh.Group(right)
+gr_bottom = Mesh.Group(bottom)
+gr_top = Mesh.Group(top)
+
+axe = geompy.MakePrismVecH(p_bas_droite, Vz, 1)
+bottom_rotated = Mesh.RotateObjectMakeMesh( gr_bottom, axe, -math.pi/2, NewMeshName='bottom_rotated' )
+
+def checkProjection(gr, mesh_translated, tol=1e-7):
+ name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
+ mesh_source = smesh.CopyMesh(gr, gr.GetName())
+ mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
+ ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
+ coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
+ mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
+ mesh_nodes = mesh_check.GetNodesId()
+ if len(ll_coincident_nodes) != mesh_translated.NbNodes():
+ non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
+ mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
+ #raise Exception("Projection failed for %s"%name)
+ print("Projection failed for %s"%name)
+
+checkProjection(gr_right, bottom_rotated)
+
+#salome.myStudy.SaveAs("test.hdf", 0, 0)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser()
+
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import salome
+import math
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+simple = False
+
+r = 10
+dist = 10
+
+p1 = geompy.MakeVertex(0., 0., 0.)
+p2 = geompy.MakeVertex(100., 100., 100.)
+box = geompy.MakeBoxTwoPnt(p1, p2)
+geompy.addToStudy(box, "box")
+
+p3 = geompy.MakeVertex(50., 5., 25.)
+sphere1 = geompy.MakeSpherePntR(p3, 15.)
+geompy.addToStudy(sphere1, "sphere1")
+
+Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+p4 = geompy.MakeVertex(100., 0., 0.)
+axe = geompy.MakePrismVecH(p4, Vz, 1)
+geompy.addToStudy(axe, "axe")
+
+sphere1_rota = geompy.MakeRotation(sphere1, axe, -math.pi/2.)
+geompy.addToStudy(sphere1_rota, "sphere1_rota")
+
+part = geompy.MakePartition([box], [sphere1, sphere1_rota])
+geompy.addToStudy(part, "part")
+
+left_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vy, GEOM.ST_ON)
+left = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(left, left_faces)
+geompy.addToStudyInFather(part, left, "left")
+
+right_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vy, p2, GEOM.ST_ON)
+right = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(right, right_faces)
+geompy.addToStudyInFather(part, right, "right")
+
+back_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vx, GEOM.ST_ON)
+back = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(back, back_faces)
+geompy.addToStudyInFather(part, back, "back")
+
+front_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vx, p2, GEOM.ST_ON)
+front = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(front, front_faces)
+geompy.addToStudyInFather(part, front, "front")
+
+bottom_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vz, GEOM.ST_ON)
+bottom = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(bottom, bottom_faces)
+geompy.addToStudyInFather(part, bottom, "bottom")
+
+top_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vz, p2, GEOM.ST_ON)
+top = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(top, top_faces)
+geompy.addToStudyInFather(part, top, "top")
+
+p1_rota = geompy.MakeRotation(p1, axe, -math.pi/2.)
+geompy.addToStudy(sphere1_rota, "sphere1_rota")
+
+p5 = geompy.MakeVertex(100, 0, 100)
+geompy.addToStudy(p5, "p5")
+
+# Mesh
+# ====
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+Mesh = smesh.Mesh(part, "Mesh")
+
+algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
+algo2d.SetGeometricMesh( 1 )
+algo2d.SetAngleMesh( 4 )
+algo2d.SetPhySize( 8 )
+
+# Periodicity
+#algo2d.SetVerbosity(10)
+#algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
+algo2d.AddPreCadFacesPeriodicity(left, front, [p1, p4, p5], [p1_rota, p4, p5])
+
+
+gr_left = Mesh.Group(left)
+gr_right = Mesh.Group(right)
+gr_front = Mesh.Group(front)
+gr_back = Mesh.Group(back)
+gr_bottom = Mesh.Group(bottom)
+gr_top = Mesh.Group(top)
+
+Mesh.Compute()
+
+left_rotated = Mesh.RotateObjectMakeMesh( gr_left, axe, -math.pi/2, NewMeshName='left_rotated' )
+
+def checkProjection(gr, mesh_translated, tol=1e-7):
+ name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
+ mesh_source = smesh.CopyMesh(gr, gr.GetName())
+ mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
+ ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
+ coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
+ mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
+ mesh_nodes = mesh_check.GetNodesId()
+ if len(ll_coincident_nodes) != mesh_translated.NbNodes():
+ non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
+ mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
+ raise Exception("Projection failed for %s"%name)
+
+checkProjection(gr_front, left_rotated)
+
+salome.sg.updateObjBrowser()
+
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+
+import sys
+import salome
+
+###
+### GEOM component
+###
+
+import math
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Face_1 = geompy.MakeFaceHW(10, 10, 1)
+geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
+Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
+vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
+Curve_1 = geompy.MakeInterpol(vertices, True, True)
+
+part = geompy.MakePartition([Face_1], [Curve_1], Limit=geompy.ShapeType["FACE"])
+geompy.addToStudy(part, "part")
+
+Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+p1 = geompy.MakeVertex(-5, -5, 0)
+p2 = geompy.MakeVertex(5, 5, 0)
+left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
+left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(left, left_edges)
+geompy.addToStudyInFather(part, left, "left")
+
+right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
+right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(right, right_edges)
+geompy.addToStudyInFather(part, right, "right")
+
+bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
+bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(bottom, bottom_edges)
+geompy.addToStudyInFather(part, bottom, "bottom")
+
+top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
+top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(top, top_edges)
+geompy.addToStudyInFather(part, top, "top")
+
+source_face = geompy.GetFaceNearPoint(part, p1)
+geompy.addToStudyInFather(part, source_face, "source_face")
+
+p_bas_gauche = geompy.MakeVertex(-5, -5, 0)
+geompy.addToStudy(p_bas_gauche, "p_bas_gauche")
+p_bas_mil = geompy.MakeVertex(0, -4, 0)
+geompy.addToStudy(p_bas_mil, "p_bas_mil")
+p_bas_droite = geompy.MakeVertex(5, -5, 0)
+geompy.addToStudy(p_bas_droite, "p_bas_droite")
+p_haut_gauche = geompy.MakeVertex(-5, 5, 0)
+geompy.addToStudy(p_haut_gauche, "p_haut_gauche")
+p_haut_mil = geompy.MakeVertex(0, 6, 0)
+geompy.addToStudy(p_haut_mil, "p_haut_mil")
+p_haut_droite = geompy.MakeVertex(5, 5, 0)
+geompy.addToStudy(p_haut_droite, "p_haut_droite")
+
+# Mesh
+# ====
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+Mesh = smesh.Mesh(part, "Mesh")
+
+algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
+algo2d.SetGeometricMesh( 1 )
+algo2d.SetAngleMesh( 4 )
+algo2d.SetPhySize( 8 )
+#algo2d.SetGradation(1.05)
+
+# Periodicity
+#algo2d.SetVerbosity(10)
+algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
+algo2d.AddPreCadEdgesPeriodicity(bottom, top, [p_bas_gauche, p_bas_mil, p_bas_droite], [p_haut_gauche, p_haut_mil, p_haut_droite])
+
+# debug
+#algo2d.SetOptionValue( 'debug', '1' )
+#algo2d.SetPreCADOptionValue( 'debug', '1' )
+
+Mesh.Compute()
+
+gr_left = Mesh.Group(left)
+gr_right = Mesh.Group(right)
+gr_bottom = Mesh.Group(bottom)
+gr_top = Mesh.Group(top)
+
+Mesh.Compute()
+
+left_translated = Mesh.TranslateObjectMakeMesh( gr_left, SMESH.DirStruct( SMESH.PointStruct ( 10, 0, 0 )), 0, 'left_translated' )
+bottom_translated = Mesh.TranslateObjectMakeMesh( gr_bottom, SMESH.DirStruct( SMESH.PointStruct ( 0, 10, 0 )), 0, 'bottom_translated' )
+
+def checkProjection(gr, mesh_translated, tol=1e-7):
+ name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
+ mesh_source = smesh.CopyMesh(gr, gr.GetName())
+ mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
+ ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
+ coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
+ mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
+ mesh_nodes = mesh_check.GetNodesId()
+ if len(ll_coincident_nodes) != mesh_translated.NbNodes():
+ non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
+ mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
+ raise Exception("Projection failed for %s"%name)
+
+checkProjection(gr_top, bottom_translated)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser()
+
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import sys
+import salome
+
+salome.salome_init()
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+
+geompy.init_geom()
+
+Face_1 = geompy.MakeFaceHW(10, 10, 1)
+Translation_1 = geompy.MakeTranslation(Face_1, 10.0001, 0.0001, 0)
+Translation_2 = geompy.MakeTranslation(Face_1, 5, -9.99995, 0)
+Partition_1 = geompy.MakePartition([Face_1, Translation_1, Translation_2], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+geompy.addToStudy( Face_1, 'Face_1' )
+geompy.addToStudy( Translation_1, 'Translation_1' )
+geompy.addToStudy( Translation_2, 'Translation_2' )
+geompy.addToStudy( Partition_1, 'Partition_1' )
+
+p_axe = geompy.MakeVertex(5, -5, 0)
+axe = geompy.MakePrismDXDYDZ(p_axe, 0, 0, 1)
+vertices = geompy.GetShapesOnCylinder(Partition_1, geompy.ShapeType["VERTEX"], axe, 1e-3, GEOM.ST_IN)
+gr_vertices = geompy.CreateGroup(Partition_1, geompy.ShapeType["VERTEX"])
+geompy.UnionList(gr_vertices, vertices)
+geompy.addToStudyInFather(Partition_1, gr_vertices, "vertices")
+
+###
+### SMESH component
+###
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+
+Mesh_1 = smesh.Mesh(Partition_1)
+
+BLSURF_1 = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+BLSURF_Parameters = BLSURF_1.Parameters()
+BLSURF_Parameters.SetPhySize( 5 )
+BLSURF_Parameters.SetPreCADMergeEdges( True )
+BLSURF_Parameters.SetPreCADProcess3DTopology( True )
+BLSURF_Parameters.SetPreCADOptionValue( 'remove_tiny_uv_edges', 'yes' )
+
+Mesh_1.Compute()
+
+# Check that vertices are merged by preCAD preprocessing
+nodes = []
+for p in vertices:
+ x, y, z = geompy.PointCoordinates(p)
+ id_node = Mesh_1.FindNodeClosestTo(x, y, z)
+ nodes.append(id_node)
+
+nodes = list(set(nodes))
+
+nodesGroup = Mesh_1.MakeGroupByIds("nodes", SMESH.NODE, nodes)
+
+assert nodesGroup.Size() == 1, nodesGroup.GetIDs()
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import sys
+import salome
+
+salome.salome_init()
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+
+geompy.init_geom()
+
+Face_1 = geompy.MakeFaceHW(10, 10, 1)
+Translation_1 = geompy.MakeTranslation(Face_1, 10.0001, 0.0001, 0)
+Translation_2 = geompy.MakeTranslation(Face_1, 5, -9.99995, 0)
+Partition_1 = geompy.MakePartition([Face_1, Translation_1, Translation_2], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+geompy.addToStudy( Face_1, 'Face_1' )
+geompy.addToStudy( Translation_1, 'Translation_1' )
+geompy.addToStudy( Translation_2, 'Translation_2' )
+geompy.addToStudy( Partition_1, 'Partition_1' )
+
+p_axe = geompy.MakeVertex(5, -5, 0)
+axe = geompy.MakePrismDXDYDZ(p_axe, 0, 0, 1)
+vertices = geompy.GetShapesOnCylinder(Partition_1, geompy.ShapeType["VERTEX"], axe, 1e-3, GEOM.ST_IN)
+gr_vertices = geompy.CreateGroup(Partition_1, geompy.ShapeType["VERTEX"])
+geompy.UnionList(gr_vertices, vertices)
+geompy.addToStudyInFather(Partition_1, gr_vertices, "vertices")
+
+###
+### SMESH component
+###
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+
+Mesh_1 = smesh.Mesh(Partition_1)
+
+BLSURF_1 = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+BLSURF_Parameters = BLSURF_1.Parameters()
+BLSURF_Parameters.SetPhySize( 5 )
+
+Mesh_1.Compute()
+
+# Check that vertices are not merged by preCAD preprocessing
+# when no preprocessing option has been explicitely called
+nodes = []
+for p in vertices:
+ x, y, z = geompy.PointCoordinates(p)
+ id_node = Mesh_1.FindNodeClosestTo(x, y, z)
+ nodes.append(id_node)
+
+nodes = list(set(nodes))
+
+Mesh_1.MakeGroupByIds("nodes", SMESH.NODE, nodes)
+
+assert len(nodes) == 3, "We should have 3 nodes. We got %i. => The preprocessing has done something, but we did not ask him to."%len(nodes)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import sys
+import salome
+
+salome.salome_init()
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+
+geompy = geomBuilder.New()
+
+# Create a box
+box = geompy.MakeBoxDXDYDZ(100, 100, 100)
+
+# Create a sphere near the sides of the box
+sphere_tmp = geompy.MakeSphereR(5)
+sphere = geompy.MakeTranslation(sphere_tmp, 6, 6, 50)
+
+part = geompy.MakePartition([box, sphere])
+geompy.addToStudy( box, 'box' )
+geompy.addToStudy( sphere, 'sphere' )
+geompy.addToStudy( part, 'part' )
+
+# Create the groups of faces
+box_faces = geompy.GetShapesOnBox(box, part, geompy.ShapeType["FACE"], GEOM.ST_ON)
+gr_box_faces = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(gr_box_faces, box_faces)
+geompy.addToStudyInFather(part, gr_box_faces, "box_faces")
+
+all_faces = geompy.SubShapeAll(part, geompy.ShapeType["FACE"])
+gr_all_faces = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(gr_all_faces, all_faces)
+
+gr_spheres_faces = geompy.CutGroups(gr_all_faces, gr_box_faces)
+geompy.addToStudyInFather(part, gr_spheres_faces, "spheres_faces")
+
+###
+### SMESH component
+###
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+
+smesh = smeshBuilder.New()
+Mesh_1 = smesh.Mesh(part, "Mesh_part")
+BLSURF = Mesh_1.Triangle(algo=smeshBuilder.BLSURF)
+BLSURF_Parameters_1 = BLSURF.Parameters()
+BLSURF_Parameters_1.SetGradation( 1.2 )
+BLSURF_Parameters_1.SetGeometricMesh( 1 )
+BLSURF_Parameters_1.SetPhySize( 20 )
+#BLSURF_Parameters_1.SetMinSize( 0.1 )
+BLSURF_Parameters_1.SetMaxSize( 20 )
+BLSURF_Parameters_1.SetAngleMesh( 8 )
+
+# Old way to set proximity (Mesh Gems 1.1)
+#BLSURF_Parameters_1.SetOptionValue( 'proximity', '1' )
+#BLSURF_Parameters_1.SetOptionValue( 'prox_ratio', '1.2' )
+#BLSURF_Parameters_1.SetOptionValue( 'prox_nb_layer', '3' )
+
+# New way to set proximity (Mesh Gems >= 1.3)
+BLSURF_Parameters_1.SetOptionValue( "volume_gradation", "1.2" )
+
+isDone = Mesh_1.Compute()
+if not isDone:
+ raise Exception("Compute mesh ended in error")
+
+# Create the groups on the mesh
+gr_mesh_box = Mesh_1.Group(gr_box_faces)
+gr_mesh_spheres = Mesh_1.Group(gr_spheres_faces)
+
+# Check the minimal area of the box faces to check the proximity
+min_area, max_area = Mesh_1.GetMinMax(SMESH.FT_Area, gr_mesh_box)
+
+print("min_area: ", min_area)
+
+if min_area > 1.5:
+ raise Exception("Wrong minimal area on box. Proximity has not worked.")
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import sys
+import salome
+
+salome.salome_init()
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+
+geompy = geomBuilder.New()
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Face_1 = geompy.MakeFaceHW(100, 100, 1)
+Disk_1 = geompy.MakeDiskR(20, 1)
+Partition_1 = geompy.MakePartition([Face_1, Disk_1], Limit=geompy.ShapeType["FACE"])
+geompy.addToStudy( O, 'O' )
+geompy.addToStudy( OX, 'OX' )
+geompy.addToStudy( OY, 'OY' )
+geompy.addToStudy( OZ, 'OZ' )
+geompy.addToStudy( Face_1, 'Face_1' )
+geompy.addToStudy( Disk_1, 'Disk_1' )
+geompy.addToStudy( Partition_1, 'Partition_1' )
+
+###
+### SMESH component
+###
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+
+from salome.BLSURFPlugin import BLSURFPluginBuilder
+
+smesh = smeshBuilder.New()
+Mesh_1 = smesh.Mesh(Partition_1)
+MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
+MG_CADSurf_Parameters_1.SetPhySize( 10 )
+MG_CADSurf_Parameters_1.SetMaxSize( 10 )
+MG_CADSurf_Parameters_1.SetChordalError( -1 )
+
+
+# Test quadrangle dominant
+MG_CADSurf_Parameters_1.SetElementType( BLSURFPluginBuilder.QuadrangleDominant )
+isDone = Mesh_1.Compute()
+
+assert Mesh_1.NbQuadrangles() > 0
+assert Mesh_1.NbTriangles() > 0
+assert Mesh_1.NbQuadrangles() > Mesh_1.NbTriangles()
+
+
+# Test quadrangles only
+MG_CADSurf_Parameters_1.SetElementType( BLSURFPluginBuilder.Quadrangles )
+isDone = Mesh_1.Compute()
+
+assert Mesh_1.NbQuadrangles() > 0
+assert Mesh_1.NbTriangles() == 0
+
+
+# Test triangles only
+MG_CADSurf_Parameters_1.SetElementType( BLSURFPluginBuilder.Triangles )
+isDone = Mesh_1.Compute()
+
+assert Mesh_1.NbQuadrangles() == 0
+assert Mesh_1.NbTriangles() > 0
+
+# Test quadrangle dominant compatibility (to be deprecated in Salome 9)
+MG_CADSurf_Parameters_1.SetQuadAllowed( True )
+isDone = Mesh_1.Compute()
+
+assert Mesh_1.NbQuadrangles() > 0
+assert Mesh_1.NbTriangles() > 0
+assert Mesh_1.NbQuadrangles() > Mesh_1.NbTriangles()
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(True)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import salome
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import math
+
+area_tolerance = 0.1
+nb_faces_tolerance = 20
+
+## Return the min and max areas of a mesh
+def getMinMaxArea(mesh):
+ mini, maxi = mesh.GetMinMax(SMESH.FT_Area)
+ return mini, maxi
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+Face_1 = geompy.MakeFaceHW(10, 10, 1)
+geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
+Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
+vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
+Curve_1 = geompy.MakeInterpol(vertices, True, True)
+
+p_small = geompy.MakeVertexOnCurve(Curve_1, 0.001)
+geompy.addToStudy(p_small, "p_small")
+
+p_small2 = geompy.MakeVertexOnCurve(Curve_1, 0.5)
+geompy.addToStudy(p_small2, "p_small2")
+
+p_small3 = geompy.MakeVertexOnCurve(Curve_1, 0.501)
+geompy.addToStudy(p_small3, "p_small3")
+
+part = geompy.MakePartition([Face_1], [Curve_1, p_small, p_small2, p_small3], Limit=geompy.ShapeType["FACE"])
+geompy.addToStudy(part, "part")
+
+Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+p1 = geompy.MakeVertex(-5, -5, 0)
+p2 = geompy.MakeVertex(5, 5, 0)
+left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
+left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(left, left_edges)
+geompy.addToStudyInFather(part, left, "left")
+
+right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
+right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(right, right_edges)
+geompy.addToStudyInFather(part, right, "right")
+
+bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
+bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(bottom, bottom_edges)
+geompy.addToStudyInFather(part, bottom, "bottom")
+
+top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
+top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(top, top_edges)
+geompy.addToStudyInFather(part, top, "top")
+
+faces = geompy.SubShapeAll(part, geompy.ShapeType["FACE"])
+sub_shapes = []
+for i, face in enumerate(faces):
+ geompy.addToStudyInFather(part, face, "face_%i"%(i+1))
+ sub_shapes.append(face)
+
+# Mesh
+# ====
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Test gradation with quadrangles
+Mesh_1 = smesh.Mesh(part, "Mesh")
+
+algo2d = Mesh_1.Triangle(algo=smeshBuilder.BLSURF)
+params = algo2d.Parameters()
+params.SetGeometricMesh( 1 )
+params.SetAngleMesh( 4 )
+params.SetPhySize( 8 )
+algo2d.SetGradation(1.05)
+params.SetElementType( True )
+
+ok = Mesh_1.Compute()
+
+if not ok:
+ raise Exception("Error when computing Mesh_1")
+
+# Check the areas of Mesh_1
+mini_1, maxi_1 = getMinMaxArea(Mesh_1)
+mini_1_ref = 0.00197
+maxi_1_ref = 0.530
+
+if abs(mini_1-mini_1_ref) > area_tolerance:
+ raise Exception("Min area of Mesh_1 incorrect")
+
+if maxi_1 > maxi_1_ref:
+ raise Exception("Max area of Mesh_1 incorrect")
+
+# Check the number of faces of Mesh_1
+nb_faces_1 = Mesh_1.NbFaces()
+nb_faces_1_ref = 1208
+
+if nb_faces_1 < nb_faces_1_ref:
+ raise Exception("Number of faces of Mesh_1 incorrect")
+
+
+# Test no gradation with quadrangles and anisotropy
+# RQ: this kind of mesh is not suitable for simulation
+# but gives a coarse mesh like a stl geometry
+Mesh_2 = smesh.Mesh(part, "Mesh")
+
+algo2d = Mesh_2.Triangle(algo=smeshBuilder.BLSURF)
+params = algo2d.Parameters()
+params.SetGeometricMesh( 1 )
+params.SetAngleMesh( 4 )
+params.SetPhySize( 8 )
+algo2d.SetGradation(1.05)
+params.SetElementType( 1 )
+params.SetAnisotropic(True)
+
+ok = Mesh_2.Compute()
+
+if not ok:
+ raise Exception("Error when computing Mesh_2")
+
+# Check the areas of Mesh_2
+mini_2, maxi_2 = getMinMaxArea(Mesh_2)
+mini_2_ref = 0.000408
+maxi_2_ref = 10.1982
+
+if abs(mini_2-mini_2_ref) > area_tolerance:
+ raise Exception("Min area of Mesh_2 incorrect")
+
+if abs(maxi_2-maxi_2_ref) > area_tolerance:
+ raise Exception("Max area of Mesh_2 incorrect")
+
+# Check the number of faces of Mesh_2
+nb_faces_2 = Mesh_2.NbFaces()
+nb_faces_2_ref = 121
+if abs(nb_faces_2-nb_faces_2_ref) > nb_faces_tolerance:
+ raise Exception("Number of faces of Mesh_2 incorrect")
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser()
+
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import salome
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import math
+
+tiny_edge_length = 0.1
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+Face_1 = geompy.MakeFaceHW(10, 10, 1)
+geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
+Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
+vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
+Curve_1 = geompy.MakeInterpol(vertices, True, True)
+
+p_small = geompy.MakeVertexOnCurve(Curve_1, 0.001)
+geompy.addToStudy(p_small, "p_small")
+
+part = geompy.MakePartition([Face_1], [Curve_1, p_small], Limit=geompy.ShapeType["FACE"])
+geompy.addToStudy(part, "part")
+
+Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+p1 = geompy.MakeVertex(-5, -5, 0)
+p2 = geompy.MakeVertex(5, 5, 0)
+left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
+left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(left, left_edges)
+geompy.addToStudyInFather(part, left, "left")
+
+right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
+right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(right, right_edges)
+geompy.addToStudyInFather(part, right, "right")
+
+bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
+bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(bottom, bottom_edges)
+geompy.addToStudyInFather(part, bottom, "bottom")
+
+top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
+top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+geompy.UnionList(top, top_edges)
+geompy.addToStudyInFather(part, top, "top")
+
+faces = geompy.SubShapeAll(part, geompy.ShapeType["FACE"])
+sub_shapes = []
+for i, face in enumerate(faces):
+ geompy.addToStudyInFather(part, face, "face_%i"%(i+1))
+ sub_shapes.append(face)
+
+# Mesh
+# ====
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+Mesh = smesh.Mesh(part, "Mesh")
+
+algo2d = Mesh.Triangle(algo=smeshBuilder.BLSURF)
+params = algo2d.Parameters()
+params.SetVerbosity(1)
+#algo2d.SetTopology(smesh.PreCAD)
+params.SetGeometricMesh( 1 )
+params.SetAngleMesh( 4 )
+params.SetPhySize( 8 )
+#algo2d.SetGradation(1.05)
+params.SetQuadraticMesh( True )
+params.SetRemoveTinyEdges( True )
+params.SetTinyEdgeLength( tiny_edge_length )
+#params.SetOptionValue( 'rectify_jacobian', '0' )
+
+Mesh.Compute()
+
+for sub_shape in sub_shapes:
+ Mesh.Group(sub_shape)
+
+x0, y0, z0 = geompy.PointCoordinates(p_small)
+node = Mesh.FindNodeClosestTo(x0, y0, z0)
+
+elems = Mesh.GetNodeInverseElements(node)
+
+edges_length = []
+for elem in elems:
+ if Mesh.GetElementType(elem, True) == SMESH.EDGE:
+ edge_length = Mesh.GetLength(elem)
+ edges_length.append(edge_length)
+
+min_length = min(edges_length)
+x1, y1, z1 = Mesh.GetNodeXYZ(node)
+
+print(min_length)
+
+if min_length<tiny_edge_length:
+ raise Exception("Small edge has not been removed")
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import sys
+import salome
+
+salome.salome_init()
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+
+geompy.init_geom()
+
+sphere = geompy.MakeSphereR(10)
+geompy.addToStudy( sphere, 'sphere' )
+
+###
+### SMESH component
+###
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+
+Mesh_1 = smesh.Mesh(sphere)
+
+BLSURF_1 = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+BLSURF_Parameters = BLSURF_1.Parameters()
+BLSURF_Parameters.SetPhySize( 5 )
+BLSURF_Parameters.SetGeometricMesh( 1 )
+BLSURF_Parameters.SetAngleMesh( 8 )
+
+ok = Mesh_1.Compute()
+
+if not ok:
+ raise Exception("Error when computing surface mesh")
+
+try:
+ Mesh_1.Tetrahedron(algo=smeshBuilder.MG_Tetra)
+
+ ok = Mesh_1.Compute()
+
+ if not ok:
+ raise Exception("Error when computing volume mesh")
+except AttributeError:
+ print("Warning: Cannot build volume mesh: MG-Tetra plugin seems to be unavailable")
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: utf-8 -*-
-
-import os
-import sys
-import salome
-import time
-
-salome.salome_init()
-theStudy = salome.myStudy
-
-###
-### GEOM component
-###
-
-import GEOM
-from salome.geom import geomBuilder
-import math
-import SALOMEDS
-
-
-geompy = geomBuilder.New(theStudy)
-
-O = geompy.MakeVertex(0, 0, 0)
-OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
-OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
-OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
-flight_solid_brep_1 = geompy.ImportBREP(os.path.join(os.getenv("DATA_DIR"),"Shapes/Brep/flight_solid.brep" ))
-geompy.addToStudy( O, 'O' )
-geompy.addToStudy( OX, 'OX' )
-geompy.addToStudy( OY, 'OY' )
-geompy.addToStudy( OZ, 'OZ' )
-geompy.addToStudy( flight_solid_brep_1, 'flight_solid.brep_1' )
-
-###
-### SMESH component
-###
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-
-smesh = smeshBuilder.New(theStudy)
-
-Mesh_1 = smesh.Mesh(flight_solid_brep_1)
-MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
-MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
-MG_CADSurf_Parameters_1.SetPhySize( 1 )
-MG_CADSurf_Parameters_1.SetMaxSize( 1 )
-MG_CADSurf_Parameters_1.SetGradation( 1.05 )
-MG_CADSurf_Parameters_1.SetAngleMesh( 1 )
-MG_CADSurf_Parameters_1.SetChordalError( 2.40018 )
-# 4 procs are used by default
-# => No need to set an option
-
-time0 = time.time()
-isDone = Mesh_1.Compute()
-time1 = time.time()
-
-time_multithread = time1-time0
-
-print("Time in 4 proc: %.3s"%(time_multithread))
-
-Mesh_2 = smesh.Mesh(flight_solid_brep_1)
-MG_CADSurf = Mesh_2.Triangle(algo=smeshBuilder.MG_CADSurf)
-MG_CADSurf_Parameters_2 = MG_CADSurf.Parameters()
-MG_CADSurf_Parameters_2.SetPhySize( 1 )
-MG_CADSurf_Parameters_2.SetMaxSize( 1 )
-MG_CADSurf_Parameters_2.SetGradation( 1.05 )
-MG_CADSurf_Parameters_2.SetAngleMesh( 1 )
-MG_CADSurf_Parameters_2.SetChordalError( 2.40018 )
-# Use only one thread
-MG_CADSurf_Parameters_2.SetMaxNumberOfThreads( 1 )
-
-time2 = time.time()
-isDone = Mesh_2.Compute()
-time3 = time.time()
-
-time_singlethread = time3-time2
-print("Time in 1 proc: %.3s"%(time_singlethread))
-
-assert time_multithread < time_singlethread/2.
-
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+++ /dev/null
-# -*- coding: utf-8 -*-
-
-import salome
-import math
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-r = 10
-dist = 10
-dist_coin = 10.1
-
-p1 = geompy.MakeVertex(0., 0., 0.)
-p2 = geompy.MakeVertex(100., 100., 100.)
-box = geompy.MakeBoxTwoPnt(p1, p2)
-geompy.addToStudy(box, "box")
-
-p3 = geompy.MakeVertex(dist_coin, 0, dist_coin)
-geompy.addToStudy(p3, "p3")
-
-part = geompy.MakePartition([box], [p3])
-geompy.addToStudy(part, "part")
-
-left = geompy.GetFaceNearPoint(box, p3)
-geompy.addToStudyInFather(box, left, "left")
-
-
-# Mesh
-# ====
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-Mesh = smesh.Mesh(part, "Mesh")
-
-algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
-algo2d.SetGeometricMesh( 1 )
-algo2d.SetAngleMesh( 4 )
-algo2d.SetPhySize( 8 )
-
-algo2d.SetInternalEnforcedVertexAllFaces(True)
-
-Mesh.Compute()
-
-id_node = Mesh.FindNodeClosestTo(dist_coin, 0, dist_coin)
-
-x, y, z = Mesh.GetNodeXYZ(id_node)
-
-assert("%.2f, %.2f, %.2f"%(x, y, z) == "%.2f, %.2f, %.2f"%(dist_coin, 0, dist_coin))
-
-salome.sg.updateObjBrowser()
-
+++ /dev/null
-# -*- coding: utf-8 -*-
-
-import salome
-import math
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-dist_coin = 10.1
-
-p1 = geompy.MakeVertex(0., 0., 0.)
-p2 = geompy.MakeVertex(100., 100., 100.)
-box = geompy.MakeBoxTwoPnt(p1, p2)
-geompy.addToStudy(box, "box")
-
-p3 = geompy.MakeVertex(dist_coin, 0, dist_coin)
-geompy.addToStudy(p3, "p3")
-
-left = geompy.GetFaceNearPoint(box, p3)
-geompy.addToStudyInFather(box, left, "left")
-
-allEnforcedCoords = []
-allEnforcedCoords.append(( dist_coin, 0, dist_coin ))
-allEnforcedCoords.append(( 20, 0, 15.3 ))
-allEnforcedCoords.append(( 25, 1, 25.3 ))
-allEnforcedCoords.append(( 35, 1, 45.3 ))
-allEnforcedCoords.append(( 35, 1, 55.3 ))
-
-p4 = geompy.MakeVertex( *(allEnforcedCoords[1] ))
-p5 = geompy.MakeVertex( *(allEnforcedCoords[2] ))
-pp = geompy.MakeCompound( [p4,p5], theName="p4,p5" )
-p6 = geompy.MakeVertex( *(allEnforcedCoords[3] ), theName="p6")
-p7 = geompy.MakeVertex( *(allEnforcedCoords[4] ), theName="p7")
-
-xyz7 = allEnforcedCoords[4]
-
-# Mesh
-# ====
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-Mesh = smesh.Mesh(box, "Mesh")
-
-
-algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
-algo2d.SetGeometricMesh( 1 )
-algo2d.SetAngleMesh( 4 )
-algo2d.SetPhySize( 8 )
-
-algo2d.SetEnforcedVertex(left, dist_coin, 0, dist_coin)
-algo2d.AddEnforcedVertexGeom( pp )
-algo2d.AddEnforcedVertexGeom( p6 )
-algo2d.AddEnforcedVertex( *xyz7 )
-
-assert Mesh.Compute()
-assert not Mesh.FindCoincidentNodes( 1e-7 )
-
-for x,y,z in allEnforcedCoords:
-
- id_node = Mesh.FindNodeClosestTo( x,y,z )
- xn, yn, zn = Mesh.GetNodeXYZ( id_node )
-
- # compare X and Z
- assert "%.2f, %.2f"%(x, z) == "%.2f, %.2f"%( xn, zn ), \
- "%.2f, %.2f, %.2f != %.2f, %.2f, %.2f"%( xn, yn, zn, x,y,z )
-
-
-salome.sg.updateObjBrowser()
-
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-
-import sys
-import salome
-
-###
-### GEOM component
-###
-
-import math
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-O = geompy.MakeVertex(0, 0, 0)
-OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
-OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
-OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
-Face_1 = geompy.MakeFaceHW(10, 10, 1)
-geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
-Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
-vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
-Curve_1 = geompy.MakeInterpol(vertices, True, True)
-
-part = geompy.MakePartition([Face_1], [Curve_1], Limit=geompy.ShapeType["FACE"])
-geompy.addToStudy(part, "part")
-
-Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
-Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
-Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-p1 = geompy.MakeVertex(-5, -5, 0)
-p2 = geompy.MakeVertex(5, 5, 0)
-left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
-left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(left, left_edges)
-geompy.addToStudyInFather(part, left, "left")
-
-right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
-right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(right, right_edges)
-geompy.addToStudyInFather(part, right, "right")
-
-bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
-bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(bottom, bottom_edges)
-geompy.addToStudyInFather(part, bottom, "bottom")
-
-top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
-top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(top, top_edges)
-geompy.addToStudyInFather(part, top, "top")
-
-source_face = geompy.GetFaceNearPoint(part, p1)
-geompy.addToStudyInFather(part, source_face, "source_face")
-
-
-# Mesh
-# ====
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-Mesh = smesh.Mesh(part, "Mesh")
-
-algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
-algo2d.SetGeometricMesh( 1 )
-algo2d.SetAngleMesh( 4 )
-algo2d.SetPhySize( 8 )
-#algo2d.SetGradation(1.05)
-
-# Periodicity
-#algo2d.SetVerbosity(10)
-algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
-algo2d.AddPreCadEdgesPeriodicity(left, right)
-algo2d.AddPreCadEdgesPeriodicity(bottom, top)
-
-
-Mesh.Compute()
-
-gr_left = Mesh.Group(left)
-gr_right = Mesh.Group(right)
-gr_bottom = Mesh.Group(bottom)
-gr_top = Mesh.Group(top)
-
-Mesh.Compute()
-
-left_translated = Mesh.TranslateObjectMakeMesh( gr_left, SMESH.DirStruct( SMESH.PointStruct ( 10, 0, 0 )), 0, 'left_translated' )
-bottom_translated = Mesh.TranslateObjectMakeMesh( gr_bottom, SMESH.DirStruct( SMESH.PointStruct ( 0, 10, 0 )), 0, 'bottom_translated' )
-
-def checkProjection(gr, mesh_translated, tol=1e-7):
- name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
- mesh_source = smesh.CopyMesh(gr, gr.GetName())
- mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
- ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
- coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
- mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
- mesh_nodes = mesh_check.GetNodesId()
- if len(ll_coincident_nodes) != mesh_translated.NbNodes():
- non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
- mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
- raise Exception("Projection failed for %s"%name)
-
-checkProjection(gr_right, left_translated)
-checkProjection(gr_top, bottom_translated)
-
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: utf-8 -*-
-
-import salome
-import math
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-simple = False
-
-r = 10
-dist = 10
-
-p1 = geompy.MakeVertex(0., 0., 0.)
-p2 = geompy.MakeVertex(100., 100., 100.)
-box = geompy.MakeBoxTwoPnt(p1, p2)
-geompy.addToStudy(box, "box")
-
-p3 = geompy.MakeVertex(25., 5., 25.)
-sphere1 = geompy.MakeSpherePntR(p3, 15.)
-geompy.addToStudy(sphere1, "sphere1")
-
-sphere1_trans = geompy.MakeTranslation(sphere1, 0, 100, 0)
-geompy.addToStudy(sphere1_trans, "sphere1_trans")
-
-sphere1_trans = geompy.MakeTranslation(sphere1, 0, 100, 0)
-geompy.addToStudy(sphere1_trans, "sphere1_trans")
-
-p4 = geompy.MakeVertex(5, 50, 90)
-sphere2 = geompy.MakeSpherePntR(p4, 20.)
-
-sphere2_trans = geompy.MakeTranslation(sphere2, 100, 0, 0)
-geompy.addToStudy(sphere2_trans, "sphere2_trans")
-
-sphere2_trans2 = geompy.MakeTranslation(sphere2, 0, 0, -100)
-geompy.addToStudy(sphere2_trans2, "sphere2_trans2")
-
-sphere2_trans3 = geompy.MakeTranslation(sphere2, 100, 0, -100)
-geompy.addToStudy(sphere2_trans3, "sphere2_trans3")
-
-if simple:
- part = box
-else:
- part = geompy.MakePartition([box], [sphere1, sphere1_trans, sphere2, sphere2_trans, sphere2_trans2, sphere2_trans3])
-geompy.addToStudy(part, "part")
-
-Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
-Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
-Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-left_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vy, GEOM.ST_ON)
-left = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(left, left_faces)
-geompy.addToStudyInFather(part, left, "left")
-
-right_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vy, p2, GEOM.ST_ON)
-right = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(right, right_faces)
-geompy.addToStudyInFather(part, right, "right")
-
-back_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vx, GEOM.ST_ON)
-back = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(back, back_faces)
-geompy.addToStudyInFather(part, back, "back")
-
-front_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vx, p2, GEOM.ST_ON)
-front = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(front, front_faces)
-geompy.addToStudyInFather(part, front, "front")
-
-bottom_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vz, GEOM.ST_ON)
-bottom = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(bottom, bottom_faces)
-geompy.addToStudyInFather(part, bottom, "bottom")
-
-top_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vz, p2, GEOM.ST_ON)
-top = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(top, top_faces)
-geompy.addToStudyInFather(part, top, "top")
-
-sources = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(sources, left_faces)
-geompy.UnionList(sources, back_faces)
-geompy.UnionList(sources, top_faces)
-geompy.addToStudyInFather(part, sources, "sources")
-
-# Mesh
-# ====
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-Mesh = smesh.Mesh(part, "Mesh")
-
-algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
-algo2d.SetGeometricMesh( 1 )
-algo2d.SetAngleMesh( 4 )
-algo2d.SetPhySize( 8 )
-algo2d.SetVerbosity(1)
-
-# Periodicity
-#algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
-algo2d.AddPreCadFacesPeriodicity(left, right)
-algo2d.AddPreCadFacesPeriodicity(front, back)
-algo2d.AddPreCadFacesPeriodicity(bottom, top)
-
-gr_left = Mesh.Group(left)
-gr_right = Mesh.Group(right)
-gr_front = Mesh.Group(front)
-gr_back = Mesh.Group(back)
-gr_bottom = Mesh.Group(bottom)
-gr_top = Mesh.Group(top)
-
-Mesh.Compute()
-
-left_translated = Mesh.TranslateObjectMakeMesh( gr_left, SMESH.DirStruct( SMESH.PointStruct ( 0, 100, 0 )), 0, 'left_translated' )
-front_translated = Mesh.TranslateObjectMakeMesh( gr_front, SMESH.DirStruct( SMESH.PointStruct ( -100, 0, 0 )), 0, 'front_translated' )
-bottom_translated = Mesh.TranslateObjectMakeMesh( gr_bottom, SMESH.DirStruct( SMESH.PointStruct ( 0, 0, 100 )), 0, 'bottom_translated' )
-
-def checkProjection(gr, mesh_translated, tol=1e-7):
- name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
- mesh_source = smesh.CopyMesh(gr, gr.GetName())
- mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
- ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
- coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
- mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
- mesh_nodes = mesh_check.GetNodesId()
- if len(ll_coincident_nodes) != mesh_translated.NbNodes():
- non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
- mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
- raise Exception("Projection failed for %s"%name)
-
-checkProjection(gr_right, left_translated)
-checkProjection(gr_back, front_translated)
-checkProjection(gr_top, bottom_translated)
-
-salome.sg.updateObjBrowser()
-
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-
-import sys
-import salome
-
-###
-### GEOM component
-###
-
-import math
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-O = geompy.MakeVertex(0, 0, 0)
-OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
-OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
-OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
-Face_1 = geompy.MakeFaceHW(10, 10, 1)
-geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
-Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
-vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
-Curve_1 = geompy.MakeInterpol(vertices, True, True)
-
-part = geompy.MakePartition([Face_1], [Curve_1], Limit=geompy.ShapeType["FACE"])
-geompy.addToStudy(part, "part")
-
-Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
-Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
-Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-p1 = geompy.MakeVertex(-5, -5, 0)
-p2 = geompy.MakeVertex(5, 5, 0)
-left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
-left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(left, left_edges)
-geompy.addToStudyInFather(part, left, "left")
-
-right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
-right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(right, right_edges)
-geompy.addToStudyInFather(part, right, "right")
-
-bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
-bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(bottom, bottom_edges)
-geompy.addToStudyInFather(part, bottom, "bottom")
-
-top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
-top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(top, top_edges)
-geompy.addToStudyInFather(part, top, "top")
-
-source_face = geompy.GetFaceNearPoint(part, p1)
-geompy.addToStudyInFather(part, source_face, "source_face")
-
-# To define a rotation, we have to set at least 3 source vertices not aligned.
-p_bas_gauche = geompy.MakeVertex(-5, -5, 0)
-geompy.addToStudy(p_bas_gauche, "p_bas_gauche")
-p_bas_mil = geompy.MakeVertex(0, -4, 0)
-geompy.addToStudy(p_bas_mil, "p_bas_mil")
-p_bas_droite = geompy.MakeVertex(5, -5, 0)
-geompy.addToStudy(p_bas_droite, "p_bas_droite")
-
-# Target vertices
-p_mil_droite = geompy.MakeVertex(4, 0, 0)
-geompy.addToStudy(p_mil_droite, "p_mil_droite")
-p_haut_droite = geompy.MakeVertex(5, 5, 0)
-geompy.addToStudy(p_haut_droite, "p_haut_droite")
-
-# Mesh
-# ====
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-Mesh = smesh.Mesh(part, "Mesh")
-
-algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
-algo2d.SetGeometricMesh( 1 )
-algo2d.SetAngleMesh( 4 )
-algo2d.SetPhySize( 8 )
-#algo2d.SetGradation(1.05)
-
-#algo2d.SetOptionValue( 'debug', '1' )
-#algo2d.SetPreCADOptionValue( 'debug', '1' )
-
-# Periodicity
-#algo2d.SetVerbosity(10)
-algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
-algo2d.AddPreCadEdgesPeriodicity(bottom, right, [p_bas_droite, p_bas_mil, p_bas_gauche], [p_bas_droite, p_mil_droite, p_haut_droite])
-
-
-Mesh.Compute()
-
-gr_left = Mesh.Group(left)
-gr_right = Mesh.Group(right)
-gr_bottom = Mesh.Group(bottom)
-gr_top = Mesh.Group(top)
-
-axe = geompy.MakePrismVecH(p_bas_droite, Vz, 1)
-bottom_rotated = Mesh.RotateObjectMakeMesh( gr_bottom, axe, -math.pi/2, NewMeshName='bottom_rotated' )
-
-def checkProjection(gr, mesh_translated, tol=1e-7):
- name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
- mesh_source = smesh.CopyMesh(gr, gr.GetName())
- mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
- ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
- coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
- mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
- mesh_nodes = mesh_check.GetNodesId()
- if len(ll_coincident_nodes) != mesh_translated.NbNodes():
- non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
- mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
- #raise Exception("Projection failed for %s"%name)
- print("Projection failed for %s"%name)
-
-checkProjection(gr_right, bottom_rotated)
-
-#salome.myStudy.SaveAs("test.hdf", 0, 0)
-
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser()
-
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import salome
-import math
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-simple = False
-
-r = 10
-dist = 10
-
-p1 = geompy.MakeVertex(0., 0., 0.)
-p2 = geompy.MakeVertex(100., 100., 100.)
-box = geompy.MakeBoxTwoPnt(p1, p2)
-geompy.addToStudy(box, "box")
-
-p3 = geompy.MakeVertex(50., 5., 25.)
-sphere1 = geompy.MakeSpherePntR(p3, 15.)
-geompy.addToStudy(sphere1, "sphere1")
-
-Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
-Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
-Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-p4 = geompy.MakeVertex(100., 0., 0.)
-axe = geompy.MakePrismVecH(p4, Vz, 1)
-geompy.addToStudy(axe, "axe")
-
-sphere1_rota = geompy.MakeRotation(sphere1, axe, -math.pi/2.)
-geompy.addToStudy(sphere1_rota, "sphere1_rota")
-
-part = geompy.MakePartition([box], [sphere1, sphere1_rota])
-geompy.addToStudy(part, "part")
-
-left_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vy, GEOM.ST_ON)
-left = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(left, left_faces)
-geompy.addToStudyInFather(part, left, "left")
-
-right_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vy, p2, GEOM.ST_ON)
-right = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(right, right_faces)
-geompy.addToStudyInFather(part, right, "right")
-
-back_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vx, GEOM.ST_ON)
-back = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(back, back_faces)
-geompy.addToStudyInFather(part, back, "back")
-
-front_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vx, p2, GEOM.ST_ON)
-front = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(front, front_faces)
-geompy.addToStudyInFather(part, front, "front")
-
-bottom_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vz, GEOM.ST_ON)
-bottom = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(bottom, bottom_faces)
-geompy.addToStudyInFather(part, bottom, "bottom")
-
-top_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vz, p2, GEOM.ST_ON)
-top = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(top, top_faces)
-geompy.addToStudyInFather(part, top, "top")
-
-p1_rota = geompy.MakeRotation(p1, axe, -math.pi/2.)
-geompy.addToStudy(sphere1_rota, "sphere1_rota")
-
-p5 = geompy.MakeVertex(100, 0, 100)
-geompy.addToStudy(p5, "p5")
-
-# Mesh
-# ====
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-Mesh = smesh.Mesh(part, "Mesh")
-
-algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
-algo2d.SetGeometricMesh( 1 )
-algo2d.SetAngleMesh( 4 )
-algo2d.SetPhySize( 8 )
-
-# Periodicity
-#algo2d.SetVerbosity(10)
-#algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
-algo2d.AddPreCadFacesPeriodicity(left, front, [p1, p4, p5], [p1_rota, p4, p5])
-
-
-gr_left = Mesh.Group(left)
-gr_right = Mesh.Group(right)
-gr_front = Mesh.Group(front)
-gr_back = Mesh.Group(back)
-gr_bottom = Mesh.Group(bottom)
-gr_top = Mesh.Group(top)
-
-Mesh.Compute()
-
-left_rotated = Mesh.RotateObjectMakeMesh( gr_left, axe, -math.pi/2, NewMeshName='left_rotated' )
-
-def checkProjection(gr, mesh_translated, tol=1e-7):
- name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
- mesh_source = smesh.CopyMesh(gr, gr.GetName())
- mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
- ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
- coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
- mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
- mesh_nodes = mesh_check.GetNodesId()
- if len(ll_coincident_nodes) != mesh_translated.NbNodes():
- non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
- mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
- raise Exception("Projection failed for %s"%name)
-
-checkProjection(gr_front, left_rotated)
-
-salome.sg.updateObjBrowser()
-
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-
-import sys
-import salome
-
-###
-### GEOM component
-###
-
-import math
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-O = geompy.MakeVertex(0, 0, 0)
-OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
-OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
-OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
-Face_1 = geompy.MakeFaceHW(10, 10, 1)
-geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
-Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
-vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
-Curve_1 = geompy.MakeInterpol(vertices, True, True)
-
-part = geompy.MakePartition([Face_1], [Curve_1], Limit=geompy.ShapeType["FACE"])
-geompy.addToStudy(part, "part")
-
-Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
-Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
-Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-p1 = geompy.MakeVertex(-5, -5, 0)
-p2 = geompy.MakeVertex(5, 5, 0)
-left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
-left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(left, left_edges)
-geompy.addToStudyInFather(part, left, "left")
-
-right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
-right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(right, right_edges)
-geompy.addToStudyInFather(part, right, "right")
-
-bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
-bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(bottom, bottom_edges)
-geompy.addToStudyInFather(part, bottom, "bottom")
-
-top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
-top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(top, top_edges)
-geompy.addToStudyInFather(part, top, "top")
-
-source_face = geompy.GetFaceNearPoint(part, p1)
-geompy.addToStudyInFather(part, source_face, "source_face")
-
-p_bas_gauche = geompy.MakeVertex(-5, -5, 0)
-geompy.addToStudy(p_bas_gauche, "p_bas_gauche")
-p_bas_mil = geompy.MakeVertex(0, -4, 0)
-geompy.addToStudy(p_bas_mil, "p_bas_mil")
-p_bas_droite = geompy.MakeVertex(5, -5, 0)
-geompy.addToStudy(p_bas_droite, "p_bas_droite")
-p_haut_gauche = geompy.MakeVertex(-5, 5, 0)
-geompy.addToStudy(p_haut_gauche, "p_haut_gauche")
-p_haut_mil = geompy.MakeVertex(0, 6, 0)
-geompy.addToStudy(p_haut_mil, "p_haut_mil")
-p_haut_droite = geompy.MakeVertex(5, 5, 0)
-geompy.addToStudy(p_haut_droite, "p_haut_droite")
-
-# Mesh
-# ====
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-Mesh = smesh.Mesh(part, "Mesh")
-
-algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
-algo2d.SetGeometricMesh( 1 )
-algo2d.SetAngleMesh( 4 )
-algo2d.SetPhySize( 8 )
-#algo2d.SetGradation(1.05)
-
-# Periodicity
-#algo2d.SetVerbosity(10)
-algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
-algo2d.AddPreCadEdgesPeriodicity(bottom, top, [p_bas_gauche, p_bas_mil, p_bas_droite], [p_haut_gauche, p_haut_mil, p_haut_droite])
-
-# debug
-#algo2d.SetOptionValue( 'debug', '1' )
-#algo2d.SetPreCADOptionValue( 'debug', '1' )
-
-Mesh.Compute()
-
-gr_left = Mesh.Group(left)
-gr_right = Mesh.Group(right)
-gr_bottom = Mesh.Group(bottom)
-gr_top = Mesh.Group(top)
-
-Mesh.Compute()
-
-left_translated = Mesh.TranslateObjectMakeMesh( gr_left, SMESH.DirStruct( SMESH.PointStruct ( 10, 0, 0 )), 0, 'left_translated' )
-bottom_translated = Mesh.TranslateObjectMakeMesh( gr_bottom, SMESH.DirStruct( SMESH.PointStruct ( 0, 10, 0 )), 0, 'bottom_translated' )
-
-def checkProjection(gr, mesh_translated, tol=1e-7):
- name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
- mesh_source = smesh.CopyMesh(gr, gr.GetName())
- mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
- ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
- coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
- mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
- mesh_nodes = mesh_check.GetNodesId()
- if len(ll_coincident_nodes) != mesh_translated.NbNodes():
- non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
- mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
- raise Exception("Projection failed for %s"%name)
-
-checkProjection(gr_top, bottom_translated)
-
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser()
-
-
+++ /dev/null
-# -*- coding: utf-8 -*-
-
-import sys
-import salome
-
-salome.salome_init()
-
-###
-### GEOM component
-###
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-
-geompy.init_geom()
-
-Face_1 = geompy.MakeFaceHW(10, 10, 1)
-Translation_1 = geompy.MakeTranslation(Face_1, 10.0001, 0.0001, 0)
-Translation_2 = geompy.MakeTranslation(Face_1, 5, -9.99995, 0)
-Partition_1 = geompy.MakePartition([Face_1, Translation_1, Translation_2], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
-geompy.addToStudy( Face_1, 'Face_1' )
-geompy.addToStudy( Translation_1, 'Translation_1' )
-geompy.addToStudy( Translation_2, 'Translation_2' )
-geompy.addToStudy( Partition_1, 'Partition_1' )
-
-p_axe = geompy.MakeVertex(5, -5, 0)
-axe = geompy.MakePrismDXDYDZ(p_axe, 0, 0, 1)
-vertices = geompy.GetShapesOnCylinder(Partition_1, geompy.ShapeType["VERTEX"], axe, 1e-3, GEOM.ST_IN)
-gr_vertices = geompy.CreateGroup(Partition_1, geompy.ShapeType["VERTEX"])
-geompy.UnionList(gr_vertices, vertices)
-geompy.addToStudyInFather(Partition_1, gr_vertices, "vertices")
-
-###
-### SMESH component
-###
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-
-Mesh_1 = smesh.Mesh(Partition_1)
-
-BLSURF_1 = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
-BLSURF_Parameters = BLSURF_1.Parameters()
-BLSURF_Parameters.SetPhySize( 5 )
-BLSURF_Parameters.SetPreCADMergeEdges( True )
-BLSURF_Parameters.SetPreCADProcess3DTopology( True )
-BLSURF_Parameters.SetPreCADOptionValue( 'remove_tiny_uv_edges', 'yes' )
-
-Mesh_1.Compute()
-
-# Check that vertices are merged by preCAD preprocessing
-nodes = []
-for p in vertices:
- x, y, z = geompy.PointCoordinates(p)
- id_node = Mesh_1.FindNodeClosestTo(x, y, z)
- nodes.append(id_node)
-
-nodes = list(set(nodes))
-
-nodesGroup = Mesh_1.MakeGroupByIds("nodes", SMESH.NODE, nodes)
-
-assert nodesGroup.Size() == 1, nodesGroup.GetIDs()
-
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: utf-8 -*-
-
-import sys
-import salome
-
-salome.salome_init()
-
-###
-### GEOM component
-###
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-
-geompy.init_geom()
-
-Face_1 = geompy.MakeFaceHW(10, 10, 1)
-Translation_1 = geompy.MakeTranslation(Face_1, 10.0001, 0.0001, 0)
-Translation_2 = geompy.MakeTranslation(Face_1, 5, -9.99995, 0)
-Partition_1 = geompy.MakePartition([Face_1, Translation_1, Translation_2], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
-geompy.addToStudy( Face_1, 'Face_1' )
-geompy.addToStudy( Translation_1, 'Translation_1' )
-geompy.addToStudy( Translation_2, 'Translation_2' )
-geompy.addToStudy( Partition_1, 'Partition_1' )
-
-p_axe = geompy.MakeVertex(5, -5, 0)
-axe = geompy.MakePrismDXDYDZ(p_axe, 0, 0, 1)
-vertices = geompy.GetShapesOnCylinder(Partition_1, geompy.ShapeType["VERTEX"], axe, 1e-3, GEOM.ST_IN)
-gr_vertices = geompy.CreateGroup(Partition_1, geompy.ShapeType["VERTEX"])
-geompy.UnionList(gr_vertices, vertices)
-geompy.addToStudyInFather(Partition_1, gr_vertices, "vertices")
-
-###
-### SMESH component
-###
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-
-Mesh_1 = smesh.Mesh(Partition_1)
-
-BLSURF_1 = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
-BLSURF_Parameters = BLSURF_1.Parameters()
-BLSURF_Parameters.SetPhySize( 5 )
-
-Mesh_1.Compute()
-
-# Check that vertices are not merged by preCAD preprocessing
-# when no preprocessing option has been explicitely called
-nodes = []
-for p in vertices:
- x, y, z = geompy.PointCoordinates(p)
- id_node = Mesh_1.FindNodeClosestTo(x, y, z)
- nodes.append(id_node)
-
-nodes = list(set(nodes))
-
-Mesh_1.MakeGroupByIds("nodes", SMESH.NODE, nodes)
-
-assert len(nodes) == 3, "We should have 3 nodes. We got %i. => The preprocessing has done something, but we did not ask him to."%len(nodes)
-
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: utf-8 -*-
-
-import sys
-import salome
-
-salome.salome_init()
-
-###
-### GEOM component
-###
-
-import GEOM
-from salome.geom import geomBuilder
-import math
-import SALOMEDS
-
-
-geompy = geomBuilder.New()
-
-# Create a box
-box = geompy.MakeBoxDXDYDZ(100, 100, 100)
-
-# Create a sphere near the sides of the box
-sphere_tmp = geompy.MakeSphereR(5)
-sphere = geompy.MakeTranslation(sphere_tmp, 6, 6, 50)
-
-part = geompy.MakePartition([box, sphere])
-geompy.addToStudy( box, 'box' )
-geompy.addToStudy( sphere, 'sphere' )
-geompy.addToStudy( part, 'part' )
-
-# Create the groups of faces
-box_faces = geompy.GetShapesOnBox(box, part, geompy.ShapeType["FACE"], GEOM.ST_ON)
-gr_box_faces = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(gr_box_faces, box_faces)
-geompy.addToStudyInFather(part, gr_box_faces, "box_faces")
-
-all_faces = geompy.SubShapeAll(part, geompy.ShapeType["FACE"])
-gr_all_faces = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(gr_all_faces, all_faces)
-
-gr_spheres_faces = geompy.CutGroups(gr_all_faces, gr_box_faces)
-geompy.addToStudyInFather(part, gr_spheres_faces, "spheres_faces")
-
-###
-### SMESH component
-###
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-
-smesh = smeshBuilder.New()
-Mesh_1 = smesh.Mesh(part, "Mesh_part")
-BLSURF = Mesh_1.Triangle(algo=smeshBuilder.BLSURF)
-BLSURF_Parameters_1 = BLSURF.Parameters()
-BLSURF_Parameters_1.SetGradation( 1.2 )
-BLSURF_Parameters_1.SetGeometricMesh( 1 )
-BLSURF_Parameters_1.SetPhySize( 20 )
-#BLSURF_Parameters_1.SetMinSize( 0.1 )
-BLSURF_Parameters_1.SetMaxSize( 20 )
-BLSURF_Parameters_1.SetAngleMesh( 8 )
-
-# Old way to set proximity (Mesh Gems 1.1)
-#BLSURF_Parameters_1.SetOptionValue( 'proximity', '1' )
-#BLSURF_Parameters_1.SetOptionValue( 'prox_ratio', '1.2' )
-#BLSURF_Parameters_1.SetOptionValue( 'prox_nb_layer', '3' )
-
-# New way to set proximity (Mesh Gems >= 1.3)
-BLSURF_Parameters_1.SetOptionValue( "volume_gradation", "1.2" )
-
-isDone = Mesh_1.Compute()
-if not isDone:
- raise Exception("Compute mesh ended in error")
-
-# Create the groups on the mesh
-gr_mesh_box = Mesh_1.Group(gr_box_faces)
-gr_mesh_spheres = Mesh_1.Group(gr_spheres_faces)
-
-# Check the minimal area of the box faces to check the proximity
-min_area, max_area = Mesh_1.GetMinMax(SMESH.FT_Area, gr_mesh_box)
-
-print("min_area: ", min_area)
-
-if min_area > 1.5:
- raise Exception("Wrong minimal area on box. Proximity has not worked.")
-
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: utf-8 -*-
-
-import salome
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import math
-
-area_tolerance = 0.1
-nb_faces_tolerance = 20
-
-## Return the min and max areas of a mesh
-def getMinMaxArea(mesh):
- mini, maxi = mesh.GetMinMax(SMESH.FT_Area)
- return mini, maxi
-
-O = geompy.MakeVertex(0, 0, 0)
-OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
-OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
-OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-Face_1 = geompy.MakeFaceHW(10, 10, 1)
-geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
-Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
-vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
-Curve_1 = geompy.MakeInterpol(vertices, True, True)
-
-p_small = geompy.MakeVertexOnCurve(Curve_1, 0.001)
-geompy.addToStudy(p_small, "p_small")
-
-p_small2 = geompy.MakeVertexOnCurve(Curve_1, 0.5)
-geompy.addToStudy(p_small2, "p_small2")
-
-p_small3 = geompy.MakeVertexOnCurve(Curve_1, 0.501)
-geompy.addToStudy(p_small3, "p_small3")
-
-part = geompy.MakePartition([Face_1], [Curve_1, p_small, p_small2, p_small3], Limit=geompy.ShapeType["FACE"])
-geompy.addToStudy(part, "part")
-
-Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
-Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
-Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-p1 = geompy.MakeVertex(-5, -5, 0)
-p2 = geompy.MakeVertex(5, 5, 0)
-left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
-left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(left, left_edges)
-geompy.addToStudyInFather(part, left, "left")
-
-right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
-right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(right, right_edges)
-geompy.addToStudyInFather(part, right, "right")
-
-bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
-bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(bottom, bottom_edges)
-geompy.addToStudyInFather(part, bottom, "bottom")
-
-top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
-top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(top, top_edges)
-geompy.addToStudyInFather(part, top, "top")
-
-faces = geompy.SubShapeAll(part, geompy.ShapeType["FACE"])
-sub_shapes = []
-for i, face in enumerate(faces):
- geompy.addToStudyInFather(part, face, "face_%i"%(i+1))
- sub_shapes.append(face)
-
-# Mesh
-# ====
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Test gradation with quadrangles
-Mesh_1 = smesh.Mesh(part, "Mesh")
-
-algo2d = Mesh_1.Triangle(algo=smeshBuilder.BLSURF)
-params = algo2d.Parameters()
-params.SetGeometricMesh( 1 )
-params.SetAngleMesh( 4 )
-params.SetPhySize( 8 )
-algo2d.SetGradation(1.05)
-params.SetQuadAllowed( True )
-
-ok = Mesh_1.Compute()
-
-if not ok:
- raise Exception("Error when computing Mesh_1")
-
-# Check the areas of Mesh_1
-mini_1, maxi_1 = getMinMaxArea(Mesh_1)
-mini_1_ref = 0.00197
-maxi_1_ref = 0.530
-
-if abs(mini_1-mini_1_ref) > area_tolerance:
- raise Exception("Min area of Mesh_1 incorrect")
-
-if maxi_1 > maxi_1_ref:
- raise Exception("Max area of Mesh_1 incorrect")
-
-# Check the number of faces of Mesh_1
-nb_faces_1 = Mesh_1.NbFaces()
-nb_faces_1_ref = 1208
-
-if nb_faces_1 < nb_faces_1_ref:
- raise Exception("Number of faces of Mesh_1 incorrect")
-
-
-# Test no gradation with quadrangles and anisotropy
-# RQ: this kind of mesh is not suitable for simulation
-# but gives a coarse mesh like a stl geometry
-Mesh_2 = smesh.Mesh(part, "Mesh")
-
-algo2d = Mesh_2.Triangle(algo=smeshBuilder.BLSURF)
-params = algo2d.Parameters()
-params.SetGeometricMesh( 1 )
-params.SetAngleMesh( 4 )
-params.SetPhySize( 8 )
-algo2d.SetGradation(1.05)
-params.SetQuadAllowed( True )
-params.SetAnisotropic(True)
-
-ok = Mesh_2.Compute()
-
-if not ok:
- raise Exception("Error when computing Mesh_2")
-
-# Check the areas of Mesh_2
-mini_2, maxi_2 = getMinMaxArea(Mesh_2)
-mini_2_ref = 0.000408
-maxi_2_ref = 10.1982
-
-if abs(mini_2-mini_2_ref) > area_tolerance:
- raise Exception("Min area of Mesh_2 incorrect")
-
-if abs(maxi_2-maxi_2_ref) > area_tolerance:
- raise Exception("Max area of Mesh_2 incorrect")
-
-# Check the number of faces of Mesh_2
-nb_faces_2 = Mesh_2.NbFaces()
-nb_faces_2_ref = 121
-if abs(nb_faces_2-nb_faces_2_ref) > nb_faces_tolerance:
- raise Exception("Number of faces of Mesh_2 incorrect")
-
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser()
-
-
+++ /dev/null
-# -*- coding: utf-8 -*-
-
-import salome
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import math
-
-tiny_edge_length = 0.1
-
-O = geompy.MakeVertex(0, 0, 0)
-OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
-OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
-OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-Face_1 = geompy.MakeFaceHW(10, 10, 1)
-geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
-Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
-vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
-Curve_1 = geompy.MakeInterpol(vertices, True, True)
-
-p_small = geompy.MakeVertexOnCurve(Curve_1, 0.001)
-geompy.addToStudy(p_small, "p_small")
-
-part = geompy.MakePartition([Face_1], [Curve_1, p_small], Limit=geompy.ShapeType["FACE"])
-geompy.addToStudy(part, "part")
-
-Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
-Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
-Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-p1 = geompy.MakeVertex(-5, -5, 0)
-p2 = geompy.MakeVertex(5, 5, 0)
-left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
-left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(left, left_edges)
-geompy.addToStudyInFather(part, left, "left")
-
-right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
-right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(right, right_edges)
-geompy.addToStudyInFather(part, right, "right")
-
-bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
-bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(bottom, bottom_edges)
-geompy.addToStudyInFather(part, bottom, "bottom")
-
-top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
-top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(top, top_edges)
-geompy.addToStudyInFather(part, top, "top")
-
-faces = geompy.SubShapeAll(part, geompy.ShapeType["FACE"])
-sub_shapes = []
-for i, face in enumerate(faces):
- geompy.addToStudyInFather(part, face, "face_%i"%(i+1))
- sub_shapes.append(face)
-
-# Mesh
-# ====
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-Mesh = smesh.Mesh(part, "Mesh")
-
-algo2d = Mesh.Triangle(algo=smeshBuilder.BLSURF)
-params = algo2d.Parameters()
-params.SetVerbosity(1)
-#algo2d.SetTopology(smesh.PreCAD)
-params.SetGeometricMesh( 1 )
-params.SetAngleMesh( 4 )
-params.SetPhySize( 8 )
-#algo2d.SetGradation(1.05)
-#params.SetQuadAllowed( True )
-params.SetQuadraticMesh( True )
-params.SetRemoveTinyEdges( True )
-params.SetTinyEdgeLength( tiny_edge_length )
-#params.SetOptionValue( 'rectify_jacobian', '0' )
-
-Mesh.Compute()
-
-for sub_shape in sub_shapes:
- Mesh.Group(sub_shape)
-
-x0, y0, z0 = geompy.PointCoordinates(p_small)
-node = Mesh.FindNodeClosestTo(x0, y0, z0)
-
-elems = Mesh.GetNodeInverseElements(node)
-
-edges_length = []
-for elem in elems:
- if Mesh.GetElementType(elem, True) == SMESH.EDGE:
- edge_length = Mesh.GetLength(elem)
- edges_length.append(edge_length)
-
-min_length = min(edges_length)
-x1, y1, z1 = Mesh.GetNodeXYZ(node)
-
-print(min_length)
-
-if min_length<tiny_edge_length:
- raise Exception("Small edge has not been removed")
-
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: utf-8 -*-
-
-import sys
-import salome
-
-salome.salome_init()
-
-###
-### GEOM component
-###
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-
-geompy.init_geom()
-
-sphere = geompy.MakeSphereR(10)
-geompy.addToStudy( sphere, 'sphere' )
-
-###
-### SMESH component
-###
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-
-Mesh_1 = smesh.Mesh(sphere)
-
-BLSURF_1 = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
-BLSURF_Parameters = BLSURF_1.Parameters()
-BLSURF_Parameters.SetPhySize( 5 )
-BLSURF_Parameters.SetGeometricMesh( 1 )
-BLSURF_Parameters.SetAngleMesh( 8 )
-
-ok = Mesh_1.Compute()
-
-if not ok:
- raise Exception("Error when computing surface mesh")
-
-Mesh_1.Tetrahedron(algo=smeshBuilder.MG_Tetra)
-
-ok = Mesh_1.Compute()
-
-if not ok:
- raise Exception("Error when computing volume mesh")
-
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser()
--- /dev/null
+# Copyright (C) 2016 CEA/DEN, EDF R&D
+#
+# 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
+#
+
+SET(TEST_NAMES
+ attractor
+ attractor_edge_on_border
+ attractor_point_outside_face
+ enforced_internal_vertex
+ enforced_vertex
+ multithread
+ periodicity_2D_prepro
+ #periodicity_prepro # already tested in examples
+ periodicity_reflexion_2D_prepro
+ periodicity_reflexion_prepro
+ periodicity_with_points_2D_prepro
+ prepro_intersections
+ prepro_keep_gaps
+ proximity
+ quadrangles_gradation
+ remove_tiny_edges
+ sphere
+)