from .monViewTexte import ViewText
try :
if sys.platform[0:5]=="linux" :
- cmd="xdg-open "+ str(fichier)
+ #cmd="xdg-open "+ str(fichier)
+ #changer pour marcher dans l'EDC
+ cmd="gedit "+ str(fichier)
os.system(cmd)
else :
os.startfile(str(fichier))
+++ /dev/null
-# Copyright (C) 2008-2018 EDF R&D
-#
-# This file is part of SALOME ADAO module
-#
-# 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.
-#
-# 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
-import os, re
-import Accas
-from Accas import *
-
-JdC = JDC_CATA (
- code = 'MapIdentification',
- )
-VERSION_CATALOGUE='V_0'
-
-
-Experiences = PROC(nom = 'experiences',
-
- description = SIMP(statut='o', typ='TXM', defaut=''),
- experience = FACT(statut='o', max = "**",
- experience_Name = SIMP (statut='o', typ='TXM'),
- source = SIMP(statut='o', typ='TXM', into=['File','Dico','Value']),
- b_source_file = BLOC(condition="source == 'File'",
- exp_file = SIMP(statut = "o", typ = 'Fichier'),
- ),
- b_source_valeur = BLOC(condition="source == 'Value'",
- exp_value = SIMP(statut = "o", typ = 'R'),
- ),
- b_source_dico = BLOC(condition="source == 'Dico'",
- exp_dico = SIMP(statut = "o", typ = 'TXM'),
- ),
- Associated_simulation_step_number = SIMP(statut='o', typ='I', val_min=1),
- dependancy = FACT( statut='o',
- type_dependancy= SIMP(statut='o',
- typ='TXM', into=['temperature','moisture','irradiation']),
- source = SIMP(statut='o', typ='TXM', into=['File','Dico','Value']),
- b_source_file = BLOC(condition="source == 'File'",
- exp_file = SIMP(statut = "o", typ = 'Fichier'),),
- b_source_valeur = BLOC(condition="source == 'Value'",
- exp_value = SIMP(statut = "o", typ = 'R'),),
- b_source_dico = BLOC(condition="source == 'Dico'",
- exp_dico = SIMP(statut = "o", typ = 'TXM'),),
- ),
- ),
- dimensions= FACT( statut = 'f',
- diameter = SIMP(statut='o', typ='R', val_min = 0),
- thickness = SIMP(statut='o', typ='R', val_min = 0),
- number_elements = SIMP(statut='o', typ='I', val_min = 0),
- ),
- type_experience = SIMP(statut='o', typ='TXM',
- into=['tension','creep','relaxation','cyclic','cyclic_stab','tube']),
-)
-
-
-TEXTE_NEW_JDC = 'Experiences()'
-
-
-
-
from Accas import *
from datetime import datetime
from mapcore import getVersion
-from prefs_MapIdentification import catalogues_param, catalogues_exp
+from cata_map_cl0d_param import F_Parameters
+from cata_map_cl0d_exp import F_Experiences
+
JdC = JDC_CATA (
code = 'MAP_c_solver_constitutive_law_0d',
)
VERSION_CATALOGUE='2018.1.beta'
-def openNewXmlExp(monMC):
-
- monMC.jdc.appli.appliEficas.maConfiguration.catalogues = catalogues_exp
- monMC.jdc.appli.appliEficas.viewmanager.newEditor()
-
-def openNewXmlParam(monMC):
- #monMC.jdc.appli.appliEficas.maConfiguration.catalogues = catalogues_param
- monMC.jdc.appli.appliEficas.viewmanager.newEditor()
-
-def getName(monMC):
- print 'to'*50
+def getLawName(monMC):
+ print "je chercher a recuperer le nom du fichier"
print monMC.nom
print monMC.val
MAP_input_file = PROC(nom = 'MAP_input_file',
-# -----------------------------------
+ #-----------------------------------
MAP_Version = SIMP(statut='o', typ='TXM', defaut=getVersion()),
-# -----------------------------------
+ #-----------------------------------
output_directory = SIMP(statut='f',
typ='Repertoire',
defaut=os.path.join(
os.path.dirname(os.getcwd()),
datetime.now().strftime("%Y%m%d-%H%M")),
),
-# -----------------------------------
+ #-----------------------------------
constitutive_law_formulation = SIMP(statut='f', typ='TXM'),
-# -----------------------------------
+ #-----------------------------------
constitutive_law_parameters_status = SIMP(statut='o', typ='TXM',
into=['Existing', 'New'],
#defaut='New'
),
-# -----------------------------------
+ #-----------------------------------
b_constitutive_law_parameters_existing = BLOC(
condition="constitutive_law_parameters_status == 'Existing'",
constitutive_law_parameters = SIMP(
statut = "o",
typ = ('Fichier', 'XML Files (*.xml);;All Files (*)'),
- siValide=getName,
+ siValide=getLawName,
)
),
-# -----------------------------------
+ #-----------------------------------
b_constitutive_law_parameters_new = BLOC(
condition="constitutive_law_parameters_status == 'New'",
constitutive_law_parameters = SIMP(
statut = "o",
typ = ('FichierNoAbs', 'XML Files (*.xml);;All Files (*)'),
- siValide=openNewXmlParam,
- )
+ ),
+ #-----------------------------------
+ Parameters = F_Parameters(statut='o')
),
-# -----------------------------------
+ #-----------------------------------
user_defined_mfront_file_directory = SIMP(statut='f',
typ='Repertoire',
defaut=os.path.join(
"share/mfront/tests",
"behaviours"),
),
-# -----------------------------------
+ #-----------------------------------
exp_filename_list_status = SIMP(statut='o',
typ='TXM',
into=['Existing', 'New'],
- #defaut='New'
),
-# -----------------------------------
+ #-----------------------------------
b_exp_filename_list_existing = BLOC(
condition="exp_filename_list_status == 'Existing'",
exp_filename_list = SIMP(
typ = ('Fichier', 'XML Files (*.xml);;All Files (*)'),
)
),
-# -----------------------------------
+ #-----------------------------------
b_exp_filename_list_new = BLOC(
condition="exp_filename_list_status == 'New'",
exp_filename_list = SIMP(
statut = "o",
- typ = ('FichierNoAbs', 'XML Files (*.xml);;All Files (*)'),
- siValide=openNewXmlExp,
- )
- )
+ typ = ('FichierNoAbs', 'XML Files (*.xml);;All Files (*)')
+ ),
+ #-----------------------------------
+ Experiences = F_Experiences(statut='o')
+ ),
+ #-----------------------------------
+ mtest_options = SIMP(statut = "f", typ = ('Fichier')),
+ #-----------------------------------
+ interface = SIMP(statut='f', typ='TXM'),
)
# Catalog entry for the experiences plan
# =======================================================================
-Experiences = PROC(nom='Experiences',
-
- #-----------------------------------
- MAP_Version = SIMP(statut='o', typ='TXM', defaut=getVersion()),
- #-----------------------------------
+def F_Experiences(statut) : return FACT(
+ statut=statut,
Description = SIMP(statut='f', typ='TXM'),
#-----------------------------------
Experience = FACT(statut='o', max="**",
)
)
+
+
+Experiences = PROC(nom='Experiences',
+
+ #-----------------------------------
+ MAP_Version = SIMP(statut='o', typ='TXM', defaut=getVersion()),
+ #-----------------------------------
+ Experiences = F_Experiences(statut='o')
+)
+
TEXTE_NEW_JDC = 'Experiences()'
# Catalog entry for the list of material parameters
# =======================================================================
-Parameters_list = PROC(nom = 'List of material parameters',
-
-# -----------------------------------
- MAP_Version = SIMP(statut='o', typ='TXM', defaut=getVersion()),
-# -----------------------------------
- Description = SIMP(statut='f', typ='TXM', defaut=''),
-# -----------------------------------
- Law = SIMP(statut='o', typ='TXM', defaut=''),
-# -----------------------------------
+def F_Parameters(statut) : return FACT(
+ statut=statut,
+ #-----------------------------------
+ Description = SIMP(statut='f', typ='TXM'),
+ #-----------------------------------
+ Law = SIMP(statut='o', typ='TXM'),
+ #-----------------------------------
Parameter = FACT(statut='o', max="**",
-# -----------------------------------
+ #-----------------------------------
Name = SIMP (statut='o', typ='TXM'),
-# -----------------------------------
+ #-----------------------------------
Type = SIMP(statut='o', typ='TXM', into=["MaterialProperty",
"ExternalStateVariable",
"Parameter", "comm"]),
-# -----------------------------------
+ #-----------------------------------
Value = SIMP(statut='o', typ='R'),
-# -----------------------------------
+ #-----------------------------------
Adjustement = SIMP(statut='o', typ=bool), # TODO: case a cocher ou decocher
-# -----------------------------------
+ #-----------------------------------
Lower_bound = SIMP(statut='f', typ='R', val_min=0), #TODO: rule: inf < sup
-# -----------------------------------
+ #-----------------------------------
Upper_bound = SIMP(statut='f', typ='R', val_min=0), #TODO: rule: inf < sup
),
+ )
+
+
+Parameters_list = PROC(nom = 'List of material parameters',
+
+ #-----------------------------------
+ MAP_Version = SIMP(statut='o', typ='TXM', defaut=getVersion()),
+ #-----------------------------------
+ parameters = F_Parameters(statut='o')
)
TEXTE_NEW_JDC = 'Parameters_list()'
-def run(listeParam):
+import re
+import os
+
+def comm2MAPinput(input_filename):
+ # Saving my input file by converting comm file into ini
+ with open(input_filename) as input_file:
+ lines = input_file.readlines()
+
+ string = "[C_solver_constitutive_law0d]\n"
+ keys =["output_directory",
+ "constitutive_law_formulation",
+ "constitutive_law_parameters",
+ "user_defined_mfront_file_directory",
+ "exp_filename_list",
+ "mtest_options",
+ "interface"]
+ for line in lines:
+ for key in keys:
+ if key + "=" in line:
+ string += key + "=" + line.split("'")[1] + "\n"
+
+ output_filename = os.path.splitext(input_filename)[0] + ".input"
+ with open(output_filename, "w") as new_file:
+ new_file.write(string)
+ print ('je convertis le fichier comm en input de MAP')
+
+ return output_filename
+
+def run(editor):
print ('je rentre dans run')
- editor=listeParam[0]
- print (editor)
- print (dir(editor))
+ command_file = "/home/C41270/MAPinput_test.comm" # TODO: nom en dur
+
+ command_file = comm2MAPinput(command_file)
+ os.system("map -r sappli run -n C_solver_constitutive_law0d -i " + command_file)
+ print "calcul fini, youpi !"
+ #+def run(listeParam):
+ #+ print ('je rentre dans run')
+ #+ editor=listeParam[0]
+ #+ print (editor)
+ #+ print (dir(editor))
+
# le dictionnaire des commandes a la structure suivante :
# la clef est la commande qui va proposer l action