# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
+
PROJECT(SalomeHOMARD C CXX)
# Ensure a proper linker behavior:
MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
ENDIF(EXISTS ${KERNEL_ROOT_DIR})
+# Find SALOME GUI
+# ===============
+SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
+IF(EXISTS ${GUI_ROOT_DIR})
+ LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
+ FIND_PACKAGE(SalomeGUI REQUIRED)
+ SALOME_GUI_WITH_CORBA() # check whether GUI builded with CORBA
+ SALOME_GUI_MODE(OPTIONAL SALOME_USE_PYCONSOLE)
+ ADD_DEFINITIONS(${GUI_DEFINITIONS})
+ INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
+ELSE(EXISTS ${GUI_ROOT_DIR})
+ MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
+ENDIF(EXISTS ${GUI_ROOT_DIR})
+
# Platform setup
# ==============
INCLUDE(SalomeSetupPlatform) # From KERNEL
# Local macros:
LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
+# additional preprocessor / compiler flags
+#ADD_DEFINITIONS(-DCMAKE_BUILD)
+IF(WIN32)
+ ADD_DEFINITIONS(-DNOGDI)
+ENDIF(WIN32)
+
# User options
# ============
OPTION(SALOME_BUILD_DOC "Generate SALOME HOMARD documentation" ON)
OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
+
+# Other KERNEL optionals:
IF(SALOME_BUILD_TESTS)
ENABLE_TESTING()
+ FIND_PACKAGE(SalomeCppUnit)
+ SALOME_LOG_OPTIONAL_PACKAGE(CppUnit SALOME_BUILD_TESTS)
+ENDIF()
+IF(SALOME_BUILD_DOC)
+ FIND_PACKAGE(SalomeSphinx)
+ SALOME_LOG_OPTIONAL_PACKAGE(Sphinx SALOME_BUILD_DOC)
ENDIF()
+
##
## From KERNEL:
##
# HDF5
FIND_PACKAGE(SalomeHDF5 REQUIRED COMPONENTS C)
-# Other KERNEL optionals:
-IF(SALOME_BUILD_DOC)
- FIND_PACKAGE(SalomeSphinx)
- SALOME_LOG_OPTIONAL_PACKAGE(Sphinx SALOME_BUILD_DOC)
-ENDIF()
-
-# Find GUI
-# ===========
-SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
-IF(EXISTS ${GUI_ROOT_DIR})
- LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
- FIND_PACKAGE(SalomeGUI REQUIRED)
- SALOME_GUI_WITH_CORBA() # check whether GUI builded with CORBA
- SALOME_GUI_MODE(OPTIONAL SALOME_USE_PYCONSOLE)
- ADD_DEFINITIONS(${GUI_DEFINITIONS})
- INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
-ELSE(EXISTS ${GUI_ROOT_DIR})
- MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
-ENDIF(EXISTS ${GUI_ROOT_DIR})
##
## From GUI:
SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
-SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
+SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
"Install path: SALOME scripts")
-SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
+SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
"Install path: SALOME script data")
-SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
+SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
"Install path: SALOME Python scripts")
-SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
+SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
"Install path: SALOME application skeleton - scripts")
-SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
+SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
"Install path: SALOME application skeleton - Python")
SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
-SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
+SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
"Install path: SALOME Python shared modules")
-SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
- "Install path: local SALOME CMake files")
+SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
+ "Install path: local SALOME CMake files")
SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
"Install path: local SALOME config files (obsolete, to be removed)")
SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
# Specific to HOMARD:
-SET(SALOME_HOMARD_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/homard" CACHE PATH
+SET(SALOME_HOMARD_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/homard" CACHE PATH
+ "Install path: SALOME HOMARD specific data")
+SET(SALOME_HOMARD_INSTALL_SAMPLES share/salome/homardsamples CACHE PATH
+ "Install path: SALOME HOMARD samples")
+SET(SALOME_HOMARD_INSTALL_TEST ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test CACHE PATH
+ "Install path: SALOME HOMARD Test files")
+SET(SALOME_HOMARD_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/homard" CACHE PATH
"Install path: SALOME HOMARD specific data")
MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
+MARK_AS_ADVANCED(SALOME_HOMARD_INSTALL_TEST)
MARK_AS_ADVANCED(SALOME_HOMARD_INSTALL_RES_DATA)
# Accumulate environment variables for HOMARD module
SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON}
${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON_SHARED})
-SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
-
-# Sources
+SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
+
+# Sources
# ========
ADD_SUBDIRECTORY(idl)
ADD_SUBDIRECTORY(adm_local)
ADD_SUBDIRECTORY(resources)
ADD_SUBDIRECTORY(src)
-ADD_SUBDIRECTORY(bin)
-IF(SALOME_BUILD_TESTS)
- ADD_SUBDIRECTORY(tests)
-ENDIF(SALOME_BUILD_TESTS)
IF(SALOME_BUILD_DOC)
ADD_SUBDIRECTORY(doc)
-ENDIF(SALOME_BUILD_DOC)
+ENDIF()
+ADD_SUBDIRECTORY(bin)
# Header configuration
# ====================
DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
# Install the export set for use with the install-tree
-INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
+INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
FILE ${PROJECT_NAME}Targets.cmake)
Exemple de couplage HOMARD-Salome
Copyright EDF-R&D 1996, 2010, 2014
"""
-__revision__ = "V1.9"
+__revision__ = "V2.1"
#
import os
import sys
#
# ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
# 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)
+DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
from tutorial_util import creation_dircase
# ==================================
-dircase = creation_dircase(1)
-gzip_gunzip(data_dir, 1, -1)
+DIRCASE = creation_dircase(1)
+gzip_gunzip(DATA_TUTORIAL, 1, -1)
# ==================================
#
import salome
#
# Hypotheses
# ==========
-Hypo_1 = homard.CreateHypothesis('Hypo_1')
-Hypo_1.SetUnifRefinUnRef(1)
+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)
-Case_1.SetConfType(1)
+case_1 = homard.CreateCase('Case_1', 'MAILL', DATA_TUTORIAL+'/tutorial_1.00.med')
+case_1.SetDirName(DIRCASE)
+case_1.SetConfType(1)
#
# 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_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)
+# 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)
+#
# ==================================
-gzip_gunzip(data_dir, 1, 1)
+gzip_gunzip(DATA_TUTORIAL, 1, 1)
# ==================================
-
+#
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
+ iparameters.getSession().restoreVisualState(1)
Exemple de couplage HOMARD-Salome
Copyright EDF-R&D 1996, 2010, 2014
"""
-__revision__ = "V1.10"
+__revision__ = "V2.10"
#
import os
import sys
#
# ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
# 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)
+DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
from tutorial_util import creation_dircase
# ==================================
-dircase = creation_dircase(2)
-gzip_gunzip(data_dir, 2, -1)
+DIRCASE = creation_dircase(2)
+gzip_gunzip(DATA_TUTORIAL, 2, -1)
# ==================================
#
import salome
# Box "Zone_2"
Zone_2 = homard.CreateZoneBox ('Zone_2', -0.1, 0.51, -0.1, 0.51, -0.1, 0.51)
#
-# Hypothese "Hypo_2"
+# Hypothese "hypo_2"
# ==================
-Hypo_2 = homard.CreateHypothesis('Hypo_2')
-Hypo_2.AddZone('Zone_1', 1)
-Hypo_2.AddZone('Zone_0', 1)
+hypo_2 = homard.CreateHypothesis('hypo_2')
+hypo_2.AddZone('Zone_1', 1)
+hypo_2.AddZone('Zone_0', 1)
#
-# Hypothese "Hypo_2_bis"
+# Hypothese "hypo_2_bis"
# ======================
-Hypo_2_bis = homard.CreateHypothesis('Hypo_2_bis')
-Hypo_2_bis.AddZone('Zone_0', -1)
-Hypo_2_bis.AddZone('Zone_2', 1)
+hypo_2_bis = homard.CreateHypothesis('hypo_2_bis')
+hypo_2_bis.AddZone('Zone_0', -1)
+hypo_2_bis.AddZone('Zone_2', 1)
#
# Cas
# ===
-Case_2 = homard.CreateCase('Case_2', 'MZERO', data_dir+'/tutorial_2.00.med')
-Case_2.SetDirName(dircase)
+case_2 = homard.CreateCase('Case_2', 'MZERO', DATA_TUTORIAL+'/tutorial_2.00.med')
+case_2.SetDirName(DIRCASE)
#
-# Iteration "Iter_2_1"
+# 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)
+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"
+# 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)
+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)
# ==================================
-gzip_gunzip(data_dir, 2, 1)
+gzip_gunzip(DATA_TUTORIAL, 2, 1)
# ==================================
if salome.sg.hasDesktop():
Exemple de couplage HOMARD-Salome
Copyright EDF-R&D 1996, 2010, 2014
"""
-__revision__ = "V1.9"
+__revision__ = "V2.1"
#
import os
import sys
#
# ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
# 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)
+DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
from tutorial_util import creation_dircase
# ==================================
-dircase = creation_dircase(3)
-gzip_gunzip(data_dir, 3, -1)
+DIRCASE = creation_dircase(3)
+gzip_gunzip(DATA_TUTORIAL, 3, -1)
# ==================================
#
import salome
study_main = salome.myStudyManager.NewStudy("HOMARD")
homard.SetCurrentStudy(salome.myStudy)
#
-# Hypothese "Hypo_0vers1"
+# Hypothese "hypo_0vers1"
# =======================
-Hypo_0vers1 = homard.CreateHypothesis('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_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')
+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.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')
+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)
+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)
+case_3 = homard.CreateCase('Case_3', 'G_0', DATA_TUTORIAL+'/tutorial_3.00.med')
+case_3.SetDirName(DIRCASE)
#
-# Iteration "Iter_3_1"
+# 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_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_TUTORIAL+'/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 = 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_TUTORIAL+'/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)
+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_TUTORIAL+'/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)
# ==================================
-gzip_gunzip(data_dir, 3, 1)
+gzip_gunzip(DATA_TUTORIAL, 3, 1)
# ==================================
if salome.sg.hasDesktop():
Exemple de couplage HOMARD-Salome
Copyright EDF-R&D 1996, 2011, 2014
"""
-__revision__ = "V2.5"
+__revision__ = "V3.1"
#
import os
import sys
#
# ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
# 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)
+DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
from tutorial_util import creation_dircase
# ==================================
-dircase = creation_dircase(4)
-gzip_gunzip(data_dir, 4, -1)
+DIRCASE = creation_dircase(4)
+gzip_gunzip(DATA_TUTORIAL, 4, -1)
# ==================================
#
import salome
#
# Frontieres
# ==========
-Boun_4_1 = homard.CreateBoundaryDi('intersection', 'PIQUAGE', data_dir+'/tutorial_4.fr.med')
+boun_4_1 = homard.CreateBoundaryDi('intersection', 'PIQUAGE', DATA_TUTORIAL+'/tutorial_4.fr.med')
#
-Boun_4_2 = homard.CreateBoundaryCylinder('cyl_1_ext', 0.0, 25., -25., 25., 50., 75., 100.)
+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_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_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.)
+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')
+# 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' )
+case_4 = homard.CreateCase('Case_4', 'PIQUAGE', DATA_TUTORIAL+'/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)
+# 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)
# ==================================
-gzip_gunzip(data_dir, 4, 1)
+gzip_gunzip(DATA_TUTORIAL, 4, 1)
# ==================================
if salome.sg.hasDesktop():
Exemple de couplage HOMARD-Salome
Copyright EDF-R&D 1996, 2010, 2014
"""
-__revision__ = "V1.8"
+__revision__ = "V2.1"
#
import os
import sys
#
# ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
# 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)
+DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
from tutorial_util import creation_dircase
# ==================================
-dircase = creation_dircase(5)
-gzip_gunzip(data_dir, 5, -1)
+DIRCASE = creation_dircase(5)
+gzip_gunzip(DATA_TUTORIAL, 5, -1)
# ==================================
#
import salome
#
# 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 of the discrete boundary boun_5_1
+boun_5_1 = homard.CreateBoundaryDi('boun_5_1', 'MAIL_EXT', DATA_TUTORIAL+'/tutorial_5.fr.med')
#
# Creation des zones
# ==================
#
# 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)
+# 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(3)
-Case_5.AddBoundaryGroup('Boun_5_1', '')
+case_5 = homard.CreateCase('Case_5', 'COEUR_2D', DATA_TUTORIAL+'/tutorial_5.00.med')
+case_5.SetDirName(DIRCASE)
+case_5.SetConfType(3)
+case_5.AddBoundaryGroup('boun_5_1', '')
#
-# Iteration "Iter_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)
+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"
+# 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)
+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)
# ==================================
-gzip_gunzip(data_dir, 5, 1)
+gzip_gunzip(DATA_TUTORIAL, 5, 1)
# ==================================
if salome.sg.hasDesktop():
Python script for HOMARD
Copyright EDF-R&D 2014
"""
-__revision__ = "V1.1"
+__revision__ = "V1.3"
import os
import sys
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
-# Repertoire des tests
-Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard")
-Rep_Test = os.path.normpath(Rep_Test)
-sys.path.append(Rep_Test)
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des scripts utilitaires
+REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
+REP_PYTHON = os.path.normpath(REP_PYTHON)
+sys.path.append(REP_PYTHON)
from test_util import remove_dir
#========================================================================
#
ficloc_basis = "tutorial_%d" % num_tuto
#
- ok = True
+ erreur = 0
num = -1
#
# Uncompression
#
if ( option == -1 ) :
#
- while ok :
+ while not erreur :
num += 1
ficloc = ficloc_basis + ".%02d.med" % num
nomfic = os.path.join(data_dir, ficloc)
if os.path.isfile(nomfic) :
os.system("gunzip "+nomfic)
else :
- ok = False
+ erreur = 1
break
#
ficloc = ficloc_basis + ".fr.med"
#
elif ( option == 1 ) :
#
- while ok :
+ while not erreur :
num += 1
ficloc = ficloc_basis + ".%02d.med.gz" % num
nomfic = os.path.join(data_dir, ficloc)
if os.path.isfile(nomfic) :
os.system("gzip "+nomfic)
else :
- ok = False
+ erreur = 2
break
#
ficloc = ficloc_basis + ".fr.med.gz"
-# Copyright (C) 2012-2015 CEA/DEN, EDF R&D
+# Copyright (C) 2016 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
HOMARD_I
HOMARDGUI
HOMARD_SWIG
+ tests
)
SET(SUBDIRS
)
FOREACH(dir ${SUBDIRS})
- ADD_SUBDIRECTORY(${dir})
+ ADD_SUBDIRECTORY(${dir})
ENDFOREACH(dir ${SUBDIRS})
+
--- /dev/null
+# Copyright (C) 2016 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# Add all test subdirs
+SUBDIRS(
+ tests
+ )
+
+
--- /dev/null
+# Copyright (C) 20126 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
+#
+
+IF(SALOME_BUILD_TESTS)
+ ADD_SUBDIRECTORY(Test)
+ENDIF(SALOME_BUILD_TESTS)
+
+FILE(GLOB sample_files
+ ${PROJECT_SOURCE_DIR}/src/tests/samples/*.med
+ ${PROJECT_SOURCE_DIR}/src/tests/samples/*.bilan
+ ${PROJECT_SOURCE_DIR}/src/tests/samples/*.odt
+ ${PROJECT_SOURCE_DIR}/src/tests/samples/*.pdf
+ ${PROJECT_SOURCE_DIR}/src/tests/samples/*.png)
+INSTALL(FILES ${sample_files} DESTINATION ${SALOME_HOMARD_INSTALL_SAMPLES})
--- /dev/null
+# Copyright (C) 2016 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# For salome test
+SET(HOMARD_TEST_FILES
+ test_1.py
+ test_2.py
+ test_3.py
+ test_4.py
+ tutorial_1.py
+ tutorial_2.py
+ tutorial_3.py
+ tutorial_4.py
+ tutorial_5.py
+ test_util.py
+)
+
+INSTALL(FILES ${HOMARD_TEST_FILES}
+ DESTINATION ${SALOME_HOMARD_INSTALL_TEST})
+
+INSTALL(FILES CTestTestfileInstall.cmake
+ DESTINATION ${SALOME_HOMARD_INSTALL_TEST}
+ RENAME CTestTestfile.cmake)
\ No newline at end of file
--- /dev/null
+# Copyright (C) 2016 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SET(SALOME_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py")
+
+SET(COMPONENT_NAME HOMARD)
+SET(TIMEOUT 500)
+
+SET(HOMARD_TEST_FILES
+test_1
+test_2
+test_3
+test_4
+tutorial_1
+tutorial_2
+tutorial_3
+tutorial_4
+tutorial_5
+)
+
+FOREACH(tfile ${HOMARD_TEST_FILES})
+ SET(TEST_NAME HOMARD_${tfile})
+ ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tfile}.py)
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+ENDFOREACH()
--- /dev/null
+# -*- coding: utf-8 -*-
+# 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__ = "V3.1"
+
+#========================================================================
+TEST_NAME = "test_1"
+DEBUG = False
+N_ITER_TEST_FILE = 3
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des scripts utilitaires
+REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
+REP_PYTHON = os.path.normpath(REP_PYTHON)
+sys.path.append(REP_PYTHON)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des donnees du test
+REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
+REP_DATA = os.path.normpath(REP_DATA)
+# 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
+ print "-------- Creation of the case", TEST_NAME
+ mesh_file = os.path.join(REP_DATA, TEST_NAME + '.00.med')
+ case_test_1 = HOMARD.CreateCase(TEST_NAME, 'MAILL', mesh_file)
+ case_test_1.SetDirName(DIRCASE)
+ #
+ # Creation of the iterations
+ # ==========================
+ # Creation of the iteration 1
+ iter_name = "I_" + TEST_NAME + "_1"
+ print "-------- Creation of the iteration", iter_name
+ iter_test_1_1 = case_test_1.NextIteration(iter_name)
+ 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_DATA, 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
+ iter_name = "I_" + TEST_NAME + "_2"
+ print "-------- Creation of the iteration", iter_name
+ iter_test_1_2 = iter_test_1_1.NextIteration(iter_name)
+ 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_DATA, 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
+ iter_name = "I_" + TEST_NAME + "_3"
+ print "-------- Creation of the iteration", iter_name
+ iter_test_1_3 = iter_test_1_2.NextIteration(iter_name)
+ 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_DATA, 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(PATH_HOMARD, "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, mesh_file)
+ 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 = homard_exec(salome.myStudy)
+ if ERROR :
+ raise Exception('Pb in homard_exec at iteration %d' %ERROR )
+except Exception, eee:
+ raise Exception('Pb in homard_exec: '+eee.message)
+#
+# Test of the results
+#
+N_REP_TEST_FILE = N_ITER_TEST_FILE
+DESTROY_DIR = not DEBUG
+test_results(REP_DATA, 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
+Test test_2
+"""
+__revision__ = "V3.1"
+
+#========================================================================
+TEST_NAME = "test_2"
+DEBUG = False
+N_ITER_TEST_FILE = 3
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des scripts utilitaires
+REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
+REP_PYTHON = os.path.normpath(REP_PYTHON)
+sys.path.append(REP_PYTHON)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des donnees du test
+REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
+REP_DATA = os.path.normpath(REP_DATA)
+# 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_DATA, 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
+ mesh_file = os.path.join(REP_DATA, TEST_NAME + '.00.med')
+ case_test_2 = HOMARD.CreateCase(TEST_NAME, 'PLAQUE_0', mesh_file)
+ case_test_2.SetDirName(DIRCASE)
+ case_test_2.AddBoundaryGroup('internal_boundary', '')
+ #
+ # Creation of the iterations
+ # ==========================
+ # Creation of the iteration 1
+ iter_name = "I_" + TEST_NAME + "_1"
+ iter_test_2_1 = case_test_2.NextIteration(iter_name)
+ 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
+ iter_name = "I_" + TEST_NAME + "_2"
+ iter_test_2_2 = iter_test_2_1.NextIteration(iter_name)
+ 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
+ iter_name = "I_" + TEST_NAME + "_3"
+ iter_test_2_3 = iter_test_2_2.NextIteration(iter_name)
+ 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(PATH_HOMARD, "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, mesh_file)
+ 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 = homard_exec(salome.myStudy)
+ if ERROR :
+ raise Exception('Pb in homard_exec at iteration %d' %ERROR )
+except Exception, eee:
+ raise Exception('Pb in homard_exec: '+eee.message)
+#
+# Test of the results
+#
+N_REP_TEST_FILE = N_ITER_TEST_FILE
+DESTROY_DIR = not DEBUG
+test_results(REP_DATA, 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
+Test test_3
+"""
+__revision__ = "V3.1"
+
+#========================================================================
+TEST_NAME = "test_3"
+DEBUG = False
+N_BOUCLE = 2
+N_ITER_TEST_FILE = 2
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des scripts utilitaires
+REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
+REP_PYTHON = os.path.normpath(REP_PYTHON)
+sys.path.append(REP_PYTHON)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des donnees du test
+REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
+REP_DATA = os.path.normpath(REP_DATA)
+# 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_DATA, 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 ) :
+ print "-------- Creation of the case", TEST_NAME
+ mesh_file = os.path.join(REP_DATA, TEST_NAME + '.00.med')
+ case_test_3 = HOMARD.CreateCase(TEST_NAME, 'MOYEU', mesh_file)
+ 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
+ iter_name = "I_" + TEST_NAME + "_1"
+ print "-------- Creation of the iteration", iter_name
+ iter_test_3_1 = case_test_3.NextIteration(iter_name)
+ 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
+ iter_name = "I_" + TEST_NAME + "_2"
+ print "-------- Creation of the iteration", iter_name
+ iter_test_3_2 = iter_test_3_1.NextIteration(iter_name)
+ 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(PATH_HOMARD, "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, mesh_file)
+ 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 = homard_exec(salome.myStudy)
+ if ERROR :
+ raise Exception('Pb in homard_exec at iteration %d' %ERROR )
+except Exception, eee:
+ raise Exception('Pb in homard_exec: '+eee.message)
+#
+# Test of the results
+#
+N_REP_TEST_FILE = N_ITER_TEST_FILE*N_BOUCLE
+DESTROY_DIR = not DEBUG
+test_results(REP_DATA, 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
+Test test_4
+"""
+__revision__ = "V2.1"
+
+#========================================================================
+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
+#
+# ==================================
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des scripts utilitaires
+REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
+REP_PYTHON = os.path.normpath(REP_PYTHON)
+sys.path.append(REP_PYTHON)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des donnees du test
+REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
+REP_DATA = os.path.normpath(REP_DATA)
+# 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_g = geompy.MakeBoxDXDYDZ(DX, DY, DZ, "BOX")
+
+ # Creation of the mesh
+ # ====================
+ smesh = smeshBuilder.New(theStudy)
+ box_m = smesh.Mesh(box_g)
+ smesh.SetName(box_m.GetMesh(), 'MESH')
+ #
+ # Creation of the hypotheses
+ # ==========================
+ regular_1d = box_m.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 = box_m.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 = box_m.Hexahedron(algo=smeshBuilder.Hexa)
+ smesh.SetName(hexa_3d.GetAlgorithm(), 'Hexa_3D')
+ #
+ # Computation
+ # ===========
+ #
+ isDone = box_m.Compute()
+ if not isDone :
+ error = 1
+ break
+ #
+ # MED exportation
+ # ===============
+ #
+ try:
+ ficmed = os.path.join(DIRCASE, 'maill.00.med')
+ box_m.ExportMED( ficmed, 0, SMESH.MED_V2_2, 1, None, 1)
+ except Exception, eee:
+ error = 2
+ raise Exception('ExportToMEDX() failed. '+eee.message)
+ #
+ 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
+ print "-------- Creation of the case", TEST_NAME
+ mesh_file = os.path.join(DIRCASE, 'maill.00.med')
+ case_test_4 = HOMARD.CreateCase(TEST_NAME, 'MESH', mesh_file)
+ case_test_4.SetDirName(DIRCASE)
+ #
+ # Creation of the iterations
+ # ==========================
+ # Creation of the iteration 1
+ iter_name = "I_" + TEST_NAME + "_1"
+ print "-------- Creation of the iteration", iter_name
+ iter_test_4_1 = case_test_4.NextIteration(iter_name)
+ 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
+ iter_name = "I_" + TEST_NAME + "_2"
+ print "-------- Creation of the iteration", iter_name
+ iter_test_4_2 = iter_test_4_1.NextIteration(iter_name)
+ 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
+ #
+ iter_name = "I_" + TEST_NAME + "_3"
+ print "-------- Creation of the iteration", iter_name
+ iter_test_4_3 = iter_test_4_2.NextIteration(iter_name)
+ 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 = geom_smesh_exec(salome.myStudy)
+ if ERROR :
+ raise Exception('Pb in geom_smesh_exec')
+except Exception, eee:
+ raise Exception('Pb in geom_smesh_exec: '+eee.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 = homard_exec(salome.myStudy)
+ if ERROR :
+ raise Exception('Pb in homard_exec at iteration %d' %ERROR )
+except Exception, eee:
+ raise Exception('Pb in homard_exec: '+eee.message)
+#
+# Test of the results
+#
+N_REP_TEST_FILE = N_ITER_TEST_FILE
+DESTROY_DIR = not DEBUG
+test_results(REP_DATA, 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
+Utilitaires pour les tests
+"""
+__revision__ = "V1.3"
+
+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
+# -*- 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 tutorial_1 associe au tutorial 1
+"""
+__revision__ = "V3.1"
+
+#========================================================================
+TEST_NAME = "tutorial_1"
+DEBUG = False
+N_ITER_TEST_FILE = 3
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des scripts utilitaires
+REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
+REP_PYTHON = os.path.normpath(REP_PYTHON)
+sys.path.append(REP_PYTHON)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des donnees du test
+REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
+REP_DATA = os.path.normpath(REP_DATA)
+# 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_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+sys.path.append(DATA_TUTORIAL)
+from tutorial_util import gzip_gunzip
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 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_TUTORIAL+'/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 = homard_exec(salome.myStudy)
+ if ERROR :
+ raise Exception('Pb in homard_exec at iteration %d' %ERROR )
+except Exception, eee:
+ raise Exception('Pb in homard_exec: '+eee.message)
+#
+# Test of the results
+#
+N_REP_TEST_FILE = N_ITER_TEST_FILE
+DESTROY_DIR = not DEBUG
+test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+#
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 1, 1)
+# ==================================
+#
+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
+Test tutorial_2 associe au tutorial 2
+"""
+__revision__ = "V3.1"
+
+#========================================================================
+TEST_NAME = "tutorial_2"
+DEBUG = False
+N_ITER_TEST_FILE = 2
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des scripts utilitaires
+REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
+REP_PYTHON = os.path.normpath(REP_PYTHON)
+sys.path.append(REP_PYTHON)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des donnees du test
+REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
+REP_DATA = os.path.normpath(REP_DATA)
+# 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_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+sys.path.append(DATA_TUTORIAL)
+from tutorial_util import gzip_gunzip
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 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_TUTORIAL+'/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 = homard_exec(salome.myStudy)
+ if ERROR :
+ raise Exception('Pb in homard_exec at iteration %d' %ERROR )
+except Exception, eee:
+ raise Exception('Pb in homard_exec: '+eee.message)
+#
+# Test of the results
+#
+N_REP_TEST_FILE = N_ITER_TEST_FILE
+DESTROY_DIR = not DEBUG
+test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+#
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 2, 1)
+# ==================================
+#
+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
+Test tutorial_3 associe au tutorial 3
+"""
+__revision__ = "V3.1"
+
+#========================================================================
+TEST_NAME = "tutorial_3"
+DEBUG = False
+N_ITER_TEST_FILE = 2
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des scripts utilitaires
+REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
+REP_PYTHON = os.path.normpath(REP_PYTHON)
+sys.path.append(REP_PYTHON)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des donnees du test
+REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
+REP_DATA = os.path.normpath(REP_DATA)
+# 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_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+sys.path.append(DATA_TUTORIAL)
+from tutorial_util import gzip_gunzip
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 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_TUTORIAL+'/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_TUTORIAL+'/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_TUTORIAL+'/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_TUTORIAL+'/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 = homard_exec(salome.myStudy)
+ if ERROR :
+ raise Exception('Pb in homard_exec at iteration %d' %ERROR )
+except Exception, eee:
+ raise Exception('Pb in homard_exec: '+eee.message)
+#
+# Test of the results
+#
+N_REP_TEST_FILE = 3
+DESTROY_DIR = not DEBUG
+test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+#
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 3, 1)
+# ==================================
+#
+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
+Test tutorial_4 associe au tutorial 4
+"""
+__revision__ = "V3.1"
+
+#========================================================================
+TEST_NAME = "tutorial_4"
+DEBUG = False
+N_ITER_TEST_FILE = 3
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des scripts utilitaires
+REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
+REP_PYTHON = os.path.normpath(REP_PYTHON)
+sys.path.append(REP_PYTHON)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des donnees du test
+REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
+REP_DATA = os.path.normpath(REP_DATA)
+# 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_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+sys.path.append(DATA_TUTORIAL)
+from tutorial_util import gzip_gunzip
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 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_TUTORIAL+'/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_TUTORIAL+'/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 = homard_exec(salome.myStudy)
+ if ERROR :
+ raise Exception('Pb in homard_exec at iteration %d' %ERROR )
+except Exception, eee:
+ raise Exception('Pb in homard_exec: '+eee.message)
+#
+# Test of the results
+#
+N_REP_TEST_FILE = N_ITER_TEST_FILE
+DESTROY_DIR = not DEBUG
+test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+#
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 4, 1)
+# ==================================
+#
+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
+Test tutorial_5 associe au tutorial 5
+"""
+__revision__ = "V3.1"
+
+#========================================================================
+TEST_NAME = "tutorial_5"
+DEBUG = False
+N_ITER_TEST_FILE = 2
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des scripts utilitaires
+REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
+REP_PYTHON = os.path.normpath(REP_PYTHON)
+sys.path.append(REP_PYTHON)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des donnees du test
+REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
+REP_DATA = os.path.normpath(REP_DATA)
+# 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_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+sys.path.append(DATA_TUTORIAL)
+from tutorial_util import gzip_gunzip
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 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_TUTORIAL+'/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_TUTORIAL+'/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 = homard_exec(salome.myStudy)
+ if ERROR :
+ raise Exception('Pb in homard_exec at iteration %d' %ERROR )
+except Exception, eee:
+ raise Exception('Pb in homard_exec: '+eee.message)
+#
+# Test of the results
+#
+N_REP_TEST_FILE = N_ITER_TEST_FILE
+DESTROY_DIR = not DEBUG
+test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+#
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 5, 1)
+# ==================================
+#
+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 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
+
+
+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
+
+
+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
+
+
+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
+
+
+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
+
+
+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
+
+
+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
+
+
+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
+
+
+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
-# 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_11 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_0"
- Zone_0 = homard.CreateZoneBox ('Zone_0', -0.1, 1.1, -0.1, 1.1, 0.9, 1.1)
- #
- # Sphere "Zone_1"
- Zone_1 = homard.CreateZoneSphere ('Zone_1', 0., 0., 0., 1.05)
- #
- # Box "Zone_2"
- Zone_2 = homard.CreateZoneBox ('Zone_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_1', 1)
- Hypo_2.AddZone('Zone_0', 1)
- #
- # Hypothese "Hypo_2_bis"
- # ======================
- Hypo_2_bis = homard.CreateHypothesis('Hypo_2_bis')
- Hypo_2_bis.AddZone('Zone_0', -1)
- Hypo_2_bis.AddZone('Zone_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_11 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_11 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_11 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
-#
-#========================================================================
-#========================================================================