mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-11 16:19:16 +05:00
bos #24009 Merge gni/adaptation branch (MG-Adapt)
This commit is contained in:
parent
24825596b3
commit
03d855b75b
@ -195,6 +195,15 @@ IF(NOT WITH_SHAPER_STUDY AND SALOME_BUILD_TESTS)
|
||||
MESSAGE(WARNING "SHAPERSTUDY is not found; the corresponding tests will be omitted")
|
||||
ENDIF()
|
||||
|
||||
# Find MEDCoupling
|
||||
# ================
|
||||
SET(MEDCOUPLING_ROOT_DIR $ENV{MEDCOUPLING_ROOT_DIR} CACHE PATH "Path to the MEDCoupling tool")
|
||||
IF(EXISTS ${MEDCOUPLING_ROOT_DIR})
|
||||
FIND_PACKAGE(SalomeMEDCoupling REQUIRED) # will reload HDF5, MEDFile, XDR, etc ...
|
||||
ELSE(EXISTS ${MEDCOUPLING_ROOT_DIR})
|
||||
MESSAGE(FATAL_ERROR "We absolutely need the MEDCoupling tool, please define MEDCOUPLING_ROOT_DIR !")
|
||||
ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR})
|
||||
|
||||
##
|
||||
## SMESH specifics
|
||||
##
|
||||
@ -231,6 +240,16 @@ IF(WIN32)
|
||||
ENDIF(${F2C_FOUND})
|
||||
ENDIF(WIN32)
|
||||
|
||||
|
||||
SET (SALOME_SMESH_DISABLE_MG_ADAPT OFF)
|
||||
IF(WIN32)
|
||||
# On Windows temporarily disable MG_ADAPT
|
||||
SET (SALOME_SMESH_DISABLE_MG_ADAPT ON)
|
||||
ENDIF()
|
||||
IF(SALOME_SMESH_DISABLE_MG_ADAPT)
|
||||
ADD_DEFINITIONS(-DDISABLE_MG_ADAPT)
|
||||
ENDIF()
|
||||
|
||||
IF(SALOME_SMESH_ENABLE_MEFISTO)
|
||||
SET(MEFISTO2D_NAME "MEFISTO_2D")
|
||||
ELSE(SALOME_SMESH_ENABLE_MEFISTO)
|
||||
|
@ -59,6 +59,10 @@ SET(SALOME_SMESH_BUILD_GUI @SALOME_BUILD_GUI@)
|
||||
SET(SALOME_SMESH_USE_CGNS @SALOME_SMESH_USE_CGNS@)
|
||||
SET(SALOME_SMESH_USE_TBB @SALOME_SMESH_USE_TBB@)
|
||||
SET(SALOME_SMESH_ENABLE_MEFISTO @SALOME_SMESH_ENABLE_MEFISTO@)
|
||||
SET(SALOME_SMESH_DISABLE_MG_ADAPT @SALOME_SMESH_DISABLE_MG_ADAPT@)
|
||||
IF(SALOME_SMESH_DISABLE_MG_ADAPT)
|
||||
LIST(APPEND SMESH_DEFINITIONS "-DDISABLE_MG_ADAPT")
|
||||
ENDIF()
|
||||
IF(NOT WIN32)
|
||||
LIST(APPEND SMESH_DEFINITIONS "-DENABLE_MEFISTO")
|
||||
ENDIF(NOT WIN32)
|
||||
|
@ -47,3 +47,4 @@ INSTALL(FILES CTestTestfileInstall.cmake
|
||||
DESTINATION ${TEST_INSTALL_DIRECTORY}
|
||||
RENAME CTestTestfile.cmake)
|
||||
INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
|
||||
INSTALL(DIRECTORY MGAdapt_med_files DESTINATION ${TEST_INSTALL_DIRECTORY})
|
||||
|
472
doc/salome/examples/MGAdaptTests_without_session.py
Normal file
472
doc/salome/examples/MGAdaptTests_without_session.py
Normal file
@ -0,0 +1,472 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Tests des adaptations par MGAdapt en standalone
|
||||
|
||||
Copyright 2021 EDF
|
||||
Gérald NICOLAS
|
||||
+33.1.78.19.43.52
|
||||
"""
|
||||
|
||||
__revision__ = "V04.04"
|
||||
|
||||
#========================= Les imports - Début ===================================
|
||||
|
||||
import sys
|
||||
import os
|
||||
import salome
|
||||
|
||||
salome.standalone()
|
||||
salome.salome_init()
|
||||
|
||||
import SMESH
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New()
|
||||
|
||||
#========================== Les imports - Fin ====================================
|
||||
|
||||
#========================= Paramétrage - Début ===================================
|
||||
# 1. REPDATA = répertoire du cas
|
||||
REPDATA = "MGAdapt_med_files"
|
||||
#
|
||||
# 2. Repérage des données
|
||||
D_DATA = dict()
|
||||
D_DATA["01"] = "01" # 2D plan ; carte locale
|
||||
D_DATA["02"] = "02" # 2D plan ; carte en arrière-plan
|
||||
D_DATA["03"] = "01" # 2D plan ; taille constante
|
||||
D_DATA["04"] = "04" # 3D ; carte locale et dernier pas de temps
|
||||
D_DATA["05"] = "04" # 3D ; carte locale et pas de temps n°1
|
||||
D_DATA["06"] = "06" # 2D non plan; carte locale
|
||||
D_DATA["07"] = "07" # 2D plan ; carte locale anisotrope
|
||||
D_DATA["08"] = "08" # 3D ; carte en arrière-plan anisotrope
|
||||
D_DATA["10"] = "10" # 2D plan ; carte locale et maillage initial quadratique
|
||||
D_DATA["11"] = "11" # 2D plan ; carte locale et maillage initial en quadrangles
|
||||
D_DATA["13"] = "13" # 3D ; carte locale en simple précision et dernier pas de temps
|
||||
#========================== Paramétrage - Fin ====================================
|
||||
|
||||
class MGAdaptTest (object):
|
||||
|
||||
"""Test de l'adaptation par MGAdapt
|
||||
|
||||
Options facultatives
|
||||
********************
|
||||
Le(s) nom du/des tests à passer. Si aucun n'est donné, tous les cas sont passés.
|
||||
"""
|
||||
|
||||
# A. La base
|
||||
|
||||
message_info = ""
|
||||
_verbose = 0
|
||||
_verbose_max = 0
|
||||
affiche_aide_globale = 0
|
||||
|
||||
# B. Les variables
|
||||
|
||||
l_cas = None
|
||||
rep_test = None
|
||||
nro_cas = None
|
||||
cas = None
|
||||
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
def __init__ ( self, liste_option ):
|
||||
|
||||
"""Le constructeur de la classe MGAdaptTest"""
|
||||
|
||||
self.l_cas = list()
|
||||
|
||||
for option in liste_option :
|
||||
|
||||
#print (option)
|
||||
saux = option.upper()
|
||||
#print (saux)
|
||||
if saux in ( "-H", "-HELP" ):
|
||||
self.affiche_aide_globale = 1
|
||||
elif saux == "-V" :
|
||||
self._verbose = 1
|
||||
elif saux == "-VMAX" :
|
||||
self._verbose = 1
|
||||
self._verbose_max = 1
|
||||
else :
|
||||
self.l_cas.append(option)
|
||||
|
||||
if not self.l_cas:
|
||||
for cle in D_DATA:
|
||||
self.l_cas.append(cle)
|
||||
self.l_cas.sort()
|
||||
|
||||
if self._verbose_max:
|
||||
print ("Liste des cas : {}".format(self.l_cas))
|
||||
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
def __del__(self):
|
||||
"""A la suppression de l'instance de classe"""
|
||||
if self._verbose_max:
|
||||
print ("Suppression de l'instance de la classe.")
|
||||
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
def _add_file_in (self, objet_adapt):
|
||||
"""Ajout du fichier med d'entrée
|
||||
|
||||
Entrées/Sorties :
|
||||
:objet_adapt: l'objet du module
|
||||
"""
|
||||
if self._verbose_max:
|
||||
print ("_add_file_in pour {}".format(self.nro_cas))
|
||||
|
||||
ficmed = os.path.join (REPDATA, "test_{}.med".format(D_DATA[self.nro_cas]))
|
||||
if self._verbose_max:
|
||||
print ("Fichier {}".format(ficmed))
|
||||
if not os.path.isfile(ficmed):
|
||||
erreur = 1
|
||||
message = "Le fichier {} est inconnu.".format(ficmed)
|
||||
else:
|
||||
objet_adapt.setMEDFileIn(ficmed)
|
||||
erreur = 0
|
||||
message = ""
|
||||
|
||||
return erreur, message
|
||||
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
def _add_file_out (self, objet_adapt):
|
||||
"""Ajout du fichier de sortie
|
||||
|
||||
Entrées/Sorties :
|
||||
:objet_adapt: l'objet du module
|
||||
"""
|
||||
if self._verbose_max:
|
||||
print ("_add_file_out pour {}".format(self.nro_cas))
|
||||
|
||||
ficmed = os.path.join (REPDATA, "test_{}.adapt.tui.med".format(self.nro_cas))
|
||||
if os.path.isfile(ficmed):
|
||||
os.remove(ficmed)
|
||||
|
||||
objet_adapt.setMEDFileOut(ficmed)
|
||||
|
||||
if self._verbose:
|
||||
print (". Maillage adapté dans le fichier {}".format(ficmed))
|
||||
|
||||
return
|
||||
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
def _add_file_bkg (self, objet_adapt):
|
||||
"""Ajout du fichier med de fond
|
||||
|
||||
Entrées/Sorties :
|
||||
:objet_adapt: l'objet du module
|
||||
"""
|
||||
if self._verbose_max:
|
||||
print ("_add_file_bkg pour {}".format(self.nro_cas))
|
||||
|
||||
ficmed = os.path.join (REPDATA, "test_{}_bg.med".format(D_DATA[self.nro_cas]))
|
||||
if self._verbose_max:
|
||||
print ("Fichier {}".format(ficmed))
|
||||
if not os.path.isfile(ficmed):
|
||||
erreur = 1
|
||||
message = "Le fichier {} est inconnu.".format(ficmed)
|
||||
else:
|
||||
objet_adapt.setMEDFileBackground(ficmed)
|
||||
erreur = 0
|
||||
message = ""
|
||||
|
||||
return erreur, message
|
||||
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
def _hypo_creation (self, maptype, option, niveau=3):
|
||||
"""Création d'une hypothèse
|
||||
|
||||
Entrées :
|
||||
:maptype: type de carte : "Local", "Background", "Constant"
|
||||
:option: nom du champ si "Local" ou "Background", valeur si "Constant"
|
||||
:niveau: niveau de verbosité
|
||||
|
||||
Sortie :
|
||||
:hypo: l'objet hypothèse
|
||||
"""
|
||||
if self._verbose_max:
|
||||
print ("_hypo_creation pour {} avec {}".format(maptype,option))
|
||||
|
||||
erreur = 0
|
||||
message = ""
|
||||
|
||||
while not erreur :
|
||||
|
||||
#--- Création de l'hypothèse ---
|
||||
hypo = smesh.CreateAdaptationHypothesis()
|
||||
|
||||
# Type de données
|
||||
if ( maptype in ("Local", "Background", "Constant") ):
|
||||
hypo.setSizeMapType(maptype)
|
||||
else:
|
||||
message = "Le type de carte {} est inconnu.".format(maptype)
|
||||
erreur = 2
|
||||
break
|
||||
|
||||
# Valeur
|
||||
if ( maptype in ("Local", "Background") ):
|
||||
hypo.setSizeMapFieldName(option)
|
||||
else:
|
||||
hypo.setConstantSize(option)
|
||||
|
||||
# Verbosité
|
||||
self._hypo_verbose (hypo, niveau)
|
||||
|
||||
break
|
||||
|
||||
return erreur, message, hypo
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
def _hypo_verbose (self, hypo, niveau=10):
|
||||
"""Débogage des hypothèses
|
||||
|
||||
Entrées :
|
||||
:niveau: niveau de verbosité
|
||||
|
||||
Entrées/Sorties :
|
||||
:hypo: l'objet hypothèse
|
||||
"""
|
||||
|
||||
hypo.setVerbosityLevel(niveau)
|
||||
|
||||
if self._verbose_max:
|
||||
|
||||
hypo.setPrintLogInFile(True)
|
||||
hypo.setKeepWorkingFiles(True)
|
||||
hypo.setRemoveOnSuccess(False)
|
||||
|
||||
return
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
def _calcul (self, objet_adapt, hypo):
|
||||
"""Calcul
|
||||
|
||||
Entrées :
|
||||
:objet_adapt: l'objet du module
|
||||
:hypo: l'objet hypothèse
|
||||
"""
|
||||
|
||||
#--- association de l'hypothese à l'objet de l'adaptation
|
||||
objet_adapt.AddHypothesis(hypo)
|
||||
|
||||
#-- Calcul
|
||||
if self._verbose_max:
|
||||
print (hypo.getCommandToRun())
|
||||
erreur = objet_adapt.Compute(False)
|
||||
if erreur:
|
||||
message = "Echec dans l'adaptation."
|
||||
else:
|
||||
message = ""
|
||||
|
||||
return erreur, message
|
||||
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
def _test_00 (self, objet_adapt):
|
||||
"""Test générique
|
||||
|
||||
Entrées/Sorties :
|
||||
:objet_adapt: l'objet du module
|
||||
"""
|
||||
|
||||
erreur = 0
|
||||
message = ""
|
||||
|
||||
while not erreur :
|
||||
|
||||
#--- les fichiers MED ---#
|
||||
erreur, message = self._add_file_in (objet_adapt)
|
||||
if erreur:
|
||||
break
|
||||
self._add_file_out (objet_adapt)
|
||||
if self.nro_cas in ("02", "08"):
|
||||
erreur, message = self._add_file_bkg (objet_adapt)
|
||||
if erreur:
|
||||
break
|
||||
|
||||
#--- Création de l'hypothèse ---
|
||||
if self.nro_cas in ("01", "04", "05", "06", "07", "10", "11", "13"):
|
||||
maptype = "Local"
|
||||
if self.nro_cas in ("01", "04", "05", "06", "07", "10"):
|
||||
option = "TAILLE"
|
||||
elif self.nro_cas in ("11",):
|
||||
option = "Taille de maille"
|
||||
elif self.nro_cas in ("13",):
|
||||
option = "Elevation"
|
||||
elif self.nro_cas in ("02", "08"):
|
||||
maptype = "Background"
|
||||
option = "TAILLE"
|
||||
elif self.nro_cas in ("03",):
|
||||
maptype = "Constant"
|
||||
option = 0.5
|
||||
|
||||
if self._verbose:
|
||||
niveau = 3
|
||||
elif self._verbose_max:
|
||||
niveau = 10
|
||||
else:
|
||||
niveau = 0
|
||||
erreur, message, hypo = self._hypo_creation(maptype, option, niveau)
|
||||
if erreur:
|
||||
break
|
||||
|
||||
#-- Ajout des options
|
||||
if self.nro_cas in ("04", "06", "07", "08", "10", "11"):
|
||||
hypo.setTimeStepRankLast()
|
||||
elif self.nro_cas in ("05",):
|
||||
hypo.setTimeStepRank(1,1)
|
||||
elif self.nro_cas in ("13",):
|
||||
hypo.setTimeStepRank(0,0)
|
||||
|
||||
# options facultatives
|
||||
if self.nro_cas in ("03",):
|
||||
hypo.setOptionValue("adaptation", "surface")
|
||||
|
||||
#-- Calcul
|
||||
try :
|
||||
erreur, message = self._calcul (objet_adapt, hypo)
|
||||
except :
|
||||
erreur = 1871
|
||||
message = "Erreur dans le calcul par SMESH"
|
||||
|
||||
break
|
||||
|
||||
return erreur, message
|
||||
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
def _traitement_cas (self ):
|
||||
"""Traitement d'un cas
|
||||
|
||||
|
||||
Sorties :
|
||||
:erreur: code d'erreur
|
||||
:message: message d'erreur
|
||||
"""
|
||||
|
||||
nom_fonction = __name__ + "/_traitement_cas"
|
||||
blabla = "\nDans {} :".format(nom_fonction)
|
||||
|
||||
if self._verbose_max:
|
||||
print (blabla)
|
||||
|
||||
# 1. Préalables
|
||||
|
||||
erreur = 0
|
||||
message = ""
|
||||
if self._verbose:
|
||||
print ("Passage du cas '{}'".format(self.nro_cas))
|
||||
|
||||
if ( self.nro_cas in ("01", "02", "03", "04", "05", "06", "07", "08", "10" ,"11" ,"13") ):
|
||||
objet_adapt = smesh.Adaptation('MG_Adapt')
|
||||
erreur, message = self._test_00 (objet_adapt)
|
||||
del objet_adapt
|
||||
|
||||
else:
|
||||
erreur = 1
|
||||
message = "Le cas '{}' est inconnu.".format(self.nro_cas)
|
||||
|
||||
return erreur, message
|
||||
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
def lancement (self):
|
||||
|
||||
"""Lancement
|
||||
|
||||
Sorties :
|
||||
:erreur: code d'erreur
|
||||
:message: message d'erreur
|
||||
"""
|
||||
|
||||
nom_fonction = __name__ + "/lancement"
|
||||
blabla = "\nDans {} :".format(nom_fonction)
|
||||
|
||||
erreur = 0
|
||||
message = ""
|
||||
|
||||
if self._verbose_max:
|
||||
print (blabla)
|
||||
|
||||
for nom_cas in self.l_cas:
|
||||
self.nro_cas = nom_cas
|
||||
erreur_t, message_t = self._traitement_cas ()
|
||||
if erreur_t:
|
||||
erreur += 1
|
||||
message += "\nErreur n° {} pour le cas {} :\n".format(erreur_t,nom_cas)
|
||||
message += message_t
|
||||
|
||||
if ( erreur and self._verbose_max ):
|
||||
print (blabla, message)
|
||||
|
||||
return erreur, message
|
||||
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
#========================== Fin de la classe ====================================
|
||||
|
||||
#==================================================================================
|
||||
# Lancement
|
||||
#==================================================================================
|
||||
|
||||
if __name__ == "__main__" :
|
||||
|
||||
# 1. Options
|
||||
|
||||
L_OPTIONS = list()
|
||||
#L_OPTIONS.append("-h")
|
||||
#L_OPTIONS.append("-v")
|
||||
#L_OPTIONS.append("-vmax")
|
||||
L_OPTIONS.append("01")
|
||||
L_OPTIONS.append("02")
|
||||
L_OPTIONS.append("03")
|
||||
L_OPTIONS.append("07")
|
||||
L_OPTIONS.append("10")
|
||||
L_OPTIONS.append("11")
|
||||
L_OPTIONS.append("04")
|
||||
L_OPTIONS.append("05")
|
||||
L_OPTIONS.append("06")
|
||||
L_OPTIONS.append("08")
|
||||
#L_OPTIONS.append("13")
|
||||
|
||||
# 2. Lancement de la classe
|
||||
|
||||
#print ("L_OPTIONS :", L_OPTIONS)
|
||||
MGADAPT_TEST = MGAdaptTest(L_OPTIONS)
|
||||
if MGADAPT_TEST.affiche_aide_globale:
|
||||
sys.stdout.write(MGADAPT_TEST.__doc__+"\n")
|
||||
else:
|
||||
ERREUR, MESSAGE_ERREUR = MGADAPT_TEST.lancement()
|
||||
if ERREUR:
|
||||
sys.stdout.write(MGADAPT_TEST.__doc__+"\n")
|
||||
MESSAGE_ERREUR += "\n {} erreur(s)\n".format(ERREUR)
|
||||
sys.stderr.write(MESSAGE_ERREUR)
|
||||
#raise Exception(MESSAGE_ERREUR)
|
||||
assert(False)
|
||||
|
||||
del MGADAPT_TEST
|
||||
|
||||
#sys.exit(0)
|
BIN
doc/salome/examples/MGAdapt_med_files/test_01.med
Normal file
BIN
doc/salome/examples/MGAdapt_med_files/test_01.med
Normal file
Binary file not shown.
BIN
doc/salome/examples/MGAdapt_med_files/test_02.med
Normal file
BIN
doc/salome/examples/MGAdapt_med_files/test_02.med
Normal file
Binary file not shown.
BIN
doc/salome/examples/MGAdapt_med_files/test_02_bg.med
Normal file
BIN
doc/salome/examples/MGAdapt_med_files/test_02_bg.med
Normal file
Binary file not shown.
BIN
doc/salome/examples/MGAdapt_med_files/test_04.med
Normal file
BIN
doc/salome/examples/MGAdapt_med_files/test_04.med
Normal file
Binary file not shown.
BIN
doc/salome/examples/MGAdapt_med_files/test_06.med
Normal file
BIN
doc/salome/examples/MGAdapt_med_files/test_06.med
Normal file
Binary file not shown.
BIN
doc/salome/examples/MGAdapt_med_files/test_07.med
Normal file
BIN
doc/salome/examples/MGAdapt_med_files/test_07.med
Normal file
Binary file not shown.
BIN
doc/salome/examples/MGAdapt_med_files/test_08.med
Normal file
BIN
doc/salome/examples/MGAdapt_med_files/test_08.med
Normal file
Binary file not shown.
BIN
doc/salome/examples/MGAdapt_med_files/test_08_bg.med
Normal file
BIN
doc/salome/examples/MGAdapt_med_files/test_08_bg.med
Normal file
Binary file not shown.
BIN
doc/salome/examples/MGAdapt_med_files/test_10.med
Normal file
BIN
doc/salome/examples/MGAdapt_med_files/test_10.med
Normal file
Binary file not shown.
BIN
doc/salome/examples/MGAdapt_med_files/test_11.med
Normal file
BIN
doc/salome/examples/MGAdapt_med_files/test_11.med
Normal file
Binary file not shown.
BIN
doc/salome/examples/MGAdapt_med_files/test_13.med
Normal file
BIN
doc/salome/examples/MGAdapt_med_files/test_13.med
Normal file
Binary file not shown.
@ -45,6 +45,7 @@ SET(BAD_TESTS
|
||||
radial_prism_3d_algo.py
|
||||
test_smeshplugin_mg_tetra_parallele.py
|
||||
test_smeshplugins.py
|
||||
MGAdaptTests_without_session.py
|
||||
)
|
||||
|
||||
SET(GOOD_TESTS
|
||||
|
BIN
doc/salome/gui/SMESH/images/adaptation_01.png
Normal file
BIN
doc/salome/gui/SMESH/images/adaptation_01.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
doc/salome/gui/SMESH/images/adaptation_02.png
Normal file
BIN
doc/salome/gui/SMESH/images/adaptation_02.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
38
doc/salome/gui/SMESH/input/adaptation.rst
Normal file
38
doc/salome/gui/SMESH/input/adaptation.rst
Normal file
@ -0,0 +1,38 @@
|
||||
.. _adaptation_page:
|
||||
|
||||
**********
|
||||
Adaptation
|
||||
**********
|
||||
|
||||
Mesh module provides the possibility to perform different adaptations of a mesh.
|
||||
|
||||
.. note::
|
||||
A mesh adaptation based on splitting is available by the HOMARD module.
|
||||
|
||||
.. _mg_adapt_anchor:
|
||||
|
||||
MG_Adapt
|
||||
########
|
||||
|
||||
For meshes made of triangles and/or tetrahedra, remeshing operations are available with the MG-Adapt plugin. The remeshing is based on wanted mesh sizes defined over the mesh or as a constant. The boundaries are dedeuced from the initial mesh.
|
||||
|
||||
To start **Remeshing** operation, select **MG Adapt** tab in **Adaptation** dialog.
|
||||
|
||||
.. image:: ../images/adaptation_01.png
|
||||
:align: center
|
||||
|
||||
|
||||
* **Mesh In** is the initial mesh to remesh.
|
||||
* **Mesh Out** is the resulting mesh after remeshing. By default, the name of the initial mesh is kept and the file name is based on the name of the initial mesh.
|
||||
* **Size map definition** is a choice between **Local**, **Background** and **Constant**.
|
||||
|
||||
- If the choice is **Background**, the name of the MED file must be given.
|
||||
- If the choice is **Local** or **Background**, the name of the field must be selected from the list, together with time step.
|
||||
|
||||
.. image:: ../images/adaptation_02.png
|
||||
:align: center
|
||||
|
||||
.. note::
|
||||
The exhaustive description of MG-Adapt can be read into its documentation. It can be reached by the general help button.
|
||||
|
||||
**See Also** a sample TUI Script of :ref:`tui_adaptation_page`.
|
@ -23,6 +23,7 @@ Introduction to Mesh module
|
||||
* :ref:`creating groups <grouping_elements_page>` of mesh elements;
|
||||
* filtering mesh entities (nodes or elements) using :ref:`Filters <filters_page>` functionality for :ref:`creating groups <grouping_elements_page>` and applying :ref:`mesh modifications <modifying_meshes_page>`;
|
||||
* :ref:`viewing meshes <viewing_meshes_overview_page>` in the VTK viewer and :ref:`getting info <mesh_infos_page>` on mesh and its sub-objects;
|
||||
* :ref:`remeshing meshes <adaptation_page>`;
|
||||
* applying to meshes :ref:`Quality Controls <quality_page>`, allowing to highlight important elements;
|
||||
* taking various :ref:`measurements <measurements_page>` of the mesh objects.
|
||||
|
||||
@ -52,6 +53,7 @@ Mesh module preferences are described in the :ref:`mesh_preferences_page` sectio
|
||||
grouping_elements
|
||||
about_filters
|
||||
about_quality_controls
|
||||
adaptation
|
||||
measurements
|
||||
viewing_meshes_overview
|
||||
smeshpy_interface
|
||||
|
@ -95,6 +95,7 @@ the following links:
|
||||
tui_transforming_meshes
|
||||
tui_viewing_meshes
|
||||
tui_quality_controls
|
||||
tui_adaptation
|
||||
tui_measurements
|
||||
tui_work_on_objects_from_gui
|
||||
tui_notebook_smesh
|
||||
|
18
doc/salome/gui/SMESH/input/tui_adaptation.rst
Normal file
18
doc/salome/gui/SMESH/input/tui_adaptation.rst
Normal file
@ -0,0 +1,18 @@
|
||||
.. _tui_adaptation_page:
|
||||
|
||||
**********
|
||||
Adaptation
|
||||
**********
|
||||
|
||||
.. _tui_mg_adapt:
|
||||
|
||||
MG_Adapt
|
||||
========
|
||||
|
||||
.. literalinclude:: ../../../examples/MGAdaptTests_without_session.py
|
||||
:language: python
|
||||
|
||||
:download:`Download this script <../../../examples/MGAdaptTests_without_session.py>`
|
||||
|
||||
|
||||
**See Also** the GUI :ref:`adaptation_page`.
|
@ -36,6 +36,7 @@ SET(SalomeIDLSMESH_IDLSOURCES
|
||||
SMESH_Pattern.idl
|
||||
SMESH_MeshEditor.idl
|
||||
SMESH_Measurements.idl
|
||||
MG_ADAPT.idl
|
||||
)
|
||||
|
||||
SET(_idl_include_dirs
|
||||
|
148
idl/MG_ADAPT.idl
Normal file
148
idl/MG_ADAPT.idl
Normal file
@ -0,0 +1,148 @@
|
||||
// Copyright (C) 2020-2021 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
|
||||
//
|
||||
|
||||
#ifndef MG_ADAPT_IDL
|
||||
#define MG_ADAPT_IDL
|
||||
|
||||
#include "SALOME_Component.idl"
|
||||
#include "SALOME_Exception.idl"
|
||||
#include "SALOME_GenericObj.idl"
|
||||
#include "SALOMEDS.idl"
|
||||
#include "SMESH_Mesh.idl"
|
||||
|
||||
module SMESH
|
||||
{
|
||||
struct MgAdaptHypothesisData
|
||||
{
|
||||
string myFileInDir, myMeshFileIn, myInMeshName, myMeshFileBackground, myOutMeshName,
|
||||
myMeshFileOut, myFileOutDir, myFileSizeMapDir, myFieldName;
|
||||
boolean fromMedFile;
|
||||
boolean myPublish, myMeshOutMed;
|
||||
boolean myUseLocalMap, myUseBackgroundMap, myUseConstantValue;
|
||||
double myConstantValue;
|
||||
long myRank, myTimeStep;
|
||||
boolean myUseNoTimeStep, myUseLastTimeStep, myUseChosenTimeStep;
|
||||
string myWorkingDir, myLogFile;
|
||||
boolean myPrintLogInFile, myKeepFiles, myRemoveLogOnSuccess;
|
||||
long myVerboseLevel;
|
||||
};
|
||||
|
||||
interface MG_ADAPT : SALOME::GenericObj
|
||||
{
|
||||
void setData(inout MgAdaptHypothesisData data);
|
||||
|
||||
void setMedFileIn(in string MedFileIn);
|
||||
string getMedFileIn();
|
||||
|
||||
void setMedFileOut(in string MedFileOut);
|
||||
string getMedFileOut();
|
||||
|
||||
void setMeshName(in string s);
|
||||
string getMeshName();
|
||||
|
||||
void setMeshNameOut(in string s);
|
||||
string getMeshNameOut();
|
||||
|
||||
void setMeshOutMed(in boolean b);
|
||||
boolean getMeshOutMed();
|
||||
|
||||
void setPublish(in boolean b);
|
||||
boolean getPublish();
|
||||
|
||||
void setSizeMapFieldName(in string s);
|
||||
string getSizeMapFieldName();
|
||||
|
||||
void setTimeStep(in long s);
|
||||
long getTimeStep();
|
||||
|
||||
void setTimeStepRank(in long s, in long f);
|
||||
long getRank();
|
||||
|
||||
void setTimeStepRankLast();
|
||||
void setNoTimeStep();
|
||||
|
||||
void setLogFile(in string f);
|
||||
string getLogFile();
|
||||
|
||||
void setVerbosityLevel(in long f);
|
||||
long getVerbosityLevel();
|
||||
|
||||
void setRemoveOnSuccess(in boolean f);
|
||||
boolean getRemoveOnSuccess();
|
||||
|
||||
MgAdaptHypothesisData getData();
|
||||
|
||||
void setUseLocalMap(in boolean f);
|
||||
boolean getUseLocalMap();
|
||||
|
||||
void setUseBackgroundMap(in boolean f);
|
||||
boolean getUseBackgroundMap();
|
||||
|
||||
void setUseConstantValue(in boolean f);
|
||||
boolean getUseConstantValue();
|
||||
|
||||
void setConstantSize(in double f);
|
||||
double getConstantSize();
|
||||
|
||||
void setSizeMapFile(in string f);
|
||||
string getSizeMapFile();
|
||||
|
||||
void setFromMedFile(in boolean f);
|
||||
boolean isFromMedFile();
|
||||
|
||||
void setKeepWorkingFiles(in boolean f);
|
||||
boolean getKeepWorkingFiles();
|
||||
|
||||
void setPrintLogInFile(in boolean f);
|
||||
boolean getPrintLogInFile();
|
||||
|
||||
void setWorkingDir(in string f);
|
||||
string getWorkingDir();
|
||||
|
||||
void setSizeMapType(in string f);
|
||||
boolean setAll();
|
||||
string getCommandToRun();
|
||||
void compute() raises(SALOME::SALOME_Exception);
|
||||
string getErrMsg();
|
||||
string getFileName();
|
||||
string getExeName();
|
||||
void copyMgAdaptHypothesisData(in MgAdaptHypothesisData f);
|
||||
|
||||
//void checkDirPath(inout string f);
|
||||
|
||||
boolean hasOptionDefined(in string optionName);
|
||||
void setOptionValue(in string optionName, in string optionValue) raises (SALOME::SALOME_Exception);
|
||||
string getOptionValue(in string optionName, inout boolean isDefault) raises (SALOME::SALOME_Exception);
|
||||
SMESH::string_array getCustomOptionValuesStrVec();
|
||||
SMESH::string_array getOptionValuesStrVec();
|
||||
};
|
||||
|
||||
typedef MG_ADAPT MG_ADAPT_HYPOTHESIS;
|
||||
interface MG_ADAPT_OBJECT : SALOME::GenericObj
|
||||
{
|
||||
void setMeshIn(in SMESH_Mesh theMesh) raises (SALOME::SALOME_Exception);
|
||||
void setMEDFileIn(in string f) raises (SALOME::SALOME_Exception);
|
||||
void setMEDFileOut(in string f) raises (SALOME::SALOME_Exception);
|
||||
void setMEDFileBackground(in string f) raises (SALOME::SALOME_Exception);
|
||||
void AddHypothesis(in MG_ADAPT mg) raises (SALOME::SALOME_Exception);
|
||||
long Compute(in boolean Publish) raises (SALOME::SALOME_Exception);
|
||||
};
|
||||
};
|
||||
|
||||
#endif // MG_ADAPT_IDL
|
@ -43,6 +43,8 @@ module SMESH
|
||||
interface FilterManager;
|
||||
interface SMESH_Pattern;
|
||||
interface Measurements;
|
||||
interface MG_ADAPT;
|
||||
interface MG_ADAPT_OBJECT;
|
||||
|
||||
/*!
|
||||
* Tags definition
|
||||
@ -584,7 +586,9 @@ module SMESH
|
||||
in GEOM::GEOM_Object theGeom,
|
||||
in double theTolerance );
|
||||
|
||||
|
||||
MG_ADAPT CreateMG_ADAPT();
|
||||
MG_ADAPT_OBJECT Adaptation(in string adaptType);
|
||||
MG_ADAPT CreateAdaptationHypothesis();
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
SET(SMESH_RESOURCES_FILES
|
||||
ModuleMesh.png
|
||||
adapt_mg_adapt.png
|
||||
advanced_mesh_info.png
|
||||
bare_border_face.png
|
||||
bare_border_volume.png
|
||||
|
@ -98,6 +98,11 @@
|
||||
<parameter name="vol_precision" value="-6" />
|
||||
<parameter name="selection_increment" value="0" />
|
||||
<parameter name="controls_increment" value="2" />
|
||||
<!-- Adaptation -->
|
||||
<parameter name="mg_adapt_file_mesh_out" value="true" />
|
||||
<parameter name="mg_adapt_publish_mesh_out" value="false" />
|
||||
<parameter name="mg_adapt_size_map" value="Local" />
|
||||
<parameter name="mg_adapt_time_step" value="None" />
|
||||
</section>
|
||||
<section name="smesh_help" >
|
||||
<parameter name="User's Guide/Mesh module/User's Guide" value="%SMESH_ROOT_DIR%/share/doc/salome/gui/SMESH/index.html;;http://docs.salome-platform.org/latest/gui/SMESH/index.html"/>
|
||||
@ -106,6 +111,9 @@
|
||||
<parameter name="User's Guide/Mesh module/Plug-ins/MacMesh plugin" value="%SMESH_ROOT_DIR%/share/doc/salome/gui/SMESH/MacMesh/index.html;;http://docs.salome-platform.org/latest/gui/SMESH/MacMesh/index.html"/>
|
||||
<parameter name="User's Guide/Mesh module/Plug-ins/blocFissure plugin" value="%SMESH_ROOT_DIR%/share/doc/salome/gui/SMESH/blocFissure/index.html;;http://docs.salome-platform.org/latest/gui/SMESH/blocFissure/index.html"/>
|
||||
<parameter name="User's Guide/Mesh module/Plug-ins/SpherePadder plugin" value="%SMESH_ROOT_DIR%/share/doc/salome/gui/SMESH/padder/index.html;;http://docs.salome-platform.org/latest/gui/SMESH/padder/index.html"/>
|
||||
<parameter name="User's Guide/Mesh module/MG-Adapt plugin/User's Guide" value="%SMESH_ROOT_DIR%/share/doc/salome/gui/SMESH/index.html#adaptation;;http://docs.salome-platform.org/latest/gui/SMESH/index.html#adaptation"/>
|
||||
<parameter name="User's Guide/Mesh module/MG-Adapt plugin/Reference" value="%MESHGEMS_ROOT_DIR%/Docs/mg-adapt_api_manual.pdf"/>
|
||||
<parameter name="User's Guide/Mesh module/MG-Adapt plugin/Manual" value="%MESHGEMS_ROOT_DIR%/Docs/mg-adapt_user_manual.pdf"/>
|
||||
<parameter name="User's Guide/Mesh module/MGCleaner plugin/User's Guide" value="%SMESH_ROOT_DIR%/share/doc/salome/gui/SMESH/MGCleaner/index.html;;http://docs.salome-platform.org/latest/gui/SMESH/MGCleaner/index.html"/>
|
||||
<parameter name="User's Guide/Mesh module/MGCleaner plugin/Reference" value="%MESHGEMS_ROOT_DIR%/Docs/mg-cleaner_api_manual.pdf"/>
|
||||
<parameter name="User's Guide/Mesh module/MGCleaner plugin/Manual" value="%MESHGEMS_ROOT_DIR%/Docs/mg-cleaner_user_manual.pdf"/>
|
||||
|
BIN
resources/adapt_mg_adapt.png
Executable file
BIN
resources/adapt_mg_adapt.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
@ -38,6 +38,7 @@ INCLUDE_DIRECTORIES(
|
||||
${PROJECT_SOURCE_DIR}/src/SMDS
|
||||
${PROJECT_SOURCE_DIR}/src/SMESHDS
|
||||
${PROJECT_SOURCE_DIR}/src/SMESHUtils
|
||||
${MEDCOUPLING_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
# additional preprocessor / compiler flags
|
||||
@ -67,6 +68,7 @@ SET(_link_LIBRARIES
|
||||
MeshDriverUNV
|
||||
MeshDriverGMF
|
||||
${DriverCGNS_LIB}
|
||||
${MEDCoupling_medloader}
|
||||
)
|
||||
|
||||
# --- headers ---
|
||||
@ -86,6 +88,7 @@ SET(SMESHimpl_HEADERS
|
||||
SMESH_MesherHelper.hxx
|
||||
SMESH_ProxyMesh.hxx
|
||||
SMESH_SMESH.hxx
|
||||
MG_ADAPT.hxx
|
||||
)
|
||||
|
||||
# --- sources ---
|
||||
@ -104,6 +107,7 @@ SET(SMESHimpl_SOURCES
|
||||
SMESH_HypoFilter.cxx
|
||||
SMESH_ProxyMesh.cxx
|
||||
SMESH_MesherHelper.cxx
|
||||
MG_ADAPT.cxx
|
||||
)
|
||||
|
||||
# --- rules ---
|
||||
@ -111,6 +115,7 @@ SET(SMESHimpl_SOURCES
|
||||
ADD_LIBRARY(SMESHimpl ${SMESHimpl_SOURCES})
|
||||
IF(WIN32)
|
||||
TARGET_COMPILE_OPTIONS(SMESHimpl PRIVATE /bigobj)
|
||||
ADD_DEFINITIONS(-DNOMINMAX)
|
||||
ENDIF(WIN32)
|
||||
|
||||
TARGET_LINK_LIBRARIES(SMESHimpl ${_link_LIBRARIES} )
|
||||
|
1567
src/SMESH/MG_ADAPT.cxx
Normal file
1567
src/SMESH/MG_ADAPT.cxx
Normal file
File diff suppressed because it is too large
Load Diff
278
src/SMESH/MG_ADAPT.hxx
Normal file
278
src/SMESH/MG_ADAPT.hxx
Normal file
@ -0,0 +1,278 @@
|
||||
// Copyright (C) 2020-2021 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
|
||||
//
|
||||
|
||||
#ifndef MG_ADAPT_HXX
|
||||
#define MG_ADAPT_HXX
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include "SMESH_SMESH.hxx"
|
||||
|
||||
namespace MEDCoupling
|
||||
{
|
||||
class MEDFileMesh;
|
||||
}
|
||||
|
||||
namespace MG_ADAPT
|
||||
{
|
||||
typedef std::map< std::string, std::string > TOptionValues;
|
||||
typedef std::set< std::string > TOptionNames;
|
||||
|
||||
std::string remove_extension(const std::string& filename);
|
||||
|
||||
struct MgAdaptHypothesisData
|
||||
{
|
||||
std::string myFileInDir, myMeshFileIn, myInMeshName, myMeshFileBackground, myOutMeshName,
|
||||
myMeshFileOut, myFileOutDir, myFileSizeMapDir, myFieldName;
|
||||
bool fromMedFile;
|
||||
bool myPublish, myMeshOutMed;
|
||||
bool myUseLocalMap, myUseBackgroundMap, myUseConstantValue;
|
||||
double myConstantValue;
|
||||
int myRank, myTimeStep;
|
||||
bool myUseNoTimeStep, myUseLastTimeStep, myUseChosenTimeStep;
|
||||
std::string myWorkingDir, myLogFile;
|
||||
bool myPrintLogInFile, myKeepFiles, myRemoveLogOnSuccess;
|
||||
int myVerboseLevel;
|
||||
};
|
||||
|
||||
|
||||
class SMESH_EXPORT MgAdapt
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
MgAdapt();
|
||||
MgAdapt(MgAdaptHypothesisData*);
|
||||
MgAdapt(const MgAdapt&);
|
||||
~MgAdapt();
|
||||
void buildModel();
|
||||
void setData( MgAdaptHypothesisData* data);
|
||||
|
||||
void setMedFileIn(std::string fileName);
|
||||
std::string getMedFileIn();
|
||||
|
||||
void setMedFileOut(std::string fileOut);
|
||||
std::string getMedFileOut();
|
||||
|
||||
void setMeshName(std::string name);
|
||||
std::string getMeshName();
|
||||
|
||||
void setMeshNameOut(std::string name);
|
||||
std::string getMeshNameOut();
|
||||
|
||||
void setMeshOutMed(bool mybool);
|
||||
bool getMeshOutMed();
|
||||
|
||||
void setPublish(bool mybool);
|
||||
bool getPublish();
|
||||
|
||||
void setFieldName(std::string myFieldName);
|
||||
std::string getFieldName();
|
||||
|
||||
void setTimeStep(int time);
|
||||
int getTimeStep() const;
|
||||
|
||||
void setRankTimeStep(int time, int myRank);
|
||||
int getRank();
|
||||
|
||||
void setTimeStepRankLast();
|
||||
void setNoTimeStep();
|
||||
void setChosenTimeStepRank();
|
||||
void updateTimeStepRank();
|
||||
|
||||
void setLogFile(std::string);
|
||||
std::string getLogFile();
|
||||
|
||||
void setVerbosityLevel(int verbosity);
|
||||
int getVerbosityLevel();
|
||||
|
||||
void setRemoveOnSuccess(bool mybool);
|
||||
bool getRemoveOnSuccess();
|
||||
|
||||
MgAdaptHypothesisData* getData() const;
|
||||
|
||||
void setUseLocalMap(bool mybool);
|
||||
bool getUseLocalMap();
|
||||
|
||||
void setUseBackgroundMap(bool mybool);
|
||||
bool getUseBackgroundMap();
|
||||
|
||||
void setUseConstantValue(bool mybool);
|
||||
bool getUseConstantValue();
|
||||
|
||||
void setConstantValue(double cnst);
|
||||
double getConstantValue() const;
|
||||
|
||||
void setSizeMapFile(std::string mapFile);
|
||||
std::string getSizeMapFile();
|
||||
|
||||
void setFromMedFile(bool mybool);
|
||||
bool isFromMedFile();
|
||||
|
||||
void setKeepWorkingFiles(bool mybool);
|
||||
bool getKeepWorkingFiles();
|
||||
|
||||
void setPrintLogInFile(bool mybool);
|
||||
bool getPrintLogInFile();
|
||||
|
||||
void setWorkingDir(std::string dir);
|
||||
std::string getWorkingDir() const;
|
||||
|
||||
|
||||
bool setAll();
|
||||
static std::string getCommandToRun(MgAdapt* );
|
||||
std::string getCommandToRun() ;
|
||||
int compute(std::string& errStr);
|
||||
std::string getFileName() const;
|
||||
static std::string getExeName();
|
||||
void copyMgAdaptHypothesisData( const MgAdaptHypothesisData* from) ;
|
||||
|
||||
void checkDirPath(std::string& dirPath);
|
||||
|
||||
bool hasOptionDefined( const std::string& optionName ) const;
|
||||
void setOptionValue(const std::string& optionName,
|
||||
const std::string& optionValue);
|
||||
std::string getOptionValue(const std::string& optionName,
|
||||
bool* isDefault=0) const;
|
||||
std::vector <std::string> getCustomOptionValuesStrVec() const;
|
||||
std::vector <std::string> getOptionValuesStrVec() const;
|
||||
|
||||
|
||||
TOptionValues getOptionValues() const;
|
||||
const TOptionValues& getCustomOptionValues() const ;
|
||||
static double toDbl(const std::string&, bool* isOk = 0);
|
||||
static bool toBool(const std::string&, bool* isOk = 0);
|
||||
static int toInt(const std::string&, bool* isOk = 0 );
|
||||
static std::string toLowerStr(const std::string& str);
|
||||
|
||||
/* default values */
|
||||
static std::string defaultWorkingDirectory();
|
||||
static std::string defaultLogFile();
|
||||
static bool defaultKeepFiles();
|
||||
static bool defaultRemoveLogOnSuccess();
|
||||
static int defaultVerboseLevel();
|
||||
static bool defaultPrintLogInFile();
|
||||
static bool defaultFromMedFile();
|
||||
static bool defaultMeshOutMed();
|
||||
static bool defaultPublish();
|
||||
static bool defaultUseLocalMap();
|
||||
static bool defaultUseBackgroundMap();
|
||||
static bool defaultUseConstantValue();
|
||||
static bool defaultUseNoTimeStep();
|
||||
static bool defaultUseLastTimeStep();
|
||||
static bool defaultUseChosenTimeStep();
|
||||
static double defaultMaximumMemory();
|
||||
|
||||
enum Status {
|
||||
DRS_OK,
|
||||
DRS_EMPTY, // a file contains no mesh with the given name
|
||||
DRS_WARN_RENUMBER, // a file has overlapped ranges of element numbers,
|
||||
// so the numbers from the file are ignored
|
||||
DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
|
||||
DRS_WARN_DESCENDING, // some elements were skipped due to descending connectivity
|
||||
DRS_FAIL, // general failure (exception etc.)
|
||||
DRS_NO_TIME_STEP // general failure (exception etc.)
|
||||
};
|
||||
|
||||
struct group
|
||||
{
|
||||
std::string _name;
|
||||
std::vector<int> _famListId;
|
||||
std::vector<std::string> _famNames;
|
||||
group(std::string name, std::vector<int> famListId, std::vector<std::string> famNames)
|
||||
:_name(name), _famListId( famListId ), _famNames( famNames ) {}
|
||||
};
|
||||
|
||||
struct family
|
||||
{
|
||||
std::string _famName;
|
||||
int _famId;
|
||||
family(std::string famName, int famId):_famName(famName), _famId(famId) {}
|
||||
};
|
||||
|
||||
|
||||
private :
|
||||
bool fromMedFile;
|
||||
std::string medFileIn;
|
||||
std::string medFileOut;
|
||||
std::string meshName;
|
||||
std::string meshNameOut;
|
||||
bool publish, meshOutMed;
|
||||
bool useLocalMap, useBackgroundMap, useConstantValue;
|
||||
bool myUseLastTimeStep, myUseNoTimeStep, myUseChosenTimeStep;
|
||||
std::string sizeMapFile;
|
||||
std::string fieldName;
|
||||
double constantValue;
|
||||
int rank, timeStep;
|
||||
|
||||
/* advanced options */
|
||||
|
||||
|
||||
std::string logFile;
|
||||
std::string workingDir;
|
||||
int verbosityLevel;
|
||||
bool removeOnSuccess;
|
||||
bool toKeepWorkingFiles;
|
||||
bool printLogInFile;
|
||||
|
||||
/* Model DATA */
|
||||
MgAdaptHypothesisData* data;
|
||||
|
||||
/* */
|
||||
|
||||
TOptionValues _option2value, _customOption2value; // user defined values
|
||||
TOptionValues _defaultOptionValues; // default values
|
||||
TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option
|
||||
|
||||
std::vector <std::string> _myErrorMessages;
|
||||
Status _myStatus;
|
||||
std::string meshFormatOutputMesh;
|
||||
std::vector< std::string> solFormatOutput;
|
||||
std::vector <group> groupVec;
|
||||
std::vector <family> famVec;
|
||||
std::vector< std::string> tmpFilesToBeDeleted;
|
||||
|
||||
/* convert MED-->.mesh format */
|
||||
void convertMedFile(std::string& meshIn,std::string& solFileIn, std::string& sizeMapIn) ;
|
||||
void storeGroups(MEDCoupling::MEDFileMesh* fileMesh);
|
||||
void restoreGroups(MEDCoupling::MEDFileMesh* fileMesh) const;
|
||||
void storefams(MEDCoupling::MEDFileMesh* fileMesh);
|
||||
void restorefams(MEDCoupling::MEDFileMesh* fileMesh) const;
|
||||
void storeGroupsAndFams(MEDCoupling::MEDFileMesh* fileMesh);
|
||||
void restoreGroupsAndFams(MEDCoupling::MEDFileMesh* fileMesh) const;
|
||||
void convertMeshFile(std::string& meshFormatIn, std::vector< std::string>& solFieldFileNames) const ;
|
||||
void buildConstantSizeMapSolFile(const std::string& solFormatFieldFileName, const int dim, const int version, const size_t nbNodes) const;
|
||||
void buildBackGroundMeshAndSolFiles(const std::vector<std::string>& fieldFileNames, const std::string& meshFormatsizeMapFile) const;
|
||||
Status addMessage(const std::string& msg, const bool isFatal = false);
|
||||
void execCmd( const char* cmd, int& err);
|
||||
void cleanUp();
|
||||
void appendMsgToLogFile(std::string& msg);
|
||||
std::vector<std::string> getListFieldsNames(std::string fileIn) ;
|
||||
void checkDimensionOptionAdaptation() ;
|
||||
void checkFieldName(std::string fileIn) ;
|
||||
void checkTimeStepRank(std::string fileIn) ;
|
||||
|
||||
};
|
||||
|
||||
} // namespace MG_ADAPT
|
||||
|
||||
#endif // MG_ADAPT_HXX
|
@ -147,6 +147,8 @@ SET(_moc_HEADERS
|
||||
SMESHGUI_SplitBiQuad.h
|
||||
SMESHGUI_IdPreview.h
|
||||
SMESHGUI_PreVisualObj.h
|
||||
SMESHGUI_MG_ADAPTDRIVER.h
|
||||
SMESHGUI_MgAdaptDlg.h
|
||||
)
|
||||
|
||||
# header files / no moc processing
|
||||
@ -262,6 +264,8 @@ SET(_other_SOURCES
|
||||
SMESHGUI_SplitBiQuad.cxx
|
||||
SMESHGUI_PreVisualObj.cxx
|
||||
SMESHGUI_IdPreview.cxx
|
||||
SMESHGUI_MG_ADAPTDRIVER.cxx
|
||||
SMESHGUI_MgAdaptDlg.cxx
|
||||
)
|
||||
|
||||
# sources / to compile
|
||||
|
@ -60,6 +60,7 @@
|
||||
#include "SMESHGUI_GroupUtils.h"
|
||||
#include "SMESHGUI_Hypotheses.h"
|
||||
#include "SMESHGUI_HypothesesUtils.h"
|
||||
#include "SMESHGUI_MG_ADAPTDRIVER.h"
|
||||
#include "SMESHGUI_Make2DFrom3DOp.h"
|
||||
#include "SMESHGUI_MakeNodeAtPointDlg.h"
|
||||
#include "SMESHGUI_Measurements.h"
|
||||
@ -167,22 +168,22 @@
|
||||
#include <vtkRenderer.h>
|
||||
|
||||
// SALOME KERNEL includes
|
||||
#include <Basics_Utils.hxx>
|
||||
#include <SALOMEDSClient_ClientFactory.hxx>
|
||||
#include <SALOMEDSClient_IParameters.hxx>
|
||||
#include <SALOMEDSClient_SComponent.hxx>
|
||||
#include <SALOMEDSClient_StudyBuilder.hxx>
|
||||
#include <SALOMEDS_Study.hxx>
|
||||
#include <SALOMEDS_SObject.hxx>
|
||||
#include "utilities.h"
|
||||
#include <SALOMEDS_Study.hxx>
|
||||
#include <SALOME_GenericObj_wrap.hxx>
|
||||
#include <SALOME_LifeCycleCORBA.hxx>
|
||||
#include <utilities.h>
|
||||
|
||||
// OCCT includes
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <NCollection_DoubleMap.hxx>
|
||||
|
||||
#include <Basics_Utils.hxx>
|
||||
|
||||
// Below macro, when uncommented, switches on simplified (more performant) algorithm
|
||||
// of auto-color picking up
|
||||
#define SIMPLE_AUTOCOLOR
|
||||
@ -3042,6 +3043,21 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Adaptation - begin
|
||||
#ifndef DISABLE_MG_ADAPT
|
||||
case SMESHOp::OpMGAdapt:
|
||||
{
|
||||
if ( isStudyLocked() )
|
||||
break;
|
||||
EmitSignalDeactivateDialog();
|
||||
|
||||
SALOME::GenericObj_wrap< SMESH::MG_ADAPT > model = GetSMESHGen()->CreateMG_ADAPT();
|
||||
bool isCreation = false;
|
||||
( new SMESHGUI_MG_ADAPTDRIVER( this, model, isCreation ))->show();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
// Adaptation - end
|
||||
case SMESHOp::OpSplitBiQuadratic:
|
||||
case SMESHOp::OpConvertMeshToQuadratic:
|
||||
case SMESHOp::OpCreateBoundaryElements: // create 2D mesh from 3D
|
||||
@ -4279,6 +4295,12 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
createSMESHAction( SMESHOp::OpAutoColor, "AUTO_COLOR" );
|
||||
createSMESHAction( SMESHOp::OpDisableAutoColor, "DISABLE_AUTO_COLOR" );
|
||||
|
||||
// Adaptation - begin
|
||||
#ifndef DISABLE_MG_ADAPT
|
||||
createSMESHAction( SMESHOp::OpMGAdapt, "MG_ADAPT", "ICON_MG_ADAPT" );
|
||||
#endif
|
||||
// Adaptation - end
|
||||
|
||||
createSMESHAction( SMESHOp::OpMinimumDistance, "MEASURE_MIN_DIST", "ICON_MEASURE_MIN_DIST" );
|
||||
createSMESHAction( SMESHOp::OpBoundingBox, "MEASURE_BND_BOX", "ICON_MEASURE_BND_BOX" );
|
||||
createSMESHAction( SMESHOp::OpPropertiesLength, "MEASURE_LENGTH", "ICON_MEASURE_LENGTH" );
|
||||
@ -4320,6 +4342,9 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
meshId = createMenu( tr( "MEN_MESH" ), -1, 70, 10 ),
|
||||
ctrlId = createMenu( tr( "MEN_CTRL" ), -1, 60, 10 ),
|
||||
modifyId = createMenu( tr( "MEN_MODIFY" ), -1, 40, 10 ),
|
||||
#ifndef DISABLE_MG_ADAPT
|
||||
adaptId = createMenu( tr( "MEN_ADAPT" ), -1, 80, 10 ),
|
||||
#endif
|
||||
measureId = createMenu( tr( "MEN_MEASURE" ), -1, 50, 10 ),
|
||||
viewId = createMenu( tr( "MEN_VIEW" ), -1, 2 );
|
||||
|
||||
@ -4492,6 +4517,12 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
createMenu( SMESHOp::OpSmoothing, modifyId, -1 );
|
||||
createMenu( SMESHOp::OpPatternMapping, modifyId, -1 );
|
||||
|
||||
// Adaptation - begin
|
||||
#ifndef DISABLE_MG_ADAPT
|
||||
createMenu( SMESHOp::OpMGAdapt, adaptId, -1 );
|
||||
#endif
|
||||
// Adaptation - end
|
||||
|
||||
createMenu( SMESHOp::OpMinimumDistance, measureId, -1 );
|
||||
createMenu( SMESHOp::OpBoundingBox, measureId, -1 );
|
||||
createMenu( SMESHOp::OpAngle, measureId, -1 );
|
||||
@ -4506,22 +4537,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
connect( volumeMenu, SIGNAL( aboutToShow() ), this, SLOT( onUpdateControlActions() ) );
|
||||
|
||||
// ----- create toolbars --------------
|
||||
int meshTb = createTool( tr( "TB_MESH" ), QString( "SMESHMeshToolbar" ) ),
|
||||
info = createTool( tr( "TB_INFO" ), QString( "SMESHInformationToolbar" ) ),
|
||||
groupTb = createTool( tr( "TB_GROUP" ), QString( "SMESHGroupToolbar" ) ),
|
||||
ctrl0dTb = createTool( tr( "TB_CTRL0D" ), QString( "SMESHNodeControlsToolbar" ) ),
|
||||
ctrl1dTb = createTool( tr( "TB_CTRL1D" ), QString( "SMESHEdgeControlsToolbar" ) ),
|
||||
ctrl2dTb = createTool( tr( "TB_CTRL2D" ), QString( "SMESHFaceControlsToolbar" ) ),
|
||||
ctrl3dTb = createTool( tr( "TB_CTRL3D" ), QString( "SMESHVolumeControlsToolbar" ) ),
|
||||
addElemTb = createTool( tr( "TB_ADD" ), QString( "SMESHAddElementToolbar" ) ),
|
||||
addNonElemTb = createTool( tr( "TB_ADDNON" ), QString( "SMESHAddElementToolbar" ) ),
|
||||
remTb = createTool( tr( "TB_REM" ), QString( "SMESHRemoveToolbar" ) ),
|
||||
//renumbTb = createTool( tr( "TB_RENUMBER" ), QString( "SMESHRenumberingToolbar" ) ),
|
||||
transformTb = createTool( tr( "TB_TRANSFORM" ), QString( "SMESHTransformationToolbar" ) ),
|
||||
modifyTb = createTool( tr( "TB_MODIFY" ), QString( "SMESHModificationToolbar" ) ),
|
||||
measuremTb = createTool( tr( "TB_MEASUREM" ), QString( "SMESHMeasurementsToolbar" ) ),
|
||||
dispModeTb = createTool( tr( "TB_DISP_MODE" ), QString( "SMESHDisplayModeToolbar" ) );
|
||||
|
||||
int meshTb = createTool( tr( "TB_MESH" ), QString( "SMESHMeshToolbar" ) ) ;
|
||||
createTool( SMESHOp::OpCreateMesh, meshTb );
|
||||
createTool( SMESHOp::OpCreateSubMesh, meshTb );
|
||||
createTool( SMESHOp::OpEditMeshOrSubMesh, meshTb );
|
||||
@ -4533,25 +4549,30 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
createTool( SMESHOp::OpEvaluate, meshTb );
|
||||
createTool( SMESHOp::OpMeshOrder, meshTb );
|
||||
|
||||
int infoTb = createTool( tr( "TB_INFO" ), QString( "SMESHInformationToolbar" ) ) ;
|
||||
createTool( SMESHOp::OpMeshInformation, infoTb );
|
||||
//createTool( SMESHOp::OpStdInfo, meshTb );
|
||||
//createTool( SMESHOp::OpWhatIs, meshTb ); // VSR: issue #0021242 (eliminate "Mesh Element Information" command)
|
||||
createTool( SMESHOp::OpFindElementByPoint, infoTb );
|
||||
|
||||
int groupTb = createTool( tr( "TB_GROUP" ), QString( "SMESHGroupToolbar" ) ) ;
|
||||
createTool( SMESHOp::OpCreateGroup, groupTb );
|
||||
createTool( SMESHOp::OpCreateGeometryGroup, groupTb );
|
||||
createTool( SMESHOp::OpConstructGroup, groupTb );
|
||||
createTool( SMESHOp::OpEditGroup, groupTb );
|
||||
|
||||
createTool( SMESHOp::OpMeshInformation, info );
|
||||
//createTool( SMESHOp::OpStdInfo, meshTb );
|
||||
//createTool( SMESHOp::OpWhatIs, meshTb ); // VSR: issue #0021242 (eliminate "Mesh Element Information" command)
|
||||
createTool( SMESHOp::OpFindElementByPoint, info );
|
||||
|
||||
int ctrl0dTb = createTool( tr( "TB_CTRL0D" ), QString( "SMESHNodeControlsToolbar" ) ) ;
|
||||
createTool( SMESHOp::OpFreeNode, ctrl0dTb );
|
||||
createTool( SMESHOp::OpEqualNode, ctrl0dTb );
|
||||
//createTool( SMESHOp::OpNodeConnectivityNb, ctrl0dTb );
|
||||
|
||||
int ctrl1dTb = createTool( tr( "TB_CTRL1D" ), QString( "SMESHEdgeControlsToolbar" ) ) ;
|
||||
createTool( SMESHOp::OpFreeBorder, ctrl1dTb );
|
||||
createTool( SMESHOp::OpLength, ctrl1dTb );
|
||||
createTool( SMESHOp::OpConnection, ctrl1dTb );
|
||||
createTool( SMESHOp::OpEqualEdge, ctrl1dTb );
|
||||
|
||||
int ctrl2dTb = createTool( tr( "TB_CTRL2D" ), QString( "SMESHFaceControlsToolbar" ) ) ;
|
||||
createTool( SMESHOp::OpFreeEdge, ctrl2dTb );
|
||||
createTool( SMESHOp::OpFreeFace, ctrl2dTb );
|
||||
createTool( SMESHOp::OpBareBorderFace, ctrl2dTb );
|
||||
@ -4568,6 +4589,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
createTool( SMESHOp::OpEqualFace, ctrl2dTb );
|
||||
createTool( SMESHOp::OpDeflection2D, ctrl2dTb );
|
||||
|
||||
int ctrl3dTb = createTool( tr( "TB_CTRL3D" ), QString( "SMESHVolumeControlsToolbar" ) ) ;
|
||||
createTool( SMESHOp::OpAspectRatio3D, ctrl3dTb );
|
||||
createTool( SMESHOp::OpVolume, ctrl3dTb );
|
||||
createTool( SMESHOp::OpMaxElementLength3D, ctrl3dTb );
|
||||
@ -4575,6 +4597,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
createTool( SMESHOp::OpOverConstrainedVolume, ctrl3dTb );
|
||||
createTool( SMESHOp::OpEqualVolume, ctrl3dTb );
|
||||
|
||||
int addElemTb = createTool( tr( "TB_ADD" ), QString( "SMESHAddElementToolbar" ) ) ;
|
||||
createTool( SMESHOp::OpNode, addElemTb );
|
||||
createTool( SMESHOp::OpElem0D, addElemTb );
|
||||
createTool( SMESHOp::OpElem0DOnElemNodes, addElemTb );
|
||||
@ -4590,6 +4613,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
createTool( SMESHOp::OpHexagonalPrism, addElemTb );
|
||||
createTool( SMESHOp::OpPolyhedron, addElemTb );
|
||||
|
||||
int addNonElemTb = createTool( tr( "TB_ADDNON" ), QString( "SMESHAddElementToolbar" ) ) ;
|
||||
createTool( SMESHOp::OpQuadraticEdge, addNonElemTb );
|
||||
createTool( SMESHOp::OpQuadraticTriangle, addNonElemTb );
|
||||
createTool( SMESHOp::OpBiQuadraticTriangle, addNonElemTb );
|
||||
@ -4603,14 +4627,17 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
createTool( SMESHOp::OpQuadraticHexahedron, addNonElemTb );
|
||||
createTool( SMESHOp::OpTriQuadraticHexahedron, addNonElemTb );
|
||||
|
||||
int remTb = createTool( tr( "TB_REM" ), QString( "SMESHRemoveToolbar" ) ) ;
|
||||
createTool( SMESHOp::OpRemoveNodes, remTb );
|
||||
createTool( SMESHOp::OpRemoveElements, remTb );
|
||||
createTool( SMESHOp::OpRemoveOrphanNodes, remTb );
|
||||
createTool( SMESHOp::OpClearMesh, remTb );
|
||||
|
||||
// int renumbTb = createTool( tr( "TB_RENUMBER" ), QString( "SMESHRenumberingToolbar" ) ) ;
|
||||
//createTool( SMESHOp::OpRenumberingNodes, renumbTb );
|
||||
//createTool( SMESHOp::OpRenumberingElements, renumbTb );
|
||||
|
||||
int transformTb = createTool( tr( "TB_TRANSFORM" ), QString( "SMESHTransformationToolbar" ) ) ;
|
||||
createTool( SMESHOp::OpMergeNodes, transformTb );
|
||||
createTool( SMESHOp::OpMergeElements, transformTb );
|
||||
createTool( SMESHOp::OpTranslation, transformTb );
|
||||
@ -4621,6 +4648,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
createTool( SMESHOp::OpSewing, transformTb );
|
||||
createTool( SMESHOp::OpDuplicateNodes, transformTb );
|
||||
|
||||
int modifyTb = createTool( tr( "TB_MODIFY" ), QString( "SMESHModificationToolbar" ) ) ;
|
||||
createTool( SMESHOp::OpConvertMeshToQuadratic, modifyTb );
|
||||
createTool( SMESHOp::OpCreateBoundaryElements, modifyTb );
|
||||
createTool( SMESHOp::OpExtrusion, modifyTb );
|
||||
@ -4638,8 +4666,17 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
createTool( SMESHOp::OpSmoothing, modifyTb );
|
||||
createTool( SMESHOp::OpPatternMapping, modifyTb );
|
||||
|
||||
// Adaptation - begin
|
||||
#ifndef DISABLE_MG_ADAPT
|
||||
int adaptTb = createTool( tr( "TB_ADAPTATION" ), QString( "SMESHAdaptationToolbar" ) ) ;
|
||||
createTool( SMESHOp::OpMGAdapt, adaptTb );
|
||||
#endif
|
||||
// Adaptation - end
|
||||
|
||||
int measuremTb = createTool( tr( "TB_MEASUREM" ), QString( "SMESHMeasurementsToolbar" ) ) ;
|
||||
createTool( SMESHOp::OpMinimumDistance, measuremTb );
|
||||
|
||||
int dispModeTb = createTool( tr( "TB_DISP_MODE" ), QString( "SMESHDisplayModeToolbar" ) );
|
||||
createTool( SMESHOp::OpUpdate, dispModeTb );
|
||||
|
||||
QString lc = "$"; // VSR : instead of QtxPopupSelection::defEquality();
|
||||
@ -4715,9 +4752,14 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
popupMgr()->insert( separator(), -1, 0 );
|
||||
createPopupItem( SMESHOp::OpConvertMeshToQuadratic, OB, mesh_submesh, "&& " + hasElems );
|
||||
createPopupItem( SMESHOp::OpCreateBoundaryElements, OB, mesh_group, "&& selcount=1 && dim>=2");
|
||||
//popupMgr()->insert( separator(), -1, 0 );
|
||||
|
||||
//popupMgr()->insert( separator(), -1, 0 );
|
||||
// Adaptation - begin
|
||||
#ifndef DISABLE_MG_ADAPT
|
||||
popupMgr()->insert( separator(), -1, 0 );
|
||||
createPopupItem( SMESHOp::OpMGAdapt, OB, mesh );
|
||||
popupMgr()->insert( separator(), -1, 0 );
|
||||
#endif
|
||||
// Adaptation - end
|
||||
|
||||
QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc );
|
||||
QString multiple_non_empty = QString( " && %1>0 && numberOfNodes>0" ).arg( dc );
|
||||
@ -5751,6 +5793,30 @@ void SMESHGUI::createPreferences()
|
||||
setPreferenceProperty( coloringType, "indexes", indices );
|
||||
addPreference( tr( "SMESH_DISTRIBUTION_COLOR" ), distributionGr, LightApp_Preferences::Color, "SMESH", "distribution_color" );
|
||||
|
||||
// Adaptation - begin
|
||||
#ifndef DISABLE_MG_ADAPT
|
||||
// Adaptation tab ------------------------------------------------------------------------
|
||||
int adaptTab = addPreference( tr( "ADAPT_PREF_TAB_GENERAL" ) );
|
||||
int bloc, pref ;
|
||||
// MG-Adapt
|
||||
bloc = addPreference( tr( "ADAPT_PREF_MG_ADAPT" ), adaptTab );
|
||||
setPreferenceProperty( bloc, "columns", 1 );
|
||||
pref = addPreference( tr( "ADAPT_PREF_MG_ADAPT_FILE_MAILLAGE_OUT" ), bloc, LightApp_Preferences::Bool, "HOMARD", "mg_adapt_file_mesh_out" );
|
||||
pref = addPreference( tr( "ADAPT_PREF_MG_ADAPT_PUBLICATION_MAILLAGE_OUT" ), bloc, LightApp_Preferences::Bool, "HOMARD", "mg_adapt_publish_mesh_out" );
|
||||
pref = addPreference( tr( "ADAPT_PREF_MG_ADAPT_SIZE_MAP" ), bloc, LightApp_Preferences::Selector, "HOMARD", "mg_adapt_size_map" );
|
||||
QStringList aListOfSizeMap;
|
||||
aListOfSizeMap << tr( "ADAPT_PREF_MG_ADAPT_SIZE_MAP_LOCAL" );
|
||||
aListOfSizeMap << tr( "ADAPT_PREF_MG_ADAPT_SIZE_MAP_BACKGROUND" );
|
||||
aListOfSizeMap << tr( "ADAPT_PREF_NONE" );;
|
||||
setPreferenceProperty( pref, "strings", aListOfSizeMap );
|
||||
pref = addPreference( tr( "ADAPT_PREF_MG_ADAPT_TIME_STEP" ), bloc, LightApp_Preferences::Selector, "HOMARD", "mg_adapt_time_step" );
|
||||
QStringList aListOfTimeStep;
|
||||
aListOfTimeStep << tr( "ADAPT_PREF_NONE" );
|
||||
aListOfTimeStep << tr( "ADAPT_PREF_MG_ADAPT_TIME_STEP_LAST" );
|
||||
aListOfTimeStep << tr( "ADAPT_PREF_MG_ADAPT_TIME_STEP_C" );;
|
||||
setPreferenceProperty( pref, "strings", aListOfTimeStep );
|
||||
#endif
|
||||
// Adaptation - end
|
||||
}
|
||||
|
||||
void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
|
||||
|
428
src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.cxx
Normal file
428
src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.cxx
Normal file
@ -0,0 +1,428 @@
|
||||
// Copyright (C) 2020-2021 CEA/DEN, EDF R&D
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include "SMESHGUI_MG_ADAPTDRIVER.h"
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_VTKUtils.h"
|
||||
#include "SMESHGUI_MeshUtils.h"
|
||||
#include "SMESH_TryCatch.hxx"
|
||||
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
#include <SUIT_Application.h>
|
||||
#include <SUIT_Desktop.h>
|
||||
#include <SUIT_MessageBox.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SVTK_ViewWindow.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QRadioButton>
|
||||
#include <QKeyEvent>
|
||||
|
||||
// SALOME KERNEL includes
|
||||
|
||||
const int SPACING = 6; // layout spacing
|
||||
const int MARGIN = 9; // layout margin
|
||||
|
||||
// bool createMgAdaptObject(MgAdapt *myMgAdapt )
|
||||
// {
|
||||
// // SMESH::SMESH_Mesh_var newMesh = SMESHGUI::GetSMESHGen()->CreateEmptyMesh();
|
||||
|
||||
// // _PTR(SObject) aHypothesis;
|
||||
// _PTR(Study) aStudy = SMESH::getStudy();
|
||||
// QStringList anEntryList;
|
||||
// _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
|
||||
// _PTR(SComponent) mgadapt = aStudy->FindComponent("MG-ADAPT");
|
||||
// _PTR(GenericAttribute) ga;
|
||||
// if (!aBuilder->FindAttribute(mgadapt, ga, "AttributeName") )
|
||||
// {
|
||||
// mgadapt = aBuilder->NewComponent("MG-ADAPT");
|
||||
// _PTR(AttributeName) Name = aBuilder->FindOrCreateAttribute(mgadapt, "AttributeName");
|
||||
// Name->SetValue("MG-ADAPT");
|
||||
// _PTR(AttributePixMap) myPixmap = aBuilder->FindOrCreateAttribute( mgadapt, "AttributePixMap" );
|
||||
// myPixmap->SetPixMap( "ICON_MG_ADAPT" );
|
||||
// anEntryList.append( mgadapt->GetID().c_str() );
|
||||
// }
|
||||
|
||||
// _PTR(SObject) obj = aBuilder->NewObject(mgadapt);
|
||||
// _PTR(AttributeName) myName = aBuilder->FindOrCreateAttribute(obj, "AttributeName");
|
||||
// myName->SetValue("hypo");
|
||||
// _PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( obj, "AttributePixMap" );
|
||||
// aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO" );
|
||||
// anEntryList.append( obj->GetID().c_str() );
|
||||
|
||||
// SMESHGUI::GetSMESHGUI()->updateObjBrowser();
|
||||
|
||||
// // // browse to the published meshes
|
||||
// if( LightApp_Application* anApp =
|
||||
// dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
|
||||
// anApp->browseObjects( anEntryList );
|
||||
// return true;
|
||||
// }
|
||||
|
||||
|
||||
SMESHGUI_MG_ADAPTDRIVER::SMESHGUI_MG_ADAPTDRIVER( SMESHGUI* theModule, SMESH::MG_ADAPT_ptr myModel, bool isCreation )
|
||||
: SMESHGUI_MgAdaptDlg((SalomeApp_Module*)theModule, myModel, SMESHGUI::desktop(), isCreation),
|
||||
mySMESHGUI( theModule ),
|
||||
myIsApplyAndClose( false )
|
||||
{
|
||||
|
||||
//resMgr = mySMESHGUI->resourceMgr();
|
||||
|
||||
selMgr = selectionMgr();
|
||||
|
||||
// connections
|
||||
connect(myArgs, SIGNAL(updateSelection()), this, SLOT(updateSelection()));
|
||||
connect(myArgs, SIGNAL(toExportMED(const char*)), this, SLOT(exportMED(const char*)));
|
||||
}
|
||||
|
||||
// SUIT_ResourceMgr* SMESHGUI_MG_ADAPTDRIVER::resourceMgr()
|
||||
// {
|
||||
// return dynamic_cast<SUIT_ResourceMgr*>( SUIT_Session::session()->resourceMgr() );
|
||||
// }
|
||||
|
||||
LightApp_SelectionMgr* SMESHGUI_MG_ADAPTDRIVER::selectionMgr()
|
||||
{
|
||||
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
|
||||
if( anApp )
|
||||
return dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() );
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SMESHGUI_MG_ADAPTDRIVER::updateSelection()
|
||||
{
|
||||
disconnect( selMgr, 0, this, 0 );
|
||||
selMgr->clearFilters();
|
||||
|
||||
SMESH::SetPointRepresentation( false );
|
||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
|
||||
aViewWindow->SetSelectionMode( ActorSelection );
|
||||
if (myArgs->aBrowser->isChecked())
|
||||
{
|
||||
connect( selMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ));
|
||||
selectionChanged();
|
||||
}
|
||||
|
||||
}
|
||||
void SMESHGUI_MG_ADAPTDRIVER::selectionChanged()
|
||||
{
|
||||
//~ get selected mesh
|
||||
SALOME_ListIO aList;
|
||||
selMgr->selectedObjects(aList);
|
||||
QString aString = "";
|
||||
int nbSel = aList.Extent();
|
||||
if (nbSel != 1)
|
||||
return;
|
||||
|
||||
Handle(SALOME_InteractiveObject) IO = aList.First();
|
||||
SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(IO);
|
||||
if ( !mesh->_is_nil() )
|
||||
{
|
||||
myMesh = mesh;
|
||||
|
||||
SMESH::SMESH_IDSource_var sSelectedObj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
|
||||
if ( sSelectedObj->_is_nil() )
|
||||
return;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
SMESH::GetNameOfSelectedIObjects( selMgr, aString );
|
||||
if ( aString.isEmpty() ) aString = " ";
|
||||
else aString = aString.trimmed();
|
||||
|
||||
|
||||
//bool ok = !aString.isEmpty();
|
||||
if ( !mesh->_is_nil() )
|
||||
{
|
||||
myArgs->aBrowserObject->setText( aString );
|
||||
myArgs->meshNameLineEdit->setText( aString );
|
||||
myArgs->selectOutMedFileLineEdit->setText(aString+QString(".med"));
|
||||
ADAPTATION_MODE aMode;
|
||||
int nbVolumes = myMesh->NbVolumes();
|
||||
int nbFaces = myMesh->NbFaces();
|
||||
if(nbFaces > 0 && nbVolumes > 0) aMode = ADAPTATION_MODE::BOTH;
|
||||
else if(nbFaces > 0) aMode = ADAPTATION_MODE::SURFACE;
|
||||
else aMode = ADAPTATION_MODE::VOLUME;
|
||||
emit myArgs->meshDimSignal(aMode);
|
||||
}
|
||||
|
||||
}
|
||||
void SMESHGUI_MG_ADAPTDRIVER::exportMED(const char* tmp_file)
|
||||
{
|
||||
bool toOverwrite = true;
|
||||
bool toFindOutDim = true;
|
||||
myMesh->ExportMED(tmp_file, false, -1, toOverwrite, toFindOutDim);
|
||||
}
|
||||
void SMESHGUI_MG_ADAPTDRIVER::setMyMesh(SMESH::SMESH_Mesh_var mesh)
|
||||
{
|
||||
myMesh = mesh;
|
||||
}
|
||||
SMESH::SMESH_Mesh_var SMESHGUI_MG_ADAPTDRIVER::getMyMesh()
|
||||
{
|
||||
return myMesh;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : PushOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_MG_ADAPTDRIVER::PushOnOK()
|
||||
{
|
||||
setIsApplyAndClose( true );
|
||||
bool ret = PushOnApply();
|
||||
// std::cout << "SMESHGUI_MG_ADAPTDRIVER::PushOnOK ret : " <<ret<<std::endl;
|
||||
if ( ret ) reject();
|
||||
}
|
||||
|
||||
bool SMESHGUI_MG_ADAPTDRIVER::PushOnApply()
|
||||
{
|
||||
if ( SMESHGUI::isStudyLocked() )
|
||||
return false;
|
||||
if( !isValid() )
|
||||
return false;
|
||||
|
||||
bool ok = SMESHGUI_MgAdaptDlg::PushOnApply();
|
||||
// std::cout << "SMESHGUI_MG_ADAPTDRIVER::PushOnApply ok 1 : " <<ok<<std::endl;
|
||||
|
||||
if ( ok )
|
||||
{
|
||||
ok = execute();
|
||||
if (getModel()->getPublish()) this->createMeshInObjectBrowser();
|
||||
// std::cout << "SMESHGUI_MG_ADAPTDRIVER::PushOnApply ok 2 : " <<ok<<std::endl;
|
||||
if ( ok )
|
||||
{
|
||||
QMessageBox::information( 0, QObject::tr(""),
|
||||
QObject::tr("MG_ADAPT_DIAG_1") );
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical( 0, QObject::tr("MG_ADAPT_ERROR"),
|
||||
QObject::tr("MG_ADAPT_DIAG_2") );
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
// macro used to initialize errStr by exception description
|
||||
// returned by SMESH_CATCH( SMESH::returnError )
|
||||
#undef SMESH_CAUGHT
|
||||
#define SMESH_CAUGHT errStr =
|
||||
|
||||
#undef SMY_OWN_CATCH
|
||||
#define SMY_OWN_CATCH catch ( SALOME::SALOME_Exception & e ) { errStr = e.details.text; }
|
||||
|
||||
bool SMESHGUI_MG_ADAPTDRIVER::execute()
|
||||
{
|
||||
int err = 1;
|
||||
std::string errStr;
|
||||
SMESH_TRY;
|
||||
{
|
||||
getModel()->compute();
|
||||
err = 0;
|
||||
errStr = SMESH::toStdStr( getModel()->getErrMsg() );
|
||||
}
|
||||
SMESH_CATCH( SMESH::returnError );
|
||||
|
||||
std::string msg = " ok";
|
||||
if ( !errStr.empty() || err != 0 )
|
||||
{
|
||||
msg = "Not ok \n" + errStr + "\n";
|
||||
std::cerr << msg;
|
||||
err = 1;
|
||||
}
|
||||
return err == 0;
|
||||
}
|
||||
#undef SMESH_CAUGHT
|
||||
#define SMESH_CAUGHT
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_MG_ADAPTDRIVER::enterEvent (QEvent*)
|
||||
{
|
||||
|
||||
// if ( !ConstructorsBox->isEnabled() ) {
|
||||
// SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
|
||||
// if ( aViewWindow && !mySelector ) {
|
||||
// mySelector = aViewWindow->GetSelector();
|
||||
// }
|
||||
// activateThisDialog();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : keyPressEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_MG_ADAPTDRIVER::keyPressEvent( QKeyEvent* e )
|
||||
{
|
||||
|
||||
QDialog::keyPressEvent( e );
|
||||
if ( e->isAccepted() )
|
||||
return;
|
||||
|
||||
if ( e->key() == Qt::Key_F1 )
|
||||
{
|
||||
e->accept();
|
||||
PushOnHelp();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : PushOnHelp()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_MG_ADAPTDRIVER::PushOnHelp()
|
||||
{
|
||||
|
||||
QString aHelpFile = "adaptation.html#_mg_adapt_anchor";
|
||||
|
||||
SMESH::ShowHelpFile( aHelpFile );
|
||||
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
|
||||
bool SMESHGUI_MG_ADAPTDRIVER::isValid()
|
||||
{
|
||||
bool ok = true;
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool SMESHGUI_MG_ADAPTDRIVER::createMeshInObjectBrowser()
|
||||
{
|
||||
QString filename( SMESH::toQStr( getModel()->getMedFileOut() ));
|
||||
QStringList errors;
|
||||
QStringList anEntryList;
|
||||
bool isEmpty = false;
|
||||
// bool ok = false;
|
||||
SMESH::SMESH_Gen_var SMESH_Gen_ptr = SMESHGUI::GetSMESHGen();
|
||||
if ( SMESH_Gen_ptr->_is_nil() ) {
|
||||
QMessageBox::critical( 0, QObject::tr("MG_ADAPT_ERROR"),
|
||||
QObject::tr("Could not retrieve SMESH_Gen_ptr") );
|
||||
return false;
|
||||
}
|
||||
SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
|
||||
aMeshes->length( 1 ); // one mesh only
|
||||
SMESH::DriverMED_ReadStatus res;
|
||||
aMeshes = SMESH_Gen_ptr->CreateMeshesFromMED( filename.toUtf8().constData(), res );
|
||||
if ( res != SMESH::DRS_OK ) {
|
||||
errors.append( QString( "%1 :\n\t%2" ).arg( filename ).arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res ).toLatin1().data() ) ) );
|
||||
}
|
||||
_PTR(Study) aStudy = SMESH::getStudy();
|
||||
for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ )
|
||||
{
|
||||
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] );
|
||||
if ( aMeshSO )
|
||||
{
|
||||
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
|
||||
_PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
|
||||
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" ); // put REFINED mesh ico
|
||||
anEntryList.append( aMeshSO->GetID().c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
isEmpty = true;
|
||||
}
|
||||
}
|
||||
// update Object browser
|
||||
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
|
||||
// browse to the published meshes
|
||||
if( LightApp_Application* anApp =
|
||||
dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
|
||||
anApp->browseObjects( anEntryList );
|
||||
|
||||
// show Error message box if there were errors
|
||||
if ( errors.count() > 0 ) {
|
||||
SUIT_MessageBox::critical( SMESHGUI::desktop(),
|
||||
QObject::tr( "SMESH_ERROR" ),
|
||||
QObject::tr( "SMESH_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
|
||||
}
|
||||
|
||||
// show warning message box, if some imported mesh is empty
|
||||
if ( isEmpty ) {
|
||||
SUIT_MessageBox::warning( SMESHGUI::desktop(),
|
||||
QObject::tr( "SMESH_WRN_WARNING" ),
|
||||
QObject::tr( "SMESH_DRS_SOME_EMPTY" ) );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// function : setIsApplyAndClose
|
||||
// Purpose : Set value of the flag indicating that the dialog is
|
||||
// accepted by Apply & Close button
|
||||
//================================================================
|
||||
void SMESHGUI_MG_ADAPTDRIVER::setIsApplyAndClose( const bool theFlag )
|
||||
{
|
||||
myIsApplyAndClose = theFlag;
|
||||
}
|
||||
//================================================================
|
||||
// function : isApplyAndClose
|
||||
// Purpose : Get value of the flag indicating that the dialog is
|
||||
// accepted by Apply & Close button
|
||||
//================================================================
|
||||
bool SMESHGUI_MG_ADAPTDRIVER::isApplyAndClose() const
|
||||
{
|
||||
return myIsApplyAndClose;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : DeactivateActiveDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_MG_ADAPTDRIVER::deactivateActiveDialog()
|
||||
{
|
||||
// if (isEnabled())
|
||||
// {
|
||||
// mySMESHGUI->ResetState();
|
||||
// mySMESHGUI->SetActiveDialogBox(0);
|
||||
// setEnabled( false );
|
||||
// }
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_MG_ADAPTDRIVER::activateThisDialog()
|
||||
{
|
||||
|
||||
/* Emit a signal to deactivate the active dialog */
|
||||
// mySMESHGUI->EmitSignalDeactivateDialog();
|
||||
// ConstructorsBox->setEnabled(true);
|
||||
// GroupArguments->setEnabled(true);
|
||||
// GroupButtons->setEnabled(true);
|
||||
|
||||
// mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||
|
||||
// onSelectIdSource( myIdSourceCheck->isChecked() );
|
||||
|
||||
// SelectionIntoArgument();
|
||||
}
|
90
src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.h
Normal file
90
src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.h
Normal file
@ -0,0 +1,90 @@
|
||||
// Copyright (C) 2020-2021 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
|
||||
//
|
||||
|
||||
#ifndef SMESHGUI_MG_ADAPTDRIVER_H
|
||||
#define SMESHGUI_MG_ADAPTDRIVER_H
|
||||
|
||||
#include "SMESH_SMESHGUI.hxx"
|
||||
|
||||
// model
|
||||
#include "SMESHGUI_MgAdaptDlg.h"
|
||||
|
||||
// IDL includes
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
#include CORBA_SERVER_HEADER(MG_ADAPT)
|
||||
|
||||
class SMESHGUI;
|
||||
class LightApp_SelectionMgr;
|
||||
//class MgAdapt;
|
||||
|
||||
// int IObjectCount();
|
||||
// const SALOME_ListIO& selectedIO();
|
||||
// _PTR(Study) getStudy();
|
||||
// Handle(SALOME_InteractiveObject) firstIObject();
|
||||
// bool createAndPublishMed(QString fileName);
|
||||
// bool createMgAdaptObject(MgAdapt* myMgAdapt = 0);
|
||||
|
||||
|
||||
class SMESHGUI_MG_ADAPTDRIVER : public SMESHGUI_MgAdaptDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public :
|
||||
SMESHGUI_MG_ADAPTDRIVER( SMESHGUI*, SMESH::MG_ADAPT_ptr, bool isCreation = true );
|
||||
void setMyMesh(SMESH::SMESH_Mesh_var);
|
||||
SMESH::SMESH_Mesh_var getMyMesh() ;
|
||||
|
||||
private :
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
LightApp_SelectionMgr* selMgr ;
|
||||
LightApp_SelectionMgr* selectionMgr();
|
||||
SMESH::SMESH_Mesh_var myMesh ;
|
||||
bool myIsApplyAndClose;
|
||||
|
||||
void enterEvent( QEvent* ); /* mouse enter the QWidget */
|
||||
void keyPressEvent( QKeyEvent* );
|
||||
|
||||
bool isValid();
|
||||
bool createMeshInObjectBrowser();
|
||||
void setIsApplyAndClose( const bool theFlag );
|
||||
bool isApplyAndClose() const;
|
||||
bool execute();
|
||||
|
||||
|
||||
private slots:
|
||||
void selectionChanged();
|
||||
void updateSelection();
|
||||
|
||||
protected slots :
|
||||
|
||||
private slots:
|
||||
|
||||
void exportMED(const char* );
|
||||
|
||||
virtual bool PushOnApply();
|
||||
virtual void PushOnOK();
|
||||
virtual void PushOnHelp();
|
||||
|
||||
void deactivateActiveDialog();
|
||||
void activateThisDialog();
|
||||
};
|
||||
|
||||
#endif // SMESHGUI_MG_ADAPTDRIVER_H
|
1338
src/SMESHGUI/SMESHGUI_MgAdaptDlg.cxx
Normal file
1338
src/SMESHGUI/SMESHGUI_MgAdaptDlg.cxx
Normal file
File diff suppressed because it is too large
Load Diff
279
src/SMESHGUI/SMESHGUI_MgAdaptDlg.h
Normal file
279
src/SMESHGUI/SMESHGUI_MgAdaptDlg.h
Normal file
@ -0,0 +1,279 @@
|
||||
// Copyright (C) 2020-2021 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
|
||||
//
|
||||
|
||||
#ifndef MG_ADAPTGUI_HXX
|
||||
#define MG_ADAPTGUI_HXX
|
||||
|
||||
// Qt includes
|
||||
#include <QDialog>
|
||||
#include <QTreeWidget>
|
||||
#include <QItemDelegate>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(MG_ADAPT)
|
||||
#include <SALOME_GenericObj_wrap.hxx>
|
||||
|
||||
class SalomeApp_Module;
|
||||
|
||||
class QButtonGroup;
|
||||
class QLineEdit;
|
||||
class QGroupBox;
|
||||
class QRadioButton;
|
||||
class QLabel;
|
||||
class QCheckBox;
|
||||
class QGridLayout;
|
||||
class QTabWidget;
|
||||
class QDoubleSpinBox;
|
||||
class QSpacerItem;
|
||||
class QSpinBox;
|
||||
class QTreeWidgetItem;
|
||||
class QHBoxLayout;
|
||||
class QComboBox;
|
||||
|
||||
class SMESHGUI_MgAdaptArguments;
|
||||
class MgAdaptAdvWidgetTreeWidget;
|
||||
class MgAdaptAdvWidget;
|
||||
|
||||
enum ADAPTATION_MODE{
|
||||
SURFACE,
|
||||
VOLUME,
|
||||
BOTH
|
||||
};
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_MgAdaptDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_MgAdaptDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
//! Property type
|
||||
enum Mode { Arguments, AdvancedOptions};
|
||||
SMESHGUI_MgAdaptDlg( SalomeApp_Module*, SMESH::MG_ADAPT_ptr, QWidget* parent= 0,bool isCreation = true );
|
||||
~SMESHGUI_MgAdaptDlg();
|
||||
|
||||
void buildDlg();
|
||||
void reject();
|
||||
bool checkParams(QString& msg) ;
|
||||
//~void setModel(MgAdapt*);
|
||||
SMESH::MG_ADAPT_ptr getModel() const;
|
||||
|
||||
public slots:
|
||||
|
||||
protected slots:
|
||||
virtual bool PushOnApply();
|
||||
|
||||
private slots:
|
||||
virtual void PushOnHelp();
|
||||
virtual void PushOnOK();
|
||||
|
||||
protected :
|
||||
|
||||
SMESHGUI_MgAdaptArguments* myArgs;
|
||||
MgAdaptAdvWidget* myAdvOpt;
|
||||
|
||||
bool readParamsFromHypo( ) const ;
|
||||
bool readParamsFromWidgets( ) ;
|
||||
bool storeParamsToHypo( const SMESH::MgAdaptHypothesisData & ) const;
|
||||
|
||||
private:
|
||||
|
||||
SalomeApp_Module* mySMESHGUI;
|
||||
QTabWidget* myTabWidget;
|
||||
|
||||
SMESH::MgAdaptHypothesisData_var myData;
|
||||
SALOME::GenericObj_wrap< SMESH::MG_ADAPT > model;
|
||||
|
||||
};
|
||||
|
||||
class SMESHGUI_MgAdaptArguments : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
//! Property type
|
||||
enum Mode { Mesh, Browser};
|
||||
enum SIZEMAP { Local, Background, Constant};
|
||||
SMESHGUI_MgAdaptArguments( QWidget* parent);
|
||||
~SMESHGUI_MgAdaptArguments();
|
||||
void setMode( const Mode, const SIZEMAP );
|
||||
|
||||
QString myFileInDir;
|
||||
QString myFileOutDir;
|
||||
QString myFileSizeMapDir;
|
||||
QGroupBox* aMeshIn ;
|
||||
QRadioButton* aMedfile;
|
||||
QRadioButton* aBrowser ;
|
||||
QLineEdit* aBrowserObject;
|
||||
QPushButton* selectMedFilebutton ;
|
||||
QSpacerItem* hspacer;
|
||||
QLineEdit* selectMedFileLineEdit ;
|
||||
QButtonGroup* meshInGroup ;
|
||||
QGridLayout* meshIn ;
|
||||
|
||||
QGroupBox* aMeshOut ;
|
||||
QLabel* meshName;
|
||||
QLineEdit* meshNameLineEdit;
|
||||
QSpacerItem* secondHspacer;
|
||||
QCheckBox* medFileCheckBox;
|
||||
QPushButton* selectOutMedFilebutton;
|
||||
QLineEdit* selectOutMedFileLineEdit;
|
||||
QSpacerItem* thirdHspacer;
|
||||
QCheckBox* publishOut;
|
||||
QGridLayout* meshOut ;
|
||||
|
||||
QGroupBox* sizeMapDefinition ;
|
||||
QRadioButton* localButton;
|
||||
QRadioButton* backgroundButton ;
|
||||
QRadioButton* constantButton ;
|
||||
QLabel* medFileBackground;
|
||||
QPushButton* selectMedFileBackgroundbutton;
|
||||
QLineEdit* selectMedFileBackgroundLineEdit;
|
||||
QLabel* valueLabel;
|
||||
QDoubleSpinBox* dvalue;
|
||||
QButtonGroup* sizeMapDefGroup ;
|
||||
QGridLayout* sizeMapDefGroupLayout;
|
||||
|
||||
|
||||
QGroupBox* sizeMapField;
|
||||
QLabel* fieldName;
|
||||
QComboBox* fieldNameCmb;
|
||||
QRadioButton* noTimeStep;
|
||||
QRadioButton* lastTimeStep ;
|
||||
QRadioButton* chosenTimeStep;
|
||||
QLabel* timeStepLabel;
|
||||
QSpinBox* timeStep;
|
||||
QLabel* rankLabel;
|
||||
QSpinBox* rankSpinBox;
|
||||
QButtonGroup* timeStepGroup;
|
||||
QGridLayout* sizeMapFieldGroupLayout;
|
||||
|
||||
signals:
|
||||
void updateSelection();
|
||||
void toExportMED(const char *);
|
||||
void meshDimSignal(ADAPTATION_MODE aMode);
|
||||
public slots:
|
||||
|
||||
protected slots:
|
||||
|
||||
private slots:
|
||||
void modeChanged( int);
|
||||
void sizeMapDefChanged(int);
|
||||
void timeStepGroupChanged(int timeStepType, bool disableOther = false, int vmax = 0);
|
||||
void onSelectMedFilebuttonClicked();
|
||||
void clear();
|
||||
void onMedFileCheckBox(int);
|
||||
void onPublishOut(int);
|
||||
void onSelectOutMedFilebutton();
|
||||
void onSelectMedFileBackgroundbutton();
|
||||
void onLocalSelected(QString);
|
||||
void onNoTimeStep(bool disableOther = false);
|
||||
void onLastTimeStep(bool disableOther = false);
|
||||
void onChosenTimeStep(bool disableOther = false, int vmax = 0);
|
||||
void visibleTimeStepRankLabel(bool visible);
|
||||
void valueAdaptation ();
|
||||
|
||||
private:
|
||||
|
||||
QString getMedFileName(bool avertir);
|
||||
int meshDim;
|
||||
int meshDimBG;
|
||||
std::map<QString, int> myFieldList;
|
||||
|
||||
};
|
||||
enum {
|
||||
OPTION_ID_COLUMN = 0,
|
||||
OPTION_TYPE_COLUMN,
|
||||
OPTION_NAME_COLUMN = 0,
|
||||
OPTION_VALUE_COLUMN,
|
||||
NB_COLUMNS,
|
||||
};
|
||||
|
||||
//////////////////////////////////////////
|
||||
// MgAdaptAdvWidget
|
||||
//////////////////////////////////////////
|
||||
class MgAdaptAdvWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MgAdaptAdvWidget( QWidget* = 0, std::vector <std::string> * = nullptr, Qt::WindowFlags = 0 );
|
||||
~MgAdaptAdvWidget();
|
||||
std::vector < std::string > *myOptions;
|
||||
QGridLayout *gridLayout_4;
|
||||
MgAdaptAdvWidgetTreeWidget *myOptionTable;
|
||||
QPushButton *addBtn;
|
||||
QSpacerItem *horizontalSpacer;
|
||||
QGroupBox *logGroupBox;
|
||||
QGridLayout *gridLayout_2;
|
||||
QGridLayout *gridLayout;
|
||||
QLabel *workingDirectoryLabel;
|
||||
QLineEdit *workingDirectoryLineEdit;
|
||||
QPushButton *workingDirectoryPushButton;
|
||||
QLabel *verboseLevelLabel;
|
||||
QSpinBox *verboseLevelSpin;
|
||||
QHBoxLayout *horizontalLayout;
|
||||
QCheckBox *logInFileCheck;
|
||||
QCheckBox *removeLogOnSuccessCheck;
|
||||
QCheckBox *keepWorkingFilesCheck;
|
||||
|
||||
void AddOption( const char* name_value_type, bool isCustom = false );
|
||||
void GetOptionAndValue( QTreeWidgetItem * tblRow, QString& option, QString& value, bool& dflt );
|
||||
void setupWidget();
|
||||
|
||||
public slots:
|
||||
void onAddOption();
|
||||
void itemChanged(QTreeWidgetItem * tblRow, int column);
|
||||
void onMeshDimChanged(ADAPTATION_MODE aMode);
|
||||
private slots:
|
||||
void _onWorkingDirectoryPushButton();
|
||||
private:
|
||||
void setOptionValue(QString& option, QString& value);
|
||||
std::map<QString, QTreeWidgetItem *> optionTreeWidgetItem;
|
||||
|
||||
QTreeWidgetItem* getNewQTreeWidgetItem(QTreeWidget* table, const char* option, QString& name, bool isCustom);
|
||||
|
||||
};
|
||||
|
||||
enum { EDITABLE_ROLE = Qt::UserRole + 1, PARAM_NAME,
|
||||
NAME_COL = 0, VALUE_COL
|
||||
};
|
||||
|
||||
class ItemDelegate: public QItemDelegate
|
||||
{
|
||||
public:
|
||||
|
||||
ItemDelegate(QObject* parent=0): QItemDelegate(parent) {}
|
||||
QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &o, const QModelIndex &index) const;
|
||||
};
|
||||
|
||||
class MgAdaptAdvWidgetTreeWidget : public QTreeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MgAdaptAdvWidgetTreeWidget( QWidget* );
|
||||
|
||||
protected:
|
||||
QModelIndex moveCursor( CursorAction, Qt::KeyboardModifiers );
|
||||
void keyPressEvent( QKeyEvent* );
|
||||
};
|
||||
|
||||
#endif // MG_ADAPTGUI_HXX
|
@ -186,6 +186,8 @@ namespace SMESHOp {
|
||||
OpConvertMeshToQuadratic = 4513, // MENU MODIFICATION - CONVERT TO/FROM QUADRATIC
|
||||
OpCreateBoundaryElements = 4514, // MENU MODIFICATION - CREATE BOUNDARY ELEMENTS
|
||||
OpSplitBiQuadratic = 4515, // MENU MODIFICATION - SPLIT BI-QUADRATIC TO LINEAR
|
||||
// Adaptation ---------------------//--------------------------------
|
||||
OpMGAdapt = 8020, // MENU ADAPTATION - MG-ADAPT
|
||||
// Measurements -------------------//--------------------------------
|
||||
OpPropertiesLength = 5000, // MENU MEASUREMENTS - BASIC PROPERTIES - LENGTH
|
||||
OpPropertiesArea = 5001, // MENU MEASUREMENTS - BASIC PROPERTIES - AREA
|
||||
|
@ -83,6 +83,10 @@
|
||||
<source>ICON_CREATE_GEO_GROUP</source>
|
||||
<translation>mesh_groups_from_gemetry.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_MG_ADAPT</source>
|
||||
<translation>adapt_mg_adapt.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_CONV_TO_QUAD</source>
|
||||
<translation>mesh_conv_to_quad.png</translation>
|
||||
|
@ -340,6 +340,126 @@
|
||||
<source>MEN_CONSTRUCT_GROUP</source>
|
||||
<translation>Construct Group</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_MG_ADAPT</source>
|
||||
<translation>Remesh with MG_Adapt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Args</source>
|
||||
<translation>Arguments</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MeshOut</source>
|
||||
<translation>Mesh Out</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MeshIn</source>
|
||||
<translation>Mesh In</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEDFile</source>
|
||||
<translation>MED file</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Browser</source>
|
||||
<translation>Browser</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Publish_MG_ADAPT</source>
|
||||
<translation>Publish</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SIZE_MAP_FIELD</source>
|
||||
<translation>Size map field</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_FIELD_NAME</source>
|
||||
<translation>Field Name</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_MED_FILE_1</source>
|
||||
<translation>This MED file cannot be read.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_MED_FILE_2</source>
|
||||
<translation>No mesh in this MED file.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_MED_FILE_3</source>
|
||||
<translation>More than one mesh in this MED file.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_MED_FILE_4</source>
|
||||
<translation>The mesh in this MED file cannot be read.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_MED_FILE_5</source>
|
||||
<translation>No field in this MED file.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_ERROR</source>
|
||||
<translation>Error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_CH_ST</source>
|
||||
<translation>Chosen time step</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_RANK</source>
|
||||
<translation>Rank</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_TSTP</source>
|
||||
<translation>Time step </translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_NO_T_ST</source>
|
||||
<translation>No time step</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_L_ST</source>
|
||||
<translation>Last time step</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MeshName</source>
|
||||
<translation>Mesh name</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>LOCAL_MG_ADAPT</source>
|
||||
<translation>Local</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BACKGRND_MG_ADAPT</source>
|
||||
<translation>Background</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CNST_MG_ADAPT</source>
|
||||
<translation>Constant</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MED_FILE_BCKG</source>
|
||||
<translation>MED file background size map</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>VALUE_MG_ADAPT</source>
|
||||
<translation>Value</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SIZE_MAP_DEF</source>
|
||||
<translation>Size map definition</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADVOP</source>
|
||||
<translation>Advanced Options</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_DIAG_1</source>
|
||||
<translation>Adaptation succeeded.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_DIAG_2</source>
|
||||
<translation>Adaptation failed.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_CONV_TO_QUAD</source>
|
||||
<translation>Convert to/from quadratic</translation>
|
||||
@ -788,6 +908,10 @@
|
||||
<source>MEN_MODIFY</source>
|
||||
<translation>Modification</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_ADAPT</source>
|
||||
<translation>Adaptation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_MEASURE</source>
|
||||
<translation>Measurements</translation>
|
||||
@ -1502,6 +1626,10 @@ Please enter correct values and try again</translation>
|
||||
<source>SMESH_AVAILABLE</source>
|
||||
<translation>Available</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_NOT_AVAILABLE</source>
|
||||
<translation>Not available</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_AVAILABLE_ALGORITHMS</source>
|
||||
<translation>Available algorithms</translation>
|
||||
@ -2897,6 +3025,82 @@ Check algorithm documentation for supported geometry</translation>
|
||||
<source>SMESH_MULTICOLOR</source>
|
||||
<translation>Multicolor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_TAB_GENERAL</source>
|
||||
<translation>Adaptation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_NONE</source>
|
||||
<translation>None</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT</source>
|
||||
<translation>Adaptation with MG-Adapt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_FILE_MAILLAGE_OUT</source>
|
||||
<translation>Write the OUT mesh</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_PUBLICATION_MAILLAGE_OUT</source>
|
||||
<translation>Publication of the OUT mesh</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OPTION_VALUE_COLUMN</source>
|
||||
<translation>Option</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OPTION_NAME_COLUMN</source>
|
||||
<translation>Value</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>compute_ridges</source>
|
||||
<translation>Compute ridges</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>max_memory</source>
|
||||
<translation>Maximum memory (Mb)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Adaption</source>
|
||||
<translation>adaptation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>components</source>
|
||||
<translation>Components</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_SIZE_MAP</source>
|
||||
<translation>Size map</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_SIZE_MAP_LOCAL</source>
|
||||
<translation>Local</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_SIZE_MAP_BACKGROUND</source>
|
||||
<translation>Background</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_TIME_STEP_LAST</source>
|
||||
<translation>Last</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_TIME_STEP</source>
|
||||
<translation>Choosen time step</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_TIME_STEP_C</source>
|
||||
<translation>Value</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_SELECT_FILE_0</source>
|
||||
<translation>MG-ADAPT select file</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_ADVOP</source>
|
||||
<translation>Advanced Options</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_VISU_PROBLEM</source>
|
||||
<translation>Mesh visualization failed</translation>
|
||||
@ -3112,6 +3316,10 @@ Use Display Entity menu command to show them.
|
||||
<source>STB_CONSTRUCT_GROUP</source>
|
||||
<translation>Construct Group</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_MG_ADAPT</source>
|
||||
<translation>Remesh with MG_Adapt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_CONV_TO_QUAD</source>
|
||||
<translation>Convert to/from quadratic</translation>
|
||||
@ -3708,6 +3916,10 @@ Use Display Entity menu command to show them.
|
||||
<source>TB_CTRL3D</source>
|
||||
<translation>Volume Controls Toolbar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TB_ADAPTATION</source>
|
||||
<translation>Adaptation Toolbar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TB_MEASUREM</source>
|
||||
<translation>Measurements Toolbar</translation>
|
||||
@ -3812,6 +4024,10 @@ Use Display Entity menu command to show them.
|
||||
<source>TOP_CONSTRUCT_GROUP</source>
|
||||
<translation>Construct Group</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_MG_ADAPT</source>
|
||||
<translation>Remesh with MG_Adapt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_CONV_TO_QUAD</source>
|
||||
<translation>Convert to/from quadratic</translation>
|
||||
|
@ -340,6 +340,126 @@
|
||||
<source>MEN_CONSTRUCT_GROUP</source>
|
||||
<translation>Construire un groupe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_MG_ADAPT</source>
|
||||
<translation>Remaillage avec MG_Adapt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Args</source>
|
||||
<translation>Arguments</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MeshOut</source>
|
||||
<translation>Maillage en sortie</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MeshIn</source>
|
||||
<translation>Maillage en entrée</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEDFile</source>
|
||||
<translation>Fichier MED</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Browser</source>
|
||||
<translation>Arbre d'études</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Publish_MG_ADAPT</source>
|
||||
<translation>Publication</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SIZE_MAP_FIELD</source>
|
||||
<translation>Champ de la carte de taille</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_FIELD_NAME</source>
|
||||
<translation>Nom du champ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_MED_FILE_1</source>
|
||||
<translation>Ce fichier MED est illisible.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_MED_FILE_2</source>
|
||||
<translation>Ce fichier MED ne contient aucun maillage.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_MED_FILE_3</source>
|
||||
<translation>Ce fichier MED contient plus d'un maillage.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_MED_FILE_4</source>
|
||||
<translation>Impossible de lire le maillage de ce fichier MED.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_MED_FILE_5</source>
|
||||
<translation>Ce fichier MED ne contient aucun champ.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_ERROR</source>
|
||||
<translation>Erreur</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_CH_ST</source>
|
||||
<translation>Pas de temps choisi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_RANK</source>
|
||||
<translation>Numéro d'ordre</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_TSTP</source>
|
||||
<translation>Pas de temps </translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_NO_T_ST</source>
|
||||
<translation>Sans pas de temps</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_L_ST</source>
|
||||
<translation>Dernier pas de temps</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MeshName</source>
|
||||
<translation>Nom du maillage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>LOCAL_MG_ADAPT</source>
|
||||
<translation>Locale</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BACKGRND_MG_ADAPT</source>
|
||||
<translation>Arrière-plan</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CNST_MG_ADAPT</source>
|
||||
<translation>Constante</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MED_FILE_BCKG</source>
|
||||
<translation>Fichier MED de la carte en arrière-plan</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>VALUE_MG_ADAPT</source>
|
||||
<translation>Valeur</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SIZE_MAP_DEF</source>
|
||||
<translation>Définition de la carte de taille</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADVOP</source>
|
||||
<translation>Options avancées</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_DIAG_1</source>
|
||||
<translation>Adaptation réussie.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_DIAG_2</source>
|
||||
<translation>Echec de l'adaptation.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_CONV_TO_QUAD</source>
|
||||
<translation>Convertir vers/depuis quadratique</translation>
|
||||
@ -482,7 +602,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_EDIT</source>
|
||||
<translation>Edition</translation>
|
||||
<translation>Editer</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_EDIT_GROUP</source>
|
||||
@ -788,6 +908,10 @@
|
||||
<source>MEN_MODIFY</source>
|
||||
<translation>Modification</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_ADAPT</source>
|
||||
<translation>Adaptation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_MEASURE</source>
|
||||
<translation>Outils de mesure</translation>
|
||||
@ -2895,6 +3019,82 @@ Référez-vous à la documentation sur l'algorithme et la géométrie supportée
|
||||
<source>SMESH_MULTICOLOR</source>
|
||||
<translation>Multicouleur</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_TAB_GENERAL</source>
|
||||
<translation>Adaptation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_NONE</source>
|
||||
<translation>Sans</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT</source>
|
||||
<translation>Adaptation avec MG-Adapt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_FILE_MAILLAGE_OUT</source>
|
||||
<translation>Ecriture du maillage de sortie</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_PUBLICATION_MAILLAGE_OUT</source>
|
||||
<translation>Publication du maillage de sortie</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OPTION_VALUE_COLUMN</source>
|
||||
<translation>Option</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OPTION_NAME_COLUMN</source>
|
||||
<translation>Valeur</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>compute_ridges</source>
|
||||
<translation>Calcul des crêtes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>max_memory</source>
|
||||
<translation>Maximum mémoire (Mb)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Adaption</source>
|
||||
<translation>Adaptation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>components</source>
|
||||
<translation>Composantes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_SIZE_MAP</source>
|
||||
<translation>Carte de tailles</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_SIZE_MAP_LOCAL</source>
|
||||
<translation>Locale</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_SIZE_MAP_BACKGROUND</source>
|
||||
<translation>Arrière-plan</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_TIME_STEP_LAST</source>
|
||||
<translation>Dernier</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_TIME_STEP</source>
|
||||
<translation>Choix du pas de temps</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_TIME_STEP_C</source>
|
||||
<translation>Valeur</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_SELECT_FILE_0</source>
|
||||
<translation>MG-ADAPT selection fichier MED</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADAPT_PREF_MG_ADAPT_ADVOP</source>
|
||||
<translation>Options avancées</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_VISU_PROBLEM</source>
|
||||
<translation>Impossible de visualiser le maillage, probablement à cause d'un manque de mémoire</translation>
|
||||
@ -3111,6 +3311,10 @@ Utilisez le menu "Visualiser une entité" pour les afficher.
|
||||
<source>STB_CONSTRUCT_GROUP</source>
|
||||
<translation>Construire un groupe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_MG_ADAPT</source>
|
||||
<translation>Remaillage avec MG_Adapt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_CONV_TO_QUAD</source>
|
||||
<translation>Convertir vers/depuis quadratique</translation>
|
||||
@ -3707,6 +3911,10 @@ Utilisez le menu "Visualiser une entité" pour les afficher.
|
||||
<source>TB_CTRL3D</source>
|
||||
<translation>Barre des contrôles des volumes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TB_ADAPTATION</source>
|
||||
<translation>Barre de l'adaptation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TB_MEASUREM</source>
|
||||
<translation>Barre des mesures</translation>
|
||||
@ -3811,6 +4019,10 @@ Utilisez le menu "Visualiser une entité" pour les afficher.
|
||||
<source>TOP_CONSTRUCT_GROUP</source>
|
||||
<translation>Construire un groupe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_MG_ADAPT</source>
|
||||
<translation>Remaillage avec MG_Adapt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_CONV_TO_QUAD</source>
|
||||
<translation>Convertir vers/de quadratique</translation>
|
||||
|
@ -113,6 +113,7 @@ SET(SMESHEngine_HEADERS
|
||||
SMESH_MeshPartDS.hxx
|
||||
SMESH.hxx
|
||||
SMESH_Component_Generator.hxx
|
||||
MG_ADAPT_i.hxx
|
||||
)
|
||||
|
||||
# --- sources ---
|
||||
@ -141,6 +142,7 @@ SET(SMESHEngine_SOURCES
|
||||
SMESH_Measurements_i.cxx
|
||||
SMESH_PreMeshInfo.cxx
|
||||
SMESH_Component_Generator.cxx
|
||||
MG_ADAPT_i.cxx
|
||||
)
|
||||
|
||||
# --- rules ---
|
||||
|
542
src/SMESH_I/MG_ADAPT_i.cxx
Normal file
542
src/SMESH_I/MG_ADAPT_i.cxx
Normal file
@ -0,0 +1,542 @@
|
||||
// Copyright (C) 2020-2021 CEA/DEN, EDF R&D
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include "MG_ADAPT_i.hxx"
|
||||
|
||||
#include "MG_ADAPT.hxx"
|
||||
#include "SMESH_File.hxx"
|
||||
#include "SMESH_Gen_i.hxx"
|
||||
#include "SMESH_PythonDump.hxx"
|
||||
#include "SMESH_TryCatch.hxx"
|
||||
|
||||
using namespace SMESH;
|
||||
|
||||
void MG_ADAPT_i::copyHypothesisDataToImpl(const SMESH::MgAdaptHypothesisData& from, ::MG_ADAPT::MgAdaptHypothesisData* to) const
|
||||
{
|
||||
to->myFileInDir = from.myFileInDir;
|
||||
to->myMeshFileIn = from.myMeshFileIn;
|
||||
to->myMeshFileBackground = from.myMeshFileBackground;
|
||||
to->myOutMeshName = from.myOutMeshName;
|
||||
to->myMeshFileOut = from.myMeshFileOut;
|
||||
to->myFileOutDir = from.myFileOutDir;
|
||||
to->myFileSizeMapDir = from.myFileSizeMapDir;
|
||||
to->myFieldName = from.myFieldName;
|
||||
to->fromMedFile = from.fromMedFile;
|
||||
to->myPublish = from.myPublish;
|
||||
to->myMeshOutMed = from.myMeshOutMed;
|
||||
to->myUseLocalMap = from.myUseLocalMap;
|
||||
to->myUseBackgroundMap = from.myUseBackgroundMap;
|
||||
to->myUseConstantValue = from.myUseConstantValue;
|
||||
to->myConstantValue = from.myConstantValue;
|
||||
to->myTimeStep = from.myTimeStep;
|
||||
to->myRank = from.myRank;
|
||||
to->myUseNoTimeStep = from.myUseNoTimeStep;
|
||||
to->myUseLastTimeStep = from.myUseLastTimeStep;
|
||||
to->myUseChosenTimeStep = from.myUseChosenTimeStep;
|
||||
to->myWorkingDir = from.myWorkingDir;
|
||||
to->myLogFile = from.myLogFile;
|
||||
to->myPrintLogInFile = from.myPrintLogInFile;
|
||||
to->myKeepFiles = from.myKeepFiles;
|
||||
to->myRemoveLogOnSuccess = from.myRemoveLogOnSuccess;
|
||||
to->myVerboseLevel = from.myVerboseLevel;
|
||||
}
|
||||
void MG_ADAPT_i::copyHypothesisDataFromImpl(const ::MG_ADAPT::MgAdaptHypothesisData* from, SMESH::MgAdaptHypothesisData* to) const
|
||||
{
|
||||
to->myFileInDir = CORBA::string_dup(from->myFileInDir.c_str());
|
||||
to->myMeshFileIn = CORBA::string_dup(from->myMeshFileIn.c_str());
|
||||
to->myMeshFileBackground = CORBA::string_dup(from->myMeshFileBackground.c_str());
|
||||
to->myOutMeshName = CORBA::string_dup(from->myOutMeshName.c_str());
|
||||
to->myMeshFileOut = CORBA::string_dup(from->myMeshFileOut.c_str());
|
||||
to->myFileOutDir = CORBA::string_dup(from->myFileOutDir.c_str());
|
||||
to->myFileSizeMapDir = CORBA::string_dup(from->myFileSizeMapDir.c_str());
|
||||
to->myFieldName = CORBA::string_dup(from->myFieldName.c_str());
|
||||
to->fromMedFile = from->fromMedFile;
|
||||
to->myPublish = from->myPublish;
|
||||
to->myMeshOutMed = from->myMeshOutMed;
|
||||
to->myUseLocalMap = from->myUseLocalMap;
|
||||
to->myUseBackgroundMap = from->myUseBackgroundMap;
|
||||
to->myUseConstantValue = from->myUseConstantValue;
|
||||
to->myConstantValue = from->myConstantValue;
|
||||
to->myTimeStep = from->myTimeStep;
|
||||
to->myRank = from->myRank;
|
||||
to->myUseNoTimeStep = from->myUseNoTimeStep;
|
||||
to->myUseLastTimeStep = from->myUseLastTimeStep;
|
||||
to->myUseChosenTimeStep = from->myUseChosenTimeStep;
|
||||
to->myWorkingDir = CORBA::string_dup(from->myWorkingDir.c_str());
|
||||
to->myLogFile = CORBA::string_dup(from->myLogFile.c_str());
|
||||
to->myPrintLogInFile = from->myPrintLogInFile;
|
||||
to->myKeepFiles = from->myKeepFiles;
|
||||
to->myRemoveLogOnSuccess = from->myRemoveLogOnSuccess;
|
||||
to->myVerboseLevel = from->myVerboseLevel;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_Gen_i::CreateMG_ADAPT
|
||||
*
|
||||
* Create measurement instance
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH::MG_ADAPT_ptr SMESH_Gen_i::CreateMG_ADAPT()
|
||||
{
|
||||
#ifndef DISABLE_MG_ADAPT
|
||||
SMESH::MG_ADAPT_i* aMGadapt = new SMESH::MG_ADAPT_i();
|
||||
SMESH::MG_ADAPT_var anObj = aMGadapt->_this();
|
||||
return anObj._retn();
|
||||
#else
|
||||
return SMESH::MG_ADAPT_ptr();
|
||||
#endif
|
||||
}
|
||||
SMESH::MG_ADAPT_ptr SMESH_Gen_i::CreateAdaptationHypothesis()
|
||||
{
|
||||
#ifndef DISABLE_MG_ADAPT
|
||||
SMESH::MG_ADAPT_i* aMGadapt = new SMESH::MG_ADAPT_i();
|
||||
SMESH::MG_ADAPT_var anObj = aMGadapt->_this();
|
||||
return anObj._retn();
|
||||
#else
|
||||
return SMESH::MG_ADAPT_ptr();
|
||||
#endif
|
||||
}
|
||||
SMESH::MG_ADAPT_OBJECT_ptr SMESH_Gen_i::Adaptation( const char* adaptationType)
|
||||
{
|
||||
#ifndef DISABLE_MG_ADAPT
|
||||
if (!strcmp(adaptationType, "MG_Adapt"))
|
||||
{
|
||||
SMESH::MG_ADAPT_OBJECT_i* mg_adapt_object = new SMESH::MG_ADAPT_OBJECT_i();
|
||||
SMESH::MG_ADAPT_OBJECT_var anObj = mg_adapt_object->_this();
|
||||
return anObj._retn();
|
||||
}
|
||||
#endif
|
||||
return SMESH::MG_ADAPT_OBJECT_ptr();
|
||||
}
|
||||
//=============================================================================
|
||||
/*!
|
||||
* standard constructor
|
||||
*/
|
||||
//=============================================================================
|
||||
MG_ADAPT_i::MG_ADAPT_i(): SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
|
||||
{
|
||||
myMgAdapt = new ::MG_ADAPT::MgAdapt();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* standard destructor
|
||||
*/
|
||||
//=============================================================================
|
||||
MG_ADAPT_i::~MG_ADAPT_i()
|
||||
{
|
||||
delete myMgAdapt;
|
||||
}
|
||||
void MG_ADAPT_i::setData( SMESH::MgAdaptHypothesisData& data)
|
||||
{
|
||||
::MG_ADAPT::MgAdaptHypothesisData* baseData = new ::MG_ADAPT::MgAdaptHypothesisData();
|
||||
copyHypothesisDataToImpl(data, baseData);
|
||||
myMgAdapt->setData(baseData);
|
||||
delete baseData;
|
||||
}
|
||||
void MG_ADAPT_i::setMedFileIn(const char* str)
|
||||
{
|
||||
myMgAdapt->setMedFileIn(str);
|
||||
}
|
||||
char* MG_ADAPT_i::getMedFileIn()
|
||||
{
|
||||
return CORBA::string_dup(myMgAdapt->getMedFileIn().c_str());
|
||||
}
|
||||
void MG_ADAPT_i::setMedFileOut(const char* str)
|
||||
{
|
||||
myMgAdapt->setMedFileOut(str);
|
||||
}
|
||||
char* MG_ADAPT_i::getMedFileOut()
|
||||
{
|
||||
return CORBA::string_dup(myMgAdapt->getMedFileOut().c_str());
|
||||
}
|
||||
void MG_ADAPT_i::setMeshName(const char* str)
|
||||
{
|
||||
myMgAdapt->setMeshName(str);
|
||||
}
|
||||
char* MG_ADAPT_i::getMeshName()
|
||||
{
|
||||
return CORBA::string_dup(myMgAdapt->getMeshName().c_str());
|
||||
}
|
||||
void MG_ADAPT_i::setMeshNameOut(const char* str)
|
||||
{
|
||||
myMgAdapt->setMeshNameOut(str);
|
||||
}
|
||||
char* MG_ADAPT_i::getMeshNameOut()
|
||||
{
|
||||
return CORBA::string_dup(myMgAdapt->getMeshNameOut().c_str());
|
||||
}
|
||||
void MG_ADAPT_i::setMeshOutMed(bool mybool)
|
||||
{
|
||||
myMgAdapt->setMeshOutMed(mybool);
|
||||
}
|
||||
bool MG_ADAPT_i::getMeshOutMed()
|
||||
{
|
||||
return myMgAdapt->getMeshOutMed();
|
||||
}
|
||||
void MG_ADAPT_i::setPublish(bool mybool)
|
||||
{
|
||||
myMgAdapt->setPublish(mybool);
|
||||
}
|
||||
bool MG_ADAPT_i::getPublish()
|
||||
{
|
||||
return myMgAdapt->getPublish();
|
||||
}
|
||||
void MG_ADAPT_i::setSizeMapFieldName(const char* str)
|
||||
{
|
||||
myMgAdapt->setFieldName(str);
|
||||
}
|
||||
char* MG_ADAPT_i::getSizeMapFieldName()
|
||||
{
|
||||
return CORBA::string_dup(myMgAdapt->getFieldName().c_str());
|
||||
}
|
||||
void MG_ADAPT_i::setTimeStep(CORBA::Long t)
|
||||
{
|
||||
myMgAdapt->setTimeStep(t);
|
||||
}
|
||||
CORBA::Long MG_ADAPT_i::getTimeStep()
|
||||
{
|
||||
return myMgAdapt->getTimeStep();
|
||||
}
|
||||
void MG_ADAPT_i::setTimeStepRank(CORBA::Long t, CORBA::Long r)
|
||||
{
|
||||
myMgAdapt->setChosenTimeStepRank();
|
||||
myMgAdapt->setRankTimeStep(t, r);
|
||||
}
|
||||
CORBA::Long MG_ADAPT_i::getRank()
|
||||
{
|
||||
return myMgAdapt->getRank();
|
||||
}
|
||||
void MG_ADAPT_i::setTimeStepRankLast()
|
||||
{
|
||||
myMgAdapt->setTimeStepRankLast();
|
||||
}
|
||||
void MG_ADAPT_i::setNoTimeStep()
|
||||
{
|
||||
myMgAdapt->setNoTimeStep();
|
||||
}
|
||||
void MG_ADAPT_i::setLogFile(const char* str)
|
||||
{
|
||||
myMgAdapt->setLogFile(str);
|
||||
}
|
||||
char* MG_ADAPT_i::getLogFile()
|
||||
{
|
||||
return CORBA::string_dup(myMgAdapt->getLogFile().c_str());
|
||||
}
|
||||
|
||||
void MG_ADAPT_i::setVerbosityLevel(CORBA::Long v)
|
||||
{
|
||||
myMgAdapt->setVerbosityLevel(v);
|
||||
}
|
||||
CORBA::Long MG_ADAPT_i::getVerbosityLevel()
|
||||
{
|
||||
return myMgAdapt->getVerbosityLevel();
|
||||
}
|
||||
void MG_ADAPT_i::setRemoveOnSuccess(bool mybool)
|
||||
{
|
||||
myMgAdapt->setRemoveOnSuccess(mybool);
|
||||
}
|
||||
bool MG_ADAPT_i::getRemoveOnSuccess()
|
||||
{
|
||||
return myMgAdapt->getRemoveOnSuccess();
|
||||
}
|
||||
SMESH::MgAdaptHypothesisData* MG_ADAPT_i::getData()
|
||||
{
|
||||
SMESH::MgAdaptHypothesisData* result = new SMESH::MgAdaptHypothesisData();
|
||||
::MG_ADAPT::MgAdaptHypothesisData* from = myMgAdapt->getData();
|
||||
copyHypothesisDataFromImpl(from, result);
|
||||
return result;
|
||||
}
|
||||
void MG_ADAPT_i::setUseLocalMap(bool mybool)
|
||||
{
|
||||
myMgAdapt->setUseLocalMap(mybool);
|
||||
}
|
||||
bool MG_ADAPT_i::getUseLocalMap()
|
||||
{
|
||||
return myMgAdapt->getUseLocalMap();
|
||||
}
|
||||
void MG_ADAPT_i::setUseBackgroundMap(bool mybool)
|
||||
{
|
||||
myMgAdapt->setUseBackgroundMap(mybool);
|
||||
}
|
||||
bool MG_ADAPT_i::getUseBackgroundMap()
|
||||
{
|
||||
return myMgAdapt->getUseBackgroundMap();
|
||||
}
|
||||
void MG_ADAPT_i::setUseConstantValue(bool mybool)
|
||||
{
|
||||
myMgAdapt->setUseConstantValue(mybool);
|
||||
}
|
||||
bool MG_ADAPT_i::getUseConstantValue()
|
||||
{
|
||||
return myMgAdapt->getUseConstantValue();
|
||||
}
|
||||
void MG_ADAPT_i::setConstantSize(double value)
|
||||
{
|
||||
myMgAdapt->setConstantValue(value);
|
||||
}
|
||||
double MG_ADAPT_i::getConstantSize()
|
||||
{
|
||||
return myMgAdapt->getConstantValue();
|
||||
}
|
||||
void MG_ADAPT_i::setSizeMapFile(const char* str)
|
||||
{
|
||||
myMgAdapt->setSizeMapFile(str);
|
||||
}
|
||||
char* MG_ADAPT_i::getSizeMapFile()
|
||||
{
|
||||
return CORBA::string_dup(myMgAdapt->getSizeMapFile().c_str());
|
||||
}
|
||||
void MG_ADAPT_i::setFromMedFile(bool mybool)
|
||||
{
|
||||
myMgAdapt->setFromMedFile(mybool);
|
||||
}
|
||||
bool MG_ADAPT_i::isFromMedFile()
|
||||
{
|
||||
return myMgAdapt->isFromMedFile();
|
||||
}
|
||||
|
||||
void MG_ADAPT_i::setKeepWorkingFiles(bool mybool)
|
||||
{
|
||||
myMgAdapt->setKeepWorkingFiles(mybool);
|
||||
}
|
||||
bool MG_ADAPT_i::getKeepWorkingFiles()
|
||||
{
|
||||
return myMgAdapt->getKeepWorkingFiles();
|
||||
}
|
||||
|
||||
//~void MG_ADAPT_i::setPrCORBA::LongLogInFile(bool);
|
||||
//~bool MG_ADAPT_i::getPrCORBA::LongLogInFile();
|
||||
|
||||
void MG_ADAPT_i::setSizeMapType(const char* type)
|
||||
{
|
||||
setUseLocalMap(false);
|
||||
setUseBackgroundMap(false);
|
||||
setUseConstantValue(false);
|
||||
|
||||
if (!strcmp("Local", type))
|
||||
setUseLocalMap(true);
|
||||
else if (!strcmp("Background", type))
|
||||
setUseBackgroundMap(true);
|
||||
else
|
||||
setUseConstantValue(true);
|
||||
}
|
||||
void MG_ADAPT_i::setWorkingDir(const char* dir)
|
||||
{
|
||||
myMgAdapt->setWorkingDir(dir);
|
||||
}
|
||||
char* MG_ADAPT_i::getWorkingDir()
|
||||
{
|
||||
return CORBA::string_dup(myMgAdapt->getWorkingDir().c_str());
|
||||
}
|
||||
bool MG_ADAPT_i::setAll()
|
||||
{
|
||||
return myMgAdapt->setAll();
|
||||
}
|
||||
char* MG_ADAPT_i::getCommandToRun()
|
||||
{
|
||||
return CORBA::string_dup(myMgAdapt->getCommandToRun().c_str());
|
||||
}
|
||||
|
||||
// macro used to initialize excStr by exception description
|
||||
// returned by SMESH_CATCH( SMESH::returnError )
|
||||
#undef SMESH_CAUGHT
|
||||
#define SMESH_CAUGHT excStr =
|
||||
|
||||
void MG_ADAPT_i::compute()
|
||||
{
|
||||
SMESH::TPythonDump noDumpSoFar;
|
||||
|
||||
errStr = "";
|
||||
std::string excStr;
|
||||
SMESH_TRY;
|
||||
|
||||
myMgAdapt->compute(errStr);
|
||||
|
||||
SMESH_CATCH( SMESH::returnError );
|
||||
|
||||
SMESH_Comment errMsg;
|
||||
if ( !excStr.empty() )
|
||||
{
|
||||
errMsg << "Exception thrown on MG_ADAPT_i::compute invocation with error message \""
|
||||
<< errStr << "\" with exception \"" << excStr << "\"";
|
||||
}
|
||||
else if ( !errStr.empty() )
|
||||
{
|
||||
errMsg << "MG_ADAPT_i::compute invocation returned error message \"" << errStr << "\"";
|
||||
}
|
||||
if ( !errMsg.empty() )
|
||||
{
|
||||
THROW_SALOME_CORBA_EXCEPTION( errMsg.c_str(), SALOME::INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
if(myMgAdapt->getPublish())
|
||||
{
|
||||
SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
|
||||
SMESH::DriverMED_ReadStatus theStatus;
|
||||
smeshGen_i->CreateMeshesFromMED(myMgAdapt->getMedFileOut().c_str(), theStatus);
|
||||
}
|
||||
}
|
||||
#undef SMESH_CAUGHT
|
||||
#define SMESH_CAUGHT
|
||||
|
||||
char* MG_ADAPT_i::getErrMsg()
|
||||
{
|
||||
return CORBA::string_dup(errStr.c_str());
|
||||
}
|
||||
char* MG_ADAPT_i::getFileName()
|
||||
{
|
||||
return CORBA::string_dup(myMgAdapt->getFileName().c_str());
|
||||
}
|
||||
char* MG_ADAPT_i::getExeName()
|
||||
{
|
||||
return CORBA::string_dup(myMgAdapt->getExeName().c_str());
|
||||
}
|
||||
void MG_ADAPT_i::copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data)
|
||||
{
|
||||
::MG_ADAPT::MgAdaptHypothesisData* baseData = new ::MG_ADAPT::MgAdaptHypothesisData();
|
||||
copyHypothesisDataToImpl(data, baseData);
|
||||
myMgAdapt->copyMgAdaptHypothesisData(baseData);
|
||||
delete baseData;
|
||||
}
|
||||
|
||||
//~void MG_ADAPT_i::checkDirPath(char*& str)
|
||||
//~{
|
||||
//~myMgAdapt->checkDirPath(str);
|
||||
//~}
|
||||
|
||||
bool MG_ADAPT_i::hasOptionDefined( const char* optionName )
|
||||
{
|
||||
return myMgAdapt->hasOptionDefined(optionName);
|
||||
}
|
||||
void MG_ADAPT_i::setOptionValue(const char* optionName,
|
||||
const char* optionValue)
|
||||
{
|
||||
SMESH_TRY;
|
||||
myMgAdapt->setOptionValue(optionName, optionValue);
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
}
|
||||
|
||||
char* MG_ADAPT_i::getOptionValue(const char* optionName,
|
||||
bool& isDefault)
|
||||
{
|
||||
SMESH_TRY;
|
||||
return CORBA::string_dup(myMgAdapt->getOptionValue(optionName, &isDefault).c_str());
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
return 0;
|
||||
}
|
||||
SMESH::string_array* MG_ADAPT_i::getCustomOptionValuesStrVec()
|
||||
{
|
||||
SMESH::string_array_var result = new SMESH::string_array();
|
||||
std::vector <std::string> vals = myMgAdapt->getCustomOptionValuesStrVec();
|
||||
result->length((CORBA::ULong) vals.size()) ;
|
||||
for (CORBA::ULong i = 0; i<vals.size(); i++) result[i] = CORBA::string_dup(vals[i].c_str());
|
||||
return result._retn();
|
||||
}
|
||||
SMESH::string_array* MG_ADAPT_i::getOptionValuesStrVec()
|
||||
{
|
||||
|
||||
SMESH::string_array_var result = new SMESH::string_array();
|
||||
std::vector <std::string> vals = myMgAdapt->getOptionValuesStrVec();
|
||||
result->length((CORBA::ULong) vals.size());
|
||||
for (CORBA::ULong i = 0; i<vals.size(); i++) result[i] = CORBA::string_dup(vals[i].c_str());
|
||||
return result._retn();
|
||||
}
|
||||
|
||||
void MG_ADAPT_i::setPrintLogInFile(bool mybool)
|
||||
{
|
||||
myMgAdapt->setPrintLogInFile(mybool);
|
||||
}
|
||||
bool MG_ADAPT_i::getPrintLogInFile()
|
||||
{
|
||||
return myMgAdapt->getPrintLogInFile();
|
||||
}
|
||||
//~TOptionValues MG_ADAPT_i::getOptionValues() const;
|
||||
//~const TOptionValues& MG_ADAPT_i::getCustomOptionValues() const ;
|
||||
|
||||
MG_ADAPT_OBJECT_i::MG_ADAPT_OBJECT_i(): SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
|
||||
{
|
||||
medFileIn="";
|
||||
medFileOut="";
|
||||
medFileBackground="";
|
||||
publish = false;
|
||||
//~myMesh = CORBA::nil;
|
||||
}
|
||||
|
||||
void MG_ADAPT_OBJECT_i::setMeshIn(SMESH::SMESH_Mesh_ptr theMesh )
|
||||
{
|
||||
myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh);
|
||||
}
|
||||
void MG_ADAPT_OBJECT_i::setMEDFileIn(const char* f)
|
||||
{
|
||||
medFileIn = f;
|
||||
}
|
||||
void MG_ADAPT_OBJECT_i::setMEDFileOut(const char* f)
|
||||
{
|
||||
medFileOut = f;
|
||||
}
|
||||
void MG_ADAPT_OBJECT_i::setMEDFileBackground(const char* f)
|
||||
{
|
||||
medFileBackground = f;
|
||||
}
|
||||
void MG_ADAPT_OBJECT_i::AddHypothesis(SMESH::MG_ADAPT_ptr mg)
|
||||
{
|
||||
|
||||
mg->setMedFileIn(medFileIn.c_str());
|
||||
mg->setMedFileOut(medFileOut.c_str());
|
||||
mg->setSizeMapFile(medFileBackground.c_str());
|
||||
hypothesis = SMESH::MG_ADAPT::_duplicate(mg);
|
||||
hypothesis->Register();
|
||||
}
|
||||
CORBA::Long MG_ADAPT_OBJECT_i::Compute(bool publish)
|
||||
{
|
||||
SMESH::TPythonDump noDumpSoFar;
|
||||
|
||||
if(!checkMeshFileIn()){
|
||||
std::cerr<< "\n Error : Please check the MED file input or mesh input. \n";
|
||||
return -1;
|
||||
}
|
||||
hypothesis->setPublish(publish);
|
||||
hypothesis->compute();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool MG_ADAPT_OBJECT_i::checkMeshFileIn()
|
||||
{
|
||||
SMESH::TPythonDump noDumpSoFar;
|
||||
|
||||
bool ret = false; // 1 ok , 0 nook
|
||||
if ( !( ret = SMESH_File( medFileIn ).exists()))
|
||||
{
|
||||
if(!myMesh->_is_nil())
|
||||
{
|
||||
bool toOverwrite = true;
|
||||
bool toFindOutDim = true;
|
||||
medFileIn = (CORBA::String_var( hypothesis->getFileName() )).in();
|
||||
medFileIn+= ".med";
|
||||
myMesh->ExportMED(medFileIn.c_str(), false, -1, toOverwrite, toFindOutDim);
|
||||
hypothesis->setMedFileIn(medFileIn.c_str());
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
172
src/SMESH_I/MG_ADAPT_i.hxx
Normal file
172
src/SMESH_I/MG_ADAPT_i.hxx
Normal file
@ -0,0 +1,172 @@
|
||||
// Copyright (C) 2020-2021 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
|
||||
//
|
||||
|
||||
#ifndef MG_ADAPT_I_HXX
|
||||
#define MG_ADAPT_I_HXX
|
||||
|
||||
#include "SMESH.hxx"
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(MG_ADAPT)
|
||||
#include "SALOME_GenericObj_i.hh"
|
||||
#include <SALOME_GenericObj_wrap.hxx>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace MG_ADAPT
|
||||
{
|
||||
class MgAdaptHypothesisData;
|
||||
class MgAdapt;
|
||||
}
|
||||
|
||||
namespace SMESH
|
||||
{
|
||||
|
||||
class SMESH_I_EXPORT MG_ADAPT_i :
|
||||
public virtual SALOME::GenericObj_i,
|
||||
public virtual POA_SMESH::MG_ADAPT
|
||||
{
|
||||
public:
|
||||
MG_ADAPT_i();
|
||||
virtual ~MG_ADAPT_i();
|
||||
void setData( SMESH::MgAdaptHypothesisData& data);
|
||||
|
||||
void setMedFileIn(const char* str);
|
||||
char* getMedFileIn();
|
||||
|
||||
void setMedFileOut(const char* str);
|
||||
char* getMedFileOut();
|
||||
|
||||
void setMeshName(const char* str);
|
||||
char* getMeshName();
|
||||
|
||||
void setMeshNameOut(const char* str);
|
||||
char* getMeshNameOut();
|
||||
|
||||
void setMeshOutMed(bool mybool);
|
||||
bool getMeshOutMed();
|
||||
|
||||
void setPublish(bool mybool);
|
||||
bool getPublish();
|
||||
|
||||
void setSizeMapFieldName(const char* str);
|
||||
char* getSizeMapFieldName();
|
||||
|
||||
void setTimeStep(CORBA::Long t);
|
||||
CORBA::Long getTimeStep() ;
|
||||
|
||||
void setTimeStepRank(CORBA::Long t, CORBA::Long r );
|
||||
CORBA::Long getRank();
|
||||
|
||||
void setTimeStepRankLast();
|
||||
void setNoTimeStep();
|
||||
|
||||
void setLogFile(const char* str);
|
||||
char* getLogFile();
|
||||
|
||||
void setVerbosityLevel(CORBA::Long v);
|
||||
CORBA::Long getVerbosityLevel();
|
||||
|
||||
void setRemoveOnSuccess(bool mybool);
|
||||
bool getRemoveOnSuccess();
|
||||
|
||||
SMESH::MgAdaptHypothesisData* getData() ;
|
||||
void setSizeMapType(const char* type);
|
||||
void setUseLocalMap(bool mybool);
|
||||
bool getUseLocalMap();
|
||||
|
||||
void setUseBackgroundMap(bool mybool);
|
||||
bool getUseBackgroundMap();
|
||||
|
||||
void setUseConstantValue(bool mybool);
|
||||
bool getUseConstantValue();
|
||||
|
||||
void setConstantSize(double value);
|
||||
double getConstantSize();
|
||||
|
||||
void setSizeMapFile(const char* str);
|
||||
char* getSizeMapFile();
|
||||
|
||||
void setFromMedFile(bool mybool);
|
||||
bool isFromMedFile();
|
||||
|
||||
void setKeepWorkingFiles(bool mybool);
|
||||
bool getKeepWorkingFiles();
|
||||
|
||||
//~void setPrCORBA::LongLogInFile(bool);
|
||||
//~bool getPrCORBA::LongLogInFile();
|
||||
|
||||
void setWorkingDir(const char* str);
|
||||
char* getWorkingDir() ;
|
||||
|
||||
void setPrintLogInFile(bool mybool);
|
||||
bool getPrintLogInFile();
|
||||
|
||||
bool setAll();
|
||||
char* getCommandToRun() ;
|
||||
void compute();
|
||||
char* getFileName();
|
||||
char* getExeName();
|
||||
void copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data ) ;
|
||||
//~void copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data ) {
|
||||
//~copyMgAdaptHypothesisData(&data);
|
||||
//~}
|
||||
|
||||
//~void checkDirPath(char*& str);
|
||||
|
||||
bool hasOptionDefined( const char* optionName ) ;
|
||||
void setOptionValue(const char* optionName,
|
||||
const char* optionValue);
|
||||
char* getOptionValue(const char* optionName,
|
||||
bool& isDefault);
|
||||
SMESH::string_array* getCustomOptionValuesStrVec() ;
|
||||
SMESH::string_array* getOptionValuesStrVec() ;
|
||||
void copyHypothesisDataFromImpl(const ::MG_ADAPT::MgAdaptHypothesisData* from, SMESH::MgAdaptHypothesisData* to) const;
|
||||
void copyHypothesisDataToImpl(const SMESH::MgAdaptHypothesisData& from, ::MG_ADAPT::MgAdaptHypothesisData* to) const;
|
||||
//~TOptionValues getOptionValues() const;
|
||||
//~const TOptionValues& getCustomOptionValues() const ;
|
||||
char* getErrMsg();
|
||||
private:
|
||||
::MG_ADAPT::MgAdapt* myMgAdapt;
|
||||
std::string errStr;
|
||||
|
||||
};
|
||||
|
||||
class SMESH_I_EXPORT MG_ADAPT_OBJECT_i:
|
||||
public virtual SALOME::GenericObj_i,
|
||||
public virtual POA_SMESH::MG_ADAPT_OBJECT {
|
||||
public :
|
||||
MG_ADAPT_OBJECT_i();
|
||||
void setMeshIn( SMESH::SMESH_Mesh_ptr theMesh );
|
||||
void setMEDFileIn(const char* f);
|
||||
void setMEDFileOut(const char* f);
|
||||
void setMEDFileBackground(const char* f);
|
||||
void AddHypothesis(SMESH::MG_ADAPT_ptr);
|
||||
CORBA::Long Compute(bool Publish);
|
||||
private:
|
||||
std::string medFileIn, medFileOut, medFileBackground;
|
||||
bool checkMeshFileIn();
|
||||
bool publish;
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SALOME::GenericObj_wrap<SMESH::MG_ADAPT> hypothesis;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // MG_ADAPT_I_HXX
|
@ -477,6 +477,10 @@ public:
|
||||
|
||||
int CountInPyDump(const TCollection_AsciiString& text);
|
||||
|
||||
SMESH::MG_ADAPT_ptr CreateMG_ADAPT();
|
||||
SMESH::MG_ADAPT_ptr CreateAdaptationHypothesis();
|
||||
SMESH::MG_ADAPT_OBJECT_ptr Adaptation( const char* adaptationType);
|
||||
|
||||
// *****************************************
|
||||
// Internal methods
|
||||
// *****************************************
|
||||
|
Loading…
Reference in New Issue
Block a user