1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2020 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]"""
44 text = "Maillage de '{}'".format(facefiss.GetName())
47 meshFissure = smesh.Mesh(facefiss)
48 algo2d = meshFissure.Triangle(algo=smeshBuilder.NETGEN_1D2D)
49 hypo2d = algo2d.Parameters()
50 hypo2d.SetMaxSize( maxSize )
51 hypo2d.SetSecondOrder( 0 )
52 hypo2d.SetOptimize( 1 )
53 hypo2d.SetFineness( 2 )
54 hypo2d.SetMinSize( minSize )
55 hypo2d.SetQuadAllowed( 0 )
56 smesh.SetName(algo2d, "algo2d_zoneFiss")
57 smesh.SetName(hypo2d, "hypo1d_zoneFiss")
59 is_done = meshFissure.Compute()
60 text = "meshFissure.Compute"
62 logging.info(text+" OK")
64 text = "Erreur au calcul du maillage.\n" + text
68 coordsNoeudsFissure = list()
69 nodeIds = meshFissure.GetNodesId()
71 coords = meshFissure.GetNodeXYZ(id)
72 coordsNoeudsFissure.append(coords[0])
73 coordsNoeudsFissure.append(coords[1])
74 coordsNoeudsFissure.append(coords[2])
78 return coordsNoeudsFissure