--- /dev/null
+# Copyright (C) 2007-2015 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(HOMARD_TEST_FILES
+ test_util.py
+ test_1.pdf
+ test_1.en.pdf
+ test_1.py
+ test_1.00.med
+ test_1.01.med
+ test_1.02.med
+ test_1.apad.03.bilan
+ test_2.pdf
+ test_2.en.pdf
+ test_2.py
+ test_2.00.med
+ test_2.fr.med
+ test_2.apad.03.bilan
+ test_3.pdf
+ test_3.en.pdf
+ test_3.py
+ test_3.00.med
+ test_3.fr.med
+ test_3.apad.02.bilan
+ test_4.pdf
+ test_4.en.pdf
+ test_4.py
+ test_4.apad.03.bilan
+ test_11.py
+ test_11.apad.03.bilan
+ test_12.py
+ test_12.apad.02.bilan
+ test_13.py
+ test_13.apad.02.bilan
+ test_14.py
+ test_14.apad.03.bilan
+ test_15.py
+ test_15.apad.02.bilan
+)
+
+INSTALL(FILES ${HOMARD_TEST_FILES} DESTINATION ${SALOME_HOMARD_INSTALL_RES_DATA})
--- /dev/null
+
+
+ANALYSE DU MAILLAGE
+===================
+
+ Maillage apres adaptation
+ MAILL
+ Date de creation : jeudi 3 avril 2014 a 11 h 45 mn 28 s
+ Dimension : 3
+ Degre : 2
+ C'est un maillage obtenu apres 3 adaptations.
+ Le niveau minimum actif est : 1
+ Le niveau maximum atteint est : 2
+
+ Direction | Unite | Minimum | Maximum
+ ---------------------------------------------------------------
+ X | INCONNUE | 0.0000 | 1.0000
+ Y | INCONNUE | 0.0000 | 1.0000
+ Z | INCONNUE | 0.0000 | 1.0000
+
+
+ NOMBRE D'ENTITES DU CALCUL
+ ==========================
+
+
+ ************************************************************
+ * Noeuds *
+ ************************************************************
+ * Nombre total * 379 *
+ * . dont sommets d'aretes * 67 *
+ * . dont milieux d'aretes * 312 *
+ ************************************************************
+
+ ************************************************************
+ * Mailles-Points *
+ ************************************************************
+ * Nombre total * 2 *
+ ************************************************************
+
+ ************************************************************
+ * Segments *
+ ************************************************************
+ * Nombre total * 2 *
+ * . dont aretes isolees * 0 *
+ * . dont aretes de bord de regions 2D * 0 *
+ * . dont aretes internes aux faces/volumes * 2 *
+ ************************************************************
+
+ ************************************************************
+ * Triangles *
+ ************************************************************
+ * Nombre total * 98 *
+ * . dont triangles de regions 2D * 0 *
+ * . dont triangles de bord * 98 *
+ * . dont triangles internes aux volumes * 0 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 0 *
+ * . du niveau 1 * 22 *
+ * . du niveau 1.5 * 28 *
+ * . du niveau 2 * 48 *
+ ************************************************************
+
+ ************************************************************
+ * Tetraedres *
+ ************************************************************
+ * Nombre total * 197 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 0 *
+ * . du niveau 1 * 13 *
+ * . du niveau 1.5 * 64 *
+ * . du niveau 2 * 120 *
+ ************************************************************
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011-2015 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
+#
+"""
+Python script for HOMARD
+Test test_1
+"""
+__revision__ = "V2.6"
+
+#========================================================================
+Test_Name = "test_1"
+debug=False
+n_iter_test_file = 3
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+pathHomard = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des donnees du test
+Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
+Rep_Test = os.path.normpath(Rep_Test)
+sys.path.append(Rep_Test)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des resultats
+if debug :
+ dircase = os.path.join("/tmp", Test_Name)
+ if ( os.path.isdir(dircase) ) :
+ remove_dir(dircase)
+ os.mkdir(dircase)
+else :
+ dircase = tempfile.mkdtemp()
+# ==================================
+
+salome.salome_init()
+import iparameters
+ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
+ipar.append("AP_MODULES_LIST", "Homard")
+#
+#========================================================================
+#========================================================================
+def homard_exec(theStudy):
+ """
+Python script for HOMARD
+ """
+ error = 0
+#
+ while not error :
+ #
+ homard.SetCurrentStudy(theStudy)
+ #
+ # Creation of the zones
+ # =====================
+ # Creation of the box Zone_1_1
+ Zone_1_1 = homard.CreateZoneBox('Zone_1_1', -0.01, 1.01, -0.01, 0.4, -0.01, 0.6)
+
+ # Creation of the sphere Zone_1_2
+ Zone_1_2 = homard.CreateZoneSphere('Zone_1_2', 0.5, 0.6, 0.7, 0.75)
+ #
+ # Creation of the hypotheses
+ # ==========================
+ dico = {}
+ dico["1"] = "raffinement"
+ dico["-1"] = "deraffinement"
+ # Creation of the hypothesis a10_1pc_de_mailles_a_raffiner_sur_ERRE_ELEM_SIGM
+ HypoName_1 = "a10_1pc_de_mailles_a_raffiner_sur_ERRE_ELEM_SIGM"
+ print "-------- Creation of the hypothesis", HypoName_1
+ Hypo_1_1 = homard.CreateHypothesis(HypoName_1)
+ Hypo_1_1.SetField('RESU____ERRE_ELEM_SIGM__________')
+ Hypo_1_1.SetUseComp(0)
+ Hypo_1_1.AddComp('ERREST')
+ Hypo_1_1.SetRefinThr(3, 10.1)
+ Hypo_1_1.AddFieldInterp('RESU____DEPL____________________')
+ Hypo_1_1.AddFieldInterp('RESU____ERRE_ELEM_SIGM__________')
+ print HypoName_1, " : champ utilisé :", Hypo_1_1.GetFieldName()
+ print HypoName_1, " : composantes utilisées :", Hypo_1_1.GetComps()
+ if ( len (Hypo_1_1.GetFieldName()) > 0 ) :
+ print ".. caractéristiques de l'adaptation :", Hypo_1_1.GetField()
+ print HypoName_1, " : champs interpolés :", Hypo_1_1.GetFieldInterps()
+ # Creation of the hypothesis Zones_1_et_2
+ HypoName_2 = "Zones_1_et_2"
+ print "-------- Creation of the hypothesis", HypoName_2
+ Zones_1_et_2 = homard.CreateHypothesis(HypoName_2)
+ Zones_1_et_2.AddZone('Zone_1_1', 1)
+ Zones_1_et_2.AddZone('Zone_1_2', 1)
+ laux = Zones_1_et_2.GetZones()
+ nbzone = len(laux)/2
+ jaux = 0
+ for iaux in range(nbzone) :
+ print HypoName_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux]
+ jaux += 2
+ print HypoName_2, " : champ utilisé :", Zones_1_et_2.GetFieldName()
+ if ( len (Zones_1_et_2.GetFieldName()) > 0 ) :
+ print ".. caractéristiques de l'adaptation :", Zones_1_et_2.GetField()
+ print HypoName_2, " : champs interpolés :", Zones_1_et_2.GetFieldInterps()
+ #
+ # Creation of the cases
+ # =====================
+ # Creation of the case
+ CaseName = "Case_" + Test_Name
+ print "-------- Creation of the case", CaseName
+ MeshFile = os.path.join(Rep_Test, Test_Name + '.00.med')
+ Case_test_1 = homard.CreateCase(CaseName, 'MAILL', MeshFile)
+ Case_test_1.SetDirName(dircase)
+ #
+ # Creation of the iterations
+ # ==========================
+ # Creation of the iteration 1
+ IterName = "I_" + Test_Name + "_1"
+ print "-------- Creation of the iteration", IterName
+ Iter_test_1_1 = Case_test_1.NextIteration(IterName)
+ Iter_test_1_1.AssociateHypo(HypoName_1)
+ print ". Hypothese :", HypoName_1
+ Iter_test_1_1.SetMeshName('M1')
+ Iter_test_1_1.SetMeshFile(os.path.join(dircase, 'maill.01.med'))
+ Iter_test_1_1.SetFieldFile(os.path.join(Rep_Test, Test_Name + '.00.med'))
+ Iter_test_1_1.SetTimeStepRank(1, 1)
+ Iter_test_1_1.SetFieldInterpTimeStep('RESU____DEPL____________________', 1)
+ Iter_test_1_1.SetFieldInterpTimeStepRank('RESU____ERRE_ELEM_SIGM__________', 1, 1)
+ print ". Instants d'interpolation :", Iter_test_1_1.GetFieldInterpsTimeStepRank()
+ error = Iter_test_1_1.Compute(1, 1)
+ if error :
+ error = 1
+ break
+
+ # Creation of the iteration 2
+ IterName = "I_" + Test_Name + "_2"
+ print "-------- Creation of the iteration", IterName
+ Iter_test_1_2 = Iter_test_1_1.NextIteration(IterName)
+ Iter_test_1_2.AssociateHypo(HypoName_1)
+ print ". Hypothese :", HypoName_1
+ Iter_test_1_2.SetMeshName('M2')
+ Iter_test_1_2.SetMeshFile(os.path.join(dircase, 'maill.02.med'))
+ Iter_test_1_2.SetFieldFile(os.path.join(Rep_Test, Test_Name + '.01.med'))
+ Iter_test_1_2.SetTimeStepRank(1, 1)
+ Iter_test_1_2.SetFieldInterpTimeStep('RESU____DEPL____________________', 1)
+ Iter_test_1_2.SetFieldInterpTimeStepRank('RESU____ERRE_ELEM_SIGM__________', 1, 1)
+ print ". Instants d'interpolation :", Iter_test_1_2.GetFieldInterpsTimeStepRank()
+ error = Iter_test_1_2.Compute(1, 1)
+ if error :
+ error = 2
+ break
+
+ # Creation of the iteration 3
+ IterName = "I_" + Test_Name + "_3"
+ print "-------- Creation of the iteration", IterName
+ Iter_test_1_3 = Iter_test_1_2.NextIteration(IterName)
+ Iter_test_1_3.AssociateHypo(HypoName_2)
+ print ". Hypothese :", HypoName_2
+ Iter_test_1_3.SetMeshName('M3')
+ Iter_test_1_3.SetMeshFile(os.path.join(dircase, 'maill.03.med'))
+ Iter_test_1_2.SetFieldFile(os.path.join(Rep_Test, Test_Name + '.02.med'))
+ print ". Instants d'interpolation :", Iter_test_1_3.GetFieldInterpsTimeStepRank()
+ error = Iter_test_1_3.Compute(1, 1)
+ if error :
+ error = 3
+ break
+ #
+ # Creation of the schema YACS
+ # ===========================
+ ScriptFile = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "en", "_downloads", "yacs_script_test.py")
+ ScriptFile = os.path.normpath(ScriptFile)
+ DirName = dircase
+ YACS_test_1 = Case_test_1.CreateYACSSchema("YACS_test_1", ScriptFile, DirName, MeshFile)
+ error = YACS_test_1.Write()
+ if error :
+ error = 4
+ break
+ #
+ break
+ #
+ return error
+
+#========================================================================
+
+homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+assert homard is not None, "Impossible to load homard engine"
+homard.SetLanguageShort("fr")
+#
+# Exec of HOMARD-SALOME
+#
+try :
+ error_main = homard_exec(salome.myStudy)
+ if error_main :
+ raise Exception('Pb in homard_exec at iteration %d' %error_main )
+except Exception, e:
+ raise Exception('Pb in homard_exec: '+e.message)
+#
+# Test of the results
+#
+n_rep_test_file = n_iter_test_file
+destroy_dir = not debug
+test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
+#
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
+ iparameters.getSession().restoreVisualState(1)
+
--- /dev/null
+
+
+ANALYSE DU MAILLAGE
+===================
+
+ Maillage apres adaptation
+ MAILL
+ Date de creation : jeudi 3 avril 2014 a 13 h 24 mn 23 s
+ Dimension : 3
+ Degre : 2
+ C'est un maillage obtenu apres 3 adaptations.
+ Le niveau minimum actif est : 3
+ Le niveau maximum atteint est : 3
+
+ Direction | Unite | Minimum | Maximum
+ ---------------------------------------------------------------
+ X | INCONNUE | 0.0000 | 1.0000
+ Y | INCONNUE | 0.0000 | 1.0000
+ Z | INCONNUE | 0.0000 | 1.0000
+
+
+ NOMBRE D'ENTITES DU CALCUL
+ ==========================
+
+
+ ************************************************************
+ * Noeuds *
+ ************************************************************
+ * Nombre total * 4913 *
+ * . dont sommets d'aretes * 729 *
+ * . dont milieux d'aretes * 4184 *
+ ************************************************************
+
+ ************************************************************
+ * Mailles-Points *
+ ************************************************************
+ * Nombre total * 2 *
+ ************************************************************
+
+ ************************************************************
+ * Segments *
+ ************************************************************
+ * Nombre total * 8 *
+ * . dont aretes isolees * 0 *
+ * . dont aretes de bord de regions 2D * 0 *
+ * . dont aretes internes aux faces/volumes * 8 *
+ ************************************************************
+
+ ************************************************************
+ * Triangles *
+ ************************************************************
+ * Nombre total * 768 *
+ * . dont triangles de regions 2D * 0 *
+ * . dont triangles de bord * 768 *
+ * . dont triangles internes aux volumes * 0 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 0 *
+ * . du niveau 1 * 0 *
+ * . du niveau 1.5 * 0 *
+ * . du niveau 2 * 0 *
+ * . du niveau 2.5 * 0 *
+ * . du niveau 3 * 768 *
+ ************************************************************
+
+ ************************************************************
+ * Tetraedres *
+ ************************************************************
+ * Nombre total * 3072 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 0 *
+ * . du niveau 1 * 0 *
+ * . du niveau 1.5 * 0 *
+ * . du niveau 2 * 0 *
+ * . du niveau 2.5 * 0 *
+ * . du niveau 3 * 3072 *
+ ************************************************************
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011-2015 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
+#
+"""
+Python script for HOMARD
+Test test_11 associe au tutorial 1
+"""
+__revision__ = "V2.3"
+
+#========================================================================
+Test_Name = "test_11"
+debug=False
+n_iter_test_file = 3
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+pathHomard = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des donnees du test
+Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
+Rep_Test = os.path.normpath(Rep_Test)
+sys.path.append(Rep_Test)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des resultats
+if debug :
+ dircase = os.path.join("/tmp", Test_Name)
+ if ( os.path.isdir(dircase) ) :
+ remove_dir(dircase)
+ os.mkdir(dircase)
+else :
+ dircase = tempfile.mkdtemp()
+# Repertoire des donnees du tutorial
+data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+data_dir = os.path.normpath(data_dir)
+sys.path.append(data_dir)
+from tutorial_util import gzip_gunzip
+# ==================================
+gzip_gunzip(data_dir, 1, -1)
+# ==================================
+
+salome.salome_init()
+import iparameters
+ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
+ipar.append("AP_MODULES_LIST", "Homard")
+#
+#========================================================================
+#========================================================================
+def homard_exec(theStudy):
+ """
+Python script for HOMARD
+ """
+ #
+ homard.SetCurrentStudy(theStudy)
+ #
+ # Hypotheses
+ # ==========
+ Hypo_1 = homard.CreateHypothesis('Hypo_1')
+ Hypo_1.SetUnifRefinUnRef(1)
+ #
+ # Cas
+ # ===
+ Case_1 = homard.CreateCase('Case_1', 'MAILL', data_dir+'/tutorial_1.00.med')
+ Case_1.SetDirName(dircase)
+ #
+ # Iterations
+ # ==========
+ # Iteration "Iter_1_1"
+ Iter_1_1 = Case_1.NextIteration('Iter_1_1')
+ Iter_1_1.SetMeshName('MESH')
+ Iter_1_1.SetMeshFile(dircase+'/maill.01.med')
+ Iter_1_1.AssociateHypo('Hypo_1')
+ error = Iter_1_1.Compute(1, 2)
+
+ # Iteration "Iter_1_2"
+ Iter_1_2 = Iter_1_1.NextIteration('Iter_1_2')
+ Iter_1_2.SetMeshName('MESH')
+ Iter_1_2.SetMeshFile(dircase+'/maill.02.med')
+ Iter_1_2.AssociateHypo('Hypo_1')
+ error = Iter_1_2.Compute(1, 2)
+
+ # Iteration "Iter_1_3"
+ Iter_1_3 = Iter_1_2.NextIteration('Iter_1_3')
+ Iter_1_3.SetMeshName('MESH')
+ Iter_1_3.SetMeshFile(dircase+'/maill.03.med')
+ Iter_1_3.AssociateHypo('Hypo_1')
+ error = Iter_1_3.Compute(1, 2)
+ #
+ return error
+
+#========================================================================
+
+homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+assert homard is not None, "Impossible to load homard engine"
+homard.SetLanguageShort("fr")
+#
+# Exec of HOMARD-SALOME
+#
+try :
+ error_main = homard_exec(salome.myStudy)
+ if error_main :
+ raise Exception('Pb in homard_exec at iteration %d' %error_main )
+except Exception, e:
+ raise Exception('Pb in homard_exec: '+e.message)
+#
+# Test of the results
+#
+n_rep_test_file = n_iter_test_file
+destroy_dir = not debug
+test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
+#
+# ==================================
+gzip_gunzip(data_dir, 1, 1)
+# ==================================
+#
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
+ iparameters.getSession().restoreVisualState(1)
+
--- /dev/null
+
+
+ANALYSE DU MAILLAGE
+===================
+
+ Maillage apres adaptation
+ MZERO
+ Date de creation : jeudi 3 avril 2014 a 13 h 25 mn 10 s
+ Dimension : 3
+ Degre : 2
+ C'est un maillage obtenu apres 2 adaptations.
+ Le niveau minimum actif est : 1
+ Le niveau maximum atteint est : 2
+
+ Direction | Unite | Minimum | Maximum
+ ---------------------------------------------------------------
+ X | INCONNUE | 0.0000 | 1.0000
+ Y | INCONNUE | 0.0000 | 1.0000
+ Z | INCONNUE | 0.0000 | 1.0000
+
+
+ NOMBRE D'ENTITES DU CALCUL
+ ==========================
+
+
+ ************************************************************
+ * Noeuds *
+ ************************************************************
+ * Nombre total * 231 *
+ * . dont sommets d'aretes * 43 *
+ * . dont milieux d'aretes * 188 *
+ ************************************************************
+
+ ************************************************************
+ * Mailles-Points *
+ ************************************************************
+ * Nombre total * 2 *
+ ************************************************************
+
+ ************************************************************
+ * Segments *
+ ************************************************************
+ * Nombre total * 3 *
+ * . dont aretes isolees * 0 *
+ * . dont aretes de bord de regions 2D * 0 *
+ * . dont aretes internes aux faces/volumes * 3 *
+ ************************************************************
+
+ ************************************************************
+ * Triangles *
+ ************************************************************
+ * Nombre total * 66 *
+ * . dont triangles de regions 2D * 0 *
+ * . dont triangles de bord * 66 *
+ * . dont triangles internes aux volumes * 0 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 6 *
+ * . du niveau 1 * 24 *
+ * . du niveau 1.5 * 12 *
+ * . du niveau 2 * 24 *
+ ************************************************************
+
+ ************************************************************
+ * Tetraedres *
+ ************************************************************
+ * Nombre total * 113 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 4 *
+ * . du niveau 1 * 19 *
+ * . du niveau 1.5 * 42 *
+ * . du niveau 2 * 48 *
+ ************************************************************
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011-2015 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
+#
+"""
+Python script for HOMARD
+Test test_12 associe au tutorial 2
+"""
+__revision__ = "V2.3"
+
+#========================================================================
+Test_Name = "test_12"
+debug=False
+n_iter_test_file = 2
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+pathHomard = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des donnees du test
+Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
+Rep_Test = os.path.normpath(Rep_Test)
+sys.path.append(Rep_Test)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des resultats
+if debug :
+ dircase = os.path.join("/tmp", Test_Name)
+ if ( os.path.isdir(dircase) ) :
+ remove_dir(dircase)
+ os.mkdir(dircase)
+else :
+ dircase = tempfile.mkdtemp()
+# Repertoire des donnees du tutorial
+data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+data_dir = os.path.normpath(data_dir)
+sys.path.append(data_dir)
+from tutorial_util import gzip_gunzip
+# ==================================
+gzip_gunzip(data_dir, 2, -1)
+# ==================================
+
+salome.salome_init()
+import iparameters
+ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
+ipar.append("AP_MODULES_LIST", "Homard")
+#
+#========================================================================
+#========================================================================
+def homard_exec(theStudy):
+ """
+Python script for HOMARD
+ """
+ #
+ homard.SetCurrentStudy(theStudy)
+ #
+ # Creation des zones
+ # ==================
+ # Box "Zone_12_0"
+ Zone_12_0 = homard.CreateZoneBox ('Zone_12_0', -0.1, 1.1, -0.1, 1.1, 0.9, 1.1)
+ #
+ # Sphere "Zone_12_1"
+ Zone_12_1 = homard.CreateZoneSphere ('Zone_12_1', 0., 0., 0., 1.05)
+ #
+ # Box "Zone_12_2"
+ Zone_12_2 = homard.CreateZoneBox ('Zone_12_2', -0.1, 0.51, -0.1, 0.51, -0.1, 0.51)
+ #
+ # Hypothese "Hypo_2"
+ # ==================
+ Hypo_2 = homard.CreateHypothesis('Hypo_2')
+ Hypo_2.AddZone('Zone_12_1', 1)
+ Hypo_2.AddZone('Zone_12_0', 1)
+ #
+ # Hypothese "Hypo_2_bis"
+ # ======================
+ Hypo_2_bis = homard.CreateHypothesis('Hypo_2_bis')
+ Hypo_2_bis.AddZone('Zone_12_0', -1)
+ Hypo_2_bis.AddZone('Zone_12_2', 1)
+ #
+ # Cas
+ # ===
+ Case_2 = homard.CreateCase('Case_2', 'MZERO', data_dir+'/tutorial_2.00.med')
+ Case_2.SetDirName(dircase)
+ #
+ # Iteration "Iter_2_1"
+ # ====================
+ Iter_2_1 = Case_2.NextIteration('Iter_2_1')
+ Iter_2_1.SetMeshName('M_1')
+ Iter_2_1.SetMeshFile(dircase+'/maill.01.med')
+ Iter_2_1.AssociateHypo('Hypo_2')
+ error = Iter_2_1.Compute(1, 2)
+ #
+ # Iteration "Iter_2_2"
+ # ====================
+ Iter_2_2 = Iter_2_1.NextIteration('Iter_2_2')
+ Iter_2_2.SetMeshName('M_2')
+ Iter_2_2.SetMeshFile(dircase+'/maill.02.med')
+ Iter_2_2.AssociateHypo('Hypo_2_bis')
+ error = Iter_2_2.Compute(1, 2)
+ #
+ return error
+
+#========================================================================
+
+homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+assert homard is not None, "Impossible to load homard engine"
+homard.SetLanguageShort("fr")
+#
+# Exec of HOMARD-SALOME
+#
+try :
+ error_main = homard_exec(salome.myStudy)
+ if error_main :
+ raise Exception('Pb in homard_exec at iteration %d' %error_main )
+except Exception, e:
+ raise Exception('Pb in homard_exec: '+e.message)
+#
+# Test of the results
+#
+n_rep_test_file = n_iter_test_file
+destroy_dir = not debug
+test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
+#
+# ==================================
+gzip_gunzip(data_dir, 2, 1)
+# ==================================
+#
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
+ iparameters.getSession().restoreVisualState(1)
+
--- /dev/null
+
+
+ANALYSE DU MAILLAGE
+===================
+
+ Maillage apres adaptation
+ G_0
+ Date de creation : lundi 2 novembre 2015 a 9 h 14 mn 1 s
+ Dimension : 3
+ Degre : 2
+ C'est un maillage obtenu apres 2 adaptations.
+ Le niveau minimum actif est : 0
+ Le niveau maximum atteint est : 2
+
+ Direction | Unite | Minimum | Maximum
+ ---------------------------------------------------------------
+ X | INCONNUE | 0.0000 | 0.60000
+ Y | INCONNUE | 0.0000 | 0.30000
+ Z | INCONNUE | 0.0000 | 0.20000
+
+
+ NOMBRE D'ENTITES DU CALCUL
+ ==========================
+
+
+ ************************************************************
+ * Noeuds *
+ ************************************************************
+ * Nombre total * 14455 *
+ * . dont sommets d'aretes * 3839 *
+ * . dont milieux d'aretes * 10616 *
+ ************************************************************
+
+ ************************************************************
+ * Segments *
+ ************************************************************
+ * Nombre total * 764 *
+ * . dont aretes isolees * 0 *
+ * . dont aretes de bord de regions 2D * 0 *
+ * . dont aretes internes aux faces/volumes * 764 *
+ ************************************************************
+
+ ************************************************************
+ * Triangles *
+ ************************************************************
+ * Nombre total * 288 *
+ * . dont triangles de regions 2D * 288 *
+ * . dont triangles de bord * 0 *
+ * . dont triangles internes aux volumes * 0 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 168 *
+ * . du niveau 1 * 0 *
+ * . du niveau 1.5 * 120 *
+ ************************************************************
+
+ ************************************************************
+ * Quadrangles *
+ ************************************************************
+ * Nombre total * 2534 *
+ * . dont quadrangles de regions 2D * 0 *
+ * . dont quadrangles de bord * 2534 *
+ * . dont quadrangles internes aux volumes * 0 *
+ ************************************************************
+ * . du niveau 0 * 142 *
+ * . du niveau 0.5 * 0 *
+ * . du niveau 1 * 2296 *
+ * . du niveau 1.5 * 0 *
+ * . du niveau 2 * 96 *
+ ************************************************************
+
+ ************************************************************
+ * Tetraedres *
+ ************************************************************
+ * Nombre total * 256 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 96 *
+ * . du niveau 1 * 0 *
+ * . du niveau 1.5 * 160 *
+ ************************************************************
+
+ ************************************************************
+ * Hexaedres *
+ ************************************************************
+ * Nombre total * 2230 *
+ ************************************************************
+ * . du niveau 0 * 66 *
+ * . du niveau 0.5 * 0 *
+ * . du niveau 1 * 1972 *
+ * . du niveau 1.5 * 0 *
+ * . du niveau 2 * 192 *
+ ************************************************************
+
+ ************************************************************
+ * Pyramides *
+ ************************************************************
+ * Nombre total * 432 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 120 *
+ * . du niveau 1 * 0 *
+ * . du niveau 1.5 * 312 *
+ ************************************************************
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011-2015 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
+#
+"""
+Python script for HOMARD
+Test test_13 associe au tutorial 3
+"""
+__revision__ = "V2.3"
+
+#========================================================================
+Test_Name = "test_13"
+debug=False
+n_iter_test_file = 2
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+pathHomard = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des donnees du test
+Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
+Rep_Test = os.path.normpath(Rep_Test)
+sys.path.append(Rep_Test)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des resultats
+if debug :
+ dircase = os.path.join("/tmp", Test_Name)
+ if ( os.path.isdir(dircase) ) :
+ remove_dir(dircase)
+ os.mkdir(dircase)
+else :
+ dircase = tempfile.mkdtemp()
+# Repertoire des donnees du tutorial
+data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+data_dir = os.path.normpath(data_dir)
+sys.path.append(data_dir)
+from tutorial_util import gzip_gunzip
+# ==================================
+gzip_gunzip(data_dir, 3, -1)
+# ==================================
+
+salome.salome_init()
+import iparameters
+ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
+ipar.append("AP_MODULES_LIST", "Homard")
+#
+#========================================================================
+#========================================================================
+def homard_exec(theStudy):
+ """
+Python script for HOMARD
+ """
+ #
+ homard.SetCurrentStudy(theStudy)
+ #
+ # Hypothese "Hypo_0vers1"
+ # =======================
+ Hypo_0vers1 = homard.CreateHypothesis('Hypo_0vers1')
+ # Characterization of the field
+ Hypo_0vers1.SetField('SOLU_0__QIRE_ELEM_SIGM__________')
+ Hypo_0vers1.SetUseComp(0)
+ Hypo_0vers1.AddComp('ERREST ')
+ Hypo_0vers1.SetRefinThr(3, 1.0)
+ Hypo_0vers1.SetTypeFieldInterp(2)
+ Hypo_0vers1.AddFieldInterp('SOLU_0__DEPL____________________')
+ Hypo_0vers1.AddFieldInterp('SOLU_0__ERRE_ELEM_SIGM__________')
+ #
+ # Hypothese "Hypo_1vers2"
+ # =======================
+ Hypo_1vers2 = homard.CreateHypothesis('Hypo_1vers2')
+ # Characterization of the field
+ Hypo_1vers2.SetField('SOLU_1__QIRE_ELEM_SIGM__________')
+ Hypo_1vers2.SetUseComp(0)
+ Hypo_1vers2.AddComp('ERREST ')
+ Hypo_1vers2.SetRefinThr(3, 1.5)
+ Hypo_1vers2.SetUnRefThr(3, 6.)
+ Hypo_1vers2.SetTypeFieldInterp(2)
+ Hypo_1vers2.AddFieldInterp('SOLU_1__DEPL____________________')
+ Hypo_1vers2.AddFieldInterp('SOLU_1__QIRE_ELEM_SIGM__________')
+ #
+ # Hypothese "Hypo_1vers2_bis"
+ # ===========================
+ Hypo_1vers2_bis = homard.CreateHypothesis('Hypo_1vers2_bis')
+ # Characterization of the field
+ Hypo_1vers2_bis.SetField('SOLU_1__DEPL____________________')
+ Hypo_1vers2_bis.SetUseComp(1)
+ Hypo_1vers2_bis.AddComp('DX')
+ Hypo_1vers2_bis.AddComp('DY')
+ Hypo_1vers2_bis.AddComp('DZ')
+ Hypo_1vers2_bis.SetRefinThr(1, 0.0001)
+ Hypo_1vers2_bis.SetUnRefThr(1, 0.000001)
+ Hypo_1vers2_bis.SetTypeFieldInterp(0)
+ #
+ # Cas
+ # ===
+ Case_3 = homard.CreateCase('Case_3', 'G_0', data_dir+'/tutorial_3.00.med')
+ Case_3.SetDirName(dircase)
+ #
+ # Iteration "Iter_3_1"
+ # ====================
+ Iter_3_1 = Case_3.NextIteration('Iter_3_1')
+ Iter_3_1.SetMeshName('H_1')
+ Iter_3_1.SetMeshFile(dircase+'/maill.01.med')
+ Iter_3_1.SetFieldFile(data_dir+'/tutorial_3.00.med')
+ Iter_3_1.SetTimeStepRank( 1, 1)
+ Iter_3_1.AssociateHypo('Hypo_0vers1')
+ error = Iter_3_1.Compute(1, 2)
+ #
+ # Iteration "Iter_3_2"
+ # ====================
+ Iter_3_2 = Iter_3_1.NextIteration('Iter_3_2')
+ Iter_3_2.SetMeshName('H_2')
+ Iter_3_2.SetMeshFile(dircase+'/maill.02.med')
+ Iter_3_2.SetFieldFile(data_dir+'/tutorial_3.01.med')
+ Iter_3_2.SetTimeStepRank(1, 1)
+ Iter_3_2.AssociateHypo('Hypo_1vers2')
+ error = Iter_3_2.Compute(1, 2)
+ #
+ # Iteration "Iter_3_2_bis"
+ # ========================
+ Iter_3_2_bis = Iter_3_1.NextIteration('Iter_3_2_bis')
+ Iter_3_2_bis.SetMeshName('H_2_bis')
+ Iter_3_2_bis.SetMeshFile(dircase+'/maill.02.bis.med')
+ Iter_3_2_bis.SetFieldFile(data_dir+'/tutorial_3.01.med')
+ Iter_3_2_bis.SetTimeStepRank(1, 1)
+ Iter_3_2_bis.AssociateHypo('Hypo_1vers2_bis')
+ error = Iter_3_2_bis.Compute(1, 2)
+ #
+ return error
+
+#========================================================================
+
+homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+assert homard is not None, "Impossible to load homard engine"
+homard.SetLanguageShort("fr")
+#
+# Exec of HOMARD-SALOME
+#
+try :
+ error_main = homard_exec(salome.myStudy)
+ if error_main :
+ raise Exception('Pb in homard_exec at iteration %d' %error_main )
+except Exception, e:
+ raise Exception('Pb in homard_exec: '+e.message)
+#
+# Test of the results
+#
+n_rep_test_file = 3
+destroy_dir = not debug
+test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
+#
+# ==================================
+gzip_gunzip(data_dir, 3, 1)
+# ==================================
+#
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
+ iparameters.getSession().restoreVisualState(1)
+
--- /dev/null
+
+
+ANALYSE DU MAILLAGE
+===================
+
+ Maillage apres adaptation
+ PIQUAGE
+ Date de creation : lundi 2 novembre 2015 a 9 h 13 mn 13 s
+ Dimension : 3
+ Degre : 1
+ C'est un maillage obtenu apres 3 adaptations.
+ Le niveau minimum actif est : 1
+ Le niveau maximum atteint est : 2
+
+ Direction | Unite | Minimum | Maximum
+ ---------------------------------------------------------------
+ | | -230.00 | 136.45
+ | | -250.62 | 189.69
+ | | -285.21 | 155.03
+
+
+ NOMBRE D'ENTITES DU CALCUL
+ ==========================
+
+
+ ************************************************************
+ * Noeuds *
+ ************************************************************
+ * Nombre total * 12825 *
+ ************************************************************
+
+ ************************************************************
+ * Segments *
+ ************************************************************
+ * Nombre total * 758 *
+ * . dont aretes isolees * 0 *
+ * . dont aretes de bord de regions 2D * 0 *
+ * . dont aretes internes aux faces/volumes * 758 *
+ ************************************************************
+
+ ************************************************************
+ * Triangles *
+ ************************************************************
+ * Nombre total * 20838 *
+ * . dont triangles de regions 2D * 0 *
+ * . dont triangles de bord * 20560 *
+ * . dont triangles internes aux volumes * 278 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 0 *
+ * . du niveau 1 * 3530 *
+ * . du niveau 1.5 * 380 *
+ * . du niveau 2 * 16928 *
+ ************************************************************
+
+ ************************************************************
+ * Tetraedres *
+ ************************************************************
+ * Nombre total * 43490 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 0 *
+ * . du niveau 1 * 18174 *
+ * . du niveau 1.5 * 25316 *
+ ************************************************************
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011-2015 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
+#
+"""
+Python script for HOMARD
+Test test_14 associe au tutorial 4
+"""
+__revision__ = "V2.3"
+
+#========================================================================
+Test_Name = "test_14"
+debug=False
+n_iter_test_file = 3
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+pathHomard = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des donnees du test
+Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
+Rep_Test = os.path.normpath(Rep_Test)
+sys.path.append(Rep_Test)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des resultats
+if debug :
+ dircase = os.path.join("/tmp", Test_Name)
+ if ( os.path.isdir(dircase) ) :
+ remove_dir(dircase)
+ os.mkdir(dircase)
+else :
+ dircase = tempfile.mkdtemp()
+# Repertoire des donnees du tutorial
+data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+data_dir = os.path.normpath(data_dir)
+sys.path.append(data_dir)
+from tutorial_util import gzip_gunzip
+# ==================================
+gzip_gunzip(data_dir, 4, -1)
+# ==================================
+
+salome.salome_init()
+import iparameters
+ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
+ipar.append("AP_MODULES_LIST", "Homard")
+#
+#========================================================================
+#========================================================================
+def homard_exec(theStudy):
+ """
+Python script for HOMARD
+ """
+ #
+ homard.SetCurrentStudy(theStudy)
+#
+ # Frontieres
+ # ==========
+ Boun_4_1 = homard.CreateBoundaryDi('intersection', 'PIQUAGE', data_dir+'/tutorial_4.fr.med')
+ #
+ Boun_4_2 = homard.CreateBoundaryCylinder('cyl_1_ext', 0.0, 25., -25., 25., 50., 75., 100.)
+ #
+ Boun_4_3 = homard.CreateBoundaryCylinder('cyl_2_ext', 17.5, -2.5, -12.5, -100., -75., -25., 50.)
+ #
+ Boun_4_4 = homard.CreateBoundaryCylinder('cyl_1_int', 0.0, 25., -25., 25., 50., 75., 75.)
+ #
+ Boun_4_5 = homard.CreateBoundaryCylinder('cyl_2_int', 17.5, -2.5, -12.5, -100., -75., -25., 25.)
+ #
+ # Hypotheses
+ # ==========
+ # Creation of the hypothesis Hypo_4
+ Hypo_4 = homard.CreateHypothesis('Hypo_4')
+ Hypo_4.SetUnifRefinUnRef(1)
+ Hypo_4.AddGroup('T1_INT_I')
+ Hypo_4.AddGroup('T1_INT_O')
+ Hypo_4.AddGroup('T2_INT')
+ # Creation of the hypothesis Hypo_4_bis
+ Hypo_4_bis = homard.CreateHypothesis('Hypo_4_bis')
+ Hypo_4_bis.SetUnifRefinUnRef(1)
+ Hypo_4_bis.AddGroup('T1_EXT_I')
+ Hypo_4_bis.AddGroup('T1_EXT_O')
+ Hypo_4_bis.AddGroup('T2_EXT')
+ #
+ # Cas
+ # ===
+ Case_4 = homard.CreateCase('Case_4', 'PIQUAGE', data_dir+'/tutorial_4.00.med')
+ Case_4.SetDirName(dircase)
+ Case_4.AddBoundaryGroup( 'intersection', '' )
+ Case_4.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_I' )
+ Case_4.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_I' )
+ Case_4.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_O' )
+ Case_4.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_O' )
+ Case_4.AddBoundaryGroup( 'cyl_2_int', 'T2_INT' )
+ Case_4.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' )
+ #
+ # Iterations
+ # ==========
+ # Iteration Iter_4_1 : raffinement selon les faces internes
+ Iter_4_1 = Case_4.NextIteration('Iter_4_1')
+ Iter_4_1.SetMeshName('PIQUAGE_1')
+ Iter_4_1.SetMeshFile(dircase+'/maill.01.med')
+ Iter_4_1.AssociateHypo('Hypo_4')
+ error = Iter_4_1.Compute(1, 2)
+ # Iteration Iter_4_2 : raffinement selon les faces externes
+ Iter_4_2 = Iter_4_1.NextIteration('Iter_4_2')
+ Iter_4_2.SetMeshName('PIQUAGE_2')
+ Iter_4_2.SetMeshFile(dircase+'/maill.02.med')
+ Iter_4_2.AssociateHypo('Hypo_4_bis')
+ error = Iter_4_2.Compute(1, 2)
+ # Iteration Iter_4_3 : second raffinement selon les faces externes
+ Iter_4_3 = Iter_4_2.NextIteration('Iter_4_3')
+ Iter_4_3.SetMeshName('PIQUAGE_3')
+ Iter_4_3.SetMeshFile(dircase+'/maill.03.med')
+ Iter_4_3.AssociateHypo('Hypo_4_bis')
+ error = Iter_4_3.Compute(1, 2)
+ #
+ return error
+
+#========================================================================
+
+homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+assert homard is not None, "Impossible to load homard engine"
+homard.SetLanguageShort("fr")
+#
+# Exec of HOMARD-SALOME
+#
+try :
+ error_main = homard_exec(salome.myStudy)
+ if error_main :
+ raise Exception('Pb in homard_exec at iteration %d' %error_main )
+except Exception, e:
+ raise Exception('Pb in homard_exec: '+e.message)
+#
+# Test of the results
+#
+n_rep_test_file = n_iter_test_file
+destroy_dir = not debug
+test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
+#
+# ==================================
+gzip_gunzip(data_dir, 4, 1)
+# ==================================
+#
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
+ iparameters.getSession().restoreVisualState(1)
+
--- /dev/null
+
+
+ANALYSE DU MAILLAGE
+===================
+
+ Maillage apres adaptation
+ COEUR_2D
+ Date de creation : mardi 24 novembre 2015 a 9 h 33 mn 8 s
+ Dimension : 2
+ Degre : 1
+ C'est un maillage obtenu apres 2 adaptations.
+ Le niveau minimum actif est : 0
+ Le niveau maximum atteint est : 2
+
+ Direction | Unite | Minimum | Maximum
+ ---------------------------------------------------------------
+ | | -248.00 | 248.00
+ | | -248.00 | 248.00
+
+
+ NOMBRE D'ENTITES DU CALCUL
+ ==========================
+
+
+ ************************************************************
+ * Noeuds *
+ ************************************************************
+ * Nombre total * 1542 *
+ ************************************************************
+
+ ************************************************************
+ * Segments *
+ ************************************************************
+ * Nombre total * 418 *
+ * . dont aretes isolees * 0 *
+ * . dont aretes de bord de regions 2D * 300 *
+ * . dont aretes internes aux faces/volumes * 118 *
+ ************************************************************
+
+ ************************************************************
+ * Triangles *
+ ************************************************************
+ * Nombre total * 2204 *
+ ************************************************************
+ * . du niveau 0 * 88 *
+ * . du niveau 1 * 980 *
+ * . du niveau 2 * 1136 *
+ ************************************************************
+
+ ************************************************************
+ * Quadrangles *
+ ************************************************************
+ * Nombre total * 334 *
+ ************************************************************
+ * . du niveau 0 * 162 *
+ * . du niveau 1 * 172 *
+ ************************************************************
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011-2015 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
+#
+"""
+Python script for HOMARD
+Test test_15 associe au tutorial 5
+"""
+__revision__ = "V2.3"
+
+#========================================================================
+Test_Name = "test_15"
+debug=False
+n_iter_test_file = 2
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+pathHomard = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des donnees du test
+Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
+Rep_Test = os.path.normpath(Rep_Test)
+sys.path.append(Rep_Test)
+sys.path.append(Rep_Test)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des resultats
+if debug :
+ dircase = os.path.join("/tmp", Test_Name)
+ if ( os.path.isdir(dircase) ) :
+ remove_dir(dircase)
+ os.mkdir(dircase)
+else :
+ dircase = tempfile.mkdtemp()
+# Repertoire des donnees du tutorial
+data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+data_dir = os.path.normpath(data_dir)
+sys.path.append(data_dir)
+from tutorial_util import gzip_gunzip
+# ==================================
+gzip_gunzip(data_dir, 5, -1)
+# ==================================
+
+salome.salome_init()
+import iparameters
+ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
+ipar.append("AP_MODULES_LIST", "Homard")
+#
+#========================================================================
+#========================================================================
+def homard_exec(theStudy):
+ """
+Python script for HOMARD
+ """
+ #
+ homard.SetCurrentStudy(theStudy)
+#
+ # Frontiere
+ # =========
+ # Creation of the discrete boundary Boun_5_1
+ Boun_5_1 = homard.CreateBoundaryDi('Boun_5_1', 'MAIL_EXT', data_dir+'/tutorial_5.fr.med')
+ #
+ # Creation des zones
+ # ==================
+ # Creation of the disk with hole enveloppe
+ enveloppe = homard.CreateZoneDiskWithHole( 'enveloppe', 0., 0., 250., 193., 1 )
+ # Creation of the rectangle quart_sup
+ quart_sup = homard.CreateZoneBox2D( 'quart_sup', 0., 250., 0., 250., 1 )
+ #
+ # Hypotheses
+ # ==========
+ # Creation of the hypothesis Hypo_5
+ Hypo_5 = homard.CreateHypothesis('Hypo_5')
+ Hypo_5.AddZone('enveloppe', 1)
+ # Creation of the hypothesis Hypo_5_bis
+ Hypo_5_bis = homard.CreateHypothesis('Hypo_5_bis')
+ Hypo_5_bis.AddZone('quart_sup', 1)
+ #
+ # Cas
+ # ===
+ Case_5 = homard.CreateCase('Case_5', 'COEUR_2D', data_dir+'/tutorial_5.00.med')
+ Case_5.SetDirName(dircase)
+ Case_5.SetConfType(1)
+ Case_5.AddBoundaryGroup('Boun_5_1', '')
+ #
+ # Iteration "Iter_5_1"
+ # ====================
+ Iter_5_1 = Case_5.NextIteration('Iter_5_1')
+ Iter_5_1.SetMeshName('COEUR_2D_01')
+ Iter_5_1.SetMeshFile(dircase+'/maill.01.med')
+ Iter_5_1.AssociateHypo('Hypo_5')
+ error = Iter_5_1.Compute(1, 2)
+ #
+ # Iteration "Iter_5_2"
+ # ====================
+ Iter_5_2 = Iter_5_1.NextIteration('Iter_5_2')
+ Iter_5_2.SetMeshName('COEUR_2D_02')
+ Iter_5_2.SetMeshFile(dircase+'/maill.02.med')
+ Iter_5_2.AssociateHypo('Hypo_5_bis')
+ error = Iter_5_2.Compute(1, 2)
+ #
+ return error
+
+#========================================================================
+
+homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+assert homard is not None, "Impossible to load homard engine"
+homard.SetLanguageShort("fr")
+#
+# Exec of HOMARD-SALOME
+#
+try :
+ error_main = homard_exec(salome.myStudy)
+ if error_main :
+ raise Exception('Pb in homard_exec at iteration %d' %error_main )
+except Exception, e:
+ raise Exception('Pb in homard_exec: '+e.message)
+#
+# Test of the results
+#
+n_rep_test_file = n_iter_test_file
+destroy_dir = not debug
+test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
+#
+# ==================================
+gzip_gunzip(data_dir, 5, 1)
+# ==================================
+#
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
+ iparameters.getSession().restoreVisualState(1)
+
--- /dev/null
+
+
+ANALYSE DU MAILLAGE
+===================
+
+ Maillage apres adaptation
+ PLAQUE_0
+ Date de creation : jeudi 3 avril 2014 a 13 h 21 mn 21 s
+ Dimension : 3
+ Degre : 2
+ C'est un maillage obtenu apres 3 adaptations.
+ Le niveau minimum actif est : 0
+ Le niveau maximum atteint est : 2
+
+ Direction | Unite | Minimum | Maximum
+ ---------------------------------------------------------------
+ X | INCONNUE |-0.40000E-01| 0.40000E-01
+ Y | INCONNUE |-0.30000E-01| 0.30000E-01
+ Z | INCONNUE |-0.30854E-01| 0.30854E-01
+
+
+ NOMBRE D'ENTITES DU CALCUL
+ ==========================
+
+
+ ************************************************************
+ * Noeuds *
+ ************************************************************
+ * Nombre total * 1212 *
+ * . dont sommets d'aretes * 317 *
+ * . dont milieux d'aretes * 895 *
+ ************************************************************
+
+ ************************************************************
+ * Segments *
+ ************************************************************
+ * Nombre total * 101 *
+ * . dont aretes isolees * 0 *
+ * . dont aretes de bord de regions 2D * 53 *
+ * . dont aretes internes aux faces/volumes * 48 *
+ ************************************************************
+
+ ************************************************************
+ * Triangles *
+ ************************************************************
+ * Nombre total * 579 *
+ ************************************************************
+ * . du niveau 0 * 33 *
+ * . du niveau 0.5 * 14 *
+ * . du niveau 1 * 148 *
+ * . du niveau 1.5 * 48 *
+ * . du niveau 2 * 336 *
+ ************************************************************
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011-2015 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
+#
+"""
+Python script for HOMARD
+Test test_2
+"""
+__revision__ = "V2.5"
+
+#========================================================================
+Test_Name = "test_2"
+debug=False
+n_iter_test_file = 3
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+pathHomard = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des donnees du test
+Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
+Rep_Test = os.path.normpath(Rep_Test)
+sys.path.append(Rep_Test)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des resultats
+if debug :
+ dircase = os.path.join("/tmp", Test_Name)
+ if ( os.path.isdir(dircase) ) :
+ remove_dir(dircase)
+ os.mkdir(dircase)
+else :
+ dircase = tempfile.mkdtemp()
+# ==================================
+
+salome.salome_init()
+import iparameters
+ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
+ipar.append("AP_MODULES_LIST", "Homard")
+#
+#========================================================================
+#========================================================================
+def homard_exec(theStudy):
+ """
+Python script for HOMARD
+ """
+ error = 0
+#
+ while not error :
+ #
+ homard.SetCurrentStudy(theStudy)
+ #
+ # Creation of the boundaries
+ # ==========================
+ # Creation of the discrete boundary Boundary_1
+ Boundary_1 = homard.CreateBoundaryDi('internal_boundary', 'plaque', os.path.join(Rep_Test, Test_Name + '.fr.med'))
+ #
+ # Creation of the hypotheses
+ # ==========================
+ # Creation of the hypothesis 1
+ HypoName_1 = "Hypo_" + Test_Name + "_1"
+ print "-------- Creation of the hypothesis", HypoName_1
+ Hypo_test_2_1 = homard.CreateHypothesis(HypoName_1)
+ Hypo_test_2_1.SetUnifRefinUnRef(1)
+ Hypo_test_2_1.AddGroup('EG')
+ Hypo_test_2_1.AddGroup('BANDE')
+ print HypoName_1, " : zones utilisées :", Hypo_test_2_1.GetZones()
+ print HypoName_1, " : champ utilisé :", Hypo_test_2_1.GetFieldName()
+ print HypoName_1, " : composantes utilisées :", Hypo_test_2_1.GetComps()
+ if ( len (Hypo_test_2_1.GetFieldName()) > 0 ) :
+ print ".. caractéristiques de l'adaptation :", Hypo_test_2_1.GetField()
+
+ # Creation of the hypothesis 2
+ HypoName_2 = "Hypo_" + Test_Name + "_2"
+ print "-------- Creation of the hypothesis", HypoName_2
+ Hypo_test_2_2 = homard.CreateHypothesis(HypoName_2)
+ Hypo_test_2_2.SetUnifRefinUnRef(1)
+ Hypo_test_2_2.AddGroup('M_D')
+ print HypoName_2, " : zones utilisées :", Hypo_test_2_2.GetZones()
+ print HypoName_2, " : champ utilisé :", Hypo_test_2_2.GetFieldName()
+ print HypoName_2, " : composantes utilisées :", Hypo_test_2_2.GetComps()
+ if ( len (Hypo_test_2_2.GetFieldName()) > 0 ) :
+ print ".. caractéristiques de l'adaptation :", Hypo_test_2_2.GetField()
+ #
+ # Creation of the cases
+ # =====================
+ # Creation of the case
+ CaseName = "Case_" + Test_Name
+ MeshFile = os.path.join(Rep_Test, Test_Name + '.00.med')
+ Case_test_2 = homard.CreateCase(CaseName, 'PLAQUE_0', MeshFile)
+ Case_test_2.SetDirName(dircase)
+ Case_test_2.AddBoundaryGroup('internal_boundary', '')
+ #
+ # Creation of the iterations
+ # ==========================
+ # Creation of the iteration 1
+ IterName = "I_" + Test_Name + "_1"
+ Iter_test_2_1 = Case_test_2.NextIteration(IterName)
+ Iter_test_2_1.SetMeshName('PLAQUE_1')
+ Iter_test_2_1.SetMeshFile(os.path.join(dircase, 'maill.01.med'))
+ Iter_test_2_1.AssociateHypo(HypoName_1)
+ error = Iter_test_2_1.Compute(1, 1)
+ if error :
+ error = 1
+ break
+
+ # Creation of the iteration 2
+ IterName = "I_" + Test_Name + "_2"
+ Iter_test_2_2 = Iter_test_2_1.NextIteration(IterName)
+ Iter_test_2_2.SetMeshName('PLAQUE_2')
+ Iter_test_2_2.SetMeshFile(os.path.join(dircase, 'maill.02.med'))
+ Iter_test_2_2.AssociateHypo(HypoName_1)
+ error = Iter_test_2_2.Compute(1, 1)
+ if error :
+ error = 2
+ break
+
+ # Creation of the iteration 3
+ IterName = "I_" + Test_Name + "_3"
+ Iter_test_2_3 = Iter_test_2_2.NextIteration(IterName)
+ Iter_test_2_3.SetMeshName('PLAQUE_3')
+ Iter_test_2_3.SetMeshFile(os.path.join(dircase, 'maill.03.med'))
+ Iter_test_2_3.AssociateHypo(HypoName_2)
+ error = Iter_test_2_3.Compute(1, 1)
+ if error :
+ error = 3
+ break
+ #
+ # Creation of the schema YACS
+ # ===========================
+ ScriptFile = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "en", "_downloads", "yacs_script_test.py")
+ ScriptFile = os.path.normpath(ScriptFile)
+ DirName = dircase
+ YACS_test_2 = Case_test_2.CreateYACSSchema("YACS_test_2", ScriptFile, DirName, MeshFile)
+ YACS_test_2.SetMaxIter(4)
+ YACS_test_2.SetType(1)
+ filexml = os.path.join(dircase, 'YACS_test_2.xml')
+ error = YACS_test_2.WriteOnFile(filexml)
+ if error :
+ error = 4
+ break
+ #
+ break
+ #
+ return error
+
+#========================================================================
+
+homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+assert homard is not None, "Impossible to load homard engine"
+homard.SetLanguageShort("fr")
+#
+# Exec of HOMARD-SALOME
+#
+try :
+ error_main = homard_exec(salome.myStudy)
+ if error_main :
+ raise Exception('Pb in homard_exec at iteration %d' %error_main )
+except Exception, e:
+ raise Exception('Pb in homard_exec: '+e.message)
+#
+# Test of the results
+#
+n_rep_test_file = n_iter_test_file
+destroy_dir = not debug
+test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
+#
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
+ iparameters.getSession().restoreVisualState(1)
+
--- /dev/null
+
+
+ANALYSE DU MAILLAGE
+===================
+
+ Maillage apres adaptation
+ MOYEU
+ Date de creation : jeudi 3 avril 2014 a 13 h 22 mn 30 s
+ Dimension : 3
+ Degre : 1
+ C'est un maillage obtenu apres 2 adaptations.
+ Le niveau minimum actif est : 2
+ Le niveau maximum atteint est : 2
+
+ Direction | Unite | Minimum | Maximum
+ ---------------------------------------------------------------
+ x | m | -36.603 | 536.60
+ y | m | -75.000 | 125.00
+ z | m | -125.00 | 75.000
+
+
+ NOMBRE D'ENTITES DU CALCUL
+ ==========================
+
+
+ ************************************************************
+ * Noeuds *
+ ************************************************************
+ * Nombre total * 3710 *
+ ************************************************************
+
+ ************************************************************
+ * Segments *
+ ************************************************************
+ * Nombre total * 156 *
+ * . dont aretes isolees * 0 *
+ * . dont aretes de bord de regions 2D * 0 *
+ * . dont aretes internes aux faces/volumes * 156 *
+ ************************************************************
+
+ ************************************************************
+ * Triangles *
+ ************************************************************
+ * Nombre total * 3232 *
+ * . dont triangles de regions 2D * 0 *
+ * . dont triangles de bord * 3232 *
+ * . dont triangles internes aux volumes * 0 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 0 *
+ * . du niveau 1 * 0 *
+ * . du niveau 1.5 * 0 *
+ * . du niveau 2 * 3232 *
+ ************************************************************
+
+ ************************************************************
+ * Tetraedres *
+ ************************************************************
+ * Nombre total * 17280 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 0 *
+ * . du niveau 1 * 0 *
+ * . du niveau 1.5 * 0 *
+ * . du niveau 2 * 17280 *
+ ************************************************************
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011-2015 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
+#
+"""
+Python script for HOMARD
+Test test_3
+"""
+__revision__ = "V2.4"
+
+#========================================================================
+Test_Name = "test_3"
+debug=False
+n_boucle = 2
+n_iter_test_file = 2
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+pathHomard = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des donnees du test
+Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
+Rep_Test = os.path.normpath(Rep_Test)
+sys.path.append(Rep_Test)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des resultats
+if debug :
+ dircase = os.path.join("/tmp", Test_Name)
+ if ( os.path.isdir(dircase) ) :
+ remove_dir(dircase)
+ os.mkdir(dircase)
+else :
+ dircase = tempfile.mkdtemp()
+# ==================================
+
+salome.salome_init()
+import iparameters
+ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
+ipar.append("AP_MODULES_LIST", "Homard")
+#
+#========================================================================
+#========================================================================
+def homard_exec(theStudy):
+ """
+Python script for HOMARD
+ """
+ error = 0
+#
+ while not error :
+#
+ homard.SetCurrentStudy(theStudy)
+ #
+ # Creation of the boundaries
+ # ==========================
+ # Creation of the discrete boundary
+ Boundary_3_1 = homard.CreateBoundaryDi('courbes', 'COURBES', os.path.join(Rep_Test, Test_Name + '.fr.med'))
+ #
+ # Creation of the external cylinder
+ Boundary_3_2 = homard.CreateBoundaryCylinder('cyl_ext', 50.0, 25., -25., 1., 0., 0., 100.)
+ #
+ # Creation of the internal cylinder
+ Boundary_3_3 = homard.CreateBoundaryCylinder('cyl_int', 50.0, 25., -25., 1., 0., 0., 50.)
+ #
+ # Creation of the first sphere
+ Boundary_3_4 = homard.CreateBoundarySphere('sphere_1', 50.0, 25., -25., 100.)
+ #
+ # Creation of the second sphere
+ Boundary_3_5 = homard.CreateBoundarySphere('sphere_2', 450.0, 25., -25., 100.)
+ #
+ # Creation of the hypotheses
+ # ==========================
+ # Uniform refinement
+ HypoName = "Hypo_" + Test_Name
+ print "-------- Creation of the hypothesis", HypoName
+ Hypo_test_3 = homard.CreateHypothesis(HypoName)
+ Hypo_test_3.SetUnifRefinUnRef(1)
+ print HypoName, " : zones utilisées :", Hypo_test_3.GetZones()
+ print HypoName, " : champ utilisé :", Hypo_test_3.GetFieldName()
+ print HypoName, " : composantes utilisées :", Hypo_test_3.GetComps()
+ #
+ for num in range (n_boucle+1) :
+ #
+ print "-------- num =", num, "--------"
+ #
+ # Creation of the case Case_test_3
+ # ===========================
+ if ( num <= 1 ) :
+ CaseName = "Case_" + Test_Name
+ print "-------- Creation of the case", CaseName
+ MeshFile = os.path.join(Rep_Test, Test_Name + '.00.med')
+ Case_test_3 = homard.CreateCase(CaseName, 'MOYEU', MeshFile)
+ Case_test_3.SetDirName(dircase)
+ Case_test_3.AddBoundaryGroup('courbes', '')
+ Case_test_3.AddBoundaryGroup('cyl_ext', 'EXT')
+ Case_test_3.AddBoundaryGroup('cyl_int', 'INT')
+ Case_test_3.AddBoundaryGroup('sphere_1', 'END_1')
+ Case_test_3.AddBoundaryGroup('sphere_2', 'END_2')
+ #
+ # Creation of the iterations
+ # ==========================
+ # Creation of the iteration 1
+ IterName = "I_" + Test_Name + "_1"
+ print "-------- Creation of the iteration", IterName
+ Iter_test_3_1 = Case_test_3.NextIteration(IterName)
+ Iter_test_3_1.SetMeshName('MOYEU_1')
+ Iter_test_3_1.SetMeshFile(os.path.join(dircase, 'maill.01.med'))
+ Iter_test_3_1.AssociateHypo('Hypo_test_3')
+ error = Iter_test_3_1.Compute(1, 1)
+ if error :
+ error = 10*num + 1
+ break
+
+ # Creation of the iteration 2
+ IterName = "I_" + Test_Name + "_2"
+ print "-------- Creation of the iteration", IterName
+ Iter_test_3_2 = Iter_test_3_1.NextIteration(IterName)
+ Iter_test_3_2.SetMeshName('MOYEU_2')
+ Iter_test_3_2.SetMeshFile(os.path.join(dircase, 'maill.02.med'))
+ Iter_test_3_2.AssociateHypo('Hypo_test_3')
+ error = Iter_test_3_2.Compute(1, 1)
+ if error :
+ error = 10*num + 2
+ break
+ #
+ # Creation of the schema YACS
+ # ===========================
+ ScriptFile = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "en", "_downloads", "yacs_script_test.py")
+ ScriptFile = os.path.normpath(ScriptFile)
+ DirName = dircase
+ YACSName = "YACS_" + Test_Name
+ print "-------- Creation of the schema", YACSName
+ YACS_test_3 = Case_test_3.CreateYACSSchema(YACSName, ScriptFile, DirName, MeshFile)
+ YACS_test_3.SetType(2)
+ YACS_test_3.SetMaxIter(2)
+ error = YACS_test_3.Write()
+ if error :
+ error = 10*num + 5
+ break
+
+ # Destructions
+ # ============
+ # Destruction of the schema, sauf a la fin
+ if ( num < n_boucle ) :
+ print "-------- Destruction of the schema", YACS_test_3.GetName()
+ error = YACS_test_3.Delete(1)
+ if error :
+ error = 10*num + 6
+ break
+ # After the first loop, the case is deleted, except the final mesh files
+ # All the iterations are deleted
+ if ( num == 0 ) :
+ print "-------- Destruction of the case", Case_test_3.GetName()
+ error = Case_test_3.Delete(0)
+ if error :
+ break
+ # After the second loop, the iterations are deleted, with the final mesh files
+ elif ( num == 1 ) :
+ # Recursive destruction of the iterations
+ print "-------- Recursive destruction of the iteration", Iter_test_3_1.GetName()
+ error = Iter_test_3_1.Delete(1)
+ if error :
+ error = 10*num + 3
+ break
+ # Destruction and creation of the hypothese
+ if ( num == 1 ) :
+ print "-------- Destruction of the hypothese", Hypo_test_3.GetName()
+ error = Hypo_test_3.Delete()
+ if error :
+ error = 10*num + 4
+ break
+ HypoName = "Hypo_test_3"
+ print "-------- Creation of the hypothesis", HypoName
+ Hypo_test_3 = homard.CreateHypothesis(HypoName)
+ Hypo_test_3.SetUnifRefinUnRef(1)
+ #
+ break
+ #
+ return error
+
+#========================================================================
+
+homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+assert homard is not None, "Impossible to load homard engine"
+homard.SetLanguageShort("fr")
+#
+# Exec of HOMARD-SALOME
+#
+try :
+ error_main = homard_exec(salome.myStudy)
+ if error_main :
+ raise Exception('Pb in homard_exec at iteration %d' %error_main )
+except Exception, e:
+ raise Exception('Pb in homard_exec: '+e.message)
+#
+# Test of the results
+#
+n_rep_test_file = n_iter_test_file*n_boucle
+destroy_dir = not debug
+test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
+#
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
+ iparameters.getSession().restoreVisualState(1)
+
--- /dev/null
+
+
+ANALYSE DU MAILLAGE
+===================
+
+ Maillage apres adaptation
+ MESH
+ Date de creation : lundi 2 novembre 2015 a 11 h 32 mn 46 s
+ Dimension : 3
+ Degre : 1
+ C'est un maillage obtenu apres 2 adaptations.
+ Le niveau minimum actif est : 0
+ Le niveau maximum atteint est : 2
+
+ Direction | Unite | Minimum | Maximum
+ ---------------------------------------------------------------
+ | | 0.0000 | 600.00
+ | | 0.0000 | 400.00
+ | | 0.0000 | 200.00
+
+
+ NOMBRE D'ENTITES DU CALCUL
+ ==========================
+
+
+ ************************************************************
+ * Noeuds *
+ ************************************************************
+ * Nombre total * 1389 *
+ ************************************************************
+
+ ************************************************************
+ * Segments *
+ ************************************************************
+ * Nombre total * 124 *
+ * . dont aretes isolees * 0 *
+ * . dont aretes de bord de regions 2D * 0 *
+ * . dont aretes internes aux faces/volumes * 124 *
+ ************************************************************
+
+ ************************************************************
+ * Triangles *
+ ************************************************************
+ * Nombre total * 54 *
+ * . dont triangles de regions 2D * 54 *
+ * . dont triangles de bord * 0 *
+ * . dont triangles internes aux volumes * 0 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 54 *
+ ************************************************************
+
+ ************************************************************
+ * Quadrangles *
+ ************************************************************
+ * Nombre total * 616 *
+ * . dont quadrangles de regions 2D * 9 *
+ * . dont quadrangles de bord * 607 *
+ * . dont quadrangles internes aux volumes * 0 *
+ ************************************************************
+ * . du niveau 0 * 503 *
+ * . du niveau 0.5 * 9 *
+ * . du niveau 1 * 104 *
+ ************************************************************
+
+ ************************************************************
+ * Tetraedres *
+ ************************************************************
+ * Nombre total * 200 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 192 *
+ * . du niveau 1 * 0 *
+ * . du niveau 1.5 * 8 *
+ ************************************************************
+
+ ************************************************************
+ * Hexaedres *
+ ************************************************************
+ * Nombre total * 847 *
+ ************************************************************
+ * . du niveau 0 * 657 *
+ * . du niveau 0.5 * 0 *
+ * . du niveau 1 * 190 *
+ ************************************************************
+
+ ************************************************************
+ * Pyramides *
+ ************************************************************
+ * Nombre total * 454 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 412 *
+ * . du niveau 1 * 0 *
+ * . du niveau 1.5 * 42 *
+ ************************************************************
--- /dev/null
+
+
+ANALYSE DU MAILLAGE
+===================
+
+ Maillage apres adaptation
+ MESH
+ Date de creation : mardi 3 novembre 2015 a 9 h 1 mn 54 s
+ Dimension : 3
+ Degre : 1
+ C'est un maillage obtenu apres 3 adaptations.
+ Le niveau minimum actif est : 0
+ Le niveau maximum atteint est : 2
+
+ Direction | Unite | Minimum | Maximum
+ ---------------------------------------------------------------
+ | | 0.0000 | 600.00
+ | | 0.0000 | 400.00
+ | | 0.0000 | 200.00
+
+
+ NOMBRE D'ENTITES DU CALCUL
+ ==========================
+
+
+ ************************************************************
+ * Noeuds *
+ ************************************************************
+ * Nombre total * 2503 *
+ ************************************************************
+
+ ************************************************************
+ * Segments *
+ ************************************************************
+ * Nombre total * 120 *
+ * . dont aretes isolees * 0 *
+ * . dont aretes de bord de regions 2D * 0 *
+ * . dont aretes internes aux faces/volumes * 120 *
+ ************************************************************
+
+ ************************************************************
+ * Triangles *
+ ************************************************************
+ * Nombre total * 582 *
+ * . dont triangles de regions 2D * 582 *
+ * . dont triangles de bord * 0 *
+ * . dont triangles internes aux volumes * 0 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 558 *
+ * . du niveau 1 * 0 *
+ * . du niveau 1.5 * 24 *
+ ************************************************************
+
+ ************************************************************
+ * Quadrangles *
+ ************************************************************
+ * Nombre total * 455 *
+ * . dont quadrangles de regions 2D * 81 *
+ * . dont quadrangles de bord * 374 *
+ * . dont quadrangles internes aux volumes * 0 *
+ ************************************************************
+ * . du niveau 0 * 322 *
+ * . du niveau 0.5 * 81 *
+ * . du niveau 1 * 52 *
+ ************************************************************
+
+ ************************************************************
+ * Tetraedres *
+ ************************************************************
+ * Nombre total * 1952 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 1824 *
+ * . du niveau 1 * 0 *
+ * . du niveau 1.5 * 128 *
+ ************************************************************
+
+ ************************************************************
+ * Hexaedres *
+ ************************************************************
+ * Nombre total * 523 *
+ ************************************************************
+ * . du niveau 0 * 283 *
+ * . du niveau 0.5 * 0 *
+ * . du niveau 1 * 240 *
+ ************************************************************
+
+ ************************************************************
+ * Pyramides *
+ ************************************************************
+ * Nombre total * 3559 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 3239 *
+ * . du niveau 1 * 0 *
+ * . du niveau 1.5 * 320 *
+ ************************************************************
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011-2015 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
+#
+"""
+Python script for HOMARD
+Test test_4
+"""
+__revision__ = "V1.0"
+
+#========================================================================
+Test_Name = "test_4"
+debug=False
+n_iter_test_file = 3
+DX = 600.
+DY = 400.
+DZ = 200.
+#========================================================================
+import os
+import tempfile
+import sys
+import numpy as np
+import salome
+import GEOM
+import SMESH
+import HOMARD
+import MEDCoupling as mc
+import MEDLoader as ml
+#
+# ==================================
+pathHomard = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des donnees du test
+Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
+Rep_Test = os.path.normpath(Rep_Test)
+sys.path.append(Rep_Test)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des resultats
+if debug :
+ dircase = os.path.join("/tmp", Test_Name)
+ if ( os.path.isdir(dircase) ) :
+ remove_dir(dircase)
+ os.mkdir(dircase)
+else :
+ dircase = tempfile.mkdtemp()
+# ==================================
+
+salome.salome_init()
+
+import SALOMEDS
+from salome.geom import geomBuilder
+from salome.smesh import smeshBuilder
+from salome.StdMeshers import StdMeshersBuilder
+#
+from MEDLoader import MEDLoader
+from MEDCouplingRemapper import MEDCouplingRemapper
+
+import iparameters
+ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
+ipar.append("AP_MODULES_LIST", "Homard")
+#
+#========================================================================
+#========================================================================
+def geom_smesh_exec(theStudy):
+ """
+Python script for GEOM and SMESH
+ """
+ error = 0
+#
+ while not error :
+ #
+ geompy = geomBuilder.New(theStudy)
+ #
+ # Creation of the box
+ # ===================
+ BOX = geompy.MakeBoxDXDYDZ(DX, DY, DZ, "BOX")
+
+ # Creation of the mesh
+ # ====================
+ smesh = smeshBuilder.New(theStudy)
+ MESH = smesh.Mesh(BOX)
+ smesh.SetName(MESH.GetMesh(), 'MESH')
+ #
+ # Creation of the hypotheses
+ # ==========================
+ Regular_1D = MESH.Segment()
+ smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
+ Length = min(DX, DY, DZ) / 5.
+ Local_Length = Regular_1D.LocalLength(Length,None,1e-07)
+ smesh.SetName(Local_Length, 'Local Length')
+ #
+ Quadrangle_2D = MESH.Quadrangle(algo=smeshBuilder.QUADRANGLE)
+ smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
+ Quadrangle_Parameters = Quadrangle_2D.QuadrangleParameters(StdMeshersBuilder.QUAD_STANDARD,-1,[],[])
+ smesh.SetName(Quadrangle_Parameters, 'Quadrangle Parameters')
+ #
+ Hexa_3D = MESH.Hexahedron(algo=smeshBuilder.Hexa)
+ smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
+ #
+ # Computation
+ # ===========
+ #
+ isDone = MESH.Compute()
+ if not isDone :
+ error = 1
+ break
+ #
+ # MED exportation
+ # ===============
+ #
+ try:
+ ficmed = os.path.join(dircase, 'maill.00.med')
+ MESH.ExportMED( ficmed, 0, SMESH.MED_V2_2, 1, None ,1)
+ except Exception, e:
+ raise Exception('ExportToMEDX() failed. '+e.message)
+ error = 2
+ #
+ break
+ #
+ return error
+
+#========================================================================
+#
+#========================================================================
+def field_exec(theStudy, niter):
+ """
+Python script for MEDCoupling
+ """
+ error = 0
+#
+ while not error :
+ #
+ # The mesh
+ # ========
+ ficmed = os.path.join(dircase, 'maill.%02d.med' % niter)
+ meshMEDFileRead = ml.MEDFileMesh.New(ficmed)
+ meshRead0 = meshMEDFileRead.getMeshAtLevel(0)
+ # Valeurs of the field
+ # ====================
+ nbNodes = meshRead0.getNumberOfNodes()
+ valeur = mc.DataArrayDouble(nbNodes)
+ for iaux, taux in enumerate(meshRead0.getCoords()) :
+ #ligne = "x = %f" % taux[0]
+ #ligne += ", y = %f" % taux[1]
+ #ligne += ", z = %f" % taux[2]
+ #print ligne
+ #distance = (taux[0]-DX*0.2)**2 + (taux[1]-DY*0.2)**2 + (taux[2]-DZ*0.4)**2
+ distance = min(abs(taux[0]-DX*0.4), abs(taux[1]-DY*0.2), abs(taux[2]-DZ*0.4))
+ valeur[iaux] = 1.e0 / max ( 1.e-5, np.sqrt(distance) )
+ #print ". valeur", valeur
+ nparr = valeur.toNumPyArray()
+ print ". mini/maxi", nparr.min(), nparr.max()
+ #
+ # Creation of the field
+ # =====================
+ field = ml.MEDCouplingFieldDouble(ml.ON_NODES, ml.ONE_TIME)
+ field.setArray(valeur)
+ field.setMesh(meshRead0)
+ field.setName("DISTANCE")
+ #
+ fMEDFile_ch = ml.MEDFileField1TS()
+ fMEDFile_ch.setFieldNoProfileSBT(field) # No profile desired on the field, Sort By Type
+ fMEDFile_ch.write(ficmed, 0) # 0 to indicate that we *append* (and no overwrite) to the MED file
+ #
+ break
+ #
+ return error
+
+#========================================================================
+#========================================================================
+def homard_exec(theStudy):
+ """
+Python script for HOMARD
+ """
+ error = 0
+#
+ while not error :
+ #
+ homard.SetCurrentStudy(theStudy)
+ #
+ # Creation of the zones
+ # =====================
+ #
+ epsilon = min(DX, DY, DZ) / 100.
+ # Creation of the box Zone_4_1
+ Zone_4_1 = homard.CreateZoneBox('Zone_4_1', -epsilon, DX/3.+epsilon, DY/4.-epsilon, 3.*DY/4.+epsilon, 4.*DZ/5.-epsilon, DZ+epsilon)
+
+ # Creation of the sphere Zone_4_2
+ rayon = min(DX, DY, DZ) / 4.
+ Zone_4_2 = homard.CreateZoneSphere('Zone_4_2', DX/3., DY*0.3, DZ*0.6, rayon)
+ #
+ # Creation of the hypotheses
+ # ==========================
+ dico = {}
+ dico["1"] = "raffinement"
+ dico["-1"] = "deraffinement"
+ # Creation of the hypothesis Hypo_4_1
+ HypoName_1 = "Zone_1"
+ print "-------- Creation of the hypothesis", HypoName_1
+ Hypo_4_1 = homard.CreateHypothesis(HypoName_1)
+ Hypo_4_1.AddZone('Zone_4_1', 1)
+ Hypo_4_1.SetExtraOutput(2)
+ laux = Hypo_4_1.GetZones()
+ nbzone = len(laux)/2
+ jaux = 0
+ for iaux in range(nbzone) :
+ print HypoName_1, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux]
+ jaux += 2
+ # Creation of the hypothesis Hypo_4_2
+ HypoName_2 = "Zone_2"
+ print "-------- Creation of the hypothesis", HypoName_2
+ Hypo_4_2 = homard.CreateHypothesis(HypoName_2)
+ Hypo_4_2.AddZone('Zone_4_2', 1)
+ Hypo_4_2.SetExtraOutput(2)
+ laux = Hypo_4_2.GetZones()
+ nbzone = len(laux)/2
+ jaux = 0
+ for iaux in range(nbzone) :
+ print HypoName_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux]
+ jaux += 2
+ # Creation of the hypothesis DISTANCE INVERSE
+ HypoName_3 = "DISTANCE INVERSE"
+ print "-------- Creation of the hypothesis", HypoName_3
+ Hypo_4_3 = homard.CreateHypothesis(HypoName_3)
+ Hypo_4_3.SetField('DISTANCE')
+ Hypo_4_3.SetUseComp(0)
+ Hypo_4_3.SetRefinThr(1, 0.3)
+ Hypo_4_3.SetUnRefThr(1, 0.2)
+ Hypo_4_3.AddFieldInterp('DISTANCE')
+ Hypo_4_3.SetExtraOutput(2)
+ print HypoName_3, " : zones utilisées :", Hypo_4_3.GetZones()
+ print HypoName_3, " : champ utilisé :", Hypo_4_3.GetFieldName()
+ print HypoName_3, " : composantes utilisées :", Hypo_4_3.GetComps()
+ if ( len (Hypo_4_3.GetFieldName()) > 0 ) :
+ print ".. caractéristiques de l'adaptation :", Hypo_4_3.GetField()
+ print HypoName_3, " : champs interpolés :", Hypo_4_3.GetFieldInterps()
+ #
+ # Creation of the cases
+ # =====================
+ # Creation of the case
+ CaseName = "Case_" + Test_Name
+ print "-------- Creation of the case", CaseName
+ MeshFile = os.path.join(dircase, 'maill.00.med')
+ Case_test_4 = homard.CreateCase(CaseName, 'MESH', MeshFile)
+ Case_test_4.SetDirName(dircase)
+ #
+ # Creation of the iterations
+ # ==========================
+ # Creation of the iteration 1
+ IterName = "I_" + Test_Name + "_1"
+ print "-------- Creation of the iteration", IterName
+ Iter_test_4_1 = Case_test_4.NextIteration(IterName)
+ Iter_test_4_1.AssociateHypo(HypoName_1)
+ print ". Hypothese :", HypoName_1
+ Iter_test_4_1.SetMeshName('M1')
+ Iter_test_4_1.SetMeshFile(os.path.join(dircase, 'maill.01.med'))
+ error = Iter_test_4_1.Compute(1, 2)
+ if error :
+ error = 1
+ break
+
+ # Creation of the iteration 2
+ IterName = "I_" + Test_Name + "_2"
+ print "-------- Creation of the iteration", IterName
+ Iter_test_4_2 = Iter_test_4_1.NextIteration(IterName)
+ Iter_test_4_2.AssociateHypo(HypoName_2)
+ print ". Hypothese :", HypoName_2
+ Iter_test_4_2.SetMeshName('M2')
+ Iter_test_4_2.SetMeshFile(os.path.join(dircase, 'maill.02.med'))
+ error = Iter_test_4_2.Compute(1, 2)
+ if error :
+ error = 2
+ break
+
+ # Creation of the iteration 3
+ #
+ error = field_exec(theStudy, 2)
+ if error :
+ error = 30
+ break
+ #
+ IterName = "I_" + Test_Name + "_3"
+ print "-------- Creation of the iteration", IterName
+ Iter_test_4_3 = Iter_test_4_2.NextIteration(IterName)
+ Iter_test_4_3.AssociateHypo(HypoName_3)
+ print ". Hypothese :", HypoName_3
+ Iter_test_4_3.SetMeshName('M3')
+ Iter_test_4_3.SetFieldFile(os.path.join(dircase, 'maill.02.med'))
+ Iter_test_4_3.SetMeshFile(os.path.join(dircase, 'maill.03.med'))
+ error = Iter_test_4_3.Compute(1, 2)
+ if error :
+ error = 3
+ break
+ #
+ break
+ #
+ return error
+
+#========================================================================
+#
+# Geometry and Mesh
+#
+try :
+ error_main = geom_smesh_exec(salome.myStudy)
+ if error_main :
+ raise Exception('Pb in geom_smesh_exec')
+except Exception, e:
+ raise Exception('Pb in geom_smesh_exec: '+e.message)
+
+homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+assert homard is not None, "Impossible to load homard engine"
+homard.SetLanguageShort("fr")
+#
+# Exec of HOMARD-SALOME
+#
+try :
+ error_main = homard_exec(salome.myStudy)
+ if error_main :
+ raise Exception('Pb in homard_exec at iteration %d' %error_main )
+except Exception, e:
+ raise Exception('Pb in homard_exec: '+e.message)
+#
+# Test of the results
+#
+n_rep_test_file = n_iter_test_file
+destroy_dir = not debug
+test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
+#
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
+ iparameters.getSession().restoreVisualState(1)
+
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011-2015 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
+#
+"""
+Python script for HOMARD
+Copyright EDF-R&D 2014
+Test test_1
+"""
+__revision__ = "V1.2"
+
+import os
+#========================================================================
+#========================================================================
+def remove_dir(directory) :
+ """
+Empties, then removes a directory.
+Copyright EDF-R&D 2013
+ """
+#
+ l_aux = os.listdir(directory)
+ for fic in l_aux :
+ fic_a = os.path.join(directory, fic)
+ if os.path.isdir(fic_a) :
+ remove_dir(fic_a)
+ else :
+ os.remove(fic_a)
+ os.rmdir(directory)
+#
+ return
+#
+#========================================================================
+#========================================================================
+def test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir = True) :
+ """
+Test of the result
+Rep_Test: repertoire des tests
+Test_Name: nom du test
+dircase: repertoire des resultats du test
+n_iter_test_file: numero de l'iteration a tester
+n_rep_test_file: numero du repertoire de l'iteration a tester
+destroy_dir: destruction du repertoire de calcul
+Copyright EDF-R&D 2014
+ """
+ #
+ test_file_suff = "apad.%02d.bilan" % n_iter_test_file
+ rep_test_file = "I%02d" % n_rep_test_file
+ #
+ test_file = os.path.join(Rep_Test, Test_Name + "." + test_file_suff)
+ mess_error_ref = "\nReference file: " + test_file
+ try :
+ file = open (test_file, "r")
+ mess_ref = file.readlines()
+ file.close()
+ except :
+ mess_error = mess_error_ref + "\nThis file does not exist.\n"
+ destroy_dir = False
+ raise Exception(mess_error)
+ #
+ test_file = os.path.join(dircase, rep_test_file, test_file_suff)
+ if os.path.isfile (test_file) :
+ file = open (test_file, "r")
+ mess = file.readlines()
+ file.close()
+ else :
+ mess_error = "\nResult file: " + test_file
+ mess_error += "\nThis file does not exist.\n"
+ destroy_dir = False
+ raise Exception(mess_error)
+
+ nblign = len(mess_ref)
+ if ( len(mess) != nblign ):
+ mess_error = mess_error_ref + "\nResult file: " + test_file
+ mess_error += "\nThe number of lines of the files are not the same.\n"
+ destroy_dir = False
+ raise Exception(mess_error)
+
+ for num in range(nblign) :
+ if (( "creation" not in mess_ref[num] ) and ( mess_ref[num] != mess[num])) :
+ message_erreur = "\nRefe : " + mess_ref[num]
+ message_erreur += "Test : " + mess[num][:-1]
+ message_erreur += "\nThe test is different from the reference."
+ destroy_dir = False
+ raise Exception(message_erreur)
+ #
+ if destroy_dir:
+ remove_dir(dircase)
+#
+ return
+#
+#========================================================================
+#========================================================================
+++ /dev/null
-# Copyright (C) 2007-2015 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(HOMARD_TEST_FILES
- test_util.py
- test_1.pdf
- test_1.en.pdf
- test_1.py
- test_1.00.med
- test_1.01.med
- test_1.02.med
- test_1.apad.03.bilan
- test_2.pdf
- test_2.en.pdf
- test_2.py
- test_2.00.med
- test_2.fr.med
- test_2.apad.03.bilan
- test_3.pdf
- test_3.en.pdf
- test_3.py
- test_3.00.med
- test_3.fr.med
- test_3.apad.02.bilan
- test_4.pdf
- test_4.en.pdf
- test_4.py
- test_4.apad.03.bilan
- test_11.py
- test_11.apad.03.bilan
- test_12.py
- test_12.apad.02.bilan
- test_13.py
- test_13.apad.02.bilan
- test_14.py
- test_14.apad.03.bilan
- test_15.py
- test_15.apad.02.bilan
-)
-
-INSTALL(FILES ${HOMARD_TEST_FILES} DESTINATION ${SALOME_HOMARD_INSTALL_RES_DATA})
+++ /dev/null
-
-
-ANALYSE DU MAILLAGE
-===================
-
- Maillage apres adaptation
- MAILL
- Date de creation : jeudi 3 avril 2014 a 11 h 45 mn 28 s
- Dimension : 3
- Degre : 2
- C'est un maillage obtenu apres 3 adaptations.
- Le niveau minimum actif est : 1
- Le niveau maximum atteint est : 2
-
- Direction | Unite | Minimum | Maximum
- ---------------------------------------------------------------
- X | INCONNUE | 0.0000 | 1.0000
- Y | INCONNUE | 0.0000 | 1.0000
- Z | INCONNUE | 0.0000 | 1.0000
-
-
- NOMBRE D'ENTITES DU CALCUL
- ==========================
-
-
- ************************************************************
- * Noeuds *
- ************************************************************
- * Nombre total * 379 *
- * . dont sommets d'aretes * 67 *
- * . dont milieux d'aretes * 312 *
- ************************************************************
-
- ************************************************************
- * Mailles-Points *
- ************************************************************
- * Nombre total * 2 *
- ************************************************************
-
- ************************************************************
- * Segments *
- ************************************************************
- * Nombre total * 2 *
- * . dont aretes isolees * 0 *
- * . dont aretes de bord de regions 2D * 0 *
- * . dont aretes internes aux faces/volumes * 2 *
- ************************************************************
-
- ************************************************************
- * Triangles *
- ************************************************************
- * Nombre total * 98 *
- * . dont triangles de regions 2D * 0 *
- * . dont triangles de bord * 98 *
- * . dont triangles internes aux volumes * 0 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 0 *
- * . du niveau 1 * 22 *
- * . du niveau 1.5 * 28 *
- * . du niveau 2 * 48 *
- ************************************************************
-
- ************************************************************
- * Tetraedres *
- ************************************************************
- * Nombre total * 197 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 0 *
- * . du niveau 1 * 13 *
- * . du niveau 1.5 * 64 *
- * . du niveau 2 * 120 *
- ************************************************************
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2011-2015 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
-#
-"""
-Python script for HOMARD
-Test test_1
-"""
-__revision__ = "V2.6"
-
-#========================================================================
-Test_Name = "test_1"
-debug=False
-n_iter_test_file = 3
-#========================================================================
-import os
-import tempfile
-import sys
-import HOMARD
-import salome
-#
-# ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
-# Repertoire des donnees du test
-Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
-Rep_Test = os.path.normpath(Rep_Test)
-sys.path.append(Rep_Test)
-from test_util import remove_dir
-from test_util import test_results
-# Repertoire des resultats
-if debug :
- dircase = os.path.join("/tmp", Test_Name)
- if ( os.path.isdir(dircase) ) :
- remove_dir(dircase)
- os.mkdir(dircase)
-else :
- dircase = tempfile.mkdtemp()
-# ==================================
-
-salome.salome_init()
-import iparameters
-ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
-ipar.append("AP_MODULES_LIST", "Homard")
-#
-#========================================================================
-#========================================================================
-def homard_exec(theStudy):
- """
-Python script for HOMARD
- """
- error = 0
-#
- while not error :
- #
- homard.SetCurrentStudy(theStudy)
- #
- # Creation of the zones
- # =====================
- # Creation of the box Zone_1_1
- Zone_1_1 = homard.CreateZoneBox('Zone_1_1', -0.01, 1.01, -0.01, 0.4, -0.01, 0.6)
-
- # Creation of the sphere Zone_1_2
- Zone_1_2 = homard.CreateZoneSphere('Zone_1_2', 0.5, 0.6, 0.7, 0.75)
- #
- # Creation of the hypotheses
- # ==========================
- dico = {}
- dico["1"] = "raffinement"
- dico["-1"] = "deraffinement"
- # Creation of the hypothesis a10_1pc_de_mailles_a_raffiner_sur_ERRE_ELEM_SIGM
- HypoName_1 = "a10_1pc_de_mailles_a_raffiner_sur_ERRE_ELEM_SIGM"
- print "-------- Creation of the hypothesis", HypoName_1
- Hypo_1_1 = homard.CreateHypothesis(HypoName_1)
- Hypo_1_1.SetField('RESU____ERRE_ELEM_SIGM__________')
- Hypo_1_1.SetUseComp(0)
- Hypo_1_1.AddComp('ERREST')
- Hypo_1_1.SetRefinThr(3, 10.1)
- Hypo_1_1.AddFieldInterp('RESU____DEPL____________________')
- Hypo_1_1.AddFieldInterp('RESU____ERRE_ELEM_SIGM__________')
- print HypoName_1, " : champ utilisé :", Hypo_1_1.GetFieldName()
- print HypoName_1, " : composantes utilisées :", Hypo_1_1.GetComps()
- if ( len (Hypo_1_1.GetFieldName()) > 0 ) :
- print ".. caractéristiques de l'adaptation :", Hypo_1_1.GetField()
- print HypoName_1, " : champs interpolés :", Hypo_1_1.GetFieldInterps()
- # Creation of the hypothesis Zones_1_et_2
- HypoName_2 = "Zones_1_et_2"
- print "-------- Creation of the hypothesis", HypoName_2
- Zones_1_et_2 = homard.CreateHypothesis(HypoName_2)
- Zones_1_et_2.AddZone('Zone_1_1', 1)
- Zones_1_et_2.AddZone('Zone_1_2', 1)
- laux = Zones_1_et_2.GetZones()
- nbzone = len(laux)/2
- jaux = 0
- for iaux in range(nbzone) :
- print HypoName_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux]
- jaux += 2
- print HypoName_2, " : champ utilisé :", Zones_1_et_2.GetFieldName()
- if ( len (Zones_1_et_2.GetFieldName()) > 0 ) :
- print ".. caractéristiques de l'adaptation :", Zones_1_et_2.GetField()
- print HypoName_2, " : champs interpolés :", Zones_1_et_2.GetFieldInterps()
- #
- # Creation of the cases
- # =====================
- # Creation of the case
- CaseName = "Case_" + Test_Name
- print "-------- Creation of the case", CaseName
- MeshFile = os.path.join(Rep_Test, Test_Name + '.00.med')
- Case_test_1 = homard.CreateCase(CaseName, 'MAILL', MeshFile)
- Case_test_1.SetDirName(dircase)
- #
- # Creation of the iterations
- # ==========================
- # Creation of the iteration 1
- IterName = "I_" + Test_Name + "_1"
- print "-------- Creation of the iteration", IterName
- Iter_test_1_1 = Case_test_1.NextIteration(IterName)
- Iter_test_1_1.AssociateHypo(HypoName_1)
- print ". Hypothese :", HypoName_1
- Iter_test_1_1.SetMeshName('M1')
- Iter_test_1_1.SetMeshFile(os.path.join(dircase, 'maill.01.med'))
- Iter_test_1_1.SetFieldFile(os.path.join(Rep_Test, Test_Name + '.00.med'))
- Iter_test_1_1.SetTimeStepRank(1, 1)
- Iter_test_1_1.SetFieldInterpTimeStep('RESU____DEPL____________________', 1)
- Iter_test_1_1.SetFieldInterpTimeStepRank('RESU____ERRE_ELEM_SIGM__________', 1, 1)
- print ". Instants d'interpolation :", Iter_test_1_1.GetFieldInterpsTimeStepRank()
- error = Iter_test_1_1.Compute(1, 1)
- if error :
- error = 1
- break
-
- # Creation of the iteration 2
- IterName = "I_" + Test_Name + "_2"
- print "-------- Creation of the iteration", IterName
- Iter_test_1_2 = Iter_test_1_1.NextIteration(IterName)
- Iter_test_1_2.AssociateHypo(HypoName_1)
- print ". Hypothese :", HypoName_1
- Iter_test_1_2.SetMeshName('M2')
- Iter_test_1_2.SetMeshFile(os.path.join(dircase, 'maill.02.med'))
- Iter_test_1_2.SetFieldFile(os.path.join(Rep_Test, Test_Name + '.01.med'))
- Iter_test_1_2.SetTimeStepRank(1, 1)
- Iter_test_1_2.SetFieldInterpTimeStep('RESU____DEPL____________________', 1)
- Iter_test_1_2.SetFieldInterpTimeStepRank('RESU____ERRE_ELEM_SIGM__________', 1, 1)
- print ". Instants d'interpolation :", Iter_test_1_2.GetFieldInterpsTimeStepRank()
- error = Iter_test_1_2.Compute(1, 1)
- if error :
- error = 2
- break
-
- # Creation of the iteration 3
- IterName = "I_" + Test_Name + "_3"
- print "-------- Creation of the iteration", IterName
- Iter_test_1_3 = Iter_test_1_2.NextIteration(IterName)
- Iter_test_1_3.AssociateHypo(HypoName_2)
- print ". Hypothese :", HypoName_2
- Iter_test_1_3.SetMeshName('M3')
- Iter_test_1_3.SetMeshFile(os.path.join(dircase, 'maill.03.med'))
- Iter_test_1_2.SetFieldFile(os.path.join(Rep_Test, Test_Name + '.02.med'))
- print ". Instants d'interpolation :", Iter_test_1_3.GetFieldInterpsTimeStepRank()
- error = Iter_test_1_3.Compute(1, 1)
- if error :
- error = 3
- break
- #
- # Creation of the schema YACS
- # ===========================
- ScriptFile = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "en", "_downloads", "yacs_script_test.py")
- ScriptFile = os.path.normpath(ScriptFile)
- DirName = dircase
- YACS_test_1 = Case_test_1.CreateYACSSchema("YACS_test_1", ScriptFile, DirName, MeshFile)
- error = YACS_test_1.Write()
- if error :
- error = 4
- break
- #
- break
- #
- return error
-
-#========================================================================
-
-homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
-assert homard is not None, "Impossible to load homard engine"
-homard.SetLanguageShort("fr")
-#
-# Exec of HOMARD-SALOME
-#
-try :
- error_main = homard_exec(salome.myStudy)
- if error_main :
- raise Exception('Pb in homard_exec at iteration %d' %error_main )
-except Exception, e:
- raise Exception('Pb in homard_exec: '+e.message)
-#
-# Test of the results
-#
-n_rep_test_file = n_iter_test_file
-destroy_dir = not debug
-test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
-#
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(1)
- iparameters.getSession().restoreVisualState(1)
-
+++ /dev/null
-
-
-ANALYSE DU MAILLAGE
-===================
-
- Maillage apres adaptation
- MAILL
- Date de creation : jeudi 3 avril 2014 a 13 h 24 mn 23 s
- Dimension : 3
- Degre : 2
- C'est un maillage obtenu apres 3 adaptations.
- Le niveau minimum actif est : 3
- Le niveau maximum atteint est : 3
-
- Direction | Unite | Minimum | Maximum
- ---------------------------------------------------------------
- X | INCONNUE | 0.0000 | 1.0000
- Y | INCONNUE | 0.0000 | 1.0000
- Z | INCONNUE | 0.0000 | 1.0000
-
-
- NOMBRE D'ENTITES DU CALCUL
- ==========================
-
-
- ************************************************************
- * Noeuds *
- ************************************************************
- * Nombre total * 4913 *
- * . dont sommets d'aretes * 729 *
- * . dont milieux d'aretes * 4184 *
- ************************************************************
-
- ************************************************************
- * Mailles-Points *
- ************************************************************
- * Nombre total * 2 *
- ************************************************************
-
- ************************************************************
- * Segments *
- ************************************************************
- * Nombre total * 8 *
- * . dont aretes isolees * 0 *
- * . dont aretes de bord de regions 2D * 0 *
- * . dont aretes internes aux faces/volumes * 8 *
- ************************************************************
-
- ************************************************************
- * Triangles *
- ************************************************************
- * Nombre total * 768 *
- * . dont triangles de regions 2D * 0 *
- * . dont triangles de bord * 768 *
- * . dont triangles internes aux volumes * 0 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 0 *
- * . du niveau 1 * 0 *
- * . du niveau 1.5 * 0 *
- * . du niveau 2 * 0 *
- * . du niveau 2.5 * 0 *
- * . du niveau 3 * 768 *
- ************************************************************
-
- ************************************************************
- * Tetraedres *
- ************************************************************
- * Nombre total * 3072 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 0 *
- * . du niveau 1 * 0 *
- * . du niveau 1.5 * 0 *
- * . du niveau 2 * 0 *
- * . du niveau 2.5 * 0 *
- * . du niveau 3 * 3072 *
- ************************************************************
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2011-2015 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
-#
-"""
-Python script for HOMARD
-Test test_11 associe au tutorial 1
-"""
-__revision__ = "V2.3"
-
-#========================================================================
-Test_Name = "test_11"
-debug=False
-n_iter_test_file = 3
-#========================================================================
-import os
-import tempfile
-import sys
-import HOMARD
-import salome
-#
-# ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
-# Repertoire des donnees du test
-Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
-Rep_Test = os.path.normpath(Rep_Test)
-sys.path.append(Rep_Test)
-from test_util import remove_dir
-from test_util import test_results
-# Repertoire des resultats
-if debug :
- dircase = os.path.join("/tmp", Test_Name)
- if ( os.path.isdir(dircase) ) :
- remove_dir(dircase)
- os.mkdir(dircase)
-else :
- dircase = tempfile.mkdtemp()
-# Repertoire des donnees du tutorial
-data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-data_dir = os.path.normpath(data_dir)
-sys.path.append(data_dir)
-from tutorial_util import gzip_gunzip
-# ==================================
-gzip_gunzip(data_dir, 1, -1)
-# ==================================
-
-salome.salome_init()
-import iparameters
-ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
-ipar.append("AP_MODULES_LIST", "Homard")
-#
-#========================================================================
-#========================================================================
-def homard_exec(theStudy):
- """
-Python script for HOMARD
- """
- #
- homard.SetCurrentStudy(theStudy)
- #
- # Hypotheses
- # ==========
- Hypo_1 = homard.CreateHypothesis('Hypo_1')
- Hypo_1.SetUnifRefinUnRef(1)
- #
- # Cas
- # ===
- Case_1 = homard.CreateCase('Case_1', 'MAILL', data_dir+'/tutorial_1.00.med')
- Case_1.SetDirName(dircase)
- #
- # Iterations
- # ==========
- # Iteration "Iter_1_1"
- Iter_1_1 = Case_1.NextIteration('Iter_1_1')
- Iter_1_1.SetMeshName('MESH')
- Iter_1_1.SetMeshFile(dircase+'/maill.01.med')
- Iter_1_1.AssociateHypo('Hypo_1')
- error = Iter_1_1.Compute(1, 2)
-
- # Iteration "Iter_1_2"
- Iter_1_2 = Iter_1_1.NextIteration('Iter_1_2')
- Iter_1_2.SetMeshName('MESH')
- Iter_1_2.SetMeshFile(dircase+'/maill.02.med')
- Iter_1_2.AssociateHypo('Hypo_1')
- error = Iter_1_2.Compute(1, 2)
-
- # Iteration "Iter_1_3"
- Iter_1_3 = Iter_1_2.NextIteration('Iter_1_3')
- Iter_1_3.SetMeshName('MESH')
- Iter_1_3.SetMeshFile(dircase+'/maill.03.med')
- Iter_1_3.AssociateHypo('Hypo_1')
- error = Iter_1_3.Compute(1, 2)
- #
- return error
-
-#========================================================================
-
-homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
-assert homard is not None, "Impossible to load homard engine"
-homard.SetLanguageShort("fr")
-#
-# Exec of HOMARD-SALOME
-#
-try :
- error_main = homard_exec(salome.myStudy)
- if error_main :
- raise Exception('Pb in homard_exec at iteration %d' %error_main )
-except Exception, e:
- raise Exception('Pb in homard_exec: '+e.message)
-#
-# Test of the results
-#
-n_rep_test_file = n_iter_test_file
-destroy_dir = not debug
-test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
-#
-# ==================================
-gzip_gunzip(data_dir, 1, 1)
-# ==================================
-#
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(1)
- iparameters.getSession().restoreVisualState(1)
-
+++ /dev/null
-
-
-ANALYSE DU MAILLAGE
-===================
-
- Maillage apres adaptation
- MZERO
- Date de creation : jeudi 3 avril 2014 a 13 h 25 mn 10 s
- Dimension : 3
- Degre : 2
- C'est un maillage obtenu apres 2 adaptations.
- Le niveau minimum actif est : 1
- Le niveau maximum atteint est : 2
-
- Direction | Unite | Minimum | Maximum
- ---------------------------------------------------------------
- X | INCONNUE | 0.0000 | 1.0000
- Y | INCONNUE | 0.0000 | 1.0000
- Z | INCONNUE | 0.0000 | 1.0000
-
-
- NOMBRE D'ENTITES DU CALCUL
- ==========================
-
-
- ************************************************************
- * Noeuds *
- ************************************************************
- * Nombre total * 231 *
- * . dont sommets d'aretes * 43 *
- * . dont milieux d'aretes * 188 *
- ************************************************************
-
- ************************************************************
- * Mailles-Points *
- ************************************************************
- * Nombre total * 2 *
- ************************************************************
-
- ************************************************************
- * Segments *
- ************************************************************
- * Nombre total * 3 *
- * . dont aretes isolees * 0 *
- * . dont aretes de bord de regions 2D * 0 *
- * . dont aretes internes aux faces/volumes * 3 *
- ************************************************************
-
- ************************************************************
- * Triangles *
- ************************************************************
- * Nombre total * 66 *
- * . dont triangles de regions 2D * 0 *
- * . dont triangles de bord * 66 *
- * . dont triangles internes aux volumes * 0 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 6 *
- * . du niveau 1 * 24 *
- * . du niveau 1.5 * 12 *
- * . du niveau 2 * 24 *
- ************************************************************
-
- ************************************************************
- * Tetraedres *
- ************************************************************
- * Nombre total * 113 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 4 *
- * . du niveau 1 * 19 *
- * . du niveau 1.5 * 42 *
- * . du niveau 2 * 48 *
- ************************************************************
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2011-2015 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
-#
-"""
-Python script for HOMARD
-Test test_12 associe au tutorial 2
-"""
-__revision__ = "V2.3"
-
-#========================================================================
-Test_Name = "test_12"
-debug=False
-n_iter_test_file = 2
-#========================================================================
-import os
-import tempfile
-import sys
-import HOMARD
-import salome
-#
-# ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
-# Repertoire des donnees du test
-Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
-Rep_Test = os.path.normpath(Rep_Test)
-sys.path.append(Rep_Test)
-from test_util import remove_dir
-from test_util import test_results
-# Repertoire des resultats
-if debug :
- dircase = os.path.join("/tmp", Test_Name)
- if ( os.path.isdir(dircase) ) :
- remove_dir(dircase)
- os.mkdir(dircase)
-else :
- dircase = tempfile.mkdtemp()
-# Repertoire des donnees du tutorial
-data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-data_dir = os.path.normpath(data_dir)
-sys.path.append(data_dir)
-from tutorial_util import gzip_gunzip
-# ==================================
-gzip_gunzip(data_dir, 2, -1)
-# ==================================
-
-salome.salome_init()
-import iparameters
-ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
-ipar.append("AP_MODULES_LIST", "Homard")
-#
-#========================================================================
-#========================================================================
-def homard_exec(theStudy):
- """
-Python script for HOMARD
- """
- #
- homard.SetCurrentStudy(theStudy)
- #
- # Creation des zones
- # ==================
- # Box "Zone_12_0"
- Zone_12_0 = homard.CreateZoneBox ('Zone_12_0', -0.1, 1.1, -0.1, 1.1, 0.9, 1.1)
- #
- # Sphere "Zone_12_1"
- Zone_12_1 = homard.CreateZoneSphere ('Zone_12_1', 0., 0., 0., 1.05)
- #
- # Box "Zone_12_2"
- Zone_12_2 = homard.CreateZoneBox ('Zone_12_2', -0.1, 0.51, -0.1, 0.51, -0.1, 0.51)
- #
- # Hypothese "Hypo_2"
- # ==================
- Hypo_2 = homard.CreateHypothesis('Hypo_2')
- Hypo_2.AddZone('Zone_12_1', 1)
- Hypo_2.AddZone('Zone_12_0', 1)
- #
- # Hypothese "Hypo_2_bis"
- # ======================
- Hypo_2_bis = homard.CreateHypothesis('Hypo_2_bis')
- Hypo_2_bis.AddZone('Zone_12_0', -1)
- Hypo_2_bis.AddZone('Zone_12_2', 1)
- #
- # Cas
- # ===
- Case_2 = homard.CreateCase('Case_2', 'MZERO', data_dir+'/tutorial_2.00.med')
- Case_2.SetDirName(dircase)
- #
- # Iteration "Iter_2_1"
- # ====================
- Iter_2_1 = Case_2.NextIteration('Iter_2_1')
- Iter_2_1.SetMeshName('M_1')
- Iter_2_1.SetMeshFile(dircase+'/maill.01.med')
- Iter_2_1.AssociateHypo('Hypo_2')
- error = Iter_2_1.Compute(1, 2)
- #
- # Iteration "Iter_2_2"
- # ====================
- Iter_2_2 = Iter_2_1.NextIteration('Iter_2_2')
- Iter_2_2.SetMeshName('M_2')
- Iter_2_2.SetMeshFile(dircase+'/maill.02.med')
- Iter_2_2.AssociateHypo('Hypo_2_bis')
- error = Iter_2_2.Compute(1, 2)
- #
- return error
-
-#========================================================================
-
-homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
-assert homard is not None, "Impossible to load homard engine"
-homard.SetLanguageShort("fr")
-#
-# Exec of HOMARD-SALOME
-#
-try :
- error_main = homard_exec(salome.myStudy)
- if error_main :
- raise Exception('Pb in homard_exec at iteration %d' %error_main )
-except Exception, e:
- raise Exception('Pb in homard_exec: '+e.message)
-#
-# Test of the results
-#
-n_rep_test_file = n_iter_test_file
-destroy_dir = not debug
-test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
-#
-# ==================================
-gzip_gunzip(data_dir, 2, 1)
-# ==================================
-#
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(1)
- iparameters.getSession().restoreVisualState(1)
-
+++ /dev/null
-
-
-ANALYSE DU MAILLAGE
-===================
-
- Maillage apres adaptation
- G_0
- Date de creation : lundi 2 novembre 2015 a 9 h 14 mn 1 s
- Dimension : 3
- Degre : 2
- C'est un maillage obtenu apres 2 adaptations.
- Le niveau minimum actif est : 0
- Le niveau maximum atteint est : 2
-
- Direction | Unite | Minimum | Maximum
- ---------------------------------------------------------------
- X | INCONNUE | 0.0000 | 0.60000
- Y | INCONNUE | 0.0000 | 0.30000
- Z | INCONNUE | 0.0000 | 0.20000
-
-
- NOMBRE D'ENTITES DU CALCUL
- ==========================
-
-
- ************************************************************
- * Noeuds *
- ************************************************************
- * Nombre total * 14455 *
- * . dont sommets d'aretes * 3839 *
- * . dont milieux d'aretes * 10616 *
- ************************************************************
-
- ************************************************************
- * Segments *
- ************************************************************
- * Nombre total * 764 *
- * . dont aretes isolees * 0 *
- * . dont aretes de bord de regions 2D * 0 *
- * . dont aretes internes aux faces/volumes * 764 *
- ************************************************************
-
- ************************************************************
- * Triangles *
- ************************************************************
- * Nombre total * 288 *
- * . dont triangles de regions 2D * 288 *
- * . dont triangles de bord * 0 *
- * . dont triangles internes aux volumes * 0 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 168 *
- * . du niveau 1 * 0 *
- * . du niveau 1.5 * 120 *
- ************************************************************
-
- ************************************************************
- * Quadrangles *
- ************************************************************
- * Nombre total * 2534 *
- * . dont quadrangles de regions 2D * 0 *
- * . dont quadrangles de bord * 2534 *
- * . dont quadrangles internes aux volumes * 0 *
- ************************************************************
- * . du niveau 0 * 142 *
- * . du niveau 0.5 * 0 *
- * . du niveau 1 * 2296 *
- * . du niveau 1.5 * 0 *
- * . du niveau 2 * 96 *
- ************************************************************
-
- ************************************************************
- * Tetraedres *
- ************************************************************
- * Nombre total * 256 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 96 *
- * . du niveau 1 * 0 *
- * . du niveau 1.5 * 160 *
- ************************************************************
-
- ************************************************************
- * Hexaedres *
- ************************************************************
- * Nombre total * 2230 *
- ************************************************************
- * . du niveau 0 * 66 *
- * . du niveau 0.5 * 0 *
- * . du niveau 1 * 1972 *
- * . du niveau 1.5 * 0 *
- * . du niveau 2 * 192 *
- ************************************************************
-
- ************************************************************
- * Pyramides *
- ************************************************************
- * Nombre total * 432 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 120 *
- * . du niveau 1 * 0 *
- * . du niveau 1.5 * 312 *
- ************************************************************
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2011-2015 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
-#
-"""
-Python script for HOMARD
-Test test_13 associe au tutorial 3
-"""
-__revision__ = "V2.3"
-
-#========================================================================
-Test_Name = "test_13"
-debug=False
-n_iter_test_file = 2
-#========================================================================
-import os
-import tempfile
-import sys
-import HOMARD
-import salome
-#
-# ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
-# Repertoire des donnees du test
-Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
-Rep_Test = os.path.normpath(Rep_Test)
-sys.path.append(Rep_Test)
-from test_util import remove_dir
-from test_util import test_results
-# Repertoire des resultats
-if debug :
- dircase = os.path.join("/tmp", Test_Name)
- if ( os.path.isdir(dircase) ) :
- remove_dir(dircase)
- os.mkdir(dircase)
-else :
- dircase = tempfile.mkdtemp()
-# Repertoire des donnees du tutorial
-data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-data_dir = os.path.normpath(data_dir)
-sys.path.append(data_dir)
-from tutorial_util import gzip_gunzip
-# ==================================
-gzip_gunzip(data_dir, 3, -1)
-# ==================================
-
-salome.salome_init()
-import iparameters
-ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
-ipar.append("AP_MODULES_LIST", "Homard")
-#
-#========================================================================
-#========================================================================
-def homard_exec(theStudy):
- """
-Python script for HOMARD
- """
- #
- homard.SetCurrentStudy(theStudy)
- #
- # Hypothese "Hypo_0vers1"
- # =======================
- Hypo_0vers1 = homard.CreateHypothesis('Hypo_0vers1')
- # Characterization of the field
- Hypo_0vers1.SetField('SOLU_0__QIRE_ELEM_SIGM__________')
- Hypo_0vers1.SetUseComp(0)
- Hypo_0vers1.AddComp('ERREST ')
- Hypo_0vers1.SetRefinThr(3, 1.0)
- Hypo_0vers1.SetTypeFieldInterp(2)
- Hypo_0vers1.AddFieldInterp('SOLU_0__DEPL____________________')
- Hypo_0vers1.AddFieldInterp('SOLU_0__ERRE_ELEM_SIGM__________')
- #
- # Hypothese "Hypo_1vers2"
- # =======================
- Hypo_1vers2 = homard.CreateHypothesis('Hypo_1vers2')
- # Characterization of the field
- Hypo_1vers2.SetField('SOLU_1__QIRE_ELEM_SIGM__________')
- Hypo_1vers2.SetUseComp(0)
- Hypo_1vers2.AddComp('ERREST ')
- Hypo_1vers2.SetRefinThr(3, 1.5)
- Hypo_1vers2.SetUnRefThr(3, 6.)
- Hypo_1vers2.SetTypeFieldInterp(2)
- Hypo_1vers2.AddFieldInterp('SOLU_1__DEPL____________________')
- Hypo_1vers2.AddFieldInterp('SOLU_1__QIRE_ELEM_SIGM__________')
- #
- # Hypothese "Hypo_1vers2_bis"
- # ===========================
- Hypo_1vers2_bis = homard.CreateHypothesis('Hypo_1vers2_bis')
- # Characterization of the field
- Hypo_1vers2_bis.SetField('SOLU_1__DEPL____________________')
- Hypo_1vers2_bis.SetUseComp(1)
- Hypo_1vers2_bis.AddComp('DX')
- Hypo_1vers2_bis.AddComp('DY')
- Hypo_1vers2_bis.AddComp('DZ')
- Hypo_1vers2_bis.SetRefinThr(1, 0.0001)
- Hypo_1vers2_bis.SetUnRefThr(1, 0.000001)
- Hypo_1vers2_bis.SetTypeFieldInterp(0)
- #
- # Cas
- # ===
- Case_3 = homard.CreateCase('Case_3', 'G_0', data_dir+'/tutorial_3.00.med')
- Case_3.SetDirName(dircase)
- #
- # Iteration "Iter_3_1"
- # ====================
- Iter_3_1 = Case_3.NextIteration('Iter_3_1')
- Iter_3_1.SetMeshName('H_1')
- Iter_3_1.SetMeshFile(dircase+'/maill.01.med')
- Iter_3_1.SetFieldFile(data_dir+'/tutorial_3.00.med')
- Iter_3_1.SetTimeStepRank( 1, 1)
- Iter_3_1.AssociateHypo('Hypo_0vers1')
- error = Iter_3_1.Compute(1, 2)
- #
- # Iteration "Iter_3_2"
- # ====================
- Iter_3_2 = Iter_3_1.NextIteration('Iter_3_2')
- Iter_3_2.SetMeshName('H_2')
- Iter_3_2.SetMeshFile(dircase+'/maill.02.med')
- Iter_3_2.SetFieldFile(data_dir+'/tutorial_3.01.med')
- Iter_3_2.SetTimeStepRank(1, 1)
- Iter_3_2.AssociateHypo('Hypo_1vers2')
- error = Iter_3_2.Compute(1, 2)
- #
- # Iteration "Iter_3_2_bis"
- # ========================
- Iter_3_2_bis = Iter_3_1.NextIteration('Iter_3_2_bis')
- Iter_3_2_bis.SetMeshName('H_2_bis')
- Iter_3_2_bis.SetMeshFile(dircase+'/maill.02.bis.med')
- Iter_3_2_bis.SetFieldFile(data_dir+'/tutorial_3.01.med')
- Iter_3_2_bis.SetTimeStepRank(1, 1)
- Iter_3_2_bis.AssociateHypo('Hypo_1vers2_bis')
- error = Iter_3_2_bis.Compute(1, 2)
- #
- return error
-
-#========================================================================
-
-homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
-assert homard is not None, "Impossible to load homard engine"
-homard.SetLanguageShort("fr")
-#
-# Exec of HOMARD-SALOME
-#
-try :
- error_main = homard_exec(salome.myStudy)
- if error_main :
- raise Exception('Pb in homard_exec at iteration %d' %error_main )
-except Exception, e:
- raise Exception('Pb in homard_exec: '+e.message)
-#
-# Test of the results
-#
-n_rep_test_file = 3
-destroy_dir = not debug
-test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
-#
-# ==================================
-gzip_gunzip(data_dir, 3, 1)
-# ==================================
-#
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(1)
- iparameters.getSession().restoreVisualState(1)
-
+++ /dev/null
-
-
-ANALYSE DU MAILLAGE
-===================
-
- Maillage apres adaptation
- PIQUAGE
- Date de creation : lundi 2 novembre 2015 a 9 h 13 mn 13 s
- Dimension : 3
- Degre : 1
- C'est un maillage obtenu apres 3 adaptations.
- Le niveau minimum actif est : 1
- Le niveau maximum atteint est : 2
-
- Direction | Unite | Minimum | Maximum
- ---------------------------------------------------------------
- | | -230.00 | 136.45
- | | -250.62 | 189.69
- | | -285.21 | 155.03
-
-
- NOMBRE D'ENTITES DU CALCUL
- ==========================
-
-
- ************************************************************
- * Noeuds *
- ************************************************************
- * Nombre total * 12825 *
- ************************************************************
-
- ************************************************************
- * Segments *
- ************************************************************
- * Nombre total * 758 *
- * . dont aretes isolees * 0 *
- * . dont aretes de bord de regions 2D * 0 *
- * . dont aretes internes aux faces/volumes * 758 *
- ************************************************************
-
- ************************************************************
- * Triangles *
- ************************************************************
- * Nombre total * 20838 *
- * . dont triangles de regions 2D * 0 *
- * . dont triangles de bord * 20560 *
- * . dont triangles internes aux volumes * 278 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 0 *
- * . du niveau 1 * 3530 *
- * . du niveau 1.5 * 380 *
- * . du niveau 2 * 16928 *
- ************************************************************
-
- ************************************************************
- * Tetraedres *
- ************************************************************
- * Nombre total * 43490 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 0 *
- * . du niveau 1 * 18174 *
- * . du niveau 1.5 * 25316 *
- ************************************************************
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2011-2015 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
-#
-"""
-Python script for HOMARD
-Test test_14 associe au tutorial 4
-"""
-__revision__ = "V2.3"
-
-#========================================================================
-Test_Name = "test_14"
-debug=False
-n_iter_test_file = 3
-#========================================================================
-import os
-import tempfile
-import sys
-import HOMARD
-import salome
-#
-# ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
-# Repertoire des donnees du test
-Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
-Rep_Test = os.path.normpath(Rep_Test)
-sys.path.append(Rep_Test)
-from test_util import remove_dir
-from test_util import test_results
-# Repertoire des resultats
-if debug :
- dircase = os.path.join("/tmp", Test_Name)
- if ( os.path.isdir(dircase) ) :
- remove_dir(dircase)
- os.mkdir(dircase)
-else :
- dircase = tempfile.mkdtemp()
-# Repertoire des donnees du tutorial
-data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-data_dir = os.path.normpath(data_dir)
-sys.path.append(data_dir)
-from tutorial_util import gzip_gunzip
-# ==================================
-gzip_gunzip(data_dir, 4, -1)
-# ==================================
-
-salome.salome_init()
-import iparameters
-ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
-ipar.append("AP_MODULES_LIST", "Homard")
-#
-#========================================================================
-#========================================================================
-def homard_exec(theStudy):
- """
-Python script for HOMARD
- """
- #
- homard.SetCurrentStudy(theStudy)
-#
- # Frontieres
- # ==========
- Boun_4_1 = homard.CreateBoundaryDi('intersection', 'PIQUAGE', data_dir+'/tutorial_4.fr.med')
- #
- Boun_4_2 = homard.CreateBoundaryCylinder('cyl_1_ext', 0.0, 25., -25., 25., 50., 75., 100.)
- #
- Boun_4_3 = homard.CreateBoundaryCylinder('cyl_2_ext', 17.5, -2.5, -12.5, -100., -75., -25., 50.)
- #
- Boun_4_4 = homard.CreateBoundaryCylinder('cyl_1_int', 0.0, 25., -25., 25., 50., 75., 75.)
- #
- Boun_4_5 = homard.CreateBoundaryCylinder('cyl_2_int', 17.5, -2.5, -12.5, -100., -75., -25., 25.)
- #
- # Hypotheses
- # ==========
- # Creation of the hypothesis Hypo_4
- Hypo_4 = homard.CreateHypothesis('Hypo_4')
- Hypo_4.SetUnifRefinUnRef(1)
- Hypo_4.AddGroup('T1_INT_I')
- Hypo_4.AddGroup('T1_INT_O')
- Hypo_4.AddGroup('T2_INT')
- # Creation of the hypothesis Hypo_4_bis
- Hypo_4_bis = homard.CreateHypothesis('Hypo_4_bis')
- Hypo_4_bis.SetUnifRefinUnRef(1)
- Hypo_4_bis.AddGroup('T1_EXT_I')
- Hypo_4_bis.AddGroup('T1_EXT_O')
- Hypo_4_bis.AddGroup('T2_EXT')
- #
- # Cas
- # ===
- Case_4 = homard.CreateCase('Case_4', 'PIQUAGE', data_dir+'/tutorial_4.00.med')
- Case_4.SetDirName(dircase)
- Case_4.AddBoundaryGroup( 'intersection', '' )
- Case_4.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_I' )
- Case_4.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_I' )
- Case_4.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_O' )
- Case_4.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_O' )
- Case_4.AddBoundaryGroup( 'cyl_2_int', 'T2_INT' )
- Case_4.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' )
- #
- # Iterations
- # ==========
- # Iteration Iter_4_1 : raffinement selon les faces internes
- Iter_4_1 = Case_4.NextIteration('Iter_4_1')
- Iter_4_1.SetMeshName('PIQUAGE_1')
- Iter_4_1.SetMeshFile(dircase+'/maill.01.med')
- Iter_4_1.AssociateHypo('Hypo_4')
- error = Iter_4_1.Compute(1, 2)
- # Iteration Iter_4_2 : raffinement selon les faces externes
- Iter_4_2 = Iter_4_1.NextIteration('Iter_4_2')
- Iter_4_2.SetMeshName('PIQUAGE_2')
- Iter_4_2.SetMeshFile(dircase+'/maill.02.med')
- Iter_4_2.AssociateHypo('Hypo_4_bis')
- error = Iter_4_2.Compute(1, 2)
- # Iteration Iter_4_3 : second raffinement selon les faces externes
- Iter_4_3 = Iter_4_2.NextIteration('Iter_4_3')
- Iter_4_3.SetMeshName('PIQUAGE_3')
- Iter_4_3.SetMeshFile(dircase+'/maill.03.med')
- Iter_4_3.AssociateHypo('Hypo_4_bis')
- error = Iter_4_3.Compute(1, 2)
- #
- return error
-
-#========================================================================
-
-homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
-assert homard is not None, "Impossible to load homard engine"
-homard.SetLanguageShort("fr")
-#
-# Exec of HOMARD-SALOME
-#
-try :
- error_main = homard_exec(salome.myStudy)
- if error_main :
- raise Exception('Pb in homard_exec at iteration %d' %error_main )
-except Exception, e:
- raise Exception('Pb in homard_exec: '+e.message)
-#
-# Test of the results
-#
-n_rep_test_file = n_iter_test_file
-destroy_dir = not debug
-test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
-#
-# ==================================
-gzip_gunzip(data_dir, 4, 1)
-# ==================================
-#
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(1)
- iparameters.getSession().restoreVisualState(1)
-
+++ /dev/null
-
-
-ANALYSE DU MAILLAGE
-===================
-
- Maillage apres adaptation
- COEUR_2D
- Date de creation : mardi 24 novembre 2015 a 9 h 33 mn 8 s
- Dimension : 2
- Degre : 1
- C'est un maillage obtenu apres 2 adaptations.
- Le niveau minimum actif est : 0
- Le niveau maximum atteint est : 2
-
- Direction | Unite | Minimum | Maximum
- ---------------------------------------------------------------
- | | -248.00 | 248.00
- | | -248.00 | 248.00
-
-
- NOMBRE D'ENTITES DU CALCUL
- ==========================
-
-
- ************************************************************
- * Noeuds *
- ************************************************************
- * Nombre total * 1542 *
- ************************************************************
-
- ************************************************************
- * Segments *
- ************************************************************
- * Nombre total * 418 *
- * . dont aretes isolees * 0 *
- * . dont aretes de bord de regions 2D * 300 *
- * . dont aretes internes aux faces/volumes * 118 *
- ************************************************************
-
- ************************************************************
- * Triangles *
- ************************************************************
- * Nombre total * 2204 *
- ************************************************************
- * . du niveau 0 * 88 *
- * . du niveau 1 * 980 *
- * . du niveau 2 * 1136 *
- ************************************************************
-
- ************************************************************
- * Quadrangles *
- ************************************************************
- * Nombre total * 334 *
- ************************************************************
- * . du niveau 0 * 162 *
- * . du niveau 1 * 172 *
- ************************************************************
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2011-2015 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
-#
-"""
-Python script for HOMARD
-Test test_15 associe au tutorial 5
-"""
-__revision__ = "V2.3"
-
-#========================================================================
-Test_Name = "test_15"
-debug=False
-n_iter_test_file = 2
-#========================================================================
-import os
-import tempfile
-import sys
-import HOMARD
-import salome
-#
-# ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
-# Repertoire des donnees du test
-Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
-Rep_Test = os.path.normpath(Rep_Test)
-sys.path.append(Rep_Test)
-sys.path.append(Rep_Test)
-from test_util import remove_dir
-from test_util import test_results
-# Repertoire des resultats
-if debug :
- dircase = os.path.join("/tmp", Test_Name)
- if ( os.path.isdir(dircase) ) :
- remove_dir(dircase)
- os.mkdir(dircase)
-else :
- dircase = tempfile.mkdtemp()
-# Repertoire des donnees du tutorial
-data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-data_dir = os.path.normpath(data_dir)
-sys.path.append(data_dir)
-from tutorial_util import gzip_gunzip
-# ==================================
-gzip_gunzip(data_dir, 5, -1)
-# ==================================
-
-salome.salome_init()
-import iparameters
-ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
-ipar.append("AP_MODULES_LIST", "Homard")
-#
-#========================================================================
-#========================================================================
-def homard_exec(theStudy):
- """
-Python script for HOMARD
- """
- #
- homard.SetCurrentStudy(theStudy)
-#
- # Frontiere
- # =========
- # Creation of the discrete boundary Boun_5_1
- Boun_5_1 = homard.CreateBoundaryDi('Boun_5_1', 'MAIL_EXT', data_dir+'/tutorial_5.fr.med')
- #
- # Creation des zones
- # ==================
- # Creation of the disk with hole enveloppe
- enveloppe = homard.CreateZoneDiskWithHole( 'enveloppe', 0., 0., 250., 193., 1 )
- # Creation of the rectangle quart_sup
- quart_sup = homard.CreateZoneBox2D( 'quart_sup', 0., 250., 0., 250., 1 )
- #
- # Hypotheses
- # ==========
- # Creation of the hypothesis Hypo_5
- Hypo_5 = homard.CreateHypothesis('Hypo_5')
- Hypo_5.AddZone('enveloppe', 1)
- # Creation of the hypothesis Hypo_5_bis
- Hypo_5_bis = homard.CreateHypothesis('Hypo_5_bis')
- Hypo_5_bis.AddZone('quart_sup', 1)
- #
- # Cas
- # ===
- Case_5 = homard.CreateCase('Case_5', 'COEUR_2D', data_dir+'/tutorial_5.00.med')
- Case_5.SetDirName(dircase)
- Case_5.SetConfType(1)
- Case_5.AddBoundaryGroup('Boun_5_1', '')
- #
- # Iteration "Iter_5_1"
- # ====================
- Iter_5_1 = Case_5.NextIteration('Iter_5_1')
- Iter_5_1.SetMeshName('COEUR_2D_01')
- Iter_5_1.SetMeshFile(dircase+'/maill.01.med')
- Iter_5_1.AssociateHypo('Hypo_5')
- error = Iter_5_1.Compute(1, 2)
- #
- # Iteration "Iter_5_2"
- # ====================
- Iter_5_2 = Iter_5_1.NextIteration('Iter_5_2')
- Iter_5_2.SetMeshName('COEUR_2D_02')
- Iter_5_2.SetMeshFile(dircase+'/maill.02.med')
- Iter_5_2.AssociateHypo('Hypo_5_bis')
- error = Iter_5_2.Compute(1, 2)
- #
- return error
-
-#========================================================================
-
-homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
-assert homard is not None, "Impossible to load homard engine"
-homard.SetLanguageShort("fr")
-#
-# Exec of HOMARD-SALOME
-#
-try :
- error_main = homard_exec(salome.myStudy)
- if error_main :
- raise Exception('Pb in homard_exec at iteration %d' %error_main )
-except Exception, e:
- raise Exception('Pb in homard_exec: '+e.message)
-#
-# Test of the results
-#
-n_rep_test_file = n_iter_test_file
-destroy_dir = not debug
-test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
-#
-# ==================================
-gzip_gunzip(data_dir, 5, 1)
-# ==================================
-#
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(1)
- iparameters.getSession().restoreVisualState(1)
-
+++ /dev/null
-
-
-ANALYSE DU MAILLAGE
-===================
-
- Maillage apres adaptation
- PLAQUE_0
- Date de creation : jeudi 3 avril 2014 a 13 h 21 mn 21 s
- Dimension : 3
- Degre : 2
- C'est un maillage obtenu apres 3 adaptations.
- Le niveau minimum actif est : 0
- Le niveau maximum atteint est : 2
-
- Direction | Unite | Minimum | Maximum
- ---------------------------------------------------------------
- X | INCONNUE |-0.40000E-01| 0.40000E-01
- Y | INCONNUE |-0.30000E-01| 0.30000E-01
- Z | INCONNUE |-0.30854E-01| 0.30854E-01
-
-
- NOMBRE D'ENTITES DU CALCUL
- ==========================
-
-
- ************************************************************
- * Noeuds *
- ************************************************************
- * Nombre total * 1212 *
- * . dont sommets d'aretes * 317 *
- * . dont milieux d'aretes * 895 *
- ************************************************************
-
- ************************************************************
- * Segments *
- ************************************************************
- * Nombre total * 101 *
- * . dont aretes isolees * 0 *
- * . dont aretes de bord de regions 2D * 53 *
- * . dont aretes internes aux faces/volumes * 48 *
- ************************************************************
-
- ************************************************************
- * Triangles *
- ************************************************************
- * Nombre total * 579 *
- ************************************************************
- * . du niveau 0 * 33 *
- * . du niveau 0.5 * 14 *
- * . du niveau 1 * 148 *
- * . du niveau 1.5 * 48 *
- * . du niveau 2 * 336 *
- ************************************************************
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2011-2015 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
-#
-"""
-Python script for HOMARD
-Test test_2
-"""
-__revision__ = "V2.5"
-
-#========================================================================
-Test_Name = "test_2"
-debug=False
-n_iter_test_file = 3
-#========================================================================
-import os
-import tempfile
-import sys
-import HOMARD
-import salome
-#
-# ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
-# Repertoire des donnees du test
-Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
-Rep_Test = os.path.normpath(Rep_Test)
-sys.path.append(Rep_Test)
-from test_util import remove_dir
-from test_util import test_results
-# Repertoire des resultats
-if debug :
- dircase = os.path.join("/tmp", Test_Name)
- if ( os.path.isdir(dircase) ) :
- remove_dir(dircase)
- os.mkdir(dircase)
-else :
- dircase = tempfile.mkdtemp()
-# ==================================
-
-salome.salome_init()
-import iparameters
-ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
-ipar.append("AP_MODULES_LIST", "Homard")
-#
-#========================================================================
-#========================================================================
-def homard_exec(theStudy):
- """
-Python script for HOMARD
- """
- error = 0
-#
- while not error :
- #
- homard.SetCurrentStudy(theStudy)
- #
- # Creation of the boundaries
- # ==========================
- # Creation of the discrete boundary Boundary_1
- Boundary_1 = homard.CreateBoundaryDi('internal_boundary', 'plaque', os.path.join(Rep_Test, Test_Name + '.fr.med'))
- #
- # Creation of the hypotheses
- # ==========================
- # Creation of the hypothesis 1
- HypoName_1 = "Hypo_" + Test_Name + "_1"
- print "-------- Creation of the hypothesis", HypoName_1
- Hypo_test_2_1 = homard.CreateHypothesis(HypoName_1)
- Hypo_test_2_1.SetUnifRefinUnRef(1)
- Hypo_test_2_1.AddGroup('EG')
- Hypo_test_2_1.AddGroup('BANDE')
- print HypoName_1, " : zones utilisées :", Hypo_test_2_1.GetZones()
- print HypoName_1, " : champ utilisé :", Hypo_test_2_1.GetFieldName()
- print HypoName_1, " : composantes utilisées :", Hypo_test_2_1.GetComps()
- if ( len (Hypo_test_2_1.GetFieldName()) > 0 ) :
- print ".. caractéristiques de l'adaptation :", Hypo_test_2_1.GetField()
-
- # Creation of the hypothesis 2
- HypoName_2 = "Hypo_" + Test_Name + "_2"
- print "-------- Creation of the hypothesis", HypoName_2
- Hypo_test_2_2 = homard.CreateHypothesis(HypoName_2)
- Hypo_test_2_2.SetUnifRefinUnRef(1)
- Hypo_test_2_2.AddGroup('M_D')
- print HypoName_2, " : zones utilisées :", Hypo_test_2_2.GetZones()
- print HypoName_2, " : champ utilisé :", Hypo_test_2_2.GetFieldName()
- print HypoName_2, " : composantes utilisées :", Hypo_test_2_2.GetComps()
- if ( len (Hypo_test_2_2.GetFieldName()) > 0 ) :
- print ".. caractéristiques de l'adaptation :", Hypo_test_2_2.GetField()
- #
- # Creation of the cases
- # =====================
- # Creation of the case
- CaseName = "Case_" + Test_Name
- MeshFile = os.path.join(Rep_Test, Test_Name + '.00.med')
- Case_test_2 = homard.CreateCase(CaseName, 'PLAQUE_0', MeshFile)
- Case_test_2.SetDirName(dircase)
- Case_test_2.AddBoundaryGroup('internal_boundary', '')
- #
- # Creation of the iterations
- # ==========================
- # Creation of the iteration 1
- IterName = "I_" + Test_Name + "_1"
- Iter_test_2_1 = Case_test_2.NextIteration(IterName)
- Iter_test_2_1.SetMeshName('PLAQUE_1')
- Iter_test_2_1.SetMeshFile(os.path.join(dircase, 'maill.01.med'))
- Iter_test_2_1.AssociateHypo(HypoName_1)
- error = Iter_test_2_1.Compute(1, 1)
- if error :
- error = 1
- break
-
- # Creation of the iteration 2
- IterName = "I_" + Test_Name + "_2"
- Iter_test_2_2 = Iter_test_2_1.NextIteration(IterName)
- Iter_test_2_2.SetMeshName('PLAQUE_2')
- Iter_test_2_2.SetMeshFile(os.path.join(dircase, 'maill.02.med'))
- Iter_test_2_2.AssociateHypo(HypoName_1)
- error = Iter_test_2_2.Compute(1, 1)
- if error :
- error = 2
- break
-
- # Creation of the iteration 3
- IterName = "I_" + Test_Name + "_3"
- Iter_test_2_3 = Iter_test_2_2.NextIteration(IterName)
- Iter_test_2_3.SetMeshName('PLAQUE_3')
- Iter_test_2_3.SetMeshFile(os.path.join(dircase, 'maill.03.med'))
- Iter_test_2_3.AssociateHypo(HypoName_2)
- error = Iter_test_2_3.Compute(1, 1)
- if error :
- error = 3
- break
- #
- # Creation of the schema YACS
- # ===========================
- ScriptFile = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "en", "_downloads", "yacs_script_test.py")
- ScriptFile = os.path.normpath(ScriptFile)
- DirName = dircase
- YACS_test_2 = Case_test_2.CreateYACSSchema("YACS_test_2", ScriptFile, DirName, MeshFile)
- YACS_test_2.SetMaxIter(4)
- YACS_test_2.SetType(1)
- filexml = os.path.join(dircase, 'YACS_test_2.xml')
- error = YACS_test_2.WriteOnFile(filexml)
- if error :
- error = 4
- break
- #
- break
- #
- return error
-
-#========================================================================
-
-homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
-assert homard is not None, "Impossible to load homard engine"
-homard.SetLanguageShort("fr")
-#
-# Exec of HOMARD-SALOME
-#
-try :
- error_main = homard_exec(salome.myStudy)
- if error_main :
- raise Exception('Pb in homard_exec at iteration %d' %error_main )
-except Exception, e:
- raise Exception('Pb in homard_exec: '+e.message)
-#
-# Test of the results
-#
-n_rep_test_file = n_iter_test_file
-destroy_dir = not debug
-test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
-#
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(1)
- iparameters.getSession().restoreVisualState(1)
-
+++ /dev/null
-
-
-ANALYSE DU MAILLAGE
-===================
-
- Maillage apres adaptation
- MOYEU
- Date de creation : jeudi 3 avril 2014 a 13 h 22 mn 30 s
- Dimension : 3
- Degre : 1
- C'est un maillage obtenu apres 2 adaptations.
- Le niveau minimum actif est : 2
- Le niveau maximum atteint est : 2
-
- Direction | Unite | Minimum | Maximum
- ---------------------------------------------------------------
- x | m | -36.603 | 536.60
- y | m | -75.000 | 125.00
- z | m | -125.00 | 75.000
-
-
- NOMBRE D'ENTITES DU CALCUL
- ==========================
-
-
- ************************************************************
- * Noeuds *
- ************************************************************
- * Nombre total * 3710 *
- ************************************************************
-
- ************************************************************
- * Segments *
- ************************************************************
- * Nombre total * 156 *
- * . dont aretes isolees * 0 *
- * . dont aretes de bord de regions 2D * 0 *
- * . dont aretes internes aux faces/volumes * 156 *
- ************************************************************
-
- ************************************************************
- * Triangles *
- ************************************************************
- * Nombre total * 3232 *
- * . dont triangles de regions 2D * 0 *
- * . dont triangles de bord * 3232 *
- * . dont triangles internes aux volumes * 0 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 0 *
- * . du niveau 1 * 0 *
- * . du niveau 1.5 * 0 *
- * . du niveau 2 * 3232 *
- ************************************************************
-
- ************************************************************
- * Tetraedres *
- ************************************************************
- * Nombre total * 17280 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 0 *
- * . du niveau 1 * 0 *
- * . du niveau 1.5 * 0 *
- * . du niveau 2 * 17280 *
- ************************************************************
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2011-2015 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
-#
-"""
-Python script for HOMARD
-Test test_3
-"""
-__revision__ = "V2.4"
-
-#========================================================================
-Test_Name = "test_3"
-debug=False
-n_boucle = 2
-n_iter_test_file = 2
-#========================================================================
-import os
-import tempfile
-import sys
-import HOMARD
-import salome
-#
-# ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
-# Repertoire des donnees du test
-Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
-Rep_Test = os.path.normpath(Rep_Test)
-sys.path.append(Rep_Test)
-from test_util import remove_dir
-from test_util import test_results
-# Repertoire des resultats
-if debug :
- dircase = os.path.join("/tmp", Test_Name)
- if ( os.path.isdir(dircase) ) :
- remove_dir(dircase)
- os.mkdir(dircase)
-else :
- dircase = tempfile.mkdtemp()
-# ==================================
-
-salome.salome_init()
-import iparameters
-ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
-ipar.append("AP_MODULES_LIST", "Homard")
-#
-#========================================================================
-#========================================================================
-def homard_exec(theStudy):
- """
-Python script for HOMARD
- """
- error = 0
-#
- while not error :
-#
- homard.SetCurrentStudy(theStudy)
- #
- # Creation of the boundaries
- # ==========================
- # Creation of the discrete boundary
- Boundary_3_1 = homard.CreateBoundaryDi('courbes', 'COURBES', os.path.join(Rep_Test, Test_Name + '.fr.med'))
- #
- # Creation of the external cylinder
- Boundary_3_2 = homard.CreateBoundaryCylinder('cyl_ext', 50.0, 25., -25., 1., 0., 0., 100.)
- #
- # Creation of the internal cylinder
- Boundary_3_3 = homard.CreateBoundaryCylinder('cyl_int', 50.0, 25., -25., 1., 0., 0., 50.)
- #
- # Creation of the first sphere
- Boundary_3_4 = homard.CreateBoundarySphere('sphere_1', 50.0, 25., -25., 100.)
- #
- # Creation of the second sphere
- Boundary_3_5 = homard.CreateBoundarySphere('sphere_2', 450.0, 25., -25., 100.)
- #
- # Creation of the hypotheses
- # ==========================
- # Uniform refinement
- HypoName = "Hypo_" + Test_Name
- print "-------- Creation of the hypothesis", HypoName
- Hypo_test_3 = homard.CreateHypothesis(HypoName)
- Hypo_test_3.SetUnifRefinUnRef(1)
- print HypoName, " : zones utilisées :", Hypo_test_3.GetZones()
- print HypoName, " : champ utilisé :", Hypo_test_3.GetFieldName()
- print HypoName, " : composantes utilisées :", Hypo_test_3.GetComps()
- #
- for num in range (n_boucle+1) :
- #
- print "-------- num =", num, "--------"
- #
- # Creation of the case Case_test_3
- # ===========================
- if ( num <= 1 ) :
- CaseName = "Case_" + Test_Name
- print "-------- Creation of the case", CaseName
- MeshFile = os.path.join(Rep_Test, Test_Name + '.00.med')
- Case_test_3 = homard.CreateCase(CaseName, 'MOYEU', MeshFile)
- Case_test_3.SetDirName(dircase)
- Case_test_3.AddBoundaryGroup('courbes', '')
- Case_test_3.AddBoundaryGroup('cyl_ext', 'EXT')
- Case_test_3.AddBoundaryGroup('cyl_int', 'INT')
- Case_test_3.AddBoundaryGroup('sphere_1', 'END_1')
- Case_test_3.AddBoundaryGroup('sphere_2', 'END_2')
- #
- # Creation of the iterations
- # ==========================
- # Creation of the iteration 1
- IterName = "I_" + Test_Name + "_1"
- print "-------- Creation of the iteration", IterName
- Iter_test_3_1 = Case_test_3.NextIteration(IterName)
- Iter_test_3_1.SetMeshName('MOYEU_1')
- Iter_test_3_1.SetMeshFile(os.path.join(dircase, 'maill.01.med'))
- Iter_test_3_1.AssociateHypo('Hypo_test_3')
- error = Iter_test_3_1.Compute(1, 1)
- if error :
- error = 10*num + 1
- break
-
- # Creation of the iteration 2
- IterName = "I_" + Test_Name + "_2"
- print "-------- Creation of the iteration", IterName
- Iter_test_3_2 = Iter_test_3_1.NextIteration(IterName)
- Iter_test_3_2.SetMeshName('MOYEU_2')
- Iter_test_3_2.SetMeshFile(os.path.join(dircase, 'maill.02.med'))
- Iter_test_3_2.AssociateHypo('Hypo_test_3')
- error = Iter_test_3_2.Compute(1, 1)
- if error :
- error = 10*num + 2
- break
- #
- # Creation of the schema YACS
- # ===========================
- ScriptFile = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "en", "_downloads", "yacs_script_test.py")
- ScriptFile = os.path.normpath(ScriptFile)
- DirName = dircase
- YACSName = "YACS_" + Test_Name
- print "-------- Creation of the schema", YACSName
- YACS_test_3 = Case_test_3.CreateYACSSchema(YACSName, ScriptFile, DirName, MeshFile)
- YACS_test_3.SetType(2)
- YACS_test_3.SetMaxIter(2)
- error = YACS_test_3.Write()
- if error :
- error = 10*num + 5
- break
-
- # Destructions
- # ============
- # Destruction of the schema, sauf a la fin
- if ( num < n_boucle ) :
- print "-------- Destruction of the schema", YACS_test_3.GetName()
- error = YACS_test_3.Delete(1)
- if error :
- error = 10*num + 6
- break
- # After the first loop, the case is deleted, except the final mesh files
- # All the iterations are deleted
- if ( num == 0 ) :
- print "-------- Destruction of the case", Case_test_3.GetName()
- error = Case_test_3.Delete(0)
- if error :
- break
- # After the second loop, the iterations are deleted, with the final mesh files
- elif ( num == 1 ) :
- # Recursive destruction of the iterations
- print "-------- Recursive destruction of the iteration", Iter_test_3_1.GetName()
- error = Iter_test_3_1.Delete(1)
- if error :
- error = 10*num + 3
- break
- # Destruction and creation of the hypothese
- if ( num == 1 ) :
- print "-------- Destruction of the hypothese", Hypo_test_3.GetName()
- error = Hypo_test_3.Delete()
- if error :
- error = 10*num + 4
- break
- HypoName = "Hypo_test_3"
- print "-------- Creation of the hypothesis", HypoName
- Hypo_test_3 = homard.CreateHypothesis(HypoName)
- Hypo_test_3.SetUnifRefinUnRef(1)
- #
- break
- #
- return error
-
-#========================================================================
-
-homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
-assert homard is not None, "Impossible to load homard engine"
-homard.SetLanguageShort("fr")
-#
-# Exec of HOMARD-SALOME
-#
-try :
- error_main = homard_exec(salome.myStudy)
- if error_main :
- raise Exception('Pb in homard_exec at iteration %d' %error_main )
-except Exception, e:
- raise Exception('Pb in homard_exec: '+e.message)
-#
-# Test of the results
-#
-n_rep_test_file = n_iter_test_file*n_boucle
-destroy_dir = not debug
-test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
-#
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(1)
- iparameters.getSession().restoreVisualState(1)
-
+++ /dev/null
-
-
-ANALYSE DU MAILLAGE
-===================
-
- Maillage apres adaptation
- MESH
- Date de creation : lundi 2 novembre 2015 a 11 h 32 mn 46 s
- Dimension : 3
- Degre : 1
- C'est un maillage obtenu apres 2 adaptations.
- Le niveau minimum actif est : 0
- Le niveau maximum atteint est : 2
-
- Direction | Unite | Minimum | Maximum
- ---------------------------------------------------------------
- | | 0.0000 | 600.00
- | | 0.0000 | 400.00
- | | 0.0000 | 200.00
-
-
- NOMBRE D'ENTITES DU CALCUL
- ==========================
-
-
- ************************************************************
- * Noeuds *
- ************************************************************
- * Nombre total * 1389 *
- ************************************************************
-
- ************************************************************
- * Segments *
- ************************************************************
- * Nombre total * 124 *
- * . dont aretes isolees * 0 *
- * . dont aretes de bord de regions 2D * 0 *
- * . dont aretes internes aux faces/volumes * 124 *
- ************************************************************
-
- ************************************************************
- * Triangles *
- ************************************************************
- * Nombre total * 54 *
- * . dont triangles de regions 2D * 54 *
- * . dont triangles de bord * 0 *
- * . dont triangles internes aux volumes * 0 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 54 *
- ************************************************************
-
- ************************************************************
- * Quadrangles *
- ************************************************************
- * Nombre total * 616 *
- * . dont quadrangles de regions 2D * 9 *
- * . dont quadrangles de bord * 607 *
- * . dont quadrangles internes aux volumes * 0 *
- ************************************************************
- * . du niveau 0 * 503 *
- * . du niveau 0.5 * 9 *
- * . du niveau 1 * 104 *
- ************************************************************
-
- ************************************************************
- * Tetraedres *
- ************************************************************
- * Nombre total * 200 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 192 *
- * . du niveau 1 * 0 *
- * . du niveau 1.5 * 8 *
- ************************************************************
-
- ************************************************************
- * Hexaedres *
- ************************************************************
- * Nombre total * 847 *
- ************************************************************
- * . du niveau 0 * 657 *
- * . du niveau 0.5 * 0 *
- * . du niveau 1 * 190 *
- ************************************************************
-
- ************************************************************
- * Pyramides *
- ************************************************************
- * Nombre total * 454 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 412 *
- * . du niveau 1 * 0 *
- * . du niveau 1.5 * 42 *
- ************************************************************
+++ /dev/null
-
-
-ANALYSE DU MAILLAGE
-===================
-
- Maillage apres adaptation
- MESH
- Date de creation : mardi 3 novembre 2015 a 9 h 1 mn 54 s
- Dimension : 3
- Degre : 1
- C'est un maillage obtenu apres 3 adaptations.
- Le niveau minimum actif est : 0
- Le niveau maximum atteint est : 2
-
- Direction | Unite | Minimum | Maximum
- ---------------------------------------------------------------
- | | 0.0000 | 600.00
- | | 0.0000 | 400.00
- | | 0.0000 | 200.00
-
-
- NOMBRE D'ENTITES DU CALCUL
- ==========================
-
-
- ************************************************************
- * Noeuds *
- ************************************************************
- * Nombre total * 2503 *
- ************************************************************
-
- ************************************************************
- * Segments *
- ************************************************************
- * Nombre total * 120 *
- * . dont aretes isolees * 0 *
- * . dont aretes de bord de regions 2D * 0 *
- * . dont aretes internes aux faces/volumes * 120 *
- ************************************************************
-
- ************************************************************
- * Triangles *
- ************************************************************
- * Nombre total * 582 *
- * . dont triangles de regions 2D * 582 *
- * . dont triangles de bord * 0 *
- * . dont triangles internes aux volumes * 0 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 558 *
- * . du niveau 1 * 0 *
- * . du niveau 1.5 * 24 *
- ************************************************************
-
- ************************************************************
- * Quadrangles *
- ************************************************************
- * Nombre total * 455 *
- * . dont quadrangles de regions 2D * 81 *
- * . dont quadrangles de bord * 374 *
- * . dont quadrangles internes aux volumes * 0 *
- ************************************************************
- * . du niveau 0 * 322 *
- * . du niveau 0.5 * 81 *
- * . du niveau 1 * 52 *
- ************************************************************
-
- ************************************************************
- * Tetraedres *
- ************************************************************
- * Nombre total * 1952 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 1824 *
- * . du niveau 1 * 0 *
- * . du niveau 1.5 * 128 *
- ************************************************************
-
- ************************************************************
- * Hexaedres *
- ************************************************************
- * Nombre total * 523 *
- ************************************************************
- * . du niveau 0 * 283 *
- * . du niveau 0.5 * 0 *
- * . du niveau 1 * 240 *
- ************************************************************
-
- ************************************************************
- * Pyramides *
- ************************************************************
- * Nombre total * 3559 *
- ************************************************************
- * . du niveau 0 * 0 *
- * . du niveau 0.5 * 3239 *
- * . du niveau 1 * 0 *
- * . du niveau 1.5 * 320 *
- ************************************************************
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2011-2015 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
-#
-"""
-Python script for HOMARD
-Test test_4
-"""
-__revision__ = "V1.0"
-
-#========================================================================
-Test_Name = "test_4"
-debug=False
-n_iter_test_file = 3
-DX = 600.
-DY = 400.
-DZ = 200.
-#========================================================================
-import os
-import tempfile
-import sys
-import numpy as np
-import salome
-import GEOM
-import SMESH
-import HOMARD
-import MEDCoupling as mc
-import MEDLoader as ml
-#
-# ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
-# Repertoire des donnees du test
-Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
-Rep_Test = os.path.normpath(Rep_Test)
-sys.path.append(Rep_Test)
-from test_util import remove_dir
-from test_util import test_results
-# Repertoire des resultats
-if debug :
- dircase = os.path.join("/tmp", Test_Name)
- if ( os.path.isdir(dircase) ) :
- remove_dir(dircase)
- os.mkdir(dircase)
-else :
- dircase = tempfile.mkdtemp()
-# ==================================
-
-salome.salome_init()
-
-import SALOMEDS
-from salome.geom import geomBuilder
-from salome.smesh import smeshBuilder
-from salome.StdMeshers import StdMeshersBuilder
-#
-from MEDLoader import MEDLoader
-from MEDCouplingRemapper import MEDCouplingRemapper
-
-import iparameters
-ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
-ipar.append("AP_MODULES_LIST", "Homard")
-#
-#========================================================================
-#========================================================================
-def geom_smesh_exec(theStudy):
- """
-Python script for GEOM and SMESH
- """
- error = 0
-#
- while not error :
- #
- geompy = geomBuilder.New(theStudy)
- #
- # Creation of the box
- # ===================
- BOX = geompy.MakeBoxDXDYDZ(DX, DY, DZ, "BOX")
-
- # Creation of the mesh
- # ====================
- smesh = smeshBuilder.New(theStudy)
- MESH = smesh.Mesh(BOX)
- smesh.SetName(MESH.GetMesh(), 'MESH')
- #
- # Creation of the hypotheses
- # ==========================
- Regular_1D = MESH.Segment()
- smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
- Length = min(DX, DY, DZ) / 5.
- Local_Length = Regular_1D.LocalLength(Length,None,1e-07)
- smesh.SetName(Local_Length, 'Local Length')
- #
- Quadrangle_2D = MESH.Quadrangle(algo=smeshBuilder.QUADRANGLE)
- smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
- Quadrangle_Parameters = Quadrangle_2D.QuadrangleParameters(StdMeshersBuilder.QUAD_STANDARD,-1,[],[])
- smesh.SetName(Quadrangle_Parameters, 'Quadrangle Parameters')
- #
- Hexa_3D = MESH.Hexahedron(algo=smeshBuilder.Hexa)
- smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
- #
- # Computation
- # ===========
- #
- isDone = MESH.Compute()
- if not isDone :
- error = 1
- break
- #
- # MED exportation
- # ===============
- #
- try:
- ficmed = os.path.join(dircase, 'maill.00.med')
- MESH.ExportMED( ficmed, 0, SMESH.MED_V2_2, 1, None ,1)
- except Exception, e:
- raise Exception('ExportToMEDX() failed. '+e.message)
- error = 2
- #
- break
- #
- return error
-
-#========================================================================
-#
-#========================================================================
-def field_exec(theStudy, niter):
- """
-Python script for MEDCoupling
- """
- error = 0
-#
- while not error :
- #
- # The mesh
- # ========
- ficmed = os.path.join(dircase, 'maill.%02d.med' % niter)
- meshMEDFileRead = ml.MEDFileMesh.New(ficmed)
- meshRead0 = meshMEDFileRead.getMeshAtLevel(0)
- # Valeurs of the field
- # ====================
- nbNodes = meshRead0.getNumberOfNodes()
- valeur = mc.DataArrayDouble(nbNodes)
- for iaux, taux in enumerate(meshRead0.getCoords()) :
- #ligne = "x = %f" % taux[0]
- #ligne += ", y = %f" % taux[1]
- #ligne += ", z = %f" % taux[2]
- #print ligne
- #distance = (taux[0]-DX*0.2)**2 + (taux[1]-DY*0.2)**2 + (taux[2]-DZ*0.4)**2
- distance = min(abs(taux[0]-DX*0.4), abs(taux[1]-DY*0.2), abs(taux[2]-DZ*0.4))
- valeur[iaux] = 1.e0 / max ( 1.e-5, np.sqrt(distance) )
- #print ". valeur", valeur
- nparr = valeur.toNumPyArray()
- print ". mini/maxi", nparr.min(), nparr.max()
- #
- # Creation of the field
- # =====================
- field = ml.MEDCouplingFieldDouble(ml.ON_NODES, ml.ONE_TIME)
- field.setArray(valeur)
- field.setMesh(meshRead0)
- field.setName("DISTANCE")
- #
- fMEDFile_ch = ml.MEDFileField1TS()
- fMEDFile_ch.setFieldNoProfileSBT(field) # No profile desired on the field, Sort By Type
- fMEDFile_ch.write(ficmed, 0) # 0 to indicate that we *append* (and no overwrite) to the MED file
- #
- break
- #
- return error
-
-#========================================================================
-#========================================================================
-def homard_exec(theStudy):
- """
-Python script for HOMARD
- """
- error = 0
-#
- while not error :
- #
- homard.SetCurrentStudy(theStudy)
- #
- # Creation of the zones
- # =====================
- #
- epsilon = min(DX, DY, DZ) / 100.
- # Creation of the box Zone_4_1
- Zone_4_1 = homard.CreateZoneBox('Zone_4_1', -epsilon, DX/3.+epsilon, DY/4.-epsilon, 3.*DY/4.+epsilon, 4.*DZ/5.-epsilon, DZ+epsilon)
-
- # Creation of the sphere Zone_4_2
- rayon = min(DX, DY, DZ) / 4.
- Zone_4_2 = homard.CreateZoneSphere('Zone_4_2', DX/3., DY*0.3, DZ*0.6, rayon)
- #
- # Creation of the hypotheses
- # ==========================
- dico = {}
- dico["1"] = "raffinement"
- dico["-1"] = "deraffinement"
- # Creation of the hypothesis Hypo_4_1
- HypoName_1 = "Zone_1"
- print "-------- Creation of the hypothesis", HypoName_1
- Hypo_4_1 = homard.CreateHypothesis(HypoName_1)
- Hypo_4_1.AddZone('Zone_4_1', 1)
- Hypo_4_1.SetExtraOutput(2)
- laux = Hypo_4_1.GetZones()
- nbzone = len(laux)/2
- jaux = 0
- for iaux in range(nbzone) :
- print HypoName_1, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux]
- jaux += 2
- # Creation of the hypothesis Hypo_4_2
- HypoName_2 = "Zone_2"
- print "-------- Creation of the hypothesis", HypoName_2
- Hypo_4_2 = homard.CreateHypothesis(HypoName_2)
- Hypo_4_2.AddZone('Zone_4_2', 1)
- Hypo_4_2.SetExtraOutput(2)
- laux = Hypo_4_2.GetZones()
- nbzone = len(laux)/2
- jaux = 0
- for iaux in range(nbzone) :
- print HypoName_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux]
- jaux += 2
- # Creation of the hypothesis DISTANCE INVERSE
- HypoName_3 = "DISTANCE INVERSE"
- print "-------- Creation of the hypothesis", HypoName_3
- Hypo_4_3 = homard.CreateHypothesis(HypoName_3)
- Hypo_4_3.SetField('DISTANCE')
- Hypo_4_3.SetUseComp(0)
- Hypo_4_3.SetRefinThr(1, 0.3)
- Hypo_4_3.SetUnRefThr(1, 0.2)
- Hypo_4_3.AddFieldInterp('DISTANCE')
- Hypo_4_3.SetExtraOutput(2)
- print HypoName_3, " : zones utilisées :", Hypo_4_3.GetZones()
- print HypoName_3, " : champ utilisé :", Hypo_4_3.GetFieldName()
- print HypoName_3, " : composantes utilisées :", Hypo_4_3.GetComps()
- if ( len (Hypo_4_3.GetFieldName()) > 0 ) :
- print ".. caractéristiques de l'adaptation :", Hypo_4_3.GetField()
- print HypoName_3, " : champs interpolés :", Hypo_4_3.GetFieldInterps()
- #
- # Creation of the cases
- # =====================
- # Creation of the case
- CaseName = "Case_" + Test_Name
- print "-------- Creation of the case", CaseName
- MeshFile = os.path.join(dircase, 'maill.00.med')
- Case_test_4 = homard.CreateCase(CaseName, 'MESH', MeshFile)
- Case_test_4.SetDirName(dircase)
- #
- # Creation of the iterations
- # ==========================
- # Creation of the iteration 1
- IterName = "I_" + Test_Name + "_1"
- print "-------- Creation of the iteration", IterName
- Iter_test_4_1 = Case_test_4.NextIteration(IterName)
- Iter_test_4_1.AssociateHypo(HypoName_1)
- print ". Hypothese :", HypoName_1
- Iter_test_4_1.SetMeshName('M1')
- Iter_test_4_1.SetMeshFile(os.path.join(dircase, 'maill.01.med'))
- error = Iter_test_4_1.Compute(1, 2)
- if error :
- error = 1
- break
-
- # Creation of the iteration 2
- IterName = "I_" + Test_Name + "_2"
- print "-------- Creation of the iteration", IterName
- Iter_test_4_2 = Iter_test_4_1.NextIteration(IterName)
- Iter_test_4_2.AssociateHypo(HypoName_2)
- print ". Hypothese :", HypoName_2
- Iter_test_4_2.SetMeshName('M2')
- Iter_test_4_2.SetMeshFile(os.path.join(dircase, 'maill.02.med'))
- error = Iter_test_4_2.Compute(1, 2)
- if error :
- error = 2
- break
-
- # Creation of the iteration 3
- #
- error = field_exec(theStudy, 2)
- if error :
- error = 30
- break
- #
- IterName = "I_" + Test_Name + "_3"
- print "-------- Creation of the iteration", IterName
- Iter_test_4_3 = Iter_test_4_2.NextIteration(IterName)
- Iter_test_4_3.AssociateHypo(HypoName_3)
- print ". Hypothese :", HypoName_3
- Iter_test_4_3.SetMeshName('M3')
- Iter_test_4_3.SetFieldFile(os.path.join(dircase, 'maill.02.med'))
- Iter_test_4_3.SetMeshFile(os.path.join(dircase, 'maill.03.med'))
- error = Iter_test_4_3.Compute(1, 2)
- if error :
- error = 3
- break
- #
- break
- #
- return error
-
-#========================================================================
-#
-# Geometry and Mesh
-#
-try :
- error_main = geom_smesh_exec(salome.myStudy)
- if error_main :
- raise Exception('Pb in geom_smesh_exec')
-except Exception, e:
- raise Exception('Pb in geom_smesh_exec: '+e.message)
-
-homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
-assert homard is not None, "Impossible to load homard engine"
-homard.SetLanguageShort("fr")
-#
-# Exec of HOMARD-SALOME
-#
-try :
- error_main = homard_exec(salome.myStudy)
- if error_main :
- raise Exception('Pb in homard_exec at iteration %d' %error_main )
-except Exception, e:
- raise Exception('Pb in homard_exec: '+e.message)
-#
-# Test of the results
-#
-n_rep_test_file = n_iter_test_file
-destroy_dir = not debug
-test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir)
-#
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(1)
- iparameters.getSession().restoreVisualState(1)
-
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2011-2015 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
-#
-"""
-Python script for HOMARD
-Copyright EDF-R&D 2014
-Test test_1
-"""
-__revision__ = "V1.2"
-
-import os
-#========================================================================
-#========================================================================
-def remove_dir(directory) :
- """
-Empties, then removes a directory.
-Copyright EDF-R&D 2013
- """
-#
- l_aux = os.listdir(directory)
- for fic in l_aux :
- fic_a = os.path.join(directory, fic)
- if os.path.isdir(fic_a) :
- remove_dir(fic_a)
- else :
- os.remove(fic_a)
- os.rmdir(directory)
-#
- return
-#
-#========================================================================
-#========================================================================
-def test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir = True) :
- """
-Test of the result
-Rep_Test: repertoire des tests
-Test_Name: nom du test
-dircase: repertoire des resultats du test
-n_iter_test_file: numero de l'iteration a tester
-n_rep_test_file: numero du repertoire de l'iteration a tester
-destroy_dir: destruction du repertoire de calcul
-Copyright EDF-R&D 2014
- """
- #
- test_file_suff = "apad.%02d.bilan" % n_iter_test_file
- rep_test_file = "I%02d" % n_rep_test_file
- #
- test_file = os.path.join(Rep_Test, Test_Name + "." + test_file_suff)
- mess_error_ref = "\nReference file: " + test_file
- try :
- file = open (test_file, "r")
- mess_ref = file.readlines()
- file.close()
- except :
- mess_error = mess_error_ref + "\nThis file does not exist.\n"
- destroy_dir = False
- raise Exception(mess_error)
- #
- test_file = os.path.join(dircase, rep_test_file, test_file_suff)
- if os.path.isfile (test_file) :
- file = open (test_file, "r")
- mess = file.readlines()
- file.close()
- else :
- mess_error = "\nResult file: " + test_file
- mess_error += "\nThis file does not exist.\n"
- destroy_dir = False
- raise Exception(mess_error)
-
- nblign = len(mess_ref)
- if ( len(mess) != nblign ):
- mess_error = mess_error_ref + "\nResult file: " + test_file
- mess_error += "\nThe number of lines of the files are not the same.\n"
- destroy_dir = False
- raise Exception(mess_error)
-
- for num in range(nblign) :
- if (( "creation" not in mess_ref[num] ) and ( mess_ref[num] != mess[num])) :
- message_erreur = "\nRefe : " + mess_ref[num]
- message_erreur += "Test : " + mess[num][:-1]
- message_erreur += "\nThe test is different from the reference."
- destroy_dir = False
- raise Exception(message_erreur)
- #
- if destroy_dir:
- remove_dir(dircase)
-#
- return
-#
-#========================================================================
-#========================================================================