Salome HOME
Correction d'une erreur sur le tri entre raffinement et déraffinement.
authorGerald Nicolas <D68518@claui2t3.der.edf.fr>
Fri, 21 Mar 2014 10:11:55 +0000 (11:11 +0100)
committerGerald Nicolas <D68518@claui2t3.der.edf.fr>
Fri, 21 Mar 2014 10:11:55 +0000 (11:11 +0100)
AMélioration des tutoriaux

15 files changed:
doc/en/tutorials.rst
doc/files/tutorial_1.py
doc/files/tutorial_2.py
doc/files/tutorial_3.py [changed mode: 0644->0755]
doc/files/tutorial_4.py [changed mode: 0644->0755]
doc/files/tutorial_5.py [changed mode: 0644->0755]
doc/files/tutorial_util.py [new file with mode: 0755]
doc/fr/tutorials.rst
src/HOMARD/HOMARD.hxx
src/HOMARD/HOMARD_Cas.cxx
src/HOMARDGUI/MonCreateCase.cxx
src/HOMARDGUI/MonCreateYACS.cxx
src/HOMARDGUI/MonMeshInfo.cxx
src/HOMARDGUI/MonPursueIteration.cxx
src/HOMARD_I/HOMARD_Gen_i.cxx

index 95dea1016f88bda6de1355388e46199a73eb4c73..9d5f7fa8c3d83f6e93a7ff96f24cae08a9f16340 100644 (file)
@@ -37,13 +37,15 @@ One will make here three successive uniform refinements of the mesh contained in
 
 
 .. literalinclude:: ../files/tutorial_1.py
-   :lines: 57-89
+   :lines: 62-94
 
 .. note::
   Download the files
 
   * :download:`initial mesh<../files/tutorial_1.00.med.gz>`
   * :download:`python script<../files/tutorial_1.py>`
+  * :download:`python script for the compression<../files/tutorial_util.py>`
+
 
 
 Refinement by zones
@@ -53,13 +55,14 @@ Refinement by zones
 One proceeds here to refinement according to zones. To pass from the initial mesh to the mesh 'M_1', one uses a box framing the z=1 plane and a sphere centered on the origin with radius 1.05. Then to pass from the mesh 'M_1' to the mesh 'M_2', one replaces the sphere by a box framing the cube on side 0.5, pointing on the origin and the meshes in the very first zone are unrefined.
 
 .. literalinclude:: ../files/tutorial_2.py
-   :lines: 57-99
+   :lines: 62-104
 
 .. note::
   Download the files
 
   * :download:`initial mesh<../files/tutorial_2.00.med.gz>`
   * :download:`python script<../files/tutorial_2.py>`
+  * :download:`python script for the compression<../files/tutorial_util.py>`
 
 
 Refinement driven by a field
@@ -70,7 +73,7 @@ One proceeds here to refinement according to a field. The hypotheses are used to
 To adapt the H_1 mesh resulting from the Iter_1 iteration, two alternatives are applied. In the first, Iter_2, the field is a scalar field of indicators of error and one cuts out the 1.5% of elements where the error is largest. In the second alternative, Iter_2_bis, one is based on a vector field and one examines the jump of this vector between an element and its neighbors: one will cut out where the infinite standard of this jump is higher than the absolute threshold of 0.0001.
 
 .. literalinclude:: ../files/tutorial_3.py
-   :lines: 57-128
+   :lines: 62-133
 
 .. note::
   Download the files
@@ -78,6 +81,7 @@ To adapt the H_1 mesh resulting from the Iter_1 iteration, two alternatives are
   * :download:`mesh and field stage 0<../files/tutorial_3.00.med.gz>`
   * :download:`mesh and field stage 1<../files/tutorial_3.01.med.gz>`
   * :download:`python script<../files/tutorial_3.py>`
+  * :download:`python script for the compression<../files/tutorial_util.py>`
 
 
 Non plane boundaries
@@ -89,7 +93,7 @@ One tests the follow-up of the curved borders here: analytical borders to descri
 Scheme YACS carrying out this adaptation is downloadable.
 
 .. literalinclude:: ../files/tutorial_4.py
-   :lines: 57-115
+   :lines: 62-120
 
 .. note::
   Download the files
@@ -97,6 +101,7 @@ Scheme YACS carrying out this adaptation is downloadable.
   * :download:`initial mesh<../files/tutorial_4.00.med.gz>`
   * :download:`mesh of the discrete boundary<../files/tutorial_4.fr.med.gz>`
   * :download:`python script<../files/tutorial_4.py>`
+  * :download:`python script for the compression<../files/tutorial_util.py>`
   * :download:`YACS scheme<../files/tutorial_4.xml>`
 
 
@@ -108,7 +113,7 @@ The instructions to adapt a 2D mesh are exactly identical to those necessary to
 In the case presented here, one for the first time refines all the elements contained in a bored disk, then in one second iteration, all the elements contained in a rectangle. One will note the use of the follow-up of the circular borders of the field.
 
 .. literalinclude:: ../files/tutorial_5.py
-   :lines: 57-99
+   :lines: 62-104
 
 .. note::
   Download the files
@@ -116,6 +121,7 @@ In the case presented here, one for the first time refines all the elements cont
   * :download:`initial mesh<../files/tutorial_5.00.med.gz>`
   * :download:`mesh of the discrete boundary<../files/tutorial_5.fr.med.gz>`
   * :download:`python script<../files/tutorial_5.py>`
+  * :download:`python script for the compression<../files/tutorial_util.py>`
 
 
 .. toctree::
index c67c19611481b4d68cd618f89061e2e8c33f6c20..ae8e554846d72b1d189a4381239cb18fe37845a8 100755 (executable)
 
 """
 Exemple de couplage HOMARD-Salome
-Copyright EDF-R&D 1996, 2010, 2013
+Copyright EDF-R&D 1996, 2010, 2014
 """
-__revision__ = "V1.7"
+__revision__ = "V1.8"
 #
 import os
+import sys
 #
 # ==================================
 # Repertoire a personnaliser
@@ -44,7 +45,11 @@ if not os.path.isdir(dircase) :
 # ==================================
 # Ce repertoire contient les fichiers de donnees : tutorial_1.00.med
 pathHomard = os.getenv('HOMARD_ROOT_DIR')
-data_dir = os.path.join(pathHomard, "share/doc/salome/gui/HOMARD/fr/_downloads")
+data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+sys.path.append(data_dir)
+from tutorial_util import gzip_gunzip
+gzip_gunzip(data_dir, 1, -1)
+# ==================================
 #
 import salome
 salome.salome_init()
@@ -88,5 +93,9 @@ Iter_1_3.SetMeshFile(dircase+'/maill.03.med')
 Iter_1_3.AssociateHypo('Hypo_1')
 codret = Iter_1_3.Compute(1, 2)
 
+# ==================================
+gzip_gunzip(data_dir, 1, 1)
+# ==================================
+
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)
index bdcafbf761fe152e84acd30925cc39855cd4e5c8..01f36f6d44382d135df47088453e546e3ab0716c 100755 (executable)
 
 """
 Exemple de couplage HOMARD-Salome
-Copyright EDF-R&D 1996, 2010, 2013
+Copyright EDF-R&D 1996, 2010, 2014
 """
-__revision__ = "V1.8"
+__revision__ = "V1.9"
 #
 import os
+import sys
 #
 # ==================================
 # Repertoire a personnaliser
@@ -44,7 +45,11 @@ if not os.path.isdir(dircase) :
 # ==================================
 # Ce repertoire contient les fichiers de donnees : tutorial_2.00.med
 pathHomard = os.getenv('HOMARD_ROOT_DIR')
-data_dir = os.path.join(pathHomard, "share/doc/salome/gui/HOMARD/fr/_downloads")
+data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+sys.path.append(data_dir)
+from tutorial_util import gzip_gunzip
+gzip_gunzip(data_dir, 2, -1)
+# ==================================
 #
 import salome
 salome.salome_init()
@@ -98,5 +103,9 @@ Iter_2_2.SetMeshFile(dircase+'/maill.02.med')
 Iter_2_2.AssociateHypo('Hypo_2_bis')
 codret = Iter_2_2.Compute(1, 2)
 
+# ==================================
+gzip_gunzip(data_dir, 2, 1)
+# ==================================
+
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)
old mode 100644 (file)
new mode 100755 (executable)
index 922f65d..ad3afb3
 
 """
 Exemple de couplage HOMARD-Salome
-Copyright EDF-R&D 1996, 2010, 2013
+Copyright EDF-R&D 1996, 2010, 2014
 """
-__revision__ = "V1.7"
+__revision__ = "V1.8"
 #
 import os
+import sys
 #
 # ==================================
 # Repertoire a personnaliser
@@ -44,7 +45,11 @@ if not os.path.isdir(dircase) :
 # ==================================
 # Ce repertoire contient les fichiers de donnees : tutorial_3.00.med, tutorial_3.01.med
 pathHomard = os.getenv('HOMARD_ROOT_DIR')
-data_dir = os.path.join(pathHomard, "share/doc/salome/gui/HOMARD/fr/_downloads")
+data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+sys.path.append(data_dir)
+from tutorial_util import gzip_gunzip
+gzip_gunzip(data_dir, 3, -1)
+# ==================================
 #
 import salome
 salome.salome_init()
@@ -126,6 +131,10 @@ Iter_3_2_bis.SetFieldFile(data_dir+'/tutorial_3.01.med')
 Iter_3_2_bis.SetTimeStepRank(1, 1)
 Iter_3_2_bis.AssociateHypo('Hypo_1vers2_bis')
 codret = Iter_3_2_bis.Compute(1, 2)
-#
+
+# ==================================
+gzip_gunzip(data_dir, 3, 1)
+# ==================================
+
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)
old mode 100644 (file)
new mode 100755 (executable)
index 0ff9e74..2740563
 
 """
 Exemple de couplage HOMARD-Salome
-Copyright EDF-R&D 1996, 2011, 2013
+Copyright EDF-R&D 1996, 2011, 2014
 """
-__revision__ = "V2.3"
+__revision__ = "V2.4"
 #
 import os
+import sys
 #
 # ==================================
 # Repertoire a personnaliser
@@ -44,7 +45,11 @@ if not os.path.isdir(dircase) :
 # ==================================
 # Ce repertoire contient les fichiers de donnees : tutorial_4.00.med, tutorial_4.fr.med
 pathHomard = os.getenv('HOMARD_ROOT_DIR')
-data_dir = os.path.join(pathHomard, "share/doc/salome/gui/HOMARD/fr/_downloads")
+data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+sys.path.append(data_dir)
+from tutorial_util import gzip_gunzip
+gzip_gunzip(data_dir, 4, -1)
+# ==================================
 #
 import salome
 salome.salome_init()
@@ -114,5 +119,9 @@ Iter_4_3.SetMeshFile(dircase+'/maill.03.med')
 Iter_4_3.AssociateHypo('Hypo_4_bis')
 codret = Iter_4_3.Compute(1, 2)
 
+# ==================================
+gzip_gunzip(data_dir, 4, 1)
+# ==================================
+
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)
old mode 100644 (file)
new mode 100755 (executable)
index 494eec2..e82b99c
 
 """
 Exemple de couplage HOMARD-Salome
-Copyright EDF-R&D 1996, 2010, 2013
+Copyright EDF-R&D 1996, 2010, 2014
 """
-__revision__ = "V1.6"
+__revision__ = "V1.7"
 #
 import os
+import sys
 #
 # ==================================
 # Repertoire a personnaliser
@@ -44,7 +45,11 @@ if not os.path.isdir(dircase) :
 # ==================================
 # Ce repertoire contient les fichiers de donnees : tutorial_5.00.med, tutorial_5.fr.med
 pathHomard = os.getenv('HOMARD_ROOT_DIR')
-data_dir = os.path.join(pathHomard, "share/doc/salome/gui/HOMARD/fr/_downloads")
+data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+sys.path.append(data_dir)
+from tutorial_util import gzip_gunzip
+gzip_gunzip(data_dir, 5, -1)
+# ==================================
 #
 import salome
 salome.salome_init()
@@ -98,6 +103,9 @@ Iter_5_2.SetMeshFile(dircase+'/maill.02.med')
 Iter_5_2.AssociateHypo('Hypo_5_bis')
 codret = Iter_5_2.Compute(1, 2)
 
+# ==================================
+gzip_gunzip(data_dir, 5, 1)
+# ==================================
 
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)
diff --git a/doc/files/tutorial_util.py b/doc/files/tutorial_util.py
new file mode 100755 (executable)
index 0000000..19f3b53
--- /dev/null
@@ -0,0 +1,97 @@
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2011-2014  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""
+Python script for HOMARD
+Copyright EDF-R&D 2014
+"""
+__revision__ = "V1.0"
+
+import os
+import sys
+#========================================================================
+#========================================================================
+def gzip_gunzip(data_dir, num_tuto, option) :
+  """
+Compression/Uncompression of the med files of a directory such as tutorial_x.nn.med
+data_dir: directory
+num_tuto: number of the tutorial
+option  : 1: compression, -1: uncompression
+Copyright EDF-R&D 2014
+  """
+#
+  ficloc_basis = "tutorial_%d" % num_tuto
+#
+  ok = True
+  num = -1
+#
+# Uncompression
+#
+  if ( option == -1 ) :
+#
+    while ok :
+      num += 1
+      ficloc = ficloc_basis + ".%02d.med" % num
+      nomfic = os.path.join(data_dir, ficloc)
+      if not os.path.isfile(nomfic) :
+        ficloc += ".gz"
+        nomfic = os.path.join(data_dir, ficloc)
+        if os.path.isfile(nomfic) :
+          os.system("gunzip "+nomfic)
+        else :
+          ok = False
+          break
+#
+    ficloc = ficloc_basis + ".fr.med"
+    nomfic = os.path.join(data_dir, ficloc)
+    if not os.path.isfile(nomfic) :
+      ficloc += ".gz"
+      nomfic = os.path.join(data_dir, ficloc)
+      if os.path.isfile(nomfic) :
+        os.system("gunzip "+nomfic)
+#
+# Compression
+#
+  elif ( option == 1 ) :
+#
+    while ok :
+      num += 1
+      ficloc = ficloc_basis + ".%02d.med.gz" % num
+      nomfic = os.path.join(data_dir, ficloc)
+      if not os.path.isfile(nomfic) :
+        ficloc = ficloc_basis + ".%02d.med" % num
+        nomfic = os.path.join(data_dir, ficloc)
+        if os.path.isfile(nomfic) :
+          os.system("gzip "+nomfic)
+        else :
+          ok = False
+          break
+#
+    ficloc = ficloc_basis + ".fr.med.gz"
+    nomfic = os.path.join(data_dir, ficloc)
+    if not os.path.isfile(nomfic) :
+      ficloc = ficloc_basis + ".fr.med"
+      nomfic = os.path.join(data_dir, ficloc)
+      if os.path.isfile(nomfic) :
+        os.system("gzip "+nomfic)
+#
+  return
+#
+#========================================================================
+#========================================================================
index 46ae9688482594953267a69d1d046321b2980202..204a67f0d632bc1117ecf1d39ae2ece72eb46e90 100644 (file)
@@ -36,13 +36,14 @@ On fera ici trois raffinements uniformes successifs du maillage contenu dans le
   * le maillage produit porte toujours le même nom. Cela ne pose pas de problème car il est stocké dans des fichiers différents.
 
 .. literalinclude:: ../files/tutorial_1.py
-   :lines: 57-89
+   :lines: 62-94
 
 .. note::
   Téléchargement des fichiers
 
   * :download:`maillage initial<../files/tutorial_1.00.med.gz>`
   * :download:`commandes python<../files/tutorial_1.py>`
+  * :download:`commandes python de l'utilitaire de compression<../files/tutorial_util.py>`
 
 
 Raffinement par des zones
@@ -52,13 +53,14 @@ Raffinement par des zones
 On procède ici au raffinement selon des zones. Pour passer du maillage initial au maillage 'M_1', on utilise une boîte encadrant le plan z=1 et une sphère centrée sur l'origine de rayon 1.05. Puis pour passer du maillage 'M_1' au maillage 'M_2', on remplace la sphère par une boîte encadrant le cube de côté 0.5, pointant sur l'origine et on déraffine les mailles contenues dans la toute première zone.
 
 .. literalinclude:: ../files/tutorial_2.py
-   :lines: 57-99
+   :lines: 62-104
 
 .. note::
   Téléchargement des fichiers
 
   * :download:`maillage initial<../files/tutorial_2.00.med.gz>`
   * :download:`commandes python<../files/tutorial_2.py>`
+  * :download:`commandes python de l'utilitaire de compression<../files/tutorial_util.py>`
 
 
 Raffinement selon un champ
@@ -69,7 +71,7 @@ On proc
 Pour adapter le maillage H_1 issu de l'itération Iter_1, deux variantes sont appliquées. Dans la première, Iter_2, le champ est un champ scalaire d'indicateurs d'erreur et on découpe les 1.5% de mailles où l'erreur est la plus grande. Dans la seconde variante, Iter_2_bis, on se base sur un champ vectoriel et on examine le saut de ce vecteur entre une maille et ses voisines : on découpera là où la norme infinie de ce saut est supérieure au seuil absolu de 0.0001.
 
 .. literalinclude:: ../files/tutorial_3.py
-   :lines: 57-128
+   :lines: 62-133
 
 .. note::
   Téléchargement des fichiers
@@ -77,6 +79,7 @@ Pour adapter le maillage H_1 issu de l'it
   * :download:`maillage et champ étape 0<../files/tutorial_3.00.med.gz>`
   * :download:`maillage et champ étape 1<../files/tutorial_3.01.med.gz>`
   * :download:`commandes python<../files/tutorial_3.py>`
+  * :download:`commandes python de l'utilitaire de compression<../files/tutorial_util.py>`
 
 
 Suivi de frontières courbes
@@ -88,7 +91,7 @@ On teste ici le suivi des fronti
 Le schéma YACS réalisant cette adaptation est téléchargeable.
 
 .. literalinclude:: ../files/tutorial_4.py
-   :lines: 57-115
+   :lines: 62-120
 
 .. note::
   Téléchargement des fichiers
@@ -96,6 +99,7 @@ Le sch
   * :download:`maillage initial<../files/tutorial_4.00.med.gz>`
   * :download:`maillage de la frontière discrète<../files/tutorial_4.fr.med.gz>`
   * :download:`commandes python<../files/tutorial_4.py>`
+  * :download:`commandes python de l'utilitaire de compression<../files/tutorial_util.py>`
   * :download:`schéma YACS<../files/tutorial_4.xml>`
 
 
@@ -107,7 +111,7 @@ Les instructions pour adapter un maillage 2D sont exactement identiques 
 Dans le cas présenté ici, on raffine une première fois toutes les mailles contenues dans un disque percé, puis dans une seconde itération, toutes les mailles contenues dans un rectangle. On notera l'utilisation du suivi des frontières circulaires du domaine.
 
 .. literalinclude:: ../files/tutorial_5.py
-   :lines: 57-99
+   :lines: 62-104
 
 .. note::
   Téléchargement des fichiers
@@ -115,7 +119,9 @@ Dans le cas pr
   * :download:`maillage initial<../files/tutorial_5.00.med.gz>`
   * :download:`maillage de la frontière discrète<../files/tutorial_5.fr.med.gz>`
   * :download:`commandes python<../files/tutorial_5.py>`
+  * :download:`commandes python de l'utilitaire de compression<../files/tutorial_util.py>`
 
 
 .. toctree::
    :maxdepth: 2
+
index 429306e4f0b88fc3a1091907097dbc04717930a1..4281c27eeca5d1440b6f1590c04045ff675a6ee7 100644 (file)
    #define HOMARDIMPL_EXPORT
 #endif
 
+// La gestion des repertoires
+#ifndef CHDIR
+  #ifdef WIN32
+    #define CHDIR _chdir
+  #else
+    #define CHDIR chdir
+  #endif
+#endif
+
 #endif
index 48bcf26d335e049c3085620a48253ef6270d18d7..0aaea7006d7525615b160107ee88d56378eb6e8b 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "HOMARD_Cas.hxx"
 #include "utilities.h"
+#include "HOMARD.hxx"
 #include <iostream>
 #include <sys/stat.h>
 
@@ -113,25 +114,18 @@ int HOMARD_Cas::SetDirName( const char* NomDir )
   MESSAGE("SetDirName, _ListIter.size() : "<<_ListIter.size());
   if ( _ListIter.size() > 1 ) { erreur = 1 ; }
   // Creation
-#ifndef WIN32
-  if ( chdir(NomDir) == 0 ) 
-#else
-  if ( _chdir(NomDir) == 0 ) 
-#endif
+  if ( CHDIR(NomDir) == 0 )
   { _NomDir = std::string( NomDir ); }
   else
   {
 
 #ifndef WIN32
     if ( mkdir(NomDir, S_IRWXU|S_IRGRP|S_IXGRP) == 0 )
-    {
-      if ( chdir(NomDir) == 0 ) 
 #else
     if ( _mkdir(NomDir) == 0 )
-    {
-      if ( _chdir(NomDir) == 0 ) 
 #endif
-      { _NomDir = std::string( NomDir ); }
+    {
+      if ( CHDIR(NomDir) == 0 ) { _NomDir = std::string( NomDir ); }
       else                      { erreur = 2 ; }
     }
     else { erreur = 2 ; }
index 5377c1ffb05e392ae7e76e8548fd8232bfc59020..258d60187e612869d17411ef51409357b5ff3a11 100644 (file)
@@ -22,6 +22,7 @@
 #include "MonEditBoundaryAn.h"
 #include "MonCreateBoundaryDi.h"
 #include "MonEditBoundaryDi.h"
+#include "HOMARD.hxx"
 
 #include <QFileDialog>
 #include <QMessageBox>
@@ -170,11 +171,7 @@ bool MonCreateCase::PushOnApply(int option)
       return false;
     }
   }
-#ifndef WIN32
-  if (chdir(aDirName.toStdString().c_str()) != 0)
-#else
-  if (_chdir(aDirName.toStdString().c_str()) != 0)
-#endif
+  if (CHDIR(aDirName.toStdString().c_str()) != 0)
   {
     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
                               QObject::tr("HOM_CASE_DIRECTORY_3") );
index fb43a48788639b3c0da5d09b9e607a3dc1fb95e2..d9b21d91e4faf1625e1236b953a47185bf184661 100644 (file)
@@ -18,6 +18,7 @@
 //
 
 #include "MonCreateYACS.h"
+#include "HOMARD.hxx"
 
 #include <QFileDialog>
 #include <QMessageBox>
@@ -148,11 +149,7 @@ bool MonCreateYACS::PushOnApply()
       return false;
     }
   }
-#ifndef WIN32
-  if (chdir(aDirName.toStdString().c_str()) != 0)
-#else
-  if (_chdir(aDirName.toStdString().c_str()) != 0)
-#endif
+  if (CHDIR(aDirName.toStdString().c_str()) != 0)
   {
     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
                               QObject::tr("HOM_CASE_DIRECTORY_3") );
index 32ba01b417cbe456a2b58b1e810f61a7a9d5d557..c18b00e755bfbecf45e057d3c3348e219fe26be3 100644 (file)
@@ -18,6 +18,7 @@
 //
 
 #include "MonMeshInfo.h"
+#include "HOMARD.hxx"
 
 #include <QFileDialog>
 #include <QMessageBox>
@@ -115,11 +116,7 @@ bool MonMeshInfo::PushOnApply()
       return false;
     }
   }
-#ifndef WIN32
-  if (chdir(aDirName.toStdString().c_str()) != 0)
-#else
-  if (_chdir(aDirName.toStdString().c_str()) != 0)
-#endif
+  if (CHDIR(aDirName.toStdString().c_str()) != 0)
   {
     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
                               QObject::tr("HOM_CASE_DIRECTORY_3") );
index ebc280baff724034bf9164db3290e66c5ac5b137..ea6575f6e8bd65bd469b216b435ffc3d8030cbb5 100644 (file)
@@ -18,6 +18,7 @@
 //
 
 #include "MonPursueIteration.h"
+#include "HOMARD.hxx"
 
 #include <QFileDialog>
 #include <QMessageBox>
@@ -107,11 +108,7 @@ bool MonPursueIteration::PushOnApply()
       return false;
     }
   }
-#ifndef WIN32
-  if (chdir(aDirName.toStdString().c_str()) != 0)
-#else
-  if (_chdir(aDirName.toStdString().c_str()) != 0)
-#endif
+  if (CHDIR(aDirName.toStdString().c_str()) != 0)
   {
     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
                               QObject::tr("HOM_CASE_DIRECTORY_3") );
@@ -125,11 +122,7 @@ bool MonPursueIteration::PushOnApply()
                               QObject::tr("HOM_START_DIRECTORY_1") );
     return false;
   }
-#ifndef WIN32
-  if (chdir(aDirNameStart.toStdString().c_str()) != 0)
-#else
-  if (_chdir(aDirNameStart.toStdString().c_str()) != 0)
-#endif
+  if (CHDIR(aDirNameStart.toStdString().c_str()) != 0)
   {
     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
                               QObject::tr("HOM_START_DIRECTORY_3") );
index bd1db458c7ca2f688a6d99b498dd4b93a298836f..f7f2dc6bbd5b5a7b5309ab00afd5ba535cbbab74 100755 (executable)
@@ -1248,11 +1248,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas,
 
   // A. Decodage du point de reprise
   // A.1. Controle du repertoire de depart de l'iteration
-#ifndef WIN32
-  codret = chdir(DirNameStart) ;
-#else
-  codret = _chdir(DirNameStart) ;
-#endif
+  codret = CHDIR(DirNameStart) ;
   if ( codret != 0 )
   {
     SALOME::ExceptionStruct es;
@@ -1436,11 +1432,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas,
     throw SALOME::SALOME_Exception(es);
   }
   // E.3. Copie du maillage HOMARD au format MED
-#ifndef WIN32
-  codret = chdir(DirNameStart) ;
-#else
-  codret = _chdir(DirNameStart) ;
-#endif
+  codret = CHDIR(DirNameStart) ;
   std::string commande = "cp " + file_maillage_homard + " " + nomDirIterTotal ;
   MESSAGE ( "commande : " << commande ) ;
   codret = system(commande.c_str()) ;
@@ -1459,11 +1451,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas,
   delete[] MeshName ;
   delete[] MeshFile ;
 
-#ifndef WIN32
-  chdir(nomDirWork.c_str());
-#else
-  _chdir(nomDirWork.c_str());
-#endif
+  CHDIR(nomDirWork.c_str());
   return HOMARD::HOMARD_Cas::_duplicate(myCase);
 }
 //=============================================================================
@@ -1522,11 +1510,7 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb
   int NumeIterMax = -1 ;
 
   // A.1. Controle du repertoire de depart du cas
-#ifndef WIN32
-  codret = chdir(DirNameStart) ;
-#else
-  codret = _chdir(DirNameStart) ;
-#endif
+  codret = CHDIR(DirNameStart) ;
   if ( codret != 0 )
   {
     SALOME::ExceptionStruct es;
@@ -1556,11 +1540,11 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb
 #endif
     if ( ( DirName_1 != "." ) && ( DirName_1 != ".." ) )
     {
-#ifndef WIN32
-      if ( chdir(DirName_1.c_str()) == 0 )
+      if ( CHDIR(DirName_1.c_str()) == 0 )
       {
 //      On cherche le fichier de configuration dans ce sous-repertoire
-        codret = chdir(DirNameStart);
+        codret = CHDIR(DirNameStart);
+#ifndef WIN32
         DIR *dp_1;
         struct dirent *dirp_1;
         dp_1  = opendir(DirName_1.c_str()) ;
@@ -1568,9 +1552,6 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb
         {
           std::string file_name_1(dirp_1->d_name);
 #else
-     if ( _chdir(DirName_1.c_str()) == 0 )
-     {
-        codret = _chdir(DirNameStart);
         HANDLE hFind1 = INVALID_HANDLE_VALUE;
         WIN32_FIND_DATA ffd1;
         hFind1 = FindFirstFile(DirName_1.c_str(), &ffd1);
@@ -1583,11 +1564,7 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb
           if ( bilan != string::npos )
           {
   // Decodage du fichier pour trouver le numero d'iteration
-#ifndef WIN32
-            chdir(DirName_1.c_str()) ;
-#else
-            _chdir(DirName_1.c_str()) ;
-#endif
+            CHDIR(DirName_1.c_str()) ;
 
             std::ifstream fichier( file_name_1.c_str() );
             if ( fichier ) // ce test échoue si le fichier n'est pas ouvert
@@ -1634,11 +1611,7 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb
               es.text = CORBA::string_dup(text.c_str());
               throw SALOME::SALOME_Exception(es);
             }
-#ifndef WIN32
-            chdir(DirNameStart) ;
-#else
-            _chdir(DirNameStart) ;
-#endif
+            CHDIR(DirNameStart) ;
           }
           if ( existe ) { break ; }
         }
@@ -1653,12 +1626,10 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb
   }
 #ifndef WIN32
   closedir(dp);
-  chdir(nomDirWork.c_str());
 #else
-    FindClose(hFind);
-  }
-  _chdir(nomDirWork.c_str());
+  FindClose(hFind);
 #endif
+  CHDIR(nomDirWork.c_str());
 
   if ( ( Number >= 0 && ( !existe ) ) || ( Number < 0 && ( NumeIterMax == -1 ) ) )
   {
@@ -2536,11 +2507,7 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena
 
    // D. On passe dans le repertoire de l'iteration a calculer
   MESSAGE ( ". On passe dans DirCompute = " << DirCompute );
-#ifndef WIN32
-  chdir(DirCompute);
-#else
-  _chdir(DirCompute);
-#endif
+  CHDIR(DirCompute);
 
   // E. Les donnees de l'execution HOMARD
   // E.1. L'objet du texte du fichier de configuration
@@ -2669,11 +2636,7 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena
     delete myDriver;
     MESSAGE ( ". On retourne dans nomDirWork = " << nomDirWork );
 
-#ifndef WIN32
-    chdir(nomDirWork.c_str());
-#else
-    _chdir(nomDirWork.c_str());
-#endif
+    CHDIR(nomDirWork.c_str());
   }
 
   return codretexec ;
@@ -2841,11 +2804,7 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num )
 {
   MESSAGE ( "CreateDirNameIter : nomrep ="<< nomrep << ", num = "<<num);
   // On verifie que le repertoire parent existe
-#ifndef WIN32
-  int codret = chdir(nomrep) ;
-#else
-  int codret = _chdir(nomrep) ;
-#endif
+  int codret = CHDIR(nomrep) ;
   if ( codret != 0 )
   {
     SALOME::ExceptionStruct es;
@@ -2862,11 +2821,7 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num )
   {
     // On passe dans le repertoire parent
 
-#ifndef WIN32
-  chdir(nomrep);
-#else
-  _chdir(nomrep);
-#endif
+    CHDIR(nomrep);
     // On recherche un nom sous la forme Iabc, avec abc representant le numero
     int jaux ;
     if      ( num <    100 ) { jaux = 2 ; }
@@ -2880,11 +2835,7 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num )
     DirNameA << "I" << iaux.str();
     // Si on ne pas peut entrer dans le repertoire, on doit verifier
     // que c'est bien un probleme d'absence
-#ifndef WIN32
-    if ( chdir(DirNameA.str().c_str()) != 0 )
-#else
-    if ( _chdir(DirNameA.str().c_str()) != 0 )
-#endif
+    if ( CHDIR(DirNameA.str().c_str()) != 0 )
     {
       bool existe = false ;
 #ifndef WIN32
@@ -2908,7 +2859,6 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num )
 #ifndef WIN32
       closedir(dp);
 #else
-      }
       FindClose(hFind);
 #endif
       if ( !existe )
@@ -2923,11 +2873,7 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num )
 
   MESSAGE ( "==> DirName = " << DirName);
   MESSAGE ( ". On retourne dans nomDirActuel = " << nomDirActuel );
-#ifndef WIN32
-  chdir(nomDirActuel.c_str());
-#else
-  _chdir(nomDirActuel.c_str());
-#endif
+  CHDIR(nomDirActuel.c_str());
   return CORBA::string_dup( DirName.c_str() );
 }
 //=============================================================================
@@ -2954,13 +2900,11 @@ char* HOMARD_Gen_i::ComputeDirManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD::
   MESSAGE (". DirCompute = " << DirCompute.str() );
 
   // B.3.3. Si le sous-repertoire n'existe pas, on le cree
-#ifndef WIN32
-  if (chdir(DirCompute.str().c_str()) != 0)
+  if (CHDIR(DirCompute.str().c_str()) != 0)
   {
+#ifndef WIN32
     if (mkdir(DirCompute.str().c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0)
 #else
-  if (_chdir(DirCompute.str().c_str()) != 0)
-  {
     if (_mkdir(DirCompute.str().c_str()) != 0)
 #endif
     {