1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2019 CEA/DEN, EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 from .geomsmesh import smesh
23 from salome.smesh import smeshBuilder
25 # -----------------------------------------------------------------------------
26 # --- maillage face de fissure pour identification zone de defaut
28 def genereMeshCalculZoneDefaut(facefiss, minSize, maxSize):
30 -Permet de générer un maillage sur l'objet géométrique 'facefiss' via
31 l'algorithme NETGEN_1D2D :
32 -SetMaxSize = dimension max d'un élément (maxSize)
33 -SetSecondOrder = élément quadratique (Y=1, N=0)
34 -SetOptimize = élément régulier (Y=1, N=0)
35 -SetFineness = finesse du maillage
36 [very_coarse, coarse, moderate, fine, very_fine, custom]
38 -SetMinSize = dimension min d'un élément (minSize)
39 -SetQuadAllowed = permission quadrangle dans maillage triangle
40 -On récupère les coordonnées de chaque noeud de la fissure qu'on stocke
41 dans une liste sous la forme : [X0, Y0, Z0, ..., Xn, Yn, Zn]"""
45 meshFissure = smesh.Mesh(facefiss)
46 algo2d = meshFissure.Triangle(algo=smeshBuilder.NETGEN_1D2D)
47 hypo2d = algo2d.Parameters()
48 hypo2d.SetMaxSize( maxSize )
49 hypo2d.SetSecondOrder( 0 )
50 hypo2d.SetOptimize( 1 )
51 hypo2d.SetFineness( 2 )
52 hypo2d.SetMinSize( minSize )
53 hypo2d.SetQuadAllowed( 0 )
54 isDone = meshFissure.Compute()
55 smesh.SetName(algo2d, "algo2d_zoneFiss")
56 smesh.SetName(hypo2d, "hypo1d_zoneFiss")
58 coordsNoeudsFissure = []
59 nodeIds = meshFissure.GetNodesId()
61 coords = meshFissure.GetNodeXYZ(id)
62 coordsNoeudsFissure.append(coords[0])
63 coordsNoeudsFissure.append(coords[1])
64 coordsNoeudsFissure.append(coords[2])
65 return coordsNoeudsFissure