Salome HOME
23288: [CEA 1626] Meshgems v2.3
authoreap <eap@opencascade.com>
Tue, 14 Jun 2016 11:35:16 +0000 (14:35 +0300)
committereap <eap@opencascade.com>
Tue, 14 Jun 2016 11:35:16 +0000 (14:35 +0300)
24 files changed:
bin/CMakeLists.txt
bin/mg-tetra_hpc.bash
bin/mg-tetra_hpc.py [new file with mode: 0644]
doc/salome/gui/GHS3DPRLPLUGIN/input/ghs3dprl_hypo.doc
idl/GHS3DPRLPlugin_Algorithm.idl
src/GHS3DPRLPlugin/GHS3DPRLPluginBuilder.py
src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx
src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.hxx
src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx
src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx
src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.cxx
src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.hxx
src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx
src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h
src/gui/GHS3DPRLPlugin_msg_en.ts
src/gui/GHS3DPRLPlugin_msg_fr.ts
src/gui/GHS3DPRLPlugin_msg_ja.ts
src/tepal2med/ghs3dprl_mesh_wrap.cxx
src/tepal2med/ghs3dprl_mesh_wrap.h
src/tepal2med/tepal2med.cxx
src/tepal2med/tetrahpc2med.cxx
src/tools/CMakeLists.txt
src/tools/testMesh.py [new file with mode: 0644]
src/tools/testMeshTest.py [new file with mode: 0644]

index 9519422648ce8339d90f40fb0a61d8ca20e96deb..7908501742dd699d07624eefe800c3c92829be5b 100755 (executable)
@@ -22,10 +22,11 @@ SALOME_CONFIGURE_FILE(VERSION.in VERSION INSTALL ${SALOME_INSTALL_BINS})
 # scripts / static / binaries
 # temporary standalone project version of mg-tetra_hpc.exe
 SET(_bin_SCRIPTS
-  mg-tetra_hpc.bash
+  #mg-tetra_hpc.bash
+  mg-tetra_hpc.py
   mg-tetra_hpc.exe_Linux_64_avril2014
-  meshgems_mpi.c
-  meshgems_mpi.h
+  #meshgems_mpi.c
+  #meshgems_mpi.h
 )
 
 # --- rules ---
index 786a422d3e21d68b11e41a1bfe86432ad83269a0..d48e9de59c69439a49f263a96f2da0922446afd7 100755 (executable)
@@ -1,59 +1,67 @@
 #!/bin/bash
 
 #bash script mg-tetra_hpc.bash
-#we have renamed binary executable mg-tetra_hpc.exe V1.3.0 as mg-tetra_hpc.exe_Linux_64_avril2014
-#to assume call of other beta-versions of distene mg-tetra_hpc.exe code in standalone plugin GHS3DPRLPLUGIN sources
-#and also assume licence file set to overriding licence file of other distene products ( HEXOTIC, GHS3D, etc... )
+#could assume overriding set licence file of user/other new version distene products
 #this script is used for only one call of mg-tetra_hpc.bash from salome plugin GHS3DPRLPLUGIN
 
-#echo "mg-tetra_hpc.bash initial parameters are:" $1 $2 $3 $4 
-echo "mg-tetra_hpc.bash initial parameters are:" $*
-#$0 is ignored
+#$0 have to be ignored: name of script
+echo "mg-tetra_hpc.bash initial parameters are:\n  "$@"\n"
+
+#example mg-tetra_hpc_mpi v2.1.11
+#mpirun -n 6 mg-tetra_hpc_mpi.exe --gradation 1.05 --max_size 0 --min_size 0 --verbose 3 --in /tmp/GHS3DPRL.mesh --out /tmp/GHS3DPRL_out.mesh
 
-CURRENTDIR=`pwd`
-COMPILDIR=`dirname $0`
-echo "COMPILDIR" $COMPILDIR
-echo "CURRENTDIR" $CURRENTDIR
-#if [[ $HOSTNAME == *hpcspot* ]]
-#  then
-#    HOST="hpcspot"
-#  else
-#    HOST="STANDART_CentOs6" #CentOs6 default
-#fi
-#echo "HOST" $HOST
 
-#we need to compile for mg-tetra_hpc.exe
-#DISTENE_LICENSE_FILE is for example, have to be set
+#this is for example, sometimes DISTENE_LICENSE_FILE have to be overriden
 #if [ $HOST == "hpcspot" ]
-#  then
-    #env openmpi centos6.5 hpcspot.com
-#    source /apps/mpi/openmpi-1.6-x86_64-gcc48/env.sh
-    #export DISTENE_LICENSE_FILE="Use global envvar: DLIM8VAR"
-    #export DLIM8VAR="dlim8 1:1:29030@10.27.51.1/002590c96d98::8fbdc02cde090ca0369ad028e839065b97709e3c33e640eb6a3c2c7e40fe3985"
-#  else
-    #env openmpi centos6.5 standart lgls is206786
-#    export WD2=/usr/lib64/openmpi
-#    export PATH=$WD2/bin:${PATH}
-#    export LD_LIBRARY_PATH=$COMPILDIR:$WD2/lib:${LD_LIBRARY_PATH}
-    #export DISTENE_LICENSE_FILE="Use global envvar: DLIM8VAR"
-    #export DLIM8VAR="dlim8 1:1:29030@132.166.151.49/84c419b8::87af196ab2a936ab31363624539bff8096fbe1f3c83028c8f6b399b0a904ef85"
+# then
+#  export DISTENE_LICENSE_FILE="Use global envvar: DLIM8VAR"
+#  export DLIM8VAR="dlim8 1:1:29030@10.27.51.1/002590c96d98::8fbdc02cde090ca0369ad028e839065b97709e3c33e640eb6a3c2c7e40fe3985"
+# else
+#   export DISTENE_LICENSE_FILE="Use global envvar: DLIM8VAR"
+#   export DLIM8VAR="dlim8 1:1:29030@132.166.151.49/84c419b8::87af196ab2a936ab31363624539bff8096fbe1f3c83028c8f6b399b0a904ef85"
+#fi
+
+
+#this is for example, sometimes need to compile stubs/libmeshgems_mpi.so for mg-tetra_hpc.exe, depends of openmpi system or not#CURRENTDIR=`pwd`
+CURRENTDIR=`pwd`
+COMPILDIR=$MESHGEMSHOME/stubs           #/export/home/prerequisites_SALOME_780/MeshGems-2.1-11/FROM_nothing/stubs
+MPI_EXE=`which mg-tetra_hpc_mpi.exe`
+TARGETDIR=$MESHGEMSHOME/lib/Linux_64    #/export/home/prerequisites_SALOME_780/MeshGems-2.1-11/FROM_nothing/lib/Linux_64
+echo "CURRENTDIR=" $CURRENTDIR
+#rm $TARGETDIR/libmeshgems_mpi.so #compile every times
+#if [ ! -f $TARGETDIR/libmeshgems_mpi.so ]
+#then
+  echo "Compile libmeshgems_mpi.so with current openmpi:"
+  echo `which mpicc`
+  echo "COMPILDIR=" $COMPILDIR
+  echo "TARGETDIR=" $TARGETDIR
+  cd $COMPILDIR
+  mpicc  meshgems_mpi.c -DMESHGEMS_LINUX_BUILD -I../include -shared -fPIC -o $TARGETDIR/libmeshgems_mpi.so
+  find $MESHGEMSHOME -name "libmeshgems_mpi.so"
+  cd $CURRENTDIR
 #fi
 
-cd $COMPILDIR
-if [ ! -f libmeshgems_mpi.so ]
-then
-  echo "libmeshgems_mpi.sols does not exist, I compile it..."
-  mpicc meshgems_mpi.c -shared -fPIC -o libmeshgems_mpi.so
-  ls -alt lib*
-fi
-cd $CURRENTDIR
+#example version mpi a mano
+#cd /export/home/prerequisites_SALOME_780/MeshGems-2.1-11/FROM_nothing/stubs
+#mpicc meshgems_mpi.c -DMESHGEMS_LINUX_BUILD -I../include -shared -fPIC -o libmeshgems_mpi.so
+#cp -f libmeshgems_mpi.so /export/home/prerequisites_SALOME_780/MeshGems-2.1-11/FROM_nothing/lib/Linux_64/.
 
 echo "mg-tetra_hpc.bash assume licence file set:"
-env | grep DLIM
+echo DLIM8VAR=$DLIM8VAR
+echo DISTENE_LICENSE_FILE=$DISTENE_LICENSE_FILE
+
+#version multithread: why not use plugin/hypothesis mg-tetra.exe instead?
+#which mg-tetra_hpc.exe
+#echo mg-tetra_hpc.exe --max_number_of_threads $2 --number_of_subdomains $2 --in ... --out /tmp/GHS3DPRL_out.mesh --verbose 3
+#for multithread only one /tmp/GHS3DPRL_out.mesh created...
+#TODO create one med file from /tmp/GHS3DPRL_out.mesh if utile later
+
+
+which mg-tetra_hpc_mpi.exe
+#echo mpirun -n $2 mg-tetra_hpc_mpi.exe ${@:3:30}
+echo mpirun -n $2 mg-tetra_hpc_mpi.exe --in /tmp/GHS3DPRL.mesh --out /tmp/GHS3DPRL_out.mesh
+mpirun -n $2 mg-tetra_hpc_mpi.exe --in /tmp/GHS3DPRL.mesh --out /tmp/GHS3DPRL_out.mesh
 
-#mg-tetra_hpc.exe_Linux_64_avril2014 --help
-#ldd `which mg-tetra_hpc.exe_Linux_64_avril2014`
-#mpirun -n $2 mg-tetra_hpc.exe_Linux_64_avril2014 ${@:3:30}
-mpirun -n $2 $MESHGEMS_ROOT_DIR/bin/run_mg-tetra_hpc.sh ${@:3:30}
+#typically write files /tmp/GHS3DPRL_out.00000?.mesh  & /tmp/GHS3DPRL_out.00000?.global
 
 
diff --git a/bin/mg-tetra_hpc.py b/bin/mg-tetra_hpc.py
new file mode 100644 (file)
index 0000000..ca6f4ed
--- /dev/null
@@ -0,0 +1,320 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# %% LICENSE_SALOME_CEA_BEGIN
+# Copyright (C) 2008-2016  CEA/DEN
+# 
+# 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
+# %% LICENSE_END
+
+
+"""
+run mg_tetra_hpc.exe or mg_tetra_hpc_mpi.exe
+
+example linux usage:
+- simple run:
+  ./mg-tetra_hpc.py --help
+  ./mg-tetra_hpc.py -n 3 --in /tmp/GHS3DPRL.mesh --out /tmp/GHS3DPRL_out.mesh --gradation 1.05 --min_size 0.001 --max_size 1.1 --multithread no > /tmp/tetrahpc.log
+"""
+
+import os
+import sys
+import time
+import platform
+import argparse as AP
+import pprint as PP #pretty print
+import subprocess as SP #Popen
+import multiprocessing as MP #cpu_count
+
+verbose = False
+
+OK = "ok"
+KO = "KO"
+OKSYS = 0 #for linux
+KOSYS = 1 #for linux
+
+NB_PROCS = MP.cpu_count()   #current cpu number of proc
+NAME_OS = platform.system() #'Linux' or 'Windows'
+
+##########################################################################
+# utilities
+##########################################################################
+
+def okToSys(aResult, verbose=False):
+  """to get windows or linux result of script"""
+  
+  def extendList(alist):
+    """utility extend list of lists of string results with ok or KO"""
+    #bad: list(itertools.chain.from_list(alist)) iterate on str
+    res = []
+    if type(alist) != list:
+      return [alist]
+    else:
+      for i in alist:
+        if type(i) == str:
+           res.append(i)
+        else:
+           res.extend(extendList(i))
+    return res
+      
+  resList = extendList(aResult)
+  if resList == []:
+    if verbose: print("WARNING: result no clear: []")
+    return KOSYS
+    
+  rr = OK
+  for ri in resList:
+    if ri[0:2] != OK:
+      if verbose: print ri
+      rr = KO
+
+  if verbose: print("INFO: result: %s" % rr)
+  if rr == OK:
+    return OKSYS
+  else:
+    return KOSYS
+
+##########################################################################
+def getDirAndName(datafile):
+  path, namefile = os.path.split(os.path.realpath(datafile))
+  rootpath = os.getcwd()
+  return (path, rootpath, namefile)
+
+
+##########################################################################
+class ArgRange(object):
+  """
+  ArgumentParser utility for range float or in in arguments
+  """
+  def __init__(self, start, end):
+    self.start = start
+    self.end = end
+
+  def __eq__(self, other):
+    return self.start <= other <= self.end
+
+  def __repr__(self):
+    return "[%s,%s]" % (self.start, self.end)
+
+
+##########################################################################
+def exec_command(cmd, verbose=False):
+  """Exec ONE command with popen"""
+
+  time.sleep(3) #wait for (MPI) flush files
+  if verbose: print("launch process:\n  %s" % cmd)
+  try:
+    pipe = SP.Popen(cmd, shell=True, stdout=SP.PIPE, stderr=SP.PIPE )
+  except Exception as e:
+    result = KO + " ERROR: we have a problem popen on: %s" % PP.pformat(cmd)
+    return result
+  
+  (out, error) = pipe.communicate()
+  pipe.wait()
+  
+  print(out)
+  print(error)
+  result = OK + " INFO: seems final ok for: %s" % PP.pformat(cmd)
+  time.sleep(3) #wait for (MPI) flush files
+  return result
+
+
+
+##########################################################################
+def force_DISTENE_LICENSE_FILE():
+  """
+  conditionaly overriding/set environ variable DISTENE_LICENSE_FILE,
+  from/if existing FORCE_DISTENE_LICENSE_FILE environ variable
+  (for test new version MeshGems etc...)
+  """
+  """
+  #example:
+  DISTENE_LICENSE_FILE=Use global envvar: DLIM8VAR
+  DLIM8VAR=dlim8 1:1:29030@132.166.151.49/84c419b8::87af196ab2a936ab31363624539bff8096fbe1f3c83028c8f6b399b0a904ef85
+  overriden by
+  FORCE_DISTENE_LICENSE_FILE=/export/home/wambeke/essai_meshgems2.3/dlim8.key
+  """
+  force = os.getenv("FORCE_DISTENE_LICENSE_FILE")
+  if force != None:
+    os.environ["DISTENE_LICENSE_FILE"] = force
+    os.environ["DLIM8VAR"] = "NOTHING"
+    """
+    #export PATH=/export/home/prerequisites_SALOME_780_LAURENT/openmpi-1.8.4/FROM_nothing/bin:$PATH
+    #do not work prefer set before salome launch
+    OPENMPI_INSTALL_DIR = "/export/home/prerequisites_SALOME_780_LAURENT/openmpi-1.8.4/FROM_nothing/bin"
+    sys.path.insert(0, OPENMPI_INSTALL_DIR) 
+    #INSTALL_DIR = /export/home/prerequisites_SALOME_780_LAURENT/openmpi-1.8.4/FROM_nothing
+    for i in sys.path[0:10]: print "PATH",i
+    """
+
+
+
+
+##########################################################################
+def launchMultithread(args):
+  if verbose: print("INFO: launchMultithread for %s" % NAME_OS)
+  
+  if NAME_OS == 'Linux':
+    #--out is ONE file: basename_tetra_hpc.mesh
+    outputMulti = os.path.splitext(args.inputFile)[0] + "_tetra_hpc.mesh" #only one file if Multithread
+    outputs = os.path.splitext(args.outputFiles)[0]
+    outputMultiAsMpi = os.path.splitext(args.outputFiles)[0] + ".000001.mesh" #create one output file named as only one from mpi 
+    cmd = "mg-tetra_hpc.exe --max_number_of_threads %i --in %s --gradation %s --max_size %s --min_size %s; cp %s %s; ls -alt %s*; " % \
+          (args.number, args.inputFile, args.gradation, args.max_size, args.min_size, outputMulti, outputMultiAsMpi, outputs)
+  else:
+    return KO +  " ERROR: unknown operating system: %s" % NAME_OS
+  
+  result = exec_command(cmd, verbose=True)
+  return result
+
+
+
+##########################################################################
+def launchMpi(args):
+  if verbose: print("INFO: launchMpi for %s" % NAME_OS)
+  
+  if NAME_OS == 'Linux':  
+    cmd  = ""
+    
+    """ compile libmeshgems_mpi.so: no needs
+    COMPILDIR=os.getenv("MESHGEMSHOME") + "/stubs"
+    TARGETDIR=os.getenv("MESHGEMSHOME") + "/lib/Linux_64"
+    cmd  = "which mg-tetra_hpc_mpi.exe; which mpicc; rm /tmp/GHS3DPRL_out*; "
+    cmd += "cd %s; mpicc meshgems_mpi.c -DMESHGEMS_LINUX_BUILD -I../include -shared -fPIC -o %s/libmeshgems_mpi.so; " % (COMPILDIR, TARGETDIR)
+    """
+
+    outputs = os.path.splitext(args.outputFiles)[0]
+    cmd += "mpirun -n %i mg-tetra_hpc_mpi.exe --in %s --out %s --gradation %s --max_size %s --min_size %s; ls -alt %s*; " % \
+          (args.number, args.inputFile, args.outputFiles, args.gradation, args.max_size, args.min_size, outputs)
+  else:
+    return KO +  " ERROR: unknown operating system: %s" % NAME_OS
+  
+  result = exec_command(cmd, verbose=True)
+  return result
+
+
+##########################################################################
+# main
+##########################################################################
+
+if __name__ == '__main__':
+  parser = AP.ArgumentParser(description='launch tetra_hpc.exe or tetra_hpc_mpi.exe mesh computation', argument_default=None)
+  #./mg-tetra_hpc.py -n 3 --in=/tmp/GHS3DPRL.mesh --out=/tmp/GHS3DPRL_out.mesh --gradation=1.05 --min_size=0.001 --max_size=1.1 --multithread no > /tmp/tetrahpc.log
+
+  parser.add_argument(
+    '-v', '--verbose', 
+    help='set verbose, for debug',
+    action='store_true',
+  )
+  parser.add_argument(
+    '-n', '--number', 
+    help='if multithread: number of threads, else distributed: number of processes MPI',
+    choices=[ArgRange(1, 999999)],
+    type=int,
+    metavar='integer >= 0',
+    default=1,
+  )
+  parser.add_argument(
+    '-m', '--multithread', 
+    help='launch tetra_hpc multithread instead tetra_hpc distributed (MPI)',
+    choices=["no", "yes"],
+    default='no',
+  )
+  parser.add_argument(
+    '-g', '--gradation', 
+    help='size ratio adjacent cell, default 0 is 1.05',
+    type=float,
+    choices=[ArgRange(0.0, 3.0)],
+    metavar='float in [0.,3]',
+    default='0'
+  )
+  parser.add_argument(
+    '-si', '--min_size', 
+    help='min size cell, default 0 is no constraint',
+    type=float,
+    choices=[ArgRange(0.0, 9e99)],
+    metavar='float >= 0',
+    default='0'
+  )
+  parser.add_argument(
+    '-sa', '--max_size', 
+    help='max size cell, default 0 is no constraint',
+    type=float,
+    choices=[ArgRange(0.0, 9e99)],
+    metavar='float >= 0',
+    default='0'
+  )
+  parser.add_argument(
+    '-i', '--inputFile', 
+    help='input file name',
+    #nargs='?',
+    metavar='.../inputFile.mesh'
+  )
+  parser.add_argument(
+    '-o', '--outputFiles', 
+    help='output basename file(s) name',
+    #nargs='?',
+    metavar='.../outputFile.mesh'
+  )
+  """
+  parser.add_argument(
+    '-x', '--xoneargument', 
+    nargs='?',
+    metavar='0|1',
+    choices=['0', '1'],
+    help='one argument, for example',
+    default='0'
+  )
+  """
+  
+    
+  """
+  args is Namespace, may use it as global to store 
+  parameters, data, used arrays and results and other...
+  """
+  args = parser.parse_args()
+  
+  verbose = args.verbose
+  if verbose: print("INFO: args:\n%s" % PP.pformat(args.__dict__))
+
+  if len(sys.argv) == 1: #no args as --help
+    parser.print_help()
+    sys.exit(KOSYS)
+
+  if args.inputFile == None:
+    print("\nERROR: Nothing to do: no input files\n\n%s\n" % PP.pformat(args))
+    parser.print_help()
+    sys.exit(KOSYS)
+
+  if args.outputFiles == None:
+    tmp, _ = os.path.splitext(args.inputFile)
+    args.outputFiles = tmp + "_out.mesh"
+    print("\nWARNING: Default ouput files: %s" % args.outputFiles)
+   
+  force_DISTENE_LICENSE_FILE()
+
+  print("INFO: mg-tetra_hpc.py assume licence file set:\n  DLIM8VAR=%s\n  DISTENE_LICENSE_FILE=%s" % \
+       (os.getenv("DLIM8VAR"), os.getenv("DISTENE_LICENSE_FILE")))
+  if args.multithread == "yes": 
+    result = launchMultithread(args)
+  else:
+    result = launchMpi(args)
+  sys.exit(okToSys(result, verbose=True))
+  
index 867f796d17227bd16250774e04f6a1960321050b..1d1404987d53b56ad6c509e3d9cc6d3158020b66 100644 (file)
@@ -50,6 +50,10 @@ can even exit Salome. Pay attention that in this case MG-Tetra-hpc algorithm wor
 independently of "killSalome.py", and sometimes on another host.
 </li>
 <li>
+<b>Tetra_hpc Multithread</b> - if this box is checked, MG-Tetra-hpc execution
+is with mg_tetra_hpc.exe (multithread version), else mg_tetra_hpc_mpi.exe (MPI distributed version).
+</li>
+<li>
 <b>Merge subdomains</b> - if this box is checked, merge the sub-domains 
 into one mesh and write the output .mesh(b).
 </li>
@@ -361,11 +365,12 @@ algo3d = m.Tetrahedron(smeshBuilder.MG_Tetra_Parallel)
 algo3d.SetMEDName(results)
 algo3d.SetNbPart(4)
 algo3d.SetBackground(False)
+algo3d.SetMultithread(False)
 algo3d.SetKeepFiles(False)
-algo3d.SetToMergeSubdomains(False)
-algo3d.SetToTagSubdomains(False)
-algo3d.SetToOutputInterfaces(False)
-algo3d.SetToDiscardSubdomains(False)
+algo3d.SetGradation(1.05)
+algo3d.SetMinSize(0)
+algo3d.SetMaxSize(0)
+
 
 # Launch meshers
 # --------------
index 5110f8677d2ef00ec7b67f87254fa9a65e4c16ff..adefb3a36eb6462eae1b8caf00af1ef33de631bb 100755 (executable)
@@ -56,20 +56,24 @@ module GHS3DPRLPlugin
     void SetBackground(in boolean value);
     boolean GetBackground();
 
+    void SetMultithread(in boolean value);
+    boolean GetMultithread();
+
     //void SetToMeshHoles(in boolean value);
     //boolean GetToMeshHoles();
-    void SetToMergeSubdomains(in boolean value);
-    boolean GetToMergeSubdomains();
-    
-    void SetToTagSubdomains(in boolean value);
-    boolean GetToTagSubdomains();
     
-    void SetToOutputInterfaces(in boolean value);
-    boolean GetToOutputInterfaces();
-    
-    void SetToDiscardSubdomains(in boolean value);
-    boolean GetToDiscardSubdomains();
+    //void SetToMergeSubdomains(in boolean value);
+    //boolean GetToMergeSubdomains();
+
+    void SetGradation(in float value);
+    float GetGradation();
+
+    void SetMinSize(in float value);
+    float GetMinSize();
+
+    void SetMaxSize(in float value);
+    float GetMaxSize();
+
   };
 
 };
index da66572886f69f3129301e095a580b42c527539e..b6747ccac3b2f51cc118ac1cc40645adc342482c 100644 (file)
@@ -103,40 +103,40 @@ class GHS3DPRL_Algorithm(Mesh_Algorithm):
         self.Parameters().SetNbPart(value)
         pass
 
-    ## When big mesh, start tepal in background
+    ## When big mesh, start tetra_hpc in background
     #  @param value "background mode" flag value
     def SetBackground(self, value):
         self.Parameters().SetBackground(value)
         pass
 
+    ## use multithread version
+    #  @param value "multithread mode" flag value
+    def SetMultithread(self, value):
+        self.Parameters().SetMultithread(value)
+        pass
+
     ## To mesh "holes" in a solid or not. Default is to mesh.
     #  @param toMesh "mesh holes" flag value
     #def SetToMeshHoles(self, toMesh):
     #    self.Parameters().SetToMeshHoles(toMesh)
     #    pass
     
-    ## To Merge Subdomains. Default is to no.
-    #  @param toMesh "MergeSubdomains" flag value
-    def SetToMergeSubdomains(self, toMesh):
-        self.Parameters().SetToMergeSubdomains(toMesh)
-        pass
-    
-    ## To Tag Subdomains. Default is to no.
-    #  @param toMesh "TagSubdomains" flag value
-    def SetToTagSubdomains(self, toMesh):
-        self.Parameters().SetToTagSubdomains(toMesh)
+    ## Sets the neigbour cell gradation of the initial mesh
+    #  @param value number of partition value
+    def SetGradation(self, value):
+        self.Parameters().SetGradation(value)
         pass
-    
-    ## To Output Interfaces. Default is to no.
-    #  @param toMesh "OutputInterfaces" flag value
-    def SetToOutputInterfaces(self, toMesh):
-        self.Parameters().SetToOutputInterfaces(toMesh)
+
+    ## Sets the cell min size of the initial mesh
+    #  @param value number of partition value
+    def SetMinSize(self, value):
+        self.Parameters().SetMinSize(value)
         pass
-    
-    ## To Discard Subdomains. Default is to no.
-    #  @param toMesh "DiscardSubdomains" flag value
-    def SetToDiscardSubdomains(self, toMesh):
-        self.Parameters().SetToDiscardSubdomains(toMesh)
+
+    ## Sets the cell max size of the initial mesh
+    #  @param value number of partition value
+    def SetMaxSize(self, value):
+        self.Parameters().SetMaxSize(value)
         pass
     
     pass # end of GHS3DPRL_Algorithm class
index d08bc1fdc191c5cef9878dc35321de6fd1585755..1932836d7fce85a3f7d7e94b910392613758a11e 100755 (executable)
 
 using namespace std;
 
-/* 
-#include <med.h>
-//#include <med_config.h>
-#include <med_utils.h>
-//#include <med_misc.h>
-#include <stdlib.h>
-using namespace med_2_2;*/
-
 static void removeFile( const TCollection_AsciiString& fileName )
 {
   try {
@@ -132,142 +124,115 @@ bool GHS3DPRLPlugin_GHS3DPRL::CheckHypothesis
 }
 
 //=======================================================================
-static bool writeGHS3DPRLFiles (const TCollection_AsciiString &  GHS3DPRL_In,
-                                SMESHDS_Mesh *                   theMesh,
-                                map <int,int> &                  theSmdsToGHS3DPRLIdMap,
-                                map <int,const SMDS_MeshNode*> & theGHS3DPRLIdToNodeMap)
-{
-   bool Ok;
-   int ifam=0;
-   TCollection_AsciiString namefile(GHS3DPRL_In);
-   namefile+=".points";
-   removeFile(namefile);
-   ofstream theFile;
-   theFile.open(namefile.ToCString(),ios::out);
-#ifdef WIN32
-   Ok = theFile.is_open();
-#else
-   Ok=theFile.rdbuf()->is_open();
-#endif
-   if (!Ok)
-   {
-      INFOS("Can't write into "<<namefile.ToCString());
-      return false;
-   }
-   cout<<endl<<"writeGHS3DPRLFiles version 2.1 "<<endl;
-   cout<<endl<<"Creating GHS3DPRL processed mesh file : "<<namefile<<endl;
-
-   int nbVertices=theMesh->NbNodes();
-   int nbFaces=theMesh->NbFaces();        //triangles or quadrangles
-   const char* space="  ";
-   //const int dummyint=1;                  //nrs,nsd,refnum=1 (for wrap)
-
-   // Writing SMESH points into GHS3DPRL File.points
-   theFile<<nbVertices<<endl;
-
-   int aSmdsNodeID=1;
-   const SMDS_MeshNode* node_2;
-   SMDS_NodeIteratorPtr itOnNode=theMesh->nodesIterator();
-   //int ifam=100;//test famille
-   theFile.precision(15); theFile.setf(ios::scientific,ios::floatfield);
-   //cout<<"set precision 15 on float\n";
-   while (itOnNode->more())
-   {
-      node_2 = itOnNode->next();
-      theSmdsToGHS3DPRLIdMap.insert(map <int,int>::value_type(node_2->GetID(),aSmdsNodeID));
-      theGHS3DPRLIdToNodeMap.insert(map <int,const SMDS_MeshNode*>::value_type(aSmdsNodeID,node_2));
-      theFile<<node_2->X()<<space<<node_2->Y()<<space<<node_2->Z()<<space<<ifam<<endl;
-      aSmdsNodeID++;
-      //if (aSmdsNodeID==11) ifam++;
-   }
-   //no specified points;
-   theFile.close();
-
-   namefile=GHS3DPRL_In+".faces";
-   removeFile(namefile);
-   theFile.open(namefile.ToCString(),ios::out);
-#ifdef WIN32
-   Ok=theFile.is_open();
-#else
-   Ok=theFile.rdbuf()->is_open();
-#endif
-   if (!Ok)
-   {
-      INFOS("Can't write into "<<namefile.ToCString());
-      return false;
-   }
-   cout<<endl<<"Creating GHS3DPRL processed mesh file : "<<namefile<<endl;
-
-   // Writing SMESH faces into GHS3DPRL File.faces
-   theFile<<nbFaces<<" 0"<<endl;   //NB_ELEMS DUMMY_INT
-                                   //" 0" is a reserved parameter
-
-   const SMDS_MeshElement* aFace;
-   map<int,int>::const_iterator itOnSmdsNode;
-   SMDS_ElemIteratorPtr itOnFaceNode;
-   SMDS_FaceIteratorPtr itOnSmdsFace = theMesh->facesIterator();
-   long nbNoTriangles=0;
-   int ifaces=0;
-   //ifam=300;
-   while (itOnSmdsFace->more())
-   {
-      aFace=itOnSmdsFace->next();
-      itOnFaceNode=aFace->nodesIterator();
-      const int nbNodes=aFace->NbNodes();
-      if (nbNodes!=3) nbNoTriangles++;
-      ifaces++;
-      theFile<<nbNodes<<space;        // NB_NODES
-      while (itOnFaceNode->more())
-      {
-          aSmdsNodeID=itOnFaceNode->next()->GetID();
-          itOnSmdsNode=theSmdsToGHS3DPRLIdMap.find(aSmdsNodeID);
-          ASSERT(itOnSmdsNode!=theSmdsToGHS3DPRLIdMap.end());
-          theFile<<space<<(*itOnSmdsNode).second; //NODE_1 NODE_2 ...
-      }
-      //(NB_NODES+1) times: DUMMY_INT
-      //if (ifaces==11) ifam++;
-      theFile<<space<<ifam;
-      for ( int i=1; i<=nbNodes; i++) theFile<<space<<200+i;
-      theFile<<endl;
-   }
-   theFile.close();
-
-   cout<<"Processed mesh files created, they contains :\n";
-   cout<<"    "<<nbVertices<<" vertices\n";
-   if (nbNoTriangles==0)
-      cout<<"    "<<nbFaces<<" faces\n\n";
-   else
-      cout<<"    "<<nbFaces<<" faces with "<<nbNoTriangles<<"faces no triangles\n\n";
-   return true;
-}
-
-//=======================================================================
-// static bool getInt( int & theValue, char * & theLine )
+// static bool writeGHS3DPRLFiles (const TCollection_AsciiString &  GHS3DPRL_In,
+//                                 SMESHDS_Mesh *                   theMesh,
+//                                 map <int,int> &                  theSmdsToGHS3DPRLIdMap,
+//                                 map <int,const SMDS_MeshNode*> & theGHS3DPRLIdToNodeMap)
 // {
-//   char *ptr;
-//   theValue = strtol( theLine, &ptr, 10 );
-//   if ( ptr == theLine ||
-//       // there must not be neither '.' nor ',' nor 'E' ...
-//       (*ptr != ' ' && *ptr != '\n' && *ptr != '\0'))
-//     return false;
-
-//   DUMP( "  " << theValue );
-//   theLine = ptr;
-//   return true;
+//    bool Ok;
+//    int ifam=0;
+//    TCollection_AsciiString namefile(GHS3DPRL_In);
+//    namefile+=".points";
+//    removeFile(namefile);
+//    ofstream theFile;
+//    theFile.open(namefile.ToCString(),ios::out);
+// #ifdef WIN32
+//    Ok = theFile.is_open();
+// #else
+//    Ok=theFile.rdbuf()->is_open();
+// #endif
+//    if (!Ok)
+//    {
+//       INFOS("Can't write into "<<namefile.ToCString());
+//       return false;
+//    }
+//    cout<<endl<<"writeGHS3DPRLFiles version tetra_hpc v2.1.11 "<<endl;
+//    cout<<endl<<"Creating GHS3DPRL processed mesh file : "<<namefile<<endl;
+
+//    int nbVertices=theMesh->NbNodes();
+//    int nbFaces=theMesh->NbFaces();        //triangles or quadrangles
+//    const char* space="  ";
+//    //const int dummyint=1;                  //nrs,nsd,refnum=1 (for wrap)
+
+//    // Writing SMESH points into GHS3DPRL File.points
+//    theFile<<nbVertices<<endl;
+
+//    int aSmdsNodeID=1;
+//    const SMDS_MeshNode* node_2;
+//    SMDS_NodeIteratorPtr itOnNode=theMesh->nodesIterator();
+//    //int ifam=100;//test famille
+//    theFile.precision(15); theFile.setf(ios::scientific,ios::floatfield);
+//    //cout<<"set precision 15 on float\n";
+//    while (itOnNode->more())
+//    {
+//       node_2 = itOnNode->next();
+//       theSmdsToGHS3DPRLIdMap.insert(map <int,int>::value_type(node_2->GetID(),aSmdsNodeID));
+//       theGHS3DPRLIdToNodeMap.insert(map <int,const SMDS_MeshNode*>::value_type(aSmdsNodeID,node_2));
+//       theFile<<node_2->X()<<space<<node_2->Y()<<space<<node_2->Z()<<space<<ifam<<endl;
+//       aSmdsNodeID++;
+//       //if (aSmdsNodeID==11) ifam++;
+//    }
+//    //no specified points;
+//    theFile.close();
+
+//    namefile=GHS3DPRL_In+".faces";
+//    removeFile(namefile);
+//    theFile.open(namefile.ToCString(),ios::out);
+// #ifdef WIN32
+//    Ok=theFile.is_open();
+// #else
+//    Ok=theFile.rdbuf()->is_open();
+// #endif
+//    if (!Ok)
+//    {
+//       INFOS("Can't write into "<<namefile.ToCString());
+//       return false;
+//    }
+//    cout<<endl<<"Creating GHS3DPRL processed mesh file : "<<namefile<<endl;
+
+//    // Writing SMESH faces into GHS3DPRL File.faces
+//    theFile<<nbFaces<<" 0"<<endl;   //NB_ELEMS DUMMY_INT
+//                                    //" 0" is a reserved parameter
+
+//    const SMDS_MeshElement* aFace;
+//    map<int,int>::const_iterator itOnSmdsNode;
+//    SMDS_ElemIteratorPtr itOnFaceNode;
+//    SMDS_FaceIteratorPtr itOnSmdsFace = theMesh->facesIterator();
+//    long nbNoTriangles=0;
+//    int ifaces=0;
+//    //ifam=300;
+//    while (itOnSmdsFace->more())
+//    {
+//       aFace=itOnSmdsFace->next();
+//       itOnFaceNode=aFace->nodesIterator();
+//       const int nbNodes=aFace->NbNodes();
+//       if (nbNodes!=3) nbNoTriangles++;
+//       ifaces++;
+//       theFile<<nbNodes<<space;        // NB_NODES
+//       while (itOnFaceNode->more())
+//       {
+//           aSmdsNodeID=itOnFaceNode->next()->GetID();
+//           itOnSmdsNode=theSmdsToGHS3DPRLIdMap.find(aSmdsNodeID);
+//           ASSERT(itOnSmdsNode!=theSmdsToGHS3DPRLIdMap.end());
+//           theFile<<space<<(*itOnSmdsNode).second; //NODE_1 NODE_2 ...
+//       }
+//       //(NB_NODES+1) times: DUMMY_INT
+//       //if (ifaces==11) ifam++;
+//       theFile<<space<<ifam;
+//       for ( int i=1; i<=nbNodes; i++) theFile<<space<<200+i;
+//       theFile<<endl;
+//    }
+//    theFile.close();
+
+//    cout<<"Processed mesh files created, they contains :\n";
+//    cout<<"    "<<nbVertices<<" vertices\n";
+//    if (nbNoTriangles==0)
+//       cout<<"    "<<nbFaces<<" faces\n\n";
+//    else
+//       cout<<"    "<<nbFaces<<" faces with "<<nbNoTriangles<<"faces no triangles\n\n";
+//    return true;
 // }
 
-//=======================================================================
-// static bool getDouble( double & theValue, char * & theLine )
-// {
-//   char *ptr;
-//   theValue = strtod( theLine, &ptr );
-//   if ( ptr == theLine )
-//     return false;
-
-//   DUMP( "   " << theValue );
-//   theLine = ptr;
-//   return true;
-// }
 
 //=======================================================================
 
@@ -275,127 +240,6 @@ static bool writeGHS3DPRLFiles (const TCollection_AsciiString &  GHS3DPRL_In,
 #define GHS3DPRLPlugin_ReadLine(aPtr,aBuf,aFile,aLineNb) \
 {  aPtr = fgets( aBuf, GHS3DPRLPlugin_BUFLENGTH - 2, aFile ); aLineNb++; DUMP(endl); }
 
-//=======================================================================
-// static bool readResult(FILE *                           theFile,
-//                        SMESHDS_Mesh *                   theMesh,
-//                        const TopoDS_Shape &             theShape,
-//                        map <int,const SMDS_MeshNode*> & theGHS3DPRLIdToNodeMap,
-//                        const TCollection_AsciiString &  GHS3DPRL_Out,
-//                        int &                            nodeRefNumber)
-// {
-//   // ---------------------------------
-//   // Read generated elements and nodes
-//   // ---------------------------------
-
-//   cout << "Reading GHS3DPRL output file : " << GHS3DPRL_Out << endl;
-//   cout << endl;
-
-//   char aBuffer[ GHS3DPRLPlugin_BUFLENGTH ];
-//   char * aPtr;
-//   int aLineNb = 0;
-//   int shapeID = theMesh->ShapeToIndex( theShape );
-
-//   int line = 1, EndOfFile = 0, nbElem = 0, nField = 10, nbRef = 0, aGHS3DPRLNodeID = 0;
-//   const char * theField;
-
-//   vector<const char*> tabField = vector<const char*>(nField);
-//   vector<int> tabRef = vector<int>(nField);
-
-//   tabField[0] = "MeshVersionFormatted";    tabRef[0] = 0;
-//   tabField[1] = "Dimension";               tabRef[1] = 0;
-//   tabField[2] = "Vertices";                tabRef[2] = 3;
-//   tabField[3] = "Edges";                   tabRef[3] = 2;
-//   tabField[4] = "Triangles";               tabRef[4] = 3;
-//   tabField[5] = "Quadrilaterals";          tabRef[5] = 4;
-//   tabField[6] = "Hexahedra";               tabRef[6] = 8;
-//   tabField[7] = "Corners";                 tabRef[7] = 1;
-//   tabField[8] = "Ridges";                  tabRef[0] = 1;
-//   tabField[9] = "End";                     tabRef[0] = 0;
-
-//   nodeRefNumber += theMesh->NbNodes();
-
-//   SMDS_NodeIteratorPtr itOnGHS3DPRLInputNode = theMesh->nodesIterator();
-//   while ( itOnGHS3DPRLInputNode->more() )
-//       theMesh->RemoveNode( itOnGHS3DPRLInputNode->next() );
-
-//   while ( EndOfFile == 0  ) {
-//       GHS3DPRLPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb );
-//       for ( int iField = 0; iField < nField; iField++ ) {
-//           stringstream theMessage;
-//           theField = tabField[iField];
-//           if ( strncmp(aPtr, theField, strlen(theField)) == 0 ) {
-//               if ( strcmp(theField, "End") == 0 ) {
-//                   EndOfFile = 1;
-//                   theMessage << "End of GHS3DPRL output file has been reached";
-//               }
-//               else {
-//                   GHS3DPRLPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb );
-//                   line++;
-//                   getInt( nbElem, aPtr );
-
-//                   if ( strcmp(theField, "MeshVersionFormatted") == 0 )
-//                       theMessage << "GHS3DPRL mesh descriptor : " << theField << " " << nbElem;
-//                   else if ( strcmp(theField, "Dimension") == 0 )
-//                       theMessage << "GHS3DPRL mesh of " << nbElem << "D dimension";
-//                   else if ( strcmp(theField, "Vertices")       == 0 ||
-//                             strcmp(theField, "Edges")          == 0 ||
-//                             strcmp(theField, "Quadrilaterals") == 0 ||
-//                             strcmp(theField, "Hexahedra")      == 0 ) {
-//                       nbRef = tabRef[iField];
-//                       GHS3DPRLPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb );           // read blank line
-
-//                       if ( strcmp(theField, "Vertices") == 0 ) {
-//                           int aGHS3DPRLID;
-//                           vector<double> coord = vector<double>(nbRef);
-//                           SMDS_MeshNode * aGHS3DPRLNode;
-
-//                           for ( int iElem = 0; iElem < nbElem; iElem++ ) {
-//                               aGHS3DPRLID = iElem + 1 + nodeRefNumber;
-//                               GHS3DPRLPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb );   // read file lines
-//                               for ( int iCoord = 0; iCoord < 3; iCoord++ )
-//                                   getDouble ( coord[ iCoord ], aPtr );
-//                               aGHS3DPRLNode = theMesh->AddNode(coord[0], coord[1], coord[2]);
-//                               theMesh->SetNodeInVolume( aGHS3DPRLNode, shapeID );
-//                               theGHS3DPRLIdToNodeMap[ aGHS3DPRLID ] = aGHS3DPRLNode;
-//                           }
-//                       }
-//                       else {
-//                           vector<const SMDS_MeshNode*> node = vector<const SMDS_MeshNode*>(nbRef);
-//                           SMDS_MeshElement* aGHS3DPRLElement;
-//                           map <int,const SMDS_MeshNode*>::iterator itOnGHS3DPRLNode;
-
-//                           for ( int iElem = 0; iElem < nbElem; iElem++ ) {
-//                               GHS3DPRLPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb );   // read file lines
-//                               for ( int iRef = 0; iRef < nbRef; iRef++ ) {
-//                                   getInt ( aGHS3DPRLNodeID, aPtr );                         // read nbRef aGHS3DPRLNodeID
-//                                   aGHS3DPRLNodeID += nodeRefNumber;
-//                                   itOnGHS3DPRLNode = theGHS3DPRLIdToNodeMap.find( aGHS3DPRLNodeID );
-//                                   node[ iRef ] = itOnGHS3DPRLNode->second;
-//                               }
-
-//                               if ( strcmp(theField, "Edges") == 0 )                        // create an element
-//                                   aGHS3DPRLElement = theMesh->AddEdge( node[0], node[1] );
-//                               else if ( strcmp(theField, "Quadrilaterals") == 0 )
-//                                   aGHS3DPRLElement = theMesh->AddFace( node[0], node[1], node[2], node[3] );
-//                               else if ( strcmp(theField, "Hexahedra") == 0 )
-//                                   aGHS3DPRLElement = theMesh->AddVolume( node[0], node[1], node[2], node[3], node[4], node[5], node[6], node[7] );
-
-//                               theMesh->SetMeshElementOnShape( aGHS3DPRLElement, shapeID );
-//                           }
-//                       }
-//                       theMessage << nbElem << " " << theField << " created";
-//                   }
-//               }
-//               if ( theMessage.str().size() != 0 ) {
-//                   cout << theMessage.str() << endl;
-//                   break;
-//               }
-//           }
-//       }
-//   }
-//   cout << endl;
-//   return true;
-// }
 
 //=============================================================================
 // Pass parameters to GHS3DPRL
@@ -407,10 +251,11 @@ void GHS3DPRLPlugin_GHS3DPRL::SetParameters(const GHS3DPRLPlugin_Hypothesis* hyp
     _NbPart = hyp->GetNbPart();
     _KeepFiles = hyp->GetKeepFiles();
     _Background = hyp->GetBackground();
-    _ToMergeSubdomains = hyp->GetToMergeSubdomains();
-    _ToTagSubdomains = hyp->GetToTagSubdomains();
-    _ToOutputInterfaces = hyp->GetToOutputInterfaces();
-    _ToDiscardSubdomains = hyp->GetToDiscardSubdomains();
+    _Multithread = hyp->GetMultithread();
+    //_ToMergeSubdomains = hyp->GetToMergeSubdomains();
+    _Gradation = hyp->GetGradation();
+    _MinSize = hyp->GetMinSize();
+    _MaxSize = hyp->GetMaxSize();
   }
 }
 
@@ -471,22 +316,33 @@ bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh,
       return false;
    }
    SetParameters(_hypothesis);
-   cout << "\n" << _name << " parameters :\n" << endl;
-   cout << "     generic path/name of MED Files = " << _MEDName << endl;
-   cout << "     number of partitions = " << _NbPart << endl;
-   cout << "     merge subdomains = " << _ToMergeSubdomains << endl;
-   cout << "     tag subdomains = " << _ToTagSubdomains << endl;
-   cout << "     output interfaces = " << _ToOutputInterfaces << endl;
-   cout << "     discard dubdomains = " << _ToDiscardSubdomains << endl;
-   cout << "     keep intermediates files (from tetra-hpc) = " << _KeepFiles << endl;
-   cout << "     background (from tetra-hpc) = " << _Background << "\n\n";
+   cout << "\n" << _name << " parameters:" << endl;
+   cout << "   generic path/name of MED Files = " << _MEDName << endl;
+   cout << "   number of partitions = " << _NbPart << endl;
+   cout << "   gradation = " << _Gradation << endl;
+   cout << "   min_size = " << _MinSize << endl;
+   cout << "   max_size = " << _MaxSize << endl;
+   cout << "   keep intermediates files (from tetra-hpc) = " << _KeepFiles << endl;
+   cout << "   background (from tetra-hpc) = " << _Background << "\n";
+   cout << "   multithread = " << _Multithread << "\n\n";
 
       //string tmpDir=getTmpDir_new();
       TCollection_AsciiString
          tmpDir=getTmpDir(),
-         GHS3DPRL_In,GHS3DPRL_Out,GHS3DPRL_Outxml,
-         run_GHS3DPRL("tetrahpc2med "),rm("rm -f "),run_nokeep_files,
-         NbPart,fileskinmed(""),fileskinmesh(""),path,casenamemed;  //_MEDName.c_str());
+         GHS3DPRL_In,
+         GHS3DPRL_Out,
+         GHS3DPRL_Outxml,
+         run_GHS3DPRL("tetrahpc2med "),
+         rm("rm -f "),
+         run_nokeep_files,
+         NbPart,
+         Gradation,
+         MinSize,
+         MaxSize,
+         fileskinmed(""),
+         fileskinmesh(""),
+         path,
+         casenamemed;  //_MEDName.c_str());
 
       casenamemed += (char *)_MEDName.c_str();
       int n=casenamemed.SearchFromEnd('/');
@@ -501,8 +357,8 @@ bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh,
          casenamemed=casenamemed.SubString(1,20);
          cerr<<"MEDName truncated (no more 20 characters) = "<<casenamemed<<endl;
       }
-      cout<<"path="<<path<<endl;
-      cout<<"casenamemed="<<casenamemed<<endl;
+      //cout<<"path="<<path<<endl;
+      //cout<<"casenamemed="<<casenamemed<<endl;
 
       map <int,int> aSmdsToGHS3DPRLIdMap;
       map <int,const SMDS_MeshNode*> aGHS3DPRLIdToNodeMap;
@@ -510,28 +366,33 @@ bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh,
       GHS3DPRL_Out = path + casenamemed;
       GHS3DPRL_Outxml = path + casenamemed + ".xml"; //master file
       NbPart=_NbPart;
-      //tepal2med --casename=/home/whoami/tmp/GHS3DPRL --number=5 --medname=DOMAIN 
-      //          --limitswap=1000 --verbose=0 --test=no --menu=no --launchtepal=yes;
+      Gradation=_Gradation;
+      MinSize=_MinSize;
+      MaxSize=_MaxSize;
+      
+      //an example:
+      //tetrahpc2med --casename=/home/whoami/tmp/GHS3DPRL --number=5 --medname=DOMAIN 
+      //             --gradation=1.05 --min_size=1e-3 --max_size=1e-2
+      //             --verbose=0 --menu=no --launchtetra=yes;
       
       run_GHS3DPRL = run_GHS3DPRL +
                      " --casename=" + GHS3DPRL_In + 
-                     " --number=" + NbPart + 
+                     " --number=" + NbPart +
                      " --medname=" + GHS3DPRL_Out +
-                     " --launchtetra=yes";
-      //no more meshhole option
-      //if (_ToMeshHoles) run_GHS3DPRL += " --meshholes=yes"; else run_GHS3DPRL += " --meshholes=no";
-      //if (_ToMergeSubdomains) run_GHS3DPRL += " --merge_subdomains=yes"; else run_GHS3DPRL += " --merge_subdomains=no";
-      //if (_ToTagSubdomains) run_GHS3DPRL += " --tag_subdomains=yes"; else run_GHS3DPRL += " --tag_subdomains=no";
-      //if (_ToOutputInterfaces) run_GHS3DPRL += " --output_interfaces=yes"; else run_GHS3DPRL += " --output_interfaces=no";
-      //if (_ToDiscardSubdomains) run_GHS3DPRL += " --discard_subdomains=yes"; else run_GHS3DPRL += " --discard_subdomains=no";
-      //if (_Background) run_GHS3DPRL += " --background=yes"; else run_GHS3DPRL += " --background=no";
+                     " --launchtetra=yes" +
+                     " --gradation=" + Gradation +
+                     " --min_size=" + MinSize +
+                     " --max_size=" + MaxSize +
+                     " --verbose=3";
+      if (_Background) run_GHS3DPRL += " --background=yes"; else run_GHS3DPRL += " --background=no";
+      if (_Multithread) run_GHS3DPRL += " --multithread=yes"; else run_GHS3DPRL += " --multithread=no";
       run_nokeep_files = rm +GHS3DPRL_In + "* " + path + "tetrahpc.log";
       system( run_nokeep_files.ToCString() ); //clean files
       run_nokeep_files = rm + GHS3DPRL_In + "* ";
 
-      cout<<"GHS3DPRL command : "<<run_GHS3DPRL.ToCString()<<endl;
+      cout<<"GHS3DPRL command :\n  "<<run_GHS3DPRL.ToCString()<<endl;
       fileskinmesh=path + "GHS3DPRL.mesh";
-      cout<<"Write input file for tetra_hpc.exe "<<fileskinmesh<<"...";
+      cout<<"  Write input file for tetra_hpc.exe "<<fileskinmesh<<"...";
       GHS3DPRL_Out = path + casenamemed;
       removeFile( GHS3DPRL_Outxml ); //only the master xml file
       //Ok=writeGHS3DPRLFiles(GHS3DPRL_In, meshDS, aSmdsToGHS3DPRLIdMap, aGHS3DPRLIdToNodeMap);
@@ -549,23 +410,17 @@ bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh,
       //fileskinmed=fileskinmed + "cp /home/wambeke/empty.med "+ path + "GHS3DPRL_skin.med";
       //system( fileskinmed.ToCString() );
       fileskinmed=path + "GHS3DPRL_skin.med";
-      cout<<"Write file "<<fileskinmed<<"...";
+      cout<<"  Write file "<<fileskinmed<<"...";
       theMesh.ExportMED(fileskinmed.ToCString(),"SKIN_INITIAL",true,1);
-      cout<<" ...done\n";
+      cout<<" ...done\n\n";
 
-      /*
-      if (!Ok) {
-         error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
-         return false; //pb abandonne
-      }*/
 
       //sometimes it is better to wait flushing files on slow filesystem...
       system( "sleep 3" );
+      //launch tetrahpc2med which launch mg-tetra_hpc.py which launch mg-tetra_hpc(_mpi?).exe
       system( run_GHS3DPRL.ToCString() );
       system( "sleep 3" );
 
-      //cout<<"!!!reprise plugin!!!"<<endl;
-
       if (_Background) {
          pluginerror = pluginerror + "backgrounding... plugin is not waiting for output files "+ casenamemed + "_*.med";
          cout<<pluginerror<<endl;
@@ -604,184 +459,7 @@ bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh,
     return Ok;
 }
 
-//=============================================================================
-// Here we are going to use the GHS3DPRL mesher (old obsolescent version tepal in v1 & v2 (before 2014))
-bool GHS3DPRLPlugin_GHS3DPRL::ComputeForTepal(SMESH_Mesh& theMesh,
-                                     const TopoDS_Shape& theShape)
-{
-   bool Ok;
-   TCollection_AsciiString pluginerror("ghs3dprl: ");
-   SMESHDS_Mesh* meshDS = theMesh.GetMeshDS();
-   //cout<<"GetMeshDS done\n";
-   if (_countSubMesh==0){
-      MESSAGE("GHS3DPRLPlugin_GHS3DPRL::Compute");
-      _countTotal=0;
-      TopExp_Explorer expf(meshDS->ShapeToMesh(), TopAbs_SOLID);
-      for ( ; expf.More(); expf.Next() ) _countTotal++;
-   }
-   _countSubMesh++;
-   //cout<<"Compute _countSubMesh "<<_countSubMesh<<endl;
-   //no stuff if multiples submesh, multiple call compute
-   //mesh all in one pass tepal (the last)
-   if (_countSubMesh != _countTotal ) return true;
-
-   //stuff on last call 
-   if (_hypothesis==NULL){
-      pluginerror += "No existing parameters/hypothesis for GHS3DPRL";
-      cout <<"\n"<<pluginerror<<"\n\n";
-      error(COMPERR_ALGO_FAILED, pluginerror.ToCString() );
-      return false;
-   }
-   SetParameters(_hypothesis);
-   cout << "\n" << _name << " parameters :\n" << endl;
-   cout << "     generic path/name of MED Files = " << _MEDName << endl;
-   cout << "     number of partitions = " << _NbPart << endl;
-   //cout << "     mesh holes = " << _ToMeshHoles << endl;
-   cout << "     mesh holes = " << 1 << endl;
-   cout << "     keep intermediates files (from tepal) = " << _KeepFiles << endl;
-   cout << "     background (from tepal) = " << _Background << "\n\n";
-
-      //string tmpDir=getTmpDir_new();
-      TCollection_AsciiString
-         tmpDir=getTmpDir(),
-         GHS3DPRL_In,GHS3DPRL_Out,GHS3DPRL_Outxml,
-         run_GHS3DPRL("tepal2med "),rm("rm "),run_nokeep_files,
-         NbPart,fileskinmed(""),path,casenamemed;  //_MEDName.c_str());
-
-      casenamemed += (char *)_MEDName.c_str();
-      int n=casenamemed.SearchFromEnd('/');
-      if (n>0) {
-         path=casenamemed.SubString(1,n);
-         casenamemed=casenamemed.SubString(n+1,casenamemed.Length()); 
-      }
-      else
-         path=tmpDir;
-
-      if (casenamemed.Length()>20){
-         casenamemed=casenamemed.SubString(1,20);
-         cerr<<"MEDName truncated (no more 20 characters) = "<<casenamemed<<endl;
-      }
-      cout<<"path="<<path<<endl;
-      cout<<"casenamemed="<<casenamemed<<endl;
-
-      map <int,int> aSmdsToGHS3DPRLIdMap;
-      map <int,const SMDS_MeshNode*> aGHS3DPRLIdToNodeMap;
-      GHS3DPRL_In = path + "GHS3DPRL";
-      GHS3DPRL_Out = path + casenamemed;
-      GHS3DPRL_Outxml = path + casenamemed + ".xml"; //master file
-      NbPart=_NbPart;
-      //tepal2med --casename=/home/whoami/tmp/GHS3DPRL --number=5 --medname=DOMAIN 
-      //          --limitswap=1000 --verbose=0 --test=no --menu=no --launchtepal=yes;
-      
-      run_GHS3DPRL = run_GHS3DPRL +
-                     " --casename=" + GHS3DPRL_In + 
-                     " --number=" + NbPart + 
-                     " --medname=" + GHS3DPRL_Out +
-                     " --launchtepal=yes";
-      //if (_ToMeshHoles) run_GHS3DPRL += " --meshholes=yes"; else run_GHS3DPRL += " --meshholes=no";
-      if (1) run_GHS3DPRL += " --meshholes=yes"; else run_GHS3DPRL += " --meshholes=no";
-      if (_Background) run_GHS3DPRL += " --background=yes"; else run_GHS3DPRL += " --background=no";
-      run_nokeep_files = rm +GHS3DPRL_In + "* " + path + "tepal.log";
-      system( run_nokeep_files.ToCString() ); //clean files
-      run_nokeep_files = rm + GHS3DPRL_In + "* ";
-
-      cout<<"GHS3DPRL command : "<<run_GHS3DPRL.ToCString()<<endl;
-      cout<<"Write files .faces .point ...";
-      GHS3DPRL_Out = path + casenamemed;
-      removeFile( GHS3DPRL_Outxml ); //only the master xml file
-      Ok=writeGHS3DPRLFiles(GHS3DPRL_In, meshDS, aSmdsToGHS3DPRLIdMap, aGHS3DPRLIdToNodeMap);
-      if (Ok) {cout<<" ...done\n";}
-      else {
-         cout<<" ...NOT done\n";
-         pluginerror = pluginerror + "problem writing input tepal files " + GHS3DPRL_In + "[.faces|.points]";
-      }
-
-      //Ecriture dans un fichier MED ?v2.? meme si not Ok
-      //create empty file -> avoid warning message
-      //med_idt fid=MEDouvrir((const char *)fileskinmed.ToCString(),MED_CREATION);
-      //med_err ret=MEDfermer(fid);
-      //fileskinmed=fileskinmed + "cp /home/wambeke/empty.med "+ path + "GHS3DPRL_skin.med";
-      //system( fileskinmed.ToCString() );
-      fileskinmed=path + "GHS3DPRL_skin.med";
-      cout<<"Write file "<<fileskinmed<<"...";
-      theMesh.ExportMED(fileskinmed.ToCString(),"SKIN_INITIAL",true,1);
-      cout<<" ...done\n";
-
-      if (!Ok) {
-         error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
-         return false; //pb abandonne
-      }
-
-      //sometimes it is better to wait flushing files on slow filesystem...
-      system( "sleep 3" );
-      system( run_GHS3DPRL.ToCString() );
-      system( "sleep 3" );
-
-      //cout<<"!!!reprise plugin!!!"<<endl;
-
-      if (_Background) {
-         pluginerror = pluginerror + "backgrounding... plugin is not waiting for output files "+ casenamemed + "_*.med";
-         cout<<pluginerror<<endl;
-         error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
-         return false; //but it is not a problem but if true my message is overwritten
-         //return true; //but it is not a problem, 
-      }
 
-      // read a result, GHS3DPRL_Out is the name of master file (previous xml format)
-      FILE * aResultFile = fopen( GHS3DPRL_Outxml.ToCString(), "r" );
-      if (aResultFile){
-          //Ok = readResult( aResultFile, meshDS, theShape, aGHS3DPRLIdToNodeMap, GHS3DPRL_Out, _nodeRefNumber );
-          Ok = true;
-          Ok = false; //but it is not a problem but if true my message is overwritten
-          fclose(aResultFile);
-          cout<<"GHS3DPRL OK output master file "<<casenamemed<<".xml exist !\n\n";
-          pluginerror = pluginerror + "new tetraedra not in memory, but stored in files "+ casenamemed + "_*.med";
-          cout<<pluginerror<<endl;
-          error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
-          if (!_KeepFiles) system( run_nokeep_files.ToCString() );
-      }
-      else{
-          Ok = false; //it is a problem AND my message is NOT overwritten
-          pluginerror = pluginerror + "output master file " + casenamemed + ".xml do not exist";
-          cout<<pluginerror<<endl;
-          error(COMPERR_ALGO_FAILED, pluginerror.ToCString() );
-          cout<<"GHS3DPRL KO output files "<<GHS3DPRL_Out<<" do not exist ! see intermediates files keeped:\n";
-          TCollection_AsciiString run_list_files("ls -alt ");
-          run_list_files +=  GHS3DPRL_Out + "* " + GHS3DPRL_In + "* " + path + "tepal.log";
-          system( run_list_files.ToCString() );
-          cout<<endl;
-      }
-      _countSubMesh=0;
-
-
-    return Ok;
-   /*pid_t pid = fork();
-   if (pid > 0) {
-      //Processus pere
-      cout<<"le pere est la\n";
-      system("echo le pere > lepere.tmp");
-      system("sleep 10");
-      system("ps -edf |grep wambeke > pslepere.tmp");
-      cout<<"le pere return 0\n";
-      return 0; //ok
-      //exit(0);
-   } else if (pid == 0) {
-      //Processus fils
-      cout<<"le fils est la\n";
-      //On rend le fils independant de tout terminal
-      setsid();
-      system("sleep 20");
-      system("echo le fils > lefils.tmp");
-      system("sleep 20");
-      system("ps -edf |grep wambeke > pslefils.tmp");
-      cout<<"le fils return 0\n";
-      return 0; //ok
-   } else {
-      //Traitement d'erreur
-      cout<<"ya probleme sur fork()\n";
-      return 1; //ko
-   }*/
-}
 
 //=============================================================================
 /*!
index e002f3a6a8985069ae3a6d3b9597878ba6174025..f1d112522c602af08fd3f87b1fe2237dc370a9a3 100755 (executable)
@@ -48,7 +48,6 @@ public:
 
   virtual bool Compute(SMESH_Mesh&         aMesh,
                        const TopoDS_Shape& aShape);
-  virtual bool ComputeForTepal(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); //obsolescent
 
   virtual bool Evaluate(SMESH_Mesh&         aMesh,
                         const TopoDS_Shape& aShape,
@@ -65,11 +64,11 @@ private:
   int         _NbPart;      //number of partitions
   bool        _KeepFiles;   //tepal file .noboite binary or not
   bool        _Background;  //true for big meshes
+  bool        _Multithread; //true for mg_tetra_hpc false for mg_tetra_hpc_mpi
   //ToMergeSubdomains ToTagSubdomains ToOutputInterfaces ToDiscardSubdomains
-  bool        _ToMergeSubdomains;
-  bool        _ToTagSubdomains;
-  bool        _ToOutputInterfaces;
-  bool        _ToDiscardSubdomains;
+  float       _Gradation;
+  float       _MinSize;
+  float       _MaxSize;
 };
 
 #endif
index cb38453b09d5f50fceb09668f56a0639c444a28c..d436fb3f920936281f1d353d6e5903958f2d5239 100755 (executable)
@@ -36,10 +36,11 @@ GHS3DPRLPlugin_Hypothesis::GHS3DPRLPlugin_Hypothesis (int hypId, int studyId, SM
     _NbPart( GetDefaultNbPart() ),
     _KeepFiles( GetDefaultKeepFiles() ),
     _Background( GetDefaultBackground() ),
-    _ToMergeSubdomains( GetDefaultToMergeSubdomains() ),
-    _ToTagSubdomains( GetDefaultToTagSubdomains() ),
-    _ToOutputInterfaces( GetDefaultToOutputInterfaces() ),
-    _ToDiscardSubdomains( GetDefaultToDiscardSubdomains() )
+    _Multithread( GetDefaultMultithread() ),
+    //_ToMergeSubdomains( GetDefaultToMergeSubdomains() ),
+    _Gradation( GetDefaultGradation() ),
+    _MinSize( GetDefaultMinSize() ),
+    _MaxSize( GetDefaultMaxSize() )
 {
   MESSAGE("GHS3DPRLPlugin_Hypothesis::GHS3DPRLPlugin_Hypothesis");
   _name = GetHypType();
@@ -116,42 +117,46 @@ void GHS3DPRLPlugin_Hypothesis::SetBackground(bool theVal) {
   }
 }
 
-/*void GHS3DPRLPlugin_Hypothesis::SetToMeshHoles(bool theVal) {
-  if (theVal != _ToMeshHoles) {
-    _ToMeshHoles = theVal;
-    NotifySubMeshesHypothesisModification();
-  }
-}*/
-
-void GHS3DPRLPlugin_Hypothesis::SetToMergeSubdomains(bool theVal) {
-  if (theVal != _ToMergeSubdomains) {
-    _ToMergeSubdomains = theVal;
+void GHS3DPRLPlugin_Hypothesis::SetMultithread(bool theVal) {
+  if (theVal != _Multithread) {
+    _Multithread = theVal;
     NotifySubMeshesHypothesisModification();
   }
 }
 
-void GHS3DPRLPlugin_Hypothesis::SetToTagSubdomains(bool theVal) {
-  if (theVal != _ToTagSubdomains) {
-    _ToTagSubdomains = theVal;
+//void GHS3DPRLPlugin_Hypothesis::SetToMergeSubdomains(bool theVal) {
+//  if (theVal != _ToMergeSubdomains) {
+//    _ToMergeSubdomains = theVal;
+//    NotifySubMeshesHypothesisModification();
+//  }
+//}
+
+void GHS3DPRLPlugin_Hypothesis::SetGradation(float theVal) {
+  if (theVal != _Gradation) {
+    _Gradation = theVal;
     NotifySubMeshesHypothesisModification();
   }
 }
 
-void GHS3DPRLPlugin_Hypothesis::SetToOutputInterfaces(bool theVal) {
-  if (theVal != _ToOutputInterfaces) {
-    _ToOutputInterfaces = theVal;
+void GHS3DPRLPlugin_Hypothesis::SetMinSize(float theVal) {
+  if (theVal != _MinSize) {
+    _MinSize = theVal;
     NotifySubMeshesHypothesisModification();
   }
 }
 
-void GHS3DPRLPlugin_Hypothesis::SetToDiscardSubdomains(bool theVal) {
-  if (theVal != _ToDiscardSubdomains) {
-    _ToDiscardSubdomains = theVal;
+void GHS3DPRLPlugin_Hypothesis::SetMaxSize(float theVal) {
+  if (theVal != _MaxSize) {
+    _MaxSize = theVal;
     NotifySubMeshesHypothesisModification();
   }
 }
 
 
+
+
+
+
 //=============================================================================
 /*!
  *
@@ -159,21 +164,18 @@ void GHS3DPRLPlugin_Hypothesis::SetToDiscardSubdomains(bool theVal) {
 //=============================================================================
 std::ostream& GHS3DPRLPlugin_Hypothesis::SaveTo(std::ostream& save)
 {
-  /*save << _MEDName ; //without whitespaces!
-  save << " " << _NbPart;
-  save << " " << (int)_KeepFiles;*/
-
   //explicit outputs for future code compatibility of saved .hdf
   //save without any whitespaces!
   save<<"MEDName="<<_MEDName<<";";
   save<<"NbPart="<<_NbPart<<";";
   //save<<"ToMeshHoles="<<(int) _ToMeshHoles<<";";
-  save<<"ToMergeSubdomains="<<(int) _ToMergeSubdomains<<";";
-  save<<"ToTagSubdomains="<<(int) _ToTagSubdomains<<";";
-  save<<"ToOutputInterfaces="<<(int) _ToOutputInterfaces<<";";
-  save<<"ToDiscardSubdomains="<<(int) _ToDiscardSubdomains<<";";
+  //save<<"ToMergeSubdomains="<<(int) _ToMergeSubdomains<<";";
+  save<<"Gradation="<<(float) _Gradation<<";";
+  save<<"MinSize="<<(float) _MinSize<<";";
+  save<<"MaxSize="<<(float) _MaxSize<<";";
   save<<"KeepFiles="<<(int) _KeepFiles<<";";
   save<<"Background="<<(int) _Background<<";";
+  save<<"Multithread="<<(int) _Multithread<<";";
   return save;
 }
 
@@ -209,11 +211,11 @@ std::istream& GHS3DPRLPlugin_Hypothesis::LoadFrom(std::istream& load)
      if (str3=="NbPart") _NbPart = atoi(str4.c_str());
      if (str3=="KeepFiles") _KeepFiles = (bool) atoi(str4.c_str());
      //if (str3=="ToMeshHoles") _ToMeshHoles = (bool) atoi(str4.c_str());
-     if (str3=="ToMergeSubdomains") _ToMergeSubdomains = (bool) atoi(str4.c_str());
-     if (str3=="ToTagSubdomains") _ToTagSubdomains = (bool) atoi(str4.c_str());
-     if (str3=="ToOutputInterfaces") _ToOutputInterfaces = (bool) atoi(str4.c_str());
-     if (str3=="ToDiscardSubdomains") _ToDiscardSubdomains = (bool) atoi(str4.c_str());
+     if (str3=="Gradation") _Gradation = (float) atof(str4.c_str());
+     if (str3=="MinSize") _MinSize = (float) atof(str4.c_str());
+     if (str3=="MaxSize") _MaxSize = (float) atof(str4.c_str());
      if (str3=="Background") _Background = (bool) atoi(str4.c_str());
+     if (str3=="Multithread") _Multithread = (bool) atoi(str4.c_str());
    }
    return load;
 }
@@ -289,6 +291,12 @@ bool GHS3DPRLPlugin_Hypothesis::GetDefaultBackground()
   return false;
 }
 
+//=============================================================================
+bool GHS3DPRLPlugin_Hypothesis::GetDefaultMultithread()
+{
+  return false;
+}
+
 //=============================================================================
 //bool GHS3DPRLPlugin_Hypothesis::GetDefaultToMeshHoles()
 //{
@@ -296,25 +304,24 @@ bool GHS3DPRLPlugin_Hypothesis::GetDefaultBackground()
 //}
 
 //=============================================================================
-bool GHS3DPRLPlugin_Hypothesis::GetDefaultToMergeSubdomains()
-{
-  return false;
-}
+//bool GHS3DPRLPlugin_Hypothesis::GetDefaultToMergeSubdomains()
+//{
+//  return false;
+//}
 
 //=============================================================================
-bool GHS3DPRLPlugin_Hypothesis::GetDefaultToTagSubdomains()
+float GHS3DPRLPlugin_Hypothesis::GetDefaultGradation()
 {
-  return false;
+  return 1.05;
 }
-
 //=============================================================================
-bool GHS3DPRLPlugin_Hypothesis::GetDefaultToOutputInterfaces()
+float GHS3DPRLPlugin_Hypothesis::GetDefaultMinSize()
 {
-  return false;
+  return 0.;
 }
-
 //=============================================================================
-bool GHS3DPRLPlugin_Hypothesis::GetDefaultToDiscardSubdomains()
+float GHS3DPRLPlugin_Hypothesis::GetDefaultMaxSize()
 {
-  return false;
+  return 0.;
 }
+
index 5d19102b9f31b9028071006a5fd9b8fc553101b5..877bf70d284a551acfab94de98ef947e676384c6 100755 (executable)
@@ -52,19 +52,20 @@ public:
 
   void                  SetBackground(bool theVal);
   bool                  GetBackground() const { return _Background; }
-  
+
+  void                  SetMultithread(bool theVal);
+  bool                  GetMultithread() const { return _Multithread; }
+
   //ToMergeSubdomains ToTagSubdomains ToOutputInterfaces ToDiscardSubdomains
-  void                  SetToMergeSubdomains(bool theVal);
-  bool                  GetToMergeSubdomains() const { return _ToMergeSubdomains; }
-  
-  void                  SetToTagSubdomains(bool theVal);
-  bool                  GetToTagSubdomains() const { return _ToTagSubdomains; }
-  
-  void                  SetToOutputInterfaces(bool theVal);
-  bool                  GetToOutputInterfaces() const { return _ToOutputInterfaces; }
-  
-  void                  SetToDiscardSubdomains(bool theVal);
-  bool                  GetToDiscardSubdomains() const { return _ToDiscardSubdomains; }
+  void                  SetGradation(float theVal);
+  float                 GetGradation() const { return _Gradation; }
+
+  void                  SetMinSize(float theVal);
+  float                 GetMinSize() const { return _MinSize; }
+
+  void                  SetMaxSize(float theVal);
+  float                 GetMaxSize() const { return _MaxSize; }
+
 
   // the parameters default values
 
@@ -72,10 +73,10 @@ public:
   static int            GetDefaultNbPart();
   static bool           GetDefaultKeepFiles();
   static bool           GetDefaultBackground();
-  static bool           GetDefaultToMergeSubdomains();
-  static bool           GetDefaultToTagSubdomains();
-  static bool           GetDefaultToOutputInterfaces();
-  static bool           GetDefaultToDiscardSubdomains();
+  static bool           GetDefaultMultithread();
+  static float          GetDefaultGradation();
+  static float          GetDefaultMinSize();
+  static float          GetDefaultMaxSize();
 
   // Persistence
   virtual std::ostream& SaveTo(std::ostream& save);
@@ -104,11 +105,12 @@ private:
   std::string  _MEDName;     // generic path/name of med files
   int          _NbPart;      // number of partitions
   bool         _KeepFiles;   // keep intermediates tepal files or not
-  bool         _Background;  // tepal in background
-  bool         _ToMergeSubdomains;
-  bool         _ToTagSubdomains;
-  bool         _ToOutputInterfaces;
-  bool         _ToDiscardSubdomains;
+  bool         _Background;  // mg-tetra_hpc in background
+  bool         _Multithread;  // launch mg-tetra_hpc multithread version, else mpi version
+//  bool         _ToMergeSubdomains;
+  float         _Gradation;
+  float         _MinSize;
+  float         _MaxSize;
   };
 
 #endif
index 816d7e04d9790f08906f21beed606e4300244a99..5378d6ea001e047b9a35a1acdc32328a668f5e66 100755 (executable)
@@ -67,10 +67,10 @@ GHS3DPRLPlugin_Hypothesis_i::~GHS3DPRLPlugin_Hypothesis_i()
  *  GHS3DPRLPlugin_Hypothesis_i::SetNbPart
  *  GHS3DPRLPlugin_Hypothesis_i::SetKeepFiles
  *  GHS3DPRLPlugin_Hypothesis_i::SetBackground
- *  GHS3DPRLPlugin_Hypothesis_i::SetToMergeSubdomains
- *  GHS3DPRLPlugin_Hypothesis_i::SetToTagSubdomains
- *  GHS3DPRLPlugin_Hypothesis_i::SetToOutputInterfaces
- *  GHS3DPRLPlugin_Hypothesis_i::SetToDiscardSubdomains
+ *  GHS3DPRLPlugin_Hypothesis_i::SetMultithread
+ *  GHS3DPRLPlugin_Hypothesis_i::SetGradation
+ *  GHS3DPRLPlugin_Hypothesis_i::SetMinSize
+ *  GHS3DPRLPlugin_Hypothesis_i::SetMaxSize
  */
 //=============================================================================
 
@@ -106,48 +106,60 @@ void GHS3DPRLPlugin_Hypothesis_i::SetBackground (CORBA::Boolean theValue)
   SMESH::TPythonDump() << _this() << ".SetBackground( " << theValue << " )";
 }
 
-void GHS3DPRLPlugin_Hypothesis_i::SetToMergeSubdomains (CORBA::Boolean theValue)
+void GHS3DPRLPlugin_Hypothesis_i::SetMultithread (CORBA::Boolean theValue)
 {
-  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetToMergeSubdomains");
+  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetMultithread");
   ASSERT(myBaseImpl);
-  this->GetImpl()->SetToMergeSubdomains(theValue);
-  SMESH::TPythonDump() << _this() << ".SetToMergeSubdomains( " << theValue << " )";
+  this->GetImpl()->SetMultithread(theValue);
+  SMESH::TPythonDump() << _this() << ".SetMultithread( " << theValue << " )";
 }
 
-void GHS3DPRLPlugin_Hypothesis_i::SetToTagSubdomains (CORBA::Boolean theValue)
+//void GHS3DPRLPlugin_Hypothesis_i::SetToMergeSubdomains (CORBA::Boolean theValue)
+//{
+//  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetToMergeSubdomains");
+//  ASSERT(myBaseImpl);
+//  this->GetImpl()->SetToMergeSubdomains(theValue);
+//  SMESH::TPythonDump() << _this() << ".SetToMergeSubdomains( " << theValue << " )";
+//}
+
+void GHS3DPRLPlugin_Hypothesis_i::SetGradation (CORBA::Float theValue)
 {
-  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetToTagSubdomains");
+  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetGradation");
   ASSERT(myBaseImpl);
-  this->GetImpl()->SetToTagSubdomains(theValue);
-  SMESH::TPythonDump() << _this() << ".SetToTagSubdomains( " << theValue << " )";
+  this->GetImpl()->SetGradation(theValue);
+  SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
 }
 
-void GHS3DPRLPlugin_Hypothesis_i::SetToOutputInterfaces (CORBA::Boolean theValue)
+void GHS3DPRLPlugin_Hypothesis_i::SetMinSize (CORBA::Float theValue)
 {
-  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetToOutputInterfaces");
+  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetMinSize");
   ASSERT(myBaseImpl);
-  this->GetImpl()->SetToOutputInterfaces(theValue);
-  SMESH::TPythonDump() << _this() << ".SetToOutputInterfaces( " << theValue << " )";
+  this->GetImpl()->SetMinSize(theValue);
+  SMESH::TPythonDump() << _this() << ".SetMinSize( " << theValue << " )";
 }
 
-void GHS3DPRLPlugin_Hypothesis_i::SetToDiscardSubdomains (CORBA::Boolean theValue)
+void GHS3DPRLPlugin_Hypothesis_i::SetMaxSize (CORBA::Float theValue)
 {
-  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetToDiscardSubdomains");
+  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetMaxSize");
   ASSERT(myBaseImpl);
-  this->GetImpl()->SetToDiscardSubdomains(theValue);
-  SMESH::TPythonDump() << _this() << ".SetToDiscardSubdomains( " << theValue << " )";
+  this->GetImpl()->SetMaxSize(theValue);
+  SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theValue << " )";
 }
 
+
+
+
+
 //=============================================================================
 /*!
  *  GHS3DPRLPlugin_Hypothesis_i::GetMEDName
  *  GHS3DPRLPlugin_Hypothesis_i::GetNbPart
  *  GHS3DPRLPlugin_Hypothesis_i::GetKeepFiles
  *  GHS3DPRLPlugin_Hypothesis_i::GetBackground
- *  GHS3DPRLPlugin_Hypothesis_i::GetToMergeSubdomains
- *  GHS3DPRLPlugin_Hypothesis_i::GetToTagSubdomains
- *  GHS3DPRLPlugin_Hypothesis_i::GetToOutputInterfaces
- *  GHS3DPRLPlugin_Hypothesis_i::GetToDiscardSubdomains
+ *  GHS3DPRLPlugin_Hypothesis_i::GetMultithread
+ *  GHS3DPRLPlugin_Hypothesis_i::GetGradation
+ *  GHS3DPRLPlugin_Hypothesis_i::GetMinSize
+ *  GHS3DPRLPlugin_Hypothesis_i::GetMaxSize
  */
 //=============================================================================
 
@@ -181,32 +193,39 @@ CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetBackground()
   return this->GetImpl()->GetBackground();
 }
 
-CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetToMergeSubdomains()
+CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetMultithread()
 {
-  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetToMergeSubdomains");
+  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetMultithread");
   ASSERT(myBaseImpl);
-  return this->GetImpl()->GetToMergeSubdomains();
+  return this->GetImpl()->GetMultithread();
 }
 
-CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetToTagSubdomains()
+//CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetToMergeSubdomains()
+//{
+//  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetToMergeSubdomains");
+//  ASSERT(myBaseImpl);
+//  return this->GetImpl()->GetToMergeSubdomains();
+//}
+
+CORBA::Float GHS3DPRLPlugin_Hypothesis_i::GetGradation()
 {
-  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetToTagSubdomains");
+  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetGradation");
   ASSERT(myBaseImpl);
-  return this->GetImpl()->GetToTagSubdomains();
+  return this->GetImpl()->GetGradation();
 }
 
-CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetToOutputInterfaces()
+CORBA::Float GHS3DPRLPlugin_Hypothesis_i::GetMinSize()
 {
-  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetToOutputInterfaces");
+  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetMinSize");
   ASSERT(myBaseImpl);
-  return this->GetImpl()->GetToOutputInterfaces();
+  return this->GetImpl()->GetMinSize();
 }
 
-CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetToDiscardSubdomains()
+CORBA::Float GHS3DPRLPlugin_Hypothesis_i::GetMaxSize()
 {
-  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetToDiscardSubdomains");
+  MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetMaxSize");
   ASSERT(myBaseImpl);
-  return this->GetImpl()->GetToDiscardSubdomains();
+  return this->GetImpl()->GetMaxSize();
 }
 
 //=============================================================================
index 5b23579187705208102a149e94230ad2650bd3cd..ab8d88835da9cb133c3f75a511ed2d1e7dd60702 100755 (executable)
@@ -62,17 +62,20 @@ class GHS3DPRLPLUGIN_EXPORT GHS3DPRLPlugin_Hypothesis_i:
   void SetBackground(CORBA::Boolean theVal);
   CORBA::Boolean GetBackground();
 
-  void SetToMergeSubdomains(CORBA::Boolean theVal);
-  CORBA::Boolean GetToMergeSubdomains();
+  void SetMultithread(CORBA::Boolean theVal);
+  CORBA::Boolean GetMultithread();
 
-  void SetToTagSubdomains(CORBA::Boolean theVal);
-  CORBA::Boolean GetToTagSubdomains();
+//  void SetToMergeSubdomains(CORBA::Boolean theVal);
+//  CORBA::Boolean GetToMergeSubdomains();
 
-  void SetToOutputInterfaces(CORBA::Boolean theVal);
-  CORBA::Boolean GetToOutputInterfaces();
+  void SetGradation(CORBA::Float theVal);
+  CORBA::Float GetGradation();
 
-  void SetToDiscardSubdomains(CORBA::Boolean theVal);
-  CORBA::Boolean GetToDiscardSubdomains();
+  void SetMinSize(CORBA::Float theVal);
+  CORBA::Float GetMinSize();
+
+  void SetMaxSize(CORBA::Float theVal);
+  CORBA::Float GetMaxSize();
 
   // Get implementation
   ::GHS3DPRLPlugin_Hypothesis* GetImpl();
index 01dfd1b737f21dc76574ebd3737670580fc32633..a573172e3f7f82c410eed0ef0b4713df1414ba44 100755 (executable)
@@ -33,6 +33,7 @@
 #include <SUIT_ResourceMgr.h>
 #include <SalomeApp_Tools.h>
 #include <QtxIntSpinBox.h>
+#include <QtxDoubleSpinBox.h>
 
 #include <QFrame>
 #include <QGroupBox>
@@ -113,25 +114,44 @@ QFrame* GHS3DPRLPluginGUI_HypothesisCreator::buildFrame()
   myBackground->setWhatsThis( tr( "GHS3DPRL_WhatsThis_Background" ) );
   l->addWidget( myBackground, row++, 0, 1, 2 );
 
+  myMultithread = new QCheckBox( tr( "GHS3DPRL_Multithread" ), GroupC1 );
+  myMultithread->setWhatsThis( tr( "GHS3DPRL_WhatsThis_Multithread" ) );
+  l->addWidget( myMultithread, row++, 0, 1, 2 );
+
   //myToMeshHoles = new QCheckBox( tr( "GHS3DPRL_ToMeshHoles" ), GroupC1 );
   //myToMeshHoles->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToMeshHoles" ) );
   //l->addWidget( myToMeshHoles, row++, 0, 1, 2 );
   
-  myToMergeSubdomains = new QCheckBox( tr( "GHS3DPRL_ToMergeSubdomains" ), GroupC1 );
-  myToMergeSubdomains->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToMergeSubdomains" ) );
-  l->addWidget( myToMergeSubdomains, row++, 0, 1, 2 );
-
-  myToTagSubdomains = new QCheckBox( tr( "GHS3DPRL_ToTagSubdomains" ), GroupC1 );
-  myToTagSubdomains->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToTagSubdomains" ) );
-  l->addWidget( myToTagSubdomains, row++, 0, 1, 2 );
-
-  myToOutputInterfaces = new QCheckBox( tr( "GHS3DPRL_ToOutputInterfaces" ), GroupC1 );
-  myToOutputInterfaces->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToOutputInterfaces" ) );
-  l->addWidget( myToOutputInterfaces, row++, 0, 1, 2 );
-
-  myToDiscardSubdomains = new QCheckBox( tr( "GHS3DPRL_ToDiscardSubdomains" ), GroupC1 );
-  myToDiscardSubdomains->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToDiscardSubdomains" ) );
-  l->addWidget( myToDiscardSubdomains, row++, 0, 1, 2 );
+  //myToMergeSubdomains = new QCheckBox( tr( "GHS3DPRL_ToMergeSubdomains" ), GroupC1 );
+  //myToMergeSubdomains->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToMergeSubdomains" ) );
+  //l->addWidget( myToMergeSubdomains, row++, 0, 1, 2 );
+
+  QLabel* aGradationText = new QLabel( tr( "GHS3DPRL_Gradation" ), GroupC1 );
+  aGradationText->setWhatsThis( tr( "GHS3DPRL_WhatsThis_Gradation" ) );
+  l->addWidget( aGradationText, row, 0, 1, 1 );
+  myGradation = new QtxDoubleSpinBox( GroupC1 );
+  l->addWidget( myGradation, row++, 1, 1, 1 );
+  myGradation->setMinimum( 0 );
+  myGradation->setMaximum( 3 );
+  myGradation->setSingleStep( 0.01 );
+
+  QLabel* aMinSizeText = new QLabel( tr( "GHS3DPRL_MinSize" ), GroupC1 );
+  aMinSizeText->setWhatsThis( tr( "GHS3DPRL_WhatsThis_MinSize" ) );
+  l->addWidget( aMinSizeText, row, 0, 1, 1 );
+  myMinSize = new QtxDoubleSpinBox( GroupC1 );
+  l->addWidget( myMinSize, row++, 1, 1, 1 );
+  myMinSize->setMinimum( 0 );
+  //myMinSize->setMaximum( 999999 );
+  //myMinSize->setSingleStep( 1 );
+
+  QLabel* aMaxSizeText = new QLabel( tr( "GHS3DPRL_MaxSize" ), GroupC1 );
+  aMaxSizeText->setWhatsThis( tr( "GHS3DPRL_WhatsThis_MaxSize" ) );
+  l->addWidget( aMaxSizeText, row, 0, 1, 1 );
+  myMaxSize = new QtxDoubleSpinBox( GroupC1 );
+  l->addWidget( myMaxSize, row++, 1, 1, 1 );
+  myMaxSize->setMinimum( 0 );
+  //myMaxSize->setMaximum( 999999 );
+  //myMaxSize->setSingleStep( 1 );
 
   myIs3D = true;
 
@@ -148,12 +168,12 @@ void GHS3DPRLPluginGUI_HypothesisCreator::retrieveParams() const
   myNbPart->setValue( data.myNbPart );
   myKeepFiles->setChecked( data.myKeepFiles );
   myBackground->setChecked( data.myBackground );
+  myMultithread->setChecked( data.myMultithread );
   //myToMeshHoles->setChecked( data.myToMeshHoles );
-  myToMergeSubdomains->setChecked( data.myToMergeSubdomains );
-  myToTagSubdomains->setChecked( data.myToTagSubdomains );
-  myToOutputInterfaces->setChecked( data.myToOutputInterfaces );
-  myToDiscardSubdomains->setChecked( data.myToDiscardSubdomains );
-  //myNbPart->setEnabled( true );
+  //myToMergeSubdomains->setChecked( data.myToMergeSubdomains );
+  myGradation->setValue( data.myGradation );
+  myMinSize->setValue( data.myMinSize );
+  myMaxSize->setValue( data.myMaxSize );
 }
 
 QString GHS3DPRLPluginGUI_HypothesisCreator::storeParams() const
@@ -166,12 +186,13 @@ QString GHS3DPRLPluginGUI_HypothesisCreator::storeParams() const
   valStr += tr( "GHS3DPRL_MEDName" ) + " = " + data.myMEDName + "; ";
   valStr += tr( "GHS3DPRL_NbPart" ) + " = " + QString::number( data.myNbPart )   + "; ";
   //valStr += tr( "GHS3DPRL_ToMeshHoles" )  + " = " + QString::number( data.myToMeshHoles ) + "; ";
-  valStr += tr( "GHS3DPRL_ToMergeSubdomains" )  + " = " + QString::number( data.myToMergeSubdomains ) + "; ";
-  valStr += tr( "GHS3DPRL_ToTagSubdomains" )  + " = " + QString::number( data.myToTagSubdomains ) + "; ";
-  valStr += tr( "GHS3DPRL_ToOutputInterfaces" )  + " = " + QString::number( data.myToOutputInterfaces ) + "; ";
-  valStr += tr( "GHS3DPRL_ToDiscardSubdomains" )  + " = " + QString::number( data.myToDiscardSubdomains ) + "; ";
+  //valStr += tr( "GHS3DPRL_ToMergeSubdomains" )  + " = " + QString::number( data.myToMergeSubdomains ) + "; ";
+  valStr += tr( "GHS3DPRL_Gradation" )  + " = " + QString::number( data.myGradation ) + "; ";
+  valStr += tr( "GHS3DPRL_MinSize" )  + " = " + QString::number( data.myMinSize ) + "; ";
+  valStr += tr( "GHS3DPRL_MaxSize" )  + " = " + QString::number( data.myMaxSize ) + "; ";
   valStr += tr( "GHS3DPRL_KeepFiles" )  + " = " + QString::number( data.myKeepFiles ) + "; ";
   valStr += tr( "GHS3DPRL_Background" )  + " = " + QString::number( data.myBackground ) + "; ";
+  valStr += tr( "GHS3DPRL_Multithread" )  + " = " + QString::number( data.myMultithread ) + "; ";
 
   return valStr;
 }
@@ -187,11 +208,12 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DPRLHypothesis
   h_data.myNbPart    = h->GetNbPart();
   h_data.myKeepFiles = h->GetKeepFiles();
   h_data.myBackground = h->GetBackground();
+  h_data.myMultithread = h->GetMultithread();
   //h_data.myToMeshHoles = h->GetToMeshHoles();
-  h_data.myToMergeSubdomains = h->GetToMergeSubdomains();
-  h_data.myToTagSubdomains = h->GetToTagSubdomains();
-  h_data.myToOutputInterfaces = h->GetToOutputInterfaces();
-  h_data.myToDiscardSubdomains = h->GetToDiscardSubdomains();
+  //h_data.myToMergeSubdomains = h->GetToMergeSubdomains();
+  h_data.myGradation = h->GetGradation();
+  h_data.myMinSize = h->GetMinSize();
+  h_data.myMaxSize = h->GetMaxSize();
 
   return true;
 }
@@ -211,11 +233,12 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DPRLHypot
     h->SetNbPart( h_data.myNbPart );
     h->SetKeepFiles( h_data.myKeepFiles );
     h->SetBackground( h_data.myBackground );
+    h->SetMultithread( h_data.myMultithread );
     //h->SetToMeshHoles( h_data.myToMeshHoles );
-    h->SetToMergeSubdomains( h_data.myToMergeSubdomains );
-    h->SetToTagSubdomains( h_data.myToTagSubdomains );
-    h->SetToOutputInterfaces( h_data.myToOutputInterfaces );
-    h->SetToDiscardSubdomains( h_data.myToDiscardSubdomains );
+    //h->SetToMergeSubdomains( h_data.myToMergeSubdomains );
+    h->SetGradation( h_data.myGradation );
+    h->SetMinSize( h_data.myMinSize );
+    h->SetMaxSize( h_data.myMaxSize );
   }
   catch ( const SALOME::SALOME_Exception& ex )
   {
@@ -233,10 +256,10 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DPRLHypothe
   h_data.myKeepFiles = myKeepFiles->isChecked();
   h_data.myBackground = myBackground->isChecked();
   //h_data.myToMeshHoles = myToMeshHoles->isChecked();
-  h_data.myToMergeSubdomains = myToMergeSubdomains->isChecked();
-  h_data.myToTagSubdomains = myToTagSubdomains->isChecked();
-  h_data.myToOutputInterfaces = myToOutputInterfaces->isChecked();
-  h_data.myToDiscardSubdomains = myToDiscardSubdomains->isChecked();
+  //h_data.myToMergeSubdomains = myToMergeSubdomains->isChecked();
+  h_data.myGradation = myGradation->value();
+  h_data.myMinSize = myMinSize->value();
+  h_data.myMaxSize = myMaxSize->value();
   return true;
 }
 
index e0ac60a76387110dc60ce6da35dbd49a9d37b494..9ecef8a692c294d34fa06b7d69855244b8d20ed2 100755 (executable)
@@ -39,6 +39,7 @@
 #include <SMESHGUI_Hypotheses.h>
 
 class QtxIntSpinBox;
+class QtxDoubleSpinBox;
 class QCheckBox;
 class QLineEdit;
 
@@ -49,11 +50,12 @@ typedef struct
   int      myNbPart;
   bool     myKeepFiles;
   bool     myBackground;
+  bool     myMultithread;
   //bool     myToMeshHoles;
-  bool     myToMergeSubdomains;
-  bool     myToTagSubdomains;
-  bool     myToOutputInterfaces;
-  bool     myToDiscardSubdomains;
+  //bool     myToMergeSubdomains;
+  float     myGradation;
+  float     myMinSize;
+  float     myMaxSize;
  } GHS3DPRLHypothesisData;
 
 /*!
@@ -85,17 +87,18 @@ private:
   bool            storeParamsToHypo( const GHS3DPRLHypothesisData& ) const;
 
 private:
- QLineEdit*       myName;
- QLineEdit*       myMEDName;
- QtxIntSpinBox*   myNbPart;
- QCheckBox*       myKeepFiles;
- QCheckBox*       myBackground;
+ QLineEdit*        myName;
+ QLineEdit*        myMEDName;
+ QtxIntSpinBox*    myNbPart;
+ QCheckBox*        myKeepFiles;
+ QCheckBox*        myBackground;
+ QCheckBox*        myMultithread;
  //QCheckBox*       myToMeshHoles;
- QCheckBox*       myToMergeSubdomains;
- QCheckBox*       myToTagSubdomains;
- QCheckBox*       myToOutputInterfaces;
- QCheckBox*       myToDiscardSubdomains;
- bool             myIs3D;
//QCheckBox*       myToMergeSubdomains;
+ QtxDoubleSpinBox* myGradation;
+ QtxDoubleSpinBox* myMinSize;
+ QtxDoubleSpinBox* myMaxSize;
+ bool              myIs3D;
 };
 
 #endif // GHS3DPRLPLUGINGUI_HypothesisCreator_H
index 2c5499707b732455896a52108734027eb05848e6..2671b82ca564043758ac877350fe7e8175ec581b 100644 (file)
         <translation>Tetra_hpc in background</translation>
     </message>
     <message>
-        <source>GHS3DPRL_ToMeshHoles</source>
-        <translation>Mesh holes</translation>
+        <source>GHS3DPRL_Multithread</source>
+        <translation>Launch mg_tetra_hpc multithread</translation>
     </message>
     <message>
-        <source>GHS3DPRL_ToMergeSubdomains</source>
-        <translation>Merge subdomains</translation>
+        <source>GHS3DPRL_ToMeshHoles</source>
+        <translation>Mesh holes</translation>
     </message>
     <message>
-        <source>GHS3DPRL_ToTagSubdomains</source>
-        <translation>Tag subdomains</translation>
+        <source>GHS3DPRL_Gradation</source>
+        <translation>Max ratio adjacent cells</translation>
     </message>
     <message>
-        <source>GHS3DPRL_ToOutputInterfaces</source>
-        <translation>Output interfaces</translation>
+        <source>GHS3DPRL_MinSize</source>
+        <translation>Desired minimum cells size</translation>
     </message>
     <message>
-        <source>GHS3DPRL_ToDiscardSubdomains</source>
-        <translation>Discard subdomains</translation>
+        <source>GHS3DPRL_MaxSize</source>
+        <translation>Desired maximum cells size</translation>
     </message>
     <message>
         <source>GHS3DPRL_MEDName</source>
     </message>
     <message>
         <source>GHS3DPRL_WhatsThis_KeepFiles</source>
-        <translation>Keep intemediates Tepal Files (.faces,.points,.msg,.noboite...)</translation>
+        <translation>Keep intermediates mg_tetra_hpc files</translation>
     </message>
     <message>
         <source>GHS3DPRL_WhatsThis_Background</source>
-        <translation>Lanch Tepal in background (for a big mesh, a long time...)</translation>
+        <translation>Lanch mg_tetra_hpc in background (for a big mesh, a long time...)</translation>
     </message>
     <message>
-        <source>GHS3DPRL_WhatsThis_ToMeshHoles</source>
-        <translation>Tepal meshes holes</translation>
+        <source>GHS3DPRL_WhatsThis_Multithread</source>
+        <translation>Launch mg_tetra_hpc multithread</translation>
     </message>
     <message>
         <source>GHS3DPRL_WhatsThis_MEDName</source>
index 4766a7d077712368e593e99066a88001c3336272..a9df8dc63ea2d6fb504447c3dfaa7c2a0c51118a 100755 (executable)
     </message>
     <message>
         <source>GHS3DPRL_Background</source>
-        <translation>Tetra_hpc en arrière plan</translation>
+        <translation>mg_tetra_hpc en arrière plan</translation>
     </message>
     <message>
-        <source>GHS3DPRL_ToMeshHoles</source>
-        <translation>Mailler les trous du maillage</translation>
+        <source>GHS3DPRL_Multithread</source>
+        <translation>Lance mg_tetra_hpc multithread</translation>
     </message>
     <message>
-        <source>GHS3DPRL_ToMergeSubdomains</source>
-        <translation>Fusionner les sous domaines en fin</translation>
+        <source>GHS3DPRL_Gradation</source>
+        <translation>Max ratio mailles adjacentes</translation>
     </message>
     <message>
-        <source>GHS3DPRL_ToTagSubdomains</source>
-        <translation>Marquer les sous domaines</translation>
+        <source>GHS3DPRL_MinSize</source>
+        <translation>Min taille mailles</translation>
     </message>
     <message>
-        <source>GHS3DPRL_ToOutputInterfaces</source>
-        <translation>Gestion des interfaces entre les sous domaines</translation>
-    </message>
-    <message>
-        <source>GHS3DPRL_ToDiscardSubdomains</source>
-        <translation>Oublier les sous domaines</translation>
+        <source>GHS3DPRL_MaxSize</source>
+        <translation>Max taille mailles</translation>
     </message>
     <message>
         <source>GHS3DPRL_MEDName</source>
     </message>
     <message>
         <source>GHS3DPRL_WhatsThis_Background</source>
-        <translation>Lancer MG-Tetra-hpc en arrière-plan (prend du temps pour un maillage de grand volume...)</translation>
+        <translation>Lancer mg_Tetra_hpc en arrière-plan (prend du temps pour un maillage de grand volume...)</translation>
     </message>
     <message>
-        <source>GHS3DPRL_WhatsThis_ToMeshHoles</source>
-        <translation>MG-Tetra-hp maille les trous (obsolète)</translation>
+        <source>GHS3DPRL_WhatsThis_Multithread</source>
+        <translation>Lancer mg_Tetra_hpc multithread</translation>
     </message>
     <message>
         <source>GHS3DPRL_WhatsThis_MEDName</source>
index 443c76d5c5b1f4fac406cb0839159f0d4a6a88ad..61b29d707018ef2070e8032abe16e9e0489a2194 100644 (file)
     </message>
     <message>
       <source>GHS3DPRL_Background</source>
-      <translation>MG-Tetra HPC in background</translation>
+      <translation>Launch mg_tetra_hpc in background</translation>
+    </message>
+    <message>
+      <source>GHS3DPRL_Multithread</source>
+      <translation>Launch mg_tetra_hpc multithread</translation>
     </message>
     <message>
       <source>GHS3DPRL_ToMeshHoles</source>
     <message>
       <source>GHS3DPRL_ToDiscardSubdomains</source>
       <translation>サブドメインの削除</translation>
+    </message>
+        <message>
+        <source>GHS3DPRL_Gradation</source>
+        <translation>Max ratio adjacent cells</translation>
+    </message>
+    <message>
+        <source>GHS3DPRL_MinSize</source>
+        <translation>Desired minimum cells size</translation>
+    </message>
+    <message>
+        <source>GHS3DPRL_MaxSize</source>
+        <translation>Desired maximum cells size</translation>
     </message>
     <message>
       <source>GHS3DPRL_MEDName</source>
     </message>
     <message>
       <source>GHS3DPRL_WhatsThis_KeepFiles</source>
-      <translation>中間のMG-Tetra HPCファイルを保持</translation>
+      <translation>中間のmg_tetra_hpcファイルを保持</translation>
     </message>
     <message>
       <source>GHS3DPRL_WhatsThis_Background</source>
-      <translation>Launch MG-Tetra HPC in background (for a big mesh, a long time...)</translation>
+      <translation>Launch mg_tetra_hpc in background (for a big mesh, a long time...)</translation>
+    </message>
+    <message>
+      <source>GHS3DPRL_WhatsThis_Multithread</source>
+      <translation>Launch mg_tetra_hpc multithread</translation>
     </message>
     <message>
       <source>GHS3DPRL_WhatsThis_ToMeshHoles</source>
-      <translation>Tepal meshes holes</translation>
+      <translation>mg_tetra_hpc meshes holes</translation>
     </message>
     <message>
       <source>GHS3DPRL_WhatsThis_MEDName</source>
index 51dfbe927380013852794643e6359fcf2a6c56c1..33bc8efb58112023b17aed83038a2db14a8caa93 100755 (executable)
@@ -344,8 +344,8 @@ bool CVWtab::CVWtab_deallocate()
       memoryuse=memoryuse-sizeof(med_float)*size;
       size=-size; //precaution
    }
-   if (memoryuse<0) std::cout<<"***WARNING*** memoryuse <0 "<<memoryuse<<std::endl;
-   if (memoryuse==0) std::cout<<"***CVWtab_deallocate*** memoryuse=0 "<<std::endl;
+   if (memoryuse<0) std::cout<<"ERROR: on arrays deallocate memory use < 0 "<<memoryuse<<std::endl;
+   if (memoryuse==0) std::cout<<"WARNING: on arrays deallocate memory use = 0 "<<std::endl;
    return true;
 }
 
@@ -497,7 +497,7 @@ bool ghs3dprl_mesh_wrap::ReadFileMSGnew(const QString FileName)
       return false;
    }
 
-   //Lit les donns :
+   //Lit les donnees :
    if (!CVW_FindString("<neighbours count=",Ff,nbneighbour)) return false;
    if (verbose>2) std::cout<<"NeighboursCountDomain_"<<this->nofile<<"="<<nbneighbour<<std::endl;
    for (i=1; i<=nbneighbour; i++)
@@ -568,7 +568,7 @@ bool ghs3dprl_mesh_wrap::TestExistingFileMESHnew(const QString FileName)
       return false;
    }
 
-   //Lit les donns au debut du fichier, 1 lignes maxi:
+   //Lit les donnees au debut du fichier, 1 lignes maxi:
    maxline=1;
    if (!CVW_FindStringInFirstLines("MeshVersionFormatted",Ff,maxline)) return false;
    if (verbose>2) std::cout<<"MeshVersionFormatted_"<<this->nofile<<" ok"<<std::endl;
@@ -595,7 +595,7 @@ bool ghs3dprl_mesh_wrap::ReadFileGLO(const QString FileName)
       return false;
    }
 
-   //Lit les donns :
+   //Lit les donnees :
    if (!CVW_FindString("<vertices count=",Ff,count)) return false;
    if (verbose>3) std::cout<<"GloVerticesCount="<<count<<std::endl;
    if (count>0)
@@ -653,6 +653,95 @@ bool ghs3dprl_mesh_wrap::ReadFileGLO(const QString FileName)
    return true;
 }
 
+///************************************
+bool ghs3dprl_mesh_wrap::ReadFileGLOBAL(const QString FileName)
+//read file .global ascii (no xml)
+//first line: Vertices Edges Triangles Tetrahedra
+{
+   std::string line("                                            ");
+   QString tmp;
+   std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in);
+   long vert=0,edge=0,tria=0,tetr=0,count=0;
+   med_int *tmint;
+   CVWtab *montab;
+   bool ok;
+   
+   if (verbose>=6)std::cout<<"Read file '"<<FileName.toLatin1().constData()<<std::endl;
+   if (!Ff.is_open()){
+      std::cerr<<"Problem file '"<<FileName.toLatin1().constData()<<"' not open\n"<<std::endl;
+      return false;
+   }
+   
+   //Lit les donnees :
+   Ff>>vert>>edge>>tria>>tetr;
+   std::cout<<"First line "<<vert<<" "<<edge<<" "<<tria<<" "<<tetr<<std::endl;
+   
+   if (vert<0)
+   {
+      std::cerr<<"Problem Vertices: a positive integer is expected"<<std::endl;
+      return false;
+   }
+
+   if (edge<0)
+   {
+      std::cerr<<"Problem Edges: a positive integer is expected"<<std::endl;
+      return false;
+   }
+
+   if (tria<0)
+   {
+      std::cerr<<"Problem Triangles: a positive integer is expected"<<std::endl;
+      return false;
+   }
+
+   if (tetr<0)
+   {
+      std::cerr<<"Problem Tetrahedra: a positive integer is expected"<<std::endl;
+      return false;
+   }
+
+   count=vert;
+   tmint=new med_int[count];
+   for (int i=0; i<count; i++) Ff>>tmint[i];
+   if (verbose>4) std::cout<<"Vertices ("<<count<<" ) "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[count-1]<<std::endl;
+
+   montab=new CVWtab(count,tmint);
+   tmp=tmp.sprintf("GL%ld VE",this->nofile);
+   ok=this->insert_key(tmp,montab);
+
+   count=edge;
+   tmint=new med_int[count];
+   for (int i=0; i<count; i++) Ff>>tmint[i];
+   if (verbose>4) std::cout<<"Edges ("<<count<<") "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[count-1]<<std::endl;
+
+   montab=new CVWtab(count,tmint);
+   tmp=tmp.sprintf("GL%ld ED",this->nofile);
+   ok=this->insert_key(tmp,montab);
+
+   count=tria;
+   tmint=new med_int[count];
+   for (int i=0; i<count; i++) Ff>>tmint[i];
+   if (verbose>4) std::cout<<"Triangles ("<<count<<") "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[count-1]<<std::endl;
+
+   montab=new CVWtab(count,tmint);
+   tmp=tmp.sprintf("GL%ld FA",this->nofile);
+   ok=this->insert_key(tmp,montab);
+
+   count=tetr;
+   tmint=new med_int[count];
+   for (int i=0; i<count; i++) Ff>>tmint[i];
+   if (verbose>4) std::cout<<"Tetrahedra ("<<count<<") "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[count-1]<<std::endl;
+
+   montab=new CVWtab(count,tmint);
+   tmp=tmp.sprintf("GL%ld EL",this->nofile);
+   ok=this->insert_key(tmp,montab);
+
+   //Ferme le fichier :
+   Ff.close();
+   this->nbfiles++;
+   return true;
+}
+
 //************************************
 bool ghs3dprl_mesh_wrap::ReadFileFACES(const QString FileName)
 //read file .faces (wrap)
@@ -669,8 +758,8 @@ bool ghs3dprl_mesh_wrap::ReadFileFACES(const QString FileName)
       return false;
    }
 
-   //Lit les donns :
-   //Replace le pointeur de fichier au dut :f.seekg(0);
+   //Lit les donnees :
+   //Replace le pointeur de fichier au debut :f.seekg(0);
    if (getline(Ff,line))
    {
       tmp=line.c_str();
@@ -712,13 +801,14 @@ bool ghs3dprl_mesh_wrap::ReadFileMESH(const QString FileName)
    std::string line("                                            ");
    QString tmp;
    std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in);
-   long Mversion=0,Mdim=0,Mvert=0,Mtria=0,Mtetra=0;
+   long Mversion=0,Mdim=0,Mvert=0,Mtria=0,Medge=0,Mtetra=0,count=0;
    med_int garbage;
-   //long ne,np,npfixe,subnumber,reste;
+   med_int *tmint;
    bool ok;
-   if (verbose>=6)std::cout<<"Read File '"<<FileName.toLatin1().constData()<<std::endl;
+   
+   if (verbose>=6)std::cout<<"Read file '"<<FileName.toLatin1().constData()<<std::endl;
    if (!Ff.is_open()){
-      std::cerr<<"Problem File '"<<FileName.toLatin1().constData()<<"' not open\n"<<std::endl;
+      std::cerr<<"Problem file '"<<FileName.toLatin1().constData()<<"' not open\n"<<std::endl;
       return false;
    }
 
@@ -761,29 +851,64 @@ bool ghs3dprl_mesh_wrap::ReadFileMESH(const QString FileName)
    }
    else
    {
-      std::cerr<<"Problem on line 6 of file: a positive integer is expected"<<std::endl;
+      std::cerr<<"Problem Vertices: a positive integer is expected"<<std::endl;
       return false;
    }
    if (Mvert<=0)
    {
-      std::cerr<<"Problem on line 6 of file: a positive integer is expected"<<std::endl;
+      std::cerr<<"Problem Vertices: a positive integer is expected"<<std::endl;
       return false;
    }
 
-   med_float *tmflo=new med_float[Mvert*3];
-   for (int i=0; i<Mvert*3; i=i+3) Ff>>tmflo[i]>>tmflo[i+1]>>tmflo[i+2]>>garbage;
-   if (verbose>4) std::cout<<"Vertices "<<tmflo[0]<<" "<<tmflo[1]<<"... "<<tmflo[Mvert*3-1]<<std::endl;
+   count=Mvert;
+   med_float *tmflo=new med_float[count*3];
+   for (int i=0; i<count*3; i=i+3) Ff>>tmflo[i]>>tmflo[i+1]>>tmflo[i+2]>>garbage;
+   if (verbose>4) std::cout<<"Vertices ("<<count<<") "<<tmflo[0]<<" "<<tmflo[1]<<"... "<<tmflo[count*3-1]<<std::endl;
 
-   CVWtab *montab=new CVWtab(Mvert*3,tmflo);
+   CVWtab *montab=new CVWtab(count*3,tmflo);
    tmp=tmp.sprintf("NB%ld VC",this->nofile);
    ok=this->insert_key(tmp,montab);
 
+   getline(Ff,line);
+   getline(Ff,line);
+   
+   if (!(getline(Ff,line) && (line.find("Edges")==0)))
+   {
+      std::cerr<<"Problem on line 'Edges' of file '"<<FileName.toLatin1().constData()<<"' :found '"<<line<<"' instead"<<std::endl;
+      return false;
+   }
+   if (getline(Ff,line))
+   {
+      tmp=line.c_str();
+      Medge=tmp.toLong(&ok);
+   }
+   else
+   {
+      std::cerr<<"Problem on line 'Edges' of file: a positive integer is expected"<<std::endl;
+      return false;
+   }
+   if (Medge<=0)
+   {
+      std::cerr<<"Problem on line 'Edges' of file: a positive integer is expected"<<std::endl;
+      return false;
+   }
+
+   count=Medge;
+   tmint=new med_int[count*2]; //*3
+   for (int i=0; i<count*2; i=i+2) {
+     Ff>>tmint[i]>>tmint[i+1]>>garbage;
+   }
+   if (verbose>4) std::cout<<"Edges ("<<count<<") "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[count*2-1]<<std::endl;
+   montab=new CVWtab(count*2,tmint);
+   tmp=tmp.sprintf("NB%ld ED",this->nofile); //TODO see if it could serve
+   ok=this->insert_key(tmp,montab);
+   
    getline(Ff,line);
    getline(Ff,line);
 
    if (!(getline(Ff,line) && (line.find("Triangles")==0)))
    {
-      std::cerr<<"Problem on line 'Triangles' of file: not found"<<line<<std::endl;
+      std::cerr<<"Problem on line 'Triangles' of file '"<<FileName.toLatin1().constData()<<"' :found '"<<line<<"' instead"<<std::endl;
       return false;
    }
    if (getline(Ff,line))
@@ -802,19 +927,16 @@ bool ghs3dprl_mesh_wrap::ReadFileMESH(const QString FileName)
       return false;
    }
 
-   med_int *tmint=new med_int[Mtria*7]; //*7 as older files .faces
-   for (int i=0; i<Mtria*7; i=i+7) {
+   count=Mtria;
+   tmint=new med_int[count*3]; //*7 as older files .faces, obsolete
+   for (int i=0; i<count*3; i=i+3) {
      Ff>>tmint[i]>>tmint[i+1]>>tmint[i+2]>>garbage;
-     tmint[i+3]=0;
-     tmint[i+4]=0;
-     tmint[i+5]=0;
-     tmint[i+6]=0;
    }
-   if (verbose>4) std::cout<<"Triangles "<<tmint[0]<<" "<<tmint[1]<<"... "<<
-       tmint[Mtria*7-5]<<" "<<tmint[Mtria*7-4]<<" "<<tmint[Mtria*7-3]<<" "<<
-      tmint[Mtria*7-2]<<" "<<tmint[Mtria*7-1]<<std::endl;
+   if (verbose>4) std::cout<<"Triangles ("<<count<<") "<<tmint[0]<<" "<<tmint[1]<<"... "<<
+       tmint[count*3-5]<<" "<<tmint[count*3-4]<<" "<<tmint[count*3-3]<<" "<<
+       tmint[count*3-2]<<" "<<tmint[count*3-1]<<std::endl;
 
-   montab=new CVWtab(Mtria*7,tmint);
+   montab=new CVWtab(count*3,tmint);
    tmp=tmp.sprintf("FC%ld",this->nofile);
    ok=this->insert_key(tmp,montab);
    
@@ -847,15 +969,17 @@ bool ghs3dprl_mesh_wrap::ReadFileMESH(const QString FileName)
       std::cout<<"MeshVersionFormatted="<<Mversion<<std::endl;
       std::cout<<"MeshDimension="<<Mdim<<std::endl;
       std::cout<<"MeshNumberOfVertices="<<Mvert<<std::endl;
+      std::cout<<"MeshNumberOfEdges="<<Medge<<std::endl;
       std::cout<<"MeshNumberOfTriangles="<<Mtria<<std::endl;
       std::cout<<"MeshNumberOfTetrahedra="<<Mtetra<<std::endl;
    }
 
-   tmint=new med_int[Mtetra*4];
-   for (int i=0; i<Mtetra*4; i=i+4) Ff>>tmint[i]>>tmint[i+1]>>tmint[i+2]>>tmint[i+3]>>garbage;
-   if (verbose>4) std::cout<<"Tetrahedra "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[Mtetra*4-1]<<std::endl;
+   count=Mtetra;
+   tmint=new med_int[count*4];
+   for (int i=0; i<count*4; i=i+4) Ff>>tmint[i]>>tmint[i+1]>>tmint[i+2]>>tmint[i+3]>>garbage;
+   if (verbose>4) std::cout<<"Tetrahedra ("<<count<<") "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[count*4-1]<<std::endl;
 
-   montab=new CVWtab(Mtetra*4,tmint);
+   montab=new CVWtab(count*4,tmint);
    tmp=tmp.sprintf("NB%ld EV",this->nofile);
    ok=this->insert_key(tmp,montab);
 
@@ -886,7 +1010,7 @@ bool ghs3dprl_mesh_wrap::ReadFileNOBOITE(const QString FileName)
       return false;
    }
 
-   //lit les donns :
+   //lit les donnees :
    Ff>>ne>>np>>npfixe;
    if (verbose>3){
       std::cout<<"NoboiteNumberOfElements="<<ne<<std::endl;
@@ -1057,7 +1181,7 @@ bool ghs3dprl_mesh_wrap::ReadFilePOINTS(const QString FileName)
    long maxlen=128;
    bool ok=true;
 
-   //Lit les donns :
+   //Lit les donnees :
    QFile Ff(FileName);
    //NOT Raw because Raw=non-buffered file access
    //qt3 ok=Ff.open(IO_ReadOnly|IO_Translate);
@@ -1250,7 +1374,7 @@ bool ghs3dprl_mesh_wrap::list_onekey_mesh_wrap(const QString &key)
 
 //************************************
 bool ghs3dprl_mesh_wrap::insert_key(const QString &key,CVWtab *tab)
-//insertion conditionn par limite this->nbelem_limit_swap
+//insertion conditionnee par limite this->nbelem_limit_swap
 //si tableaux contenus on dimension superieure
 //alors swap disque dans getenv(tmp) fichier temporaire binaire
 {
@@ -1269,7 +1393,7 @@ bool ghs3dprl_mesh_wrap::insert_key(const QString &key,CVWtab *tab)
 }
 //************************************
 CVWtab* ghs3dprl_mesh_wrap::restore_key(const QString &key)
-//retauration conditionn par limite nbelem
+//retauration conditionnee par limite nbelem
 //si tableaux contenus on dimension superieure a nbelem
 //alors swap disque dans getenv(tmp) fichier temporaire
 //alors lecture du fichier (et reallocate memory)
@@ -1793,13 +1917,18 @@ bool ghs3dprl_mesh_wrap::Write_MEDfiles_v2(bool deletekeys)
    else if (verbose>3) std::cout<<"--deletegroups matches \"New_Tetrahedra\"\n";
 
    if (verbose>6){std::cout<<"\nIntermediatesFamilies\n"; families.write();}
-   if (verbose>6) std::cout<<"\nNumber0fFiles="<<nbfilestot<<std::endl;
+   //if (verbose>6) std::cout<<"\nNumber0fFiles="<<nbfilestot<<std::endl;
    familles intermediatesfamilies=families;
    //initialisations on all domains
    nbtetrastotal=0;
 
    //loop on the domains
    //for (idom=1; idom<=nbfilestot; idom++) {
+   if (for_multithread) {
+     nbfilestot=1;
+     std::cout<<"\nset Number0fFiles as multithread="<<nbfilestot<<std::endl;
+   }
+   if (verbose>6) std::cout<<"\nNumber0fFiles="<<nbfilestot<<std::endl;
    for (idom=1; idom<=nbfilestot; idom++) {
    
       this->nofile=idom;
@@ -1828,44 +1957,51 @@ bool ghs3dprl_mesh_wrap::Write_MEDfiles_v2(bool deletekeys)
       if (err<0) {std::cerr<<"Problem MEDmeshCr"<<nomfinal<<std::endl; goto erreur;}
 
       if (!idom_nodes()) {std::cerr<<"Problem on Nodes"<<std::endl; goto erreur;}
+      if (verbose>4) std::cout<<"\nEnd of Nodes ***\n"<<std::endl;
       if (!idom_edges()) {std::cerr<<"Problem on Edges"<<std::endl; goto erreur;}
+      if (verbose>4) std::cout<<"\nEnd of Edges ***\n"<<std::endl;
       if (!idom_faces()) {std::cerr<<"Problem on Faces"<<std::endl; goto erreur;}
+      if (verbose>4) std::cout<<"\nEnd of Faces ***\n"<<std::endl;
       if (!idom_tetras()) {std::cerr<<"Problem on tetrahedra"<<std::endl; goto erreur;}
-      if (!idom_joints()) {std::cerr<<"Problem on Joints"<<std::endl; goto erreur;}
-
-      if (verbose>6){std::cout<<"\nFinalsFamilies\n"; families.write();}
-      //for nodes families
-      nb=create_families(fid,1);
-      if (verbose>5)std::cout<<"NumberOfFamiliesNodes="<<nb<<std::endl;
-
-      err=MEDmeshEntityFamilyNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_NODE,MED_UNDEF_GEOMETRY_TYPE,nbnodes,famnodes);
-      if (verbose>8)
-         std::cout<<"MEDmeshEntityFamilyNumberWr nodes "<<nbnodes<<":"<<
-               famnodes[0]<<"..."<<famnodes[nbnodes-1]<<" "<<std::endl;
-      delete[] famnodes;
-      if (err<0) std::cerr<<"Problem MEDmeshEntityFamilyNumberWr nodes"<<std::endl;
-
-      //for others families
-      nb=create_families(fid,-1);
-      if (verbose>5)std::cout<<"NumberOfFamiliesFacesAndEdgesEtc="<<nb<<std::endl;
-
-      err=MEDmeshEntityFamilyNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TRIA3,nbtria3,famtria3);
-      if (verbose>8)
-         std::cout<<"MEDmeshEntityFamilyNumberWr tria3 "<<nbtria3<<":"<<
-               famtria3[0]<<"..."<<famtria3[nbtria3-1]<<" "<<std::endl;
-      delete[] famtria3;
-      if (err<0) std::cerr<<"Problem MEDmeshEntityFamilyNumberWr tria3"<<std::endl;
-
-      err=MEDmeshEntityFamilyNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TETRA4,nbtetra4,famtetra4);
-      if (verbose>8)
-         std::cout<<"MEDmeshEntityFamilyNumberWr tetra4 "<<nbtetra4<<":"<<
-               famtetra4[0]<<"..."<<famtetra4[nbtria3-1]<<" "<<std::endl;
-      delete[] famtetra4;
-      if (err<0) std::cerr<<"Problem MEDmeshEntityFamilyNumberWr tria3"<<std::endl;
-
+      if (verbose>4) std::cout<<"\nEnd of Tetrahedra ***\n"<<std::endl;
+      //non existing files msg mh-tetra_hpc v2.1.11
+      //if (!idom_joints()) {std::cerr<<"Problem on Joints"<<std::endl; goto erreur;}
+
+      if (!for_multithread) {
+        if (verbose>6){std::cout<<"\nFinalsFamilies\n"; families.write();}
+        //for nodes families
+        nb=create_families(fid,1);
+        if (verbose>5)std::cout<<"NumberOfFamiliesNodes="<<nb<<std::endl;
+
+        err=MEDmeshEntityFamilyNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_NODE,MED_UNDEF_GEOMETRY_TYPE,nbnodes,famnodes);
+        if (verbose>8)
+          std::cout<<"MEDmeshEntityFamilyNumberWr nodes "<<nbnodes<<":"<<
+                famnodes[0]<<"..."<<famnodes[nbnodes-1]<<" "<<std::endl;
+        delete[] famnodes;
+        if (err<0) std::cerr<<"Problem MEDmeshEntityFamilyNumberWr nodes"<<std::endl;
+
+        //for others families
+        nb=create_families(fid,-1);
+        if (verbose>5)std::cout<<"NumberOfFamiliesFacesAndEdgesEtc="<<nb<<std::endl;
+
+        err=MEDmeshEntityFamilyNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TRIA3,nbtria3,famtria3);
+        if (verbose>8)
+          std::cout<<"MEDmeshEntityFamilyNumberWr tria3 "<<nbtria3<<":"<<
+                famtria3[0]<<"..."<<famtria3[nbtria3-1]<<" "<<std::endl;
+        delete[] famtria3;
+        if (err<0) std::cerr<<"Problem MEDmeshEntityFamilyNumberWr tria3"<<std::endl;
+
+        err=MEDmeshEntityFamilyNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TETRA4,nbtetra4,famtetra4);
+        if (verbose>8)
+          std::cout<<"MEDmeshEntityFamilyNumberWr tetra4 "<<nbtetra4<<":"<<
+                famtetra4[0]<<"..."<<famtetra4[nbtria3-1]<<" "<<std::endl;
+        delete[] famtetra4;
+        if (err<0) std::cerr<<"Problem MEDmeshEntityFamilyNumberWr tria3"<<std::endl;
+      }
+    
       MEDfileClose(fid); //no error
       //master.xml writings
-      oktmp=Write_masterxmlMEDfile();
+      //oktmp=Write_masterxmlMEDfile();
       continue;       //and loop on others domains
 
       erreur:         //error
@@ -1876,7 +2012,8 @@ bool ghs3dprl_mesh_wrap::Write_MEDfiles_v2(bool deletekeys)
    
    MEDfileClose(fidjoint); //no error
    if (verbose>0)std::cout<<"\nTotalNumberOftetrahedra="<<nbtetrastotal<<std::endl;
-
+   ok = true;
+   
    return ok;
 }
 
@@ -1899,7 +2036,7 @@ bool ghs3dprl_mesh_wrap::idom_nodes()
             ok=this->ReadFileNOBOITE(tmp);
          }
          if (for_tetrahpc) {
-            tmp=pathini+casename+tmp.sprintf(format_tetra.toLatin1().constData(),idom)+".mesh";
+            tmp=pathini+casename+"_out"+tmp.sprintf(format_tetra.toLatin1().constData(),idom)+".mesh";
             ok=this->ReadFileMESH(tmp);
          }
          tab=this->restore_key(key); //tab1=this->mestab[key1];
@@ -1911,7 +2048,7 @@ bool ghs3dprl_mesh_wrap::idom_nodes()
       nbnodes=tab->size/3;
       err=MEDmeshNodeCoordinateWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,0.,MED_FULL_INTERLACE,nbnodes,tab->tmflo);
       if (err<0) {std::cerr<<"Problem MEDmeshNodeCoordinateWr"<<std::endl; return false;}
-      if (verbose>4)std::cout<<"NumberOfNodes="<<nbnodes<<std::endl;
+      if (verbose>4) std::cout<<"NumberOfNodes="<<nbnodes<<std::endl;
 
       //writing indices of nodes
       arrayi=new med_int[nbnodes];
@@ -1920,6 +2057,7 @@ bool ghs3dprl_mesh_wrap::idom_nodes()
       delete[] arrayi;
       if (err<0) {std::cerr<<"Problem MEDmeshEntityNumberWr of nodes"<<std::endl; return false;}
 
+    if (!for_multithread) {
       key1=key1.sprintf("GL%d VE",idom); //global numerotation 
       tab1=this->restore_key(key1); //tab1=this->mestab[key1];
       if (!tab1) {
@@ -1928,8 +2066,8 @@ bool ghs3dprl_mesh_wrap::idom_nodes()
             ok=this->ReadFileGLO(tmp);
          }
          if (for_tetrahpc) {
-            tmp=pathini+casename+tmp.sprintf(format_tetra.toLatin1().constData(),idom)+".glo";
-            ok=this->ReadFileGLO(tmp);
+            tmp=pathini+casename+"_out"+tmp.sprintf(format_tetra.toLatin1().constData(),idom)+".global";
+            ok=this->ReadFileGLOBAL(tmp);
          }
          if (!ok) {std::cerr<<"Problem file "<<tmp.toLatin1().constData()<<std::endl; return false;}
          tab1=this->restore_key(key1); //tab1=this->mestab[key1];
@@ -1967,7 +2105,8 @@ bool ghs3dprl_mesh_wrap::idom_nodes()
       //writing nodes(vertices) global numbering
       err=MEDmeshGlobalNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_NODE,MED_UNDEF_GEOMETRY_TYPE,nbnodes,tab1->tmint);
       if (err<0){std::cerr<<"Problem MEDmeshGlobalNumberWr nodes"<<std::endl; return false;}
-
+    }
+    
    return ok;
 }
 
@@ -2088,18 +2227,19 @@ bool ghs3dprl_mesh_wrap::idom_faces()
          tab1=this->restore_key(key1);
          if (!tab1) return false;
       }
-      nbtria3=tab1->size/7;
+      nbtria3=tab1->size/3;
       if (verbose>4) std::cout<<"NumberOfTriangles="<<nbtria3<<std::endl;
-      arrayi=new med_int[nbtria3*3];
-      ii=0,i=0 ;
-      for (j=0; j<nbtria3 ; j++){
-         arrayi[ii]=tab1->tmint[i]; ii++;
-         arrayi[ii]=tab1->tmint[i+1]; ii++;
-         arrayi[ii]=tab1->tmint[i+2]; ii++;
-         i=i+7;
-      }
-      err=MEDmeshElementConnectivityWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,0.,MED_CELL,MED_TRIA3,MED_NODAL,MED_FULL_INTERLACE,nbtria3,arrayi);
-      delete[] arrayi; //need immediately more little array
+      //arrayi=new med_int[nbtria3*3];
+      //ii=0,i=0 ;
+      //for (j=0; j<nbtria3 ; j++){
+      //   arrayi[ii]=tab1->tmint[i]; ii++;
+      //   arrayi[ii]=tab1->tmint[i+1]; ii++;
+      //   arrayi[ii]=tab1->tmint[i+2]; ii++;
+      //   i=i+7;
+      //}
+      //err=MEDmeshElementConnectivityWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,0.,MED_CELL,MED_TRIA3,MED_NODAL,MED_FULL_INTERLACE,nbtria3,arrayi);
+      err=MEDmeshElementConnectivityWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,0.,MED_CELL,MED_TRIA3,MED_NODAL,MED_FULL_INTERLACE,nbtria3,tab1->tmint);
+      //delete[] arrayi; //need immediately more little array
       if (err<0){std::cerr<<"Problem MEDmeshElementConnectivityWr for triangles connectivity"<<std::endl; return false;}
       
       //writing indices of faces triangles of wrap
@@ -2113,45 +2253,48 @@ bool ghs3dprl_mesh_wrap::idom_faces()
       if (err<0){std::cerr<<"Problem MEDmeshEntityNumberWr of triangles"<<std::endl; return false;}
 
       //GLx FA=files.GLo FAces
-      key1=key1.sprintf("GL%d FA",idom);
-      tab1=this->restore_key(key1); //tab1=this->mestab[key1];
-      if (nbtria3!=tab1->size){std::cerr<<"Problem size GLi FA!=nbtria3!"<<std::endl; return false;}
-
-      key2=key2.sprintf("SKIN_TRIA3_FAMILIES",idom); //on global numerotation 
-      tab2=this->restore_key(key2); //tab1=this->mestab[key1];
-      med_int nbskin=0; 
-      if (tab2) nbskin=tab2->size;
+      if (!for_multithread) {
+        key1=key1.sprintf("GL%d FA",idom);
+        tab1=this->restore_key(key1); //tab1=this->mestab[key1];
+        if (nbtria3!=tab1->size){std::cerr<<"Problem size GLi FA!=nbtria3!"<<std::endl; return false;}
       
-      //set families of faces existing in GHS3DPRL_skin.med
-      med_int nb=nbtria3;
-      famtria3=new med_int[nb];
-      for (i=0; i<nb ; i++) famtria3[i]=famalltria3;
-      med_int * fammore=new med_int[nb];
-      for (i=0; i<nb ; i++) fammore[i]=famnewtria3;
-
-      //set families of faces of skin
-      for (i=0; i<nb ; i++){
-         j=tab1->tmint[i]-1; //
-         if (j<nbskin){
-            fammore[i]=tab2->tmint[j];
-         }
-      }
-      ok=set_one_more_family(famtria3,fammore,nb);
-      delete[] fammore;
       
-      //writing faces(triangles) global numbering
-      if (verbose>2)
-         std::cout<<"CreateMEDglobalNumerotation_Faces "<<key1.toLatin1().constData()<<" "<<tab1->size<<std::endl;
-      err=MEDmeshGlobalNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TRIA3,tab1->size,tab1->tmint);
-      if (err<0){std::cerr<<"Problem MEDmeshGlobalNumberWr faces"<<std::endl; return false;}
-
-      //xx=this->remove_key_mesh_wrap(QRegExp("FC*",true,true));
-      tmp=tmp.sprintf("GL%d FA",idom);
-      //qt3 xx=this->remove_key_mesh_wrap(QRegExp(tmp,true,true));
-      xx=this->remove_key_mesh_wrap(QRegExp(tmp,Qt::CaseSensitive,QRegExp::RegExp));
-      tmp=tmp.sprintf("GL%d VE",idom);
-      //qt3 xx=this->remove_key_mesh_wrap(QRegExp(tmp,true,true));
-      xx=this->remove_key_mesh_wrap(QRegExp(tmp,Qt::CaseSensitive,QRegExp::RegExp));
+        key2=key2.sprintf("SKIN_TRIA3_FAMILIES",idom); //on global numerotation 
+        tab2=this->restore_key(key2); //tab1=this->mestab[key1];
+        med_int nbskin=0; 
+        if (tab2) nbskin=tab2->size;
+        
+        //set families of faces existing in GHS3DPRL_skin.med
+        med_int nb=nbtria3;
+        famtria3=new med_int[nb];
+        for (i=0; i<nb ; i++) famtria3[i]=famalltria3;
+        med_int * fammore=new med_int[nb];
+        for (i=0; i<nb ; i++) fammore[i]=famnewtria3;
+
+        //set families of faces of skin
+        for (i=0; i<nb ; i++){
+          j=tab1->tmint[i]-1; //
+          if (j<nbskin){
+              fammore[i]=tab2->tmint[j];
+          }
+        }
+        ok=set_one_more_family(famtria3,fammore,nb);
+        delete[] fammore;
+        
+        //writing faces(triangles) global numbering
+        if (verbose>2)
+          std::cout<<"CreateMEDglobalNumerotation_Faces "<<key1.toLatin1().constData()<<" "<<tab1->size<<std::endl;
+        err=MEDmeshGlobalNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TRIA3,tab1->size,tab1->tmint);
+        if (err<0){std::cerr<<"Problem MEDmeshGlobalNumberWr faces"<<std::endl; return false;}
+
+        //xx=this->remove_key_mesh_wrap(QRegExp("FC*",true,true));
+        tmp=tmp.sprintf("GL%d FA",idom);
+        //qt3 xx=this->remove_key_mesh_wrap(QRegExp(tmp,true,true));
+        xx=this->remove_key_mesh_wrap(QRegExp(tmp,Qt::CaseSensitive,QRegExp::RegExp));
+        tmp=tmp.sprintf("GL%d VE",idom);
+        //qt3 xx=this->remove_key_mesh_wrap(QRegExp(tmp,true,true));
+        xx=this->remove_key_mesh_wrap(QRegExp(tmp,Qt::CaseSensitive,QRegExp::RegExp));
+      }
 
    return ok;
 }
@@ -2471,23 +2614,37 @@ bool ghs3dprl_mesh_wrap::idom_tetras()
       famtetra4=new med_int[nbtetra4];
       for (i=0; i<nbtetra4 ; i++) famtetra4[i]=famnewtetra4;
 
-      //writing tetrahedra global numbering
-      //GLx EL=files.GLo ELements
-      key1=key1.sprintf("GL%d EL",idom);
-      tab1=this->restore_key(key1); //tab1=this->mestab[key1];
-      if (!tab1) {
-         tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".glo";
-         ok=this->ReadFileGLO(tmp);
-         tab1=this->restore_key(key1);
-         if (!tab1) return false;
-      }
+      if (!for_multithread) {
+        //writing tetrahedra global numbering
+        //GLx EL=files.GLo ELements
+        key1=key1.sprintf("GL%d EL",idom);
+        tab1=this->restore_key(key1); //tab1=this->mestab[key1];
+        if (!tab1) {
+          //tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".glo";
+          //ok=this->ReadFileGLO(tmp);
+          //tab1=this->restore_key(key1);
+          //if (!tab1) return false;
+
+          if (!for_tetrahpc) {
+              tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".glo";
+              ok=this->ReadFileGLO(tmp);
+          }
+          if (for_tetrahpc) {
+              tmp=pathini+casename+"_out"+tmp.sprintf(format_tetra.toLatin1().constData(),idom)+".global";
+              ok=this->ReadFileGLOBAL(tmp);
+          }
+          tab1=this->restore_key(key1);
+          if (!tab1) return false;
 
-      if (tab1->size!=nbtetra4){
-         std::cerr<<"Problem incorrect size of tetrahedra global numbering"<<std::endl; return false;}
-      if (verbose>2)
-         std::cout<<"CreateMEDglobalNumerotation_tetrahedra "<<key1.toLatin1().constData()<<" "<<tab1->size<<std::endl;
-      err=MEDmeshGlobalNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TETRA4,tab1->size,tab1->tmint);
-      if (err<0){std::cerr<<"Problem MEDmeshGlobalNumberWr tetrahedra"<<std::endl; return false;}
+        }
+
+        if (tab1->size!=nbtetra4){
+          std::cerr<<"Problem incorrect size of tetrahedra global numbering"<<std::endl; return false;}
+        if (verbose>2)
+          std::cout<<"CreateMEDglobalNumerotation_tetrahedra "<<key1.toLatin1().constData()<<" "<<tab1->size<<std::endl;
+        err=MEDmeshGlobalNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TETRA4,tab1->size,tab1->tmint);
+        if (err<0){std::cerr<<"Problem MEDmeshGlobalNumberWr tetrahedra"<<std::endl; return false;}
+      }
 
       tmp=tmp.sprintf("NB%d EV",idom);
       //qt3 xx=this->remove_key_mesh_wrap(QRegExp(tmp,true,true));
index ec85929978f30d0f6323bc1ecbc2e030d166fe3b..27f3bf25fed3a197a07400571ad34b1fb0b9067f 100755 (executable)
@@ -83,9 +83,17 @@ class familles{
 class ghs3dprl_mesh_wrap
 {
 public:
-   QString medname,casename,path,pathini,filemed,format,format_tetra;
-   bool for_tetrahpc; //to know what files to read: .noboite or .mesh
-   QRegExp deletegroups; //regular expression 
+   QString 
+      medname,
+      casename,
+      path,
+      pathini,
+      filemed,
+      format,
+      format_tetra;
+   bool for_tetrahpc;    //to know what files to read: .noboite or .mesh
+   bool for_multithread; //to know what files to read: one or more
+   QRegExp deletegroups; //regular expression
    long
       nbtetrastotal,
       nofile,nbfiles,nbfilestot,
@@ -151,6 +159,7 @@ public:
    bool ReadFileMSGnew(const QString FileName);
    bool TestExistingFileMESHnew(const QString FileName);
    bool ReadFileGLO(const QString FileName);
+   bool ReadFileGLOBAL(const QString FileName); //mg-tetra v2.1.11
    bool ReadFileFACES(const QString FileName);
    bool ReadFileMESH(const QString FileName);
    bool ReadFileNOBOITE(const QString FileName);
index 7d1c9bc9e9de3fc7b1c3cfc707222943212733bd..89760d240e10c07b6dafa18a5574999f202cc561 100755 (executable)
@@ -90,7 +90,7 @@ med_idt ouvre_fichier_MED(char *fichier,int verbose)
   if (ret < 0) return fid;
 
   MEDfileNumVersionRd(fid, &majeur, &mineur, &release);
-  if (majeur < 2 || majeur == 2 && mineur < 2) {
+  if (( majeur < 2 ) || ( majeur == 2 && mineur < 2 )) {
     fprintf(stderr,"File %s from MED V%d.%d.%d not assumed\n",
                    fichier,majeur,mineur,release);
     //" version est ant�ieure �la version 2.2";
index a24b3da70f451589b38101566611e534ed6eaea3..d3ba409c8b7202f1804cd59e2bb94b9abbeec546 100755 (executable)
@@ -45,7 +45,7 @@
 #include <QApplication>
 
 #include "ghs3dprl_msg_parser.h"
-#include "dlg_ghs3dmain.h"
+//#include "dlg_ghs3dmain.h"
 
 #ifdef WIN32
 #include <io.h>
@@ -90,7 +90,7 @@ med_idt ouvre_fichier_MED(char *fichier,int verbose)
   if (ret < 0) return fid;
 
   MEDfileNumVersionRd(fid, &majeur, &mineur, &release);
-  if (majeur < 2 || majeur == 2 && mineur < 2) {
+  if (( majeur < 2 ) || ( majeur == 2 && mineur < 2 )) {
     fprintf(stderr,"File %s from MED V%d.%d.%d not assumed\n",
                    fichier,majeur,mineur,release);
     //" version est ant�ieure �la version 2.2";
@@ -468,17 +468,99 @@ if (mymailw->verbose>3){
    return true;
 }
 
+/*
+mg-tetra_hpc_mpi.exe --help
+
+    =================================================
+    MG-Tetra_HPC -- MeshGems 2.1-11 (September, 2015)
+    =================================================
+
+        Distene SAS
+           Campus Teratec
+           2, rue de la Piquetterie
+           91680 Bruyeres le Chatel
+           FRANCE
+        Phone: +33(0)970-650-219   Fax: +33(0)169-269-033
+        EMail: <support@distene.com>
+
+        Running MG-Tetra_HPC (Copyright 2014 by Distene SAS)
+           date of run: 31-May-2016 AT 09:05:29
+           running on : Linux 2.6.32-431.11.2.el6.centos.plus.x86_64 x86_64
+           using modules: 
+                MeshGems-Core 2.1-11
+
+        MeshGems is a Registered Trademark of Distene SAS
+
+
+
+Usage: tetra_hpc_mpi.exe [options]
+
+Options: 
+
+     Short option (if it exists)
+    /    Long option
+   |    /   Description
+   |   |   /
+   v   v  v
+
+     --gradation <g>
+          Sets the size gradation value.
+          <gradation> is the desired maximum ratio between 2 adjacent
+          tetrahedron edges. The closer it is to 1.0, the more uniform the mesh
+          will be.
+          Default: 1.05
+
+     --help
+          Prints this help.
+          
+     --in <input mesh file name>
+          Sets the input file.
+          (MANDATORY)
+
+     --max_size <maximum size>
+          Sets the desired maximum cell size value.
+          Default: 0 (no maximum size).
+
+     --min_size <minimum size>
+          Default: 0 (no minimum size).
+          Sets the desired minimum cell size value.
+
+     --out <output mesh file name>
+          Sets the output file.
+          If unset, _tetra_hpc is appended to the input file basename.
+          Using an existing file is forbidden.
+          Using the same file as --in is forbidden.
+          
+     --verbose <verbose>
+          Set the verbosity level, increasing from 0 to 10.
+           <verbose> values are increasing from 0 to 10 :
+             0 : no details
+            10 : very detailed
+          Default: 3
+
+
+================================================================================
+               MG-Tetra_HPC -- MeshGems 2.1-11 (September, 2015)
+         END OF SESSION - MG-Tetra_HPC (Copyright 2014 by Distene SAS)
+                   compiled Sep  3 2015 12:50:47 on Linux_64
+               MeshGems is a Registered Trademark of Distene SAS
+================================================================================
+       ( Distene SAS
+        Phone: +33(0)970-650-219   Fax: +33(0)169-269-033
+        EMail: <support@distene.com> )
+*/
+
 
 //************************************
 int main(int argc, char *argv[])
 {
    bool ok;
    int i,nb,nbfiles,limit_swap,nbelem_limit_swap,limit_swap_defaut,verbose;
+   float gradation,min_size,max_size;
    QString path,pathini,casename,casenamemed,fileskinmed,
            tmp,cmd,format,format_tetra,
-           test,menu,launchtetra,background,deletegroups,
-           ToMergeSubdomains,ToTagSubdomains,ToOutputInterfaces,ToDiscardSubdomains,
-           version="V3.0 (MED3+tetra-hpc)";
+           test,launchtetra,background,multithread,deletegroups,
+           version="V4.0 (MED3 + tetra-hpc v2.3 Sept 2016)";
    
    char *chelp=NULL,
         *ccasename=NULL,
@@ -486,31 +568,27 @@ int main(int argc, char *argv[])
         *cmedname=NULL,
         *climitswap=NULL,
         *cverbose=NULL,
-        *ctest=NULL,
-        *cmenu=NULL,
         *claunchtetra=NULL,
-        *cToMergeSubdomains=NULL,
-        *cToTagSubdomains=NULL,
-        *cToOutputInterfaces=NULL,
-        *cToDiscardSubdomains=NULL,
+        *cgradation=NULL,
+        *cmin_size=NULL,
+        *cmax_size=NULL,
         *cbackground=NULL,
+        *cmultithread=NULL,
         *cdeletegroups=NULL;
 
    for (i = 0; i < argc; i++){
       if (!strncmp (argv[i], "--help", sizeof ("--help"))) chelp = &(argv[i][0]);
       else if (!strncmp (argv[i], "--casename=", sizeof ("--casename"))) ccasename = &(argv[i][sizeof ("--casename")]);
       else if (!strncmp (argv[i], "--number=", sizeof ("--number"))) cnumber = &(argv[i][sizeof ("--number")]);
-      else if (!strncmp (argv[i], "--medname=", sizeof ("--medname"))) cmedname = &(argv[i][sizeof ("--medname")]);
       else if (!strncmp (argv[i], "--limitswap=", sizeof ("--limitswap"))) climitswap = &(argv[i][sizeof ("--limitswap")]);
+      else if (!strncmp (argv[i], "--medname=", sizeof ("--medname"))) cmedname = &(argv[i][sizeof ("--medname")]);
       else if (!strncmp (argv[i], "--verbose=", sizeof ("--verbose"))) cverbose = &(argv[i][sizeof ("--verbose")]);
-      else if (!strncmp (argv[i], "--test=", sizeof ("--test"))) ctest = &(argv[i][sizeof ("--test")]);
-      else if (!strncmp (argv[i], "--menu=", sizeof ("--menu"))) cmenu = &(argv[i][sizeof ("--menu")]);
       else if (!strncmp (argv[i], "--launchtetra=", sizeof ("--launchtetra"))) claunchtetra = &(argv[i][sizeof ("--launchtetra")]);
-      else if (!strncmp (argv[i], "--merge_subdomains=", sizeof ("--merge_subdomains"))) cToMergeSubdomains = &(argv[i][sizeof ("--")]);
-      else if (!strncmp (argv[i], "--tag_subdomains=", sizeof ("--tag_subdomains"))) cToTagSubdomains = &(argv[i][sizeof ("--")]);
-      else if (!strncmp (argv[i], "--output_interfaces=", sizeof ("--output_interfaces"))) cToOutputInterfaces = &(argv[i][sizeof ("--")]);
-      else if (!strncmp (argv[i], "--discard_subdomains=", sizeof ("--discard_subdomains"))) cToDiscardSubdomains = &(argv[i][sizeof ("--")]);
+      else if (!strncmp (argv[i], "--gradation=", sizeof ("--gradation"))) cgradation = &(argv[i][sizeof ("--gradation")]);
+      else if (!strncmp (argv[i], "--min_size=", sizeof ("--min_size"))) cmin_size = &(argv[i][sizeof ("--min_size")]);
+      else if (!strncmp (argv[i], "--max_size=", sizeof ("--max_size"))) cmax_size = &(argv[i][sizeof ("--max_size")]);
       else if (!strncmp (argv[i], "--background=", sizeof ("--background"))) cbackground = &(argv[i][sizeof ("--background")]);
+      else if (!strncmp (argv[i], "--multithread=", sizeof ("--multithread"))) cmultithread = &(argv[i][sizeof ("--multithread")]);
       else if (!strncmp (argv[i], "--deletegroups=", sizeof ("--deletegroups"))) cdeletegroups = &(argv[i][sizeof ("--deletegroups")]);
       }
 
@@ -525,22 +603,19 @@ int main(int argc, char *argv[])
       "   --medname            : path and name of output MED files\n"<<
       "   --limitswap          : max size of working cpu memory (Mo) (before swapping on .temp files)\n"<<
       "   --verbose            : trace of execution (0->6)\n"<<
-      "   --test               : more tests about joints, before generation of output files\n"<<
-      "   --menu               : a GUI menu for option number\n"<<
-      "   --launchtetra        : also launch tetra-hpc on files casename.mesh and option number\n"<<
-      "   --merge_subdomains   : merge the subdomains into one mesh and write the output .mesh(b) file\n"<<
-      "   --tag_subdomains     : use the parallel subdomain index as tag into the merged output mesh\n"<<
-      "                            to identify the parallel subdomains (used in combination with the merge_subdomains option)\n"<<
-      "   --output_interfaces  : write the parallel subdomains interface triangles into the merged output mesh\n"<<
-      "                            (used in combination with the merge_subdomains option)\n"<<
-      "   --discard_subdomains : discard the parallel subdomains informations output (mesh, global numbering and interfaces)\n"<<
+      "   --launchtetra        : launch mg_tetra_hpc on files casename.mesh and option number,\n"<<
+      "                            else only use existing input/output files\n"<<
+      "   --gradation          : the desired maximum ratio between 2 adjacent tetrahedron edges (Default 1.05). The closer it is to 1.0\n"<<
+      "   --min_size           : the desired maximum cell size value (Default: 0 no maximum size)\n"<<
+      "   --max_size           : the desired minimum cell size value (Default: 0 no minimum size)\n"<<
       "   --background         : force background mode from launch tetra-hpc and generation of final MED files (big meshes)\n"<<
+      "   --multithread        : launch mg_tetra_hpc multithread version, else mpi version\n"<<
       "   --deletegroups       : regular expression (see QRegExp) which matches unwanted groups in final MED files\n"<<
       "                            (try --deletegroups=\"(\\bJOINT)\"\n"<<
       "                            (try --deletegroups=\"(\\bAll_Nodes|\\bAll_Faces)\"\n"<<
       "                            (try --deletegroups=\"((\\bAll_|\\bNew_)(N|F|T))\"\n";
-      std::cout<<"example:\n   tetrahpcl2med --casename=/tmp/GHS3DPRL --number=2 --medname=DOMAIN "<<
-                 "--limitswap=1000 --verbose=0 --test=yes --menu=no --launchtetra=no\n\n";
+      std::cout<<"example:\n   tetrahpc2med --casename=/tmp/GHS3DPRL --number=2 --medname=DOMAIN "<<
+                 "--verbose=0 --launchtetra=no\n\n";
       return 1;  //no output files
    }
    
@@ -563,12 +638,13 @@ int main(int argc, char *argv[])
       std::cerr<<"--number: a positive integer is expected\n\n";
       return 1;
    }
-   if (nbfiles>2048){ //delirium in 2014
+   if (nbfiles>2048){ //delirium in 2016
       std::cerr<<"--number: a positive integer <= 2048 is expected\n\n";
       return 1;
    }
    if (!cmedname) cmedname=ccasename;
    casenamemed=cmedname;
+
    limit_swap_defaut=1000; //1000Mo
    limit_swap=limit_swap_defaut;
    if (climitswap){
@@ -583,10 +659,7 @@ int main(int argc, char *argv[])
          return 1;
       }
    }
-   //default 1GOctet/8(for float)
-   nbelem_limit_swap=limit_swap*1000000; //100%
-   CVWtab::memorymax=nbelem_limit_swap;
-
+   
    verbose=1; //default
    if (cverbose){
       tmp=cverbose;
@@ -601,46 +674,54 @@ int main(int argc, char *argv[])
       }
    }
 
-   test="no"; //default
-   if (ctest){
-      tmp=ctest;
-      if (tmp=="yes") test="yes";
-   }
-
-   menu="no"; //default
-   if (cmenu){
-      tmp=cmenu;
-      if (tmp=="yes") menu="yes";
-   }
-
    launchtetra="no"; //default
    if (claunchtetra){
       tmp=claunchtetra;
       if (tmp=="yes") launchtetra="yes";
    }
 
-   ToMergeSubdomains="no"; //default
-   if (cToMergeSubdomains){
-      tmp=cToMergeSubdomains;
-      if (tmp=="yes") ToMergeSubdomains="yes";
-   }
-
-   ToTagSubdomains="no"; //default
-   if (cToTagSubdomains){
-      tmp=cToTagSubdomains;
-      if (tmp=="yes") ToTagSubdomains="yes";
+   gradation=1.05; //default
+   if (cgradation){
+      tmp=cgradation;
+      gradation=tmp.toFloat(&ok);
+      if (!ok){
+         std::cerr<<"--gradation: a float { 0; ]1,3] } is expected\n\n";
+         return 1;
+      }
+      if (gradation>3.){
+         std::cerr<<"--gradation: a float <= 3. is expected\n\n";
+         return 1;
+      }
+      if (gradation<0.){
+         std::cerr<<"--gradation: a float >= 0. is expected\n\n";
+         return 1;
+      }
    }
 
-   ToOutputInterfaces="no"; //default
-   if (cToOutputInterfaces){
-      tmp=cToOutputInterfaces;
-      if (tmp=="yes") ToOutputInterfaces="yes";
+   if (cmin_size){
+      tmp=cmin_size;
+      min_size=tmp.toFloat(&ok);
+      if (!ok){
+         std::cerr<<"--min_size: a float >= 0. is expected\n\n";
+         return 1;
+      }
+      if (gradation<0.){
+         std::cerr<<"--min_size: a float >= 0. is expected\n\n";
+         return 1;
+      }
    }
 
-   ToDiscardSubdomains="no"; //default
-   if (cToDiscardSubdomains){
-      tmp=cToDiscardSubdomains;
-      if (tmp=="yes") ToDiscardSubdomains="yes";
+   if (cmax_size){
+      tmp=cmax_size;
+      max_size=tmp.toFloat(&ok);
+      if (!ok){
+         std::cerr<<"--max_size: a float >= 0. is expected\n\n";
+         return 1;
+      }
+      if (gradation<0.){
+         std::cerr<<"--max_size: a float >= 0. is expected\n\n";
+         return 1;
+      }
    }
 
    background="no"; //default
@@ -649,24 +730,13 @@ int main(int argc, char *argv[])
       if (tmp=="yes") background="yes";
    }
 
-
-   // We must always have an application
-   if (menu=="yes") {
-    QApplication a(argc,argv);
-    dlg_ghs3dmain *m = new dlg_ghs3dmain();
-    m->setWindowTitle("tetrahpc2med 3.0");
-    m->show();
-    a.exec();
-    if ( m->result() == QDialog::Accepted ) {
-      std::cout<<"parameters "<<m->KeepFiles()<<" "<<m->NbPart()<<std::endl;
-      nbfiles=m->NbPart();
-    }
-    else {
-      return 1;
-    }
-    delete m;
+   multithread="no"; //default
+   if (cmultithread){
+      tmp=cmultithread;
+      if (tmp=="yes") multithread="yes";
    }
 
+
    int n=casenamemed.count('/');
    if (n>0)
       path=casenamemed.section('/',-n-1,-2)+"/";
@@ -689,8 +759,8 @@ int main(int argc, char *argv[])
       casename.truncate(20);
    }
 
-   /*std::cout<<"CaseNameMed="<<casenamemed<<std::endl;
-   std::cout<<"PathMed="<<path<<std::endl;*/
+   //std::cout<<"CaseNameMed="<<casenamemed.toLatin1().constData()<<std::endl;
+   //std::cout<<"PathMed="<<path.toLatin1().constData()<<std::endl;
 
    deletegroups="(\\bxyz)"; //default improbable name
    if (cdeletegroups){
@@ -699,23 +769,38 @@ int main(int argc, char *argv[])
    
    //verbose=5;
    if (verbose>0)
-   std::cout<<"tetrahpc2med "<<version.toLatin1().constData()<<" parameters:"<<
+   std::cout<<
+           "tetrahpc2med "<<version.toLatin1().constData()<<" parameters:"<<
          "\n   --casename="<<pathini.toLatin1().constData()<<casename.toLatin1().constData()<<
          "\n   --number="<<nbfiles<<
          "\n   --medname="<<path.toLatin1().constData()<<casenamemed.toLatin1().constData()<<
-         "\n   --limitswap="<<limit_swap<<
          "\n   --verbose="<<verbose<<
-         "\n   --test="<<test.toLatin1().constData()<<
-         "\n   --menu="<<menu.toLatin1().constData()<<
          "\n   --launchtetra="<<launchtetra.toLatin1().constData()<<
-         "\n   --merge_subdomains="<<ToMergeSubdomains.toLatin1().constData()<<
-         "\n   --tag_subdomains="<<ToTagSubdomains.toLatin1().constData()<<
-         "\n   --output_interfaces="<<ToOutputInterfaces.toLatin1().constData()<<
-         "\n   --discard_subdomains="<<ToDiscardSubdomains.toLatin1().constData()<<
+         "\n   --gradation="<<gradation<<
+         "\n   --min_size="<<min_size<<
+         "\n   --max_size="<<max_size<<
          "\n   --background="<<background.toLatin1().constData()<<
+         "\n   --multithread="<<multithread.toLatin1().constData()<<
          "\n   --deletegroups=\""<<deletegroups.toLatin1().constData()<<"\"\n";
+         
+   if (launchtetra=="yes"){
+     
+      //call tetra_hpc.py is pthon script which assumes mpirun or else if no multithread
+      //after compilation openmpi or else acrobatic DISTENE_LICENCE change...
+      
+      cmd="mg-tetra_hpc.py --number=" + QString::number(nbfiles)+
+          " --in=" + pathini+casename + ".mesh" +
+          " --out=" + pathini+casename + "_out.mesh" +
+          " --gradation=" + QString::number(gradation) +
+          " --min_size=" + QString::number(min_size) +
+          " --max_size=" + QString::number(max_size) +
+          " --multithread=" + multithread.toLatin1().constData() +
+          " > " + path + "tetrahpc.log";
+      std::cout<<"\nlaunch tetra_hpc command:"<<
+                 "\n   "<<cmd.toLatin1().constData()<<"\n"<<std::endl;
+   }
    
-   //utile si appel par plugin ghs3dprl sur big meshes et tetrahpc sur plusieurs jours
+   //utile si appel par plugin ghs3dprl sur big meshes et tetra_hpc sur plusieurs jours
 #ifndef WIN32
    if (background=="yes"){
       pid_t pid = fork();
@@ -733,41 +818,25 @@ int main(int argc, char *argv[])
    printf("background mode is not supported on win32 platform !\n");
 #endif
 
-   //"tetrahpc -f exemple1 -n 4"
    if (launchtetra=="yes"){
-      //tetra_hpc.exe --help
-      //mpirun -n 3 mg-tetra_hpc.exe --in GHS3DPRL.mesh --out TOTO.mesh
-      
-      //direct mpirun cause problem: invalid
-      //cmd="mpirun -n "+cmd.sprintf("%d",nbfiles)+" mg-tetra_hpc.exe --in "+
-      
-      //call tetra_hpc.bash is script which assumes mpirun after compilation openmpi etc...
-      cmd="mg-tetra_hpc.bash -n "+cmd.sprintf("%d",nbfiles)+" --in "+
-          pathini+casename+".mesh --out "+
-          pathini+casename+".mesh"+
-          " --merge_subdomains "+ToMergeSubdomains+
-          " --tag_subdomains "+ToTagSubdomains+
-          " --output_interfaces "+ToOutputInterfaces+
-          " --discard_subdomains "+ToDiscardSubdomains+
-          " > "+path+"tetrahpc.log";
-      std::cout<<"\nlaunchtetra command: background="<<cbackground<<
-                 "\n      "<<cmd.toLatin1().constData()<<std::endl;
-      system(cmd.toLatin1().constData()); // run
       //sometimes it is better to wait flushing files on slow filesystem...
       system("sleep 3");
+      system(cmd.toLatin1().constData()); // run
+      system("sleep 3");
    }
    ghs3dprl_mesh_wrap *mymailw=new ghs3dprl_mesh_wrap;
    //no constructor, later maybe
    mymailw->nbfiles=0;
    mymailw->nbfilestot=nbfiles;
    //for huge cases big array swap in huge binary files
-   mymailw->nbelem_limit_swap=nbelem_limit_swap;
    mymailw->verbose=verbose;
    mymailw->casename=casename;
    mymailw->medname=casenamemed;
    mymailw->path=path;
    mymailw->pathini=pathini;
    mymailw->deletegroups=QRegExp(deletegroups,Qt::CaseSensitive,QRegExp::RegExp);
+   mymailw->for_multithread=false;
+   if (multithread=="yes") mymailw->for_multithread=true;
    ghs3dprl_msg_parser handler;
    //constructor later maybe
    //handler.verbose=true;
@@ -778,13 +847,19 @@ int main(int argc, char *argv[])
    format=format.sprintf("%d",nbfiles);
    int nbf=format.length();
    format=format.sprintf(".%%0%dd.%%0%dd",nbf,nbf);
-   format_tetra=".%05d";
+   format_tetra=".%06d";
    if (verbose>10)std::cout<<"format "<<format.toLatin1().constData()<<std::endl;
    if (verbose>10)std::cout<<"format_tetra "<<format_tetra.toLatin1().constData()<<std::endl;
    mymailw->format=format;
    mymailw->format_tetra=format_tetra;
    mymailw->for_tetrahpc=true; //to know what files to read: .noboite or .mesh
    
+   //default 1GOctet/8(for float)
+   nbelem_limit_swap=limit_swap*1000000; //100%
+   CVWtab::memorymax=nbelem_limit_swap;
+   mymailw->nbelem_limit_swap=nbelem_limit_swap;
+
+   
    //something like "/home/wambeke/tmp/GHS3DPRL_skin.med"
    fileskinmed=pathini+casename+"_skin.med";
    //fileskinmed="/home/wambeke/tmp/GHS3DPRL_skin.med";
index 913648c7796d75fe77ba0365dff23a4e3ad2085e..930ba7d8efc662f039ae0387b0993de4cfd7cb93 100644 (file)
@@ -23,7 +23,9 @@
 SET(_bin_SCRIPTS
   facespoints2mesh.py
   mesh2facespoints.py
+  testMesh.py
+  testMeshTest.py
 )
 
 # --- rules ---
-SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON})
\ No newline at end of file
+SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON})
diff --git a/src/tools/testMesh.py b/src/tools/testMesh.py
new file mode 100644 (file)
index 0000000..cf3a206
--- /dev/null
@@ -0,0 +1,816 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+\r
+# %% LICENSE_SALOME_CEA_BEGIN\r
+# Copyright (C) 2008-2016  CEA/DEN\r
+# \r
+# This library is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU Lesser General Public\r
+# License as published by the Free Software Foundation; either\r
+# version 2.1 of the License, or (at your option) any later version.\r
+# \r
+# This library is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+# Lesser General Public License for more details.\r
+# \r
+# You should have received a copy of the GNU Lesser General Public\r
+# License along with this library; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+# \r
+# See http://www.salome-platform.org or email : webmaster.salome@opencascade.com\r
+# %% LICENSE_END\r
+\r
+\r
+"""\r
+run coherency tests on one and some mesh.\r
+initially used for test output(s) mg_tetra_hpc_mpi.exe\r
+\r
+WARNING: is for small meshes, obviously no optimisation.\r
+WARNING: printing and .mesh indices are 1 to n when stored list python 0 to n-1\r
+\r
+example linux usage:\r
+- simple run:\r
+  ./testMesh.py --verbose --testall --files ./GHS3DPRL_out.000001.mesh ./GHS3DPRL_out.000002.mesh\r
+  ./testMesh.py -a -f /tmp/GHS3DPRL_out.00000?.mesh\r
+"""\r
+\r
+import os\r
+import sys\r
+import platform\r
+import argparse as AP\r
+import pprint as PP #pretty print\r
+\r
+verbose = False\r
+\r
+OK = "ok"\r
+KO = "KO"\r
+OKSYS = 0 #for linux\r
+KOSYS = 1 #for linux\r
+\r
+\r
+#########################################\r
+# utilities\r
+\r
+def okToSys(aResult, verbose=False):\r
+  """to get windows or linux result of script"""\r
+  
+  def extendList(alist):
+    """utility extend list of lists of string results with ok or KO"""\r
+    #bad: list(itertools.chain.from_list(alist)) iterate on str\r
+    res = []\r
+    if type(alist) != list:\r
+      return [alist]\r
+    else:\r
+      for i in alist:\r
+        if type(i) == str:\r
+           res.append(i)\r
+        else:\r
+           res.extend(extendList(i))\r
+    return res\r
+      \r
+  resList = extendList(aResult)\r
+  if resList == []:\r
+    if verbose: print("WARNING: result no clear: []")\r
+    return KOSYS\r
+    \r
+  rr = OK\r
+  for ri in resList:\r
+    if ri[0:2] != OK:\r
+      if verbose: print ri\r
+      rr = KO\r
+\r
+  if verbose: print("INFO: result: %s" % rr)\r
+  if rr == OK:\r
+    return OKSYS\r
+  else:\r
+    return KOSYS\r
+\r
+def getDirAndName(datafile):\r
+  path, namefile = os.path.split(os.path.realpath(datafile))\r
+  rootpath = os.getcwd()\r
+  return (path, rootpath, namefile)\r
+\r
+def resumeList(aList):\r
+  if len(aList) == 0: \r
+    return []\r
+  if len(aList) < 3:\r
+    return aList\r
+  res = [aList[0], "...", aList[-1]]\r
+  return res\r
+\r
+def resumeLines(aList, ilines):\r
+  if verbose: print("INFO: resumeLines", ilines)\r
+  if len(aList) == 0: \r
+    return []\r
+  if len(aList) < 3:\r
+    return aList\r
+  res = []\r
+  for i in ilines:
+    if i != None: # if not existing tetrahedra for example\r
+      resi = [ii.strip("\n") for ii in aList[i:i+4]]\r
+      resi.append("...")\r
+      res.append(resi)\r
+  return res\r
+\r
+\r
+#########################################\r
+class XXVert(object): \r
+  """Vertices, Nodes"""\r
+  def __init__(self, x, y, z, color=0, indexglobal=0):\r
+    self.x = x\r
+    self.y = y\r
+    self.z = z\r
+    self.color = color\r
+    self.indexglobal = indexglobal\r
+\r
+  def compare(self, vb, args, withAll=True):\r
+    if self.x != vb.x: return False\r
+    if self.y != vb.y: return False\r
+    if self.z != vb.z: return False\r
+    if withAll:\r
+      if args.withColor:\r
+        if self.color != vb.color: return False\r
+      if args.withIndex:\r
+        if self.indexglobal != vb.indexglobal: return False\r
+    return True\r
+\r
+  def __eq__(self, vb):\r
+    """equality test without color or indexglobal"""\r
+    #print "vertice equality"\r
+    if self.x != vb.x: return False\r
+    if self.y != vb.y: return False\r
+    if self.z != vb.z: return False\r
+    return True\r
+\r
+  def __ne__(self, vb):\r
+    """inequality test without color or indexglobal"""\r
+    #print "vertice inequality"\r
+    if self.x == vb.x and self.y == vb.y and self.z != vb.z: \r
+      return True\r
+    return False\r
+\r
+  def __repr__(self):\r
+    return "XXVert(%.4f %.4f %.4f (%i %i))" % \\r
+           (self.x, self.y, self.z, self.color, self.indexglobal)\r
+\r
+  def __str__(self):\r
+    return "(%s %s %s (%i %i))" % \\r
+           (self.x, self.y, self.z, self.color, self.indexglobal)\r
+\r
+  def dist(self, vb):\r
+    res = (self.x - vb.x)**2 + (self.y - vb.y)**2 + (self.z -vb.z)**2\r
+    return res**.5\r
+\r
+\r
+\r
+#########################################\r
+class XXEdge(object):\r
+  """Edges, 2 Nodes"""\r
+  def __init__(self, a, b, color=0, indexglobal=0):\r
+    self.a = a\r
+    self.b = b\r
+    self.color = color\r
+    self.indexglobal = indexglobal\r
+\r
+  def compare(self, eb, args):\r
+    res = self.a.compare(eb.a, args) and \\r
+          self.b.compare(eb.b, args)\r
+    if res:\r
+      if args.withColor:\r
+        if self.color != eb.color: return False\r
+      if args.withIndex:\r
+        if self.indexglobal != eb.indexglobal: return False\r
+    return res\r
+\r
+  def __repr__(self):\r
+    return "XXEdge(%i %i (%i %i))" % \\r
+           (self.a, self.b, self.color, self.indexglobal)\r
+\r
+  def __str__(self):\r
+    return "(%i %i (%i %i))" % \\r
+           (self.a, self.b, self.color, self.indexglobal)\r
+\r
+  def inTria(self, tria, args):\r
+    t = [tria.a, tria.b, tria.c]\r
+    if not self.a in t: return False\r
+    if not self.b in t: return False\r
+    return True\r
+\r
+  def getVertices(self, mesh):\r
+    v1 = mesh.verts[self.a - 1]\r
+    v2 = mesh.verts[self.b - 1]\r
+    return [v1, v2]\r
+\r
+\r
+#########################################\r
+class XXTria(object):\r
+  """Triangles, Faces, 3 nodes"""\r
+  def __init__(self, a, b, c, color=0, indexglobal=0):\r
+    self.a = a\r
+    self.b = b\r
+    self.c = c\r
+    self.color = color\r
+    self.indexglobal = indexglobal\r
+\r
+  def compare(self, trb, args):\r
+    res = self.a.compare(trb.a, args) and \\r
+          self.b.compare(trb.b, args) and \\r
+          self.c.compare(trb.c, args)\r
+    if res:\r
+      if args.withColor:\r
+        if self.color != trb.color: return False\r
+      if args.withIndex:\r
+        if self.indexglobal != trb.indexglobal: return False\r
+    return res\r
+\r
+  def __repr__(self):\r
+    return "XXTria(%i %i %i (%i %i))" % \\r
+           (self.a, self.b, self.c, self.color, self.indexglobal)\r
+\r
+  def __str__(self):\r
+    return "(%i %i %i (%i %i))" % \\r
+           (self.a, self.b, self.c, self.color, self.indexglobal)\r
+\r
+  def inTetra(self, tetra, args):\r
+    t = [tetra.a, tetra.b, tetra.c, tetra.d]\r
+    if not self.a in t: return False\r
+    if not self.b in t: return False\r
+    if not self.c in t: return False\r
+    return True\r
+\r
+  def getVertices(self, mesh):\r
+    v1 = mesh.verts[self.a - 1]\r
+    v2 = mesh.verts[self.b - 1]\r
+    v3 = mesh.verts[self.c - 1]\r
+    return [v1, v2, v3]\r
+\r
+\r
+\r
+#########################################\r
+class XXTetra(object):\r
+  """Tetra, 4 nodes"""\r
+  def __init__(self, a, b, c, d, color=0, indexglobal=0):\r
+    self.a = a\r
+    self.b = b\r
+    self.c = c\r
+    self.d = d\r
+    self.color = color\r
+    self.indexglobal = indexglobal\r
+\r
+  def compare(self, teb, args):\r
+    res = self.a.compare(teb.a, args) and \\r
+          self.b.compare(teb.b, args) and \\r
+          self.c.compare(teb.c, args) and \\r
+          self.d.compare(teb.d, args)\r
+    if res:\r
+      if args.withColor:\r
+        if self.color != teb.color: return False\r
+      if args.withIndex:\r
+        if self.indexglobal != teb.indexglobal: return False\r
+    return res\r
+\r
+  def __repr__(self):\r
+    return "XXTetra(%i %i %i %i (%i %i))" % \\r
+           (self.a, self.b, self.c, self.d, self.color, self.indexglobal)\r
+\r
+  def __str__(self):\r
+    return "(%i %i %i %i (%i %i))" % \\r
+           (self.a, self.b, self.c, self.d, self.color, self.indexglobal)\r
+\r
+  def getVertices(self, mesh):\r
+    v1 = mesh.verts[self.a - 1]\r
+    v2 = mesh.verts[self.b - 1]\r
+    v3 = mesh.verts[self.c - 1]\r
+    v4 = mesh.verts[self.d - 1]\r
+    return [v1, v2, v3, v4]\r
+\r
+\r
+#########################################\r
+class XXMesh(object):\r
+  """Mesh: vertices, edges, triangles, tetrahedra"""\r
+  def __init__(self):\r
+    self.nameFile = ""\r
+    self.verts = []\r
+    self.edges = []\r
+    self.trias = []\r
+    self.tetras = []\r
+\r
+  def initFromFileMesh(self, fileName, args, withGlobal=True):\r
+    if not os.path.isfile(fileName):\r
+      raise Exception("ERROR: inexisting file '%s'" % fileName)\r
+    with open(fileName, "r") as f:\r
+      lines = f.readlines()\r
+    iverts, iedges, itrias, itetras = self.getIndexInMeshFile(lines)\r
+    self.verts = self.getMeshVerts(lines, iverts)\r
+    self.edges = self.getMeshEdges(lines, iedges)\r
+    self.trias = self.getMeshTrias(lines, itrias)\r
+    self.tetras = self.getMeshTetras(lines, itetras)\r
+    self.nameFile = fileName\r
+    if args.globalNumerotation == True and withGlobal==True:\r
+      self.initFromFileGlobal(fileName, args)\r
+    if verbose: \r
+      print("\nINFO: initFromFileMesh: read file: %s" % str(self))\r
+      print(self.strResume())\r
+      print(PP.pformat(resumeLines(lines, [iverts, iedges, itrias, itetras])))\r
+\r
+  def initFromFileGlobal(self, fileNameMeshOrGlobal, args):\r
+    shortname, extension = os.path.splitext(fileNameMeshOrGlobal)\r
+    if extension == ".mesh":\r
+      fileName = shortname +  ".global"\r
+    elif extension == "global":\r
+      fileName = fileNameMeshOrGlobal\r
+    else:\r
+      raise Exception("ERROR: initFromFileGlobal: unexpected file '%s'" % fileName)\r
+    if not os.path.isfile(fileName):\r
+      raise Exception("ERROR: initFromFileGlobal: inexisting file '%s'" % fileName)\r
+    \r
+    with open(fileName, "r") as f:\r
+      lines = f.readlines()\r
+    nbverts, nbedges, nbtrias, nbtetras = [int(i) for i in lines[0].split()]\r
+    if verbose:\r
+      print("\nINFO: initFromFileGlobal: read file: %s" % str(self))\r
+      print("  nbverts %i\n  nbedges %i\n  nbtrias %i\n  nbtetras %i" % (nbverts, nbedges, nbtrias, nbtetras))\r
+    if nbverts != len(self.verts): \r
+      raise Exception("ERROR: in file '%s' unexpected number of Vertices %i<>%i" % (fileName, nbverts, len(self.verts)))\r
+    if nbedges != len(self.edges): \r
+      raise Exception("ERROR: in file '%s' unexpected number of Edges %i<>%i" % (fileName, nbedges, len(self.edges)))\r
+    if nbtrias != len(self.trias): \r
+      raise Exception("ERROR: in file '%s' unexpected number of Triangles %i<>%i" % (fileName, nbtrias, len(self.trias)))\r
+    if nbtetras != len(self.tetras): \r
+      raise Exception("ERROR: in file '%s' unexpected number of Tetrahedra %i<>%i" % (fileName, nbtetras, len(self.tetras)))\r
+    i = 1 #begin index line 1\r
+    for ii in range(nbverts):\r
+      self.verts[ii].indexglobal = long(lines[i])\r
+      i +=1\r
+    for ii in range(nbedges):\r
+      self.edges[ii].indexglobal = long(lines[i])\r
+      i +=1\r
+    for ii in range(nbtrias):\r
+      self.trias[ii].indexglobal = long(lines[i])\r
+      i +=1\r
+    for ii in range(nbtetras):\r
+      self.tetras[ii].indexglobal = long(lines[i])\r
+      i +=1\r
+\r
+\r
+  def __repr__(self):\r
+    return "XXMesh(nameFile='%s', nbverts=%i, nbedges=%i, nbtrias=%i, nbtetras=%i)" % \\r
+           (self.nameFile, len(self.verts), len(self.edges), len(self.trias), len(self.tetras))\r
+\r
+  def strResume(self):\r
+    res = str(self)\r
+    contents = {\r
+      "Vertices": resumeList(self.verts),\r
+      "Edges": resumeList(self.edges),\r
+      "Triangles": resumeList(self.trias),\r
+      "Tetrahedra": resumeList(self.tetras),\r
+    }\r
+    res = res + "\n" + PP.pformat(contents)\r
+    return res\r
+\r
+  def getIndexInMeshFile(self, lines):\r
+    res = []\r
+    for s in ["Vertices", "Edges", "Triangles", "Tetrahedra"]:\r
+      try:\r
+        i = lines.index(s+"\n")\r
+      except:\r
+        i = None\r
+      res.append(i)\r
+    return res\r
+\r
+  def getMeshVerts(self, lines, i):\r
+    res=[]\r
+    try:\r
+      idep = i+2\r
+      ilen = int(lines[i+1])\r
+      ifin =  idep+ilen\r
+      for line in lines[idep:ifin]:\r
+        li = line.split(" ")\r
+        x, y, z, color = float(li[0]), float(li[1]), float(li[2]), int(li[3])\r
+        res.append(XXVert(x, y, z, color))\r
+      return res\r
+    except:\r
+      return res\r
+\r
+  def getMeshEdges(self, lines, i):\r
+    res=[]\r
+    try:\r
+      idep = i+2\r
+      ilen = int(lines[i+1])\r
+      ifin =  idep+ilen\r
+      for line in lines[idep:ifin]:\r
+        li = line.split(" ")\r
+        a, b, color = int(li[0]), int(li[1]), int(li[2])\r
+        res.append(XXEdge(a, b, color))\r
+      return res\r
+    except:\r
+      return res\r
+\r
+  def getMeshTrias(self, lines, i):\r
+    res=[]\r
+    try:\r
+      idep = i+2\r
+      ilen = int(lines[i+1])\r
+      ifin =  idep+ilen\r
+      for line in lines[idep:ifin]:\r
+        li = line.split(" ")\r
+        a, b, c, color = int(li[0]), int(li[1]), int(li[2]), int(li[3])\r
+        res.append(XXTria(a, b, c, color))\r
+      return res\r
+    except:\r
+      return res\r
+\r
+  def getMeshTetras(self, lines, i):\r
+    res=[]\r
+    try:\r
+      idep = i+2\r
+      ilen = int(lines[i+1])\r
+      ifin =  idep+ilen\r
+      for line in lines[idep:ifin]:\r
+        li = line.split(" ")\r
+        a, b, c, d, color = int(li[0]), int(li[1]), int(li[2]), int(li[3]), int(li[4])\r
+        res.append(XXTetra(a, b, c, d, color))\r
+      return res\r
+    except:\r
+      return res\r
+\r
+  def haveVertsDistinct(self, args):\r
+    """stop a first KO"""\r
+    i = 0\r
+    verts = self.verts\r
+    for v1 in verts[:-1]:\r
+      i += 1\r
+      j = i\r
+      for v2 in verts[i:]:\r
+        j += 1\r
+        if v1.compare(v2, args):\r
+          #printing indices 1 to n\r
+          print("ERROR: %s vert[%i] equal vert[%i]: v1=%s v2=%s" % (self.nameFile, i, j, v1, v2))\r
+          return KO + " ERROR: %s some equal vertices" % self.nameFile #stop a first KO\r
+    return OK + " INFO: no equal vertices"\r
+\r
+  def getVertices(self, elem):\r
+    """functionnal raccourci to XXElem.getVertices(XXMesh)"""\r
+    return elem.getVertices(self)\r
+\r
+  def compareListOfVertices(self, v1s, v2s, ordered=False):\r
+    """not ordered for now"""\r
+    if ordered:\r
+      res = [i for i, j in zip(v1s, v2s) if i == j]\r
+      return len(res)==len(v1s)\r
+    else:       \r
+      res = 0\r
+      for i in v1s:\r
+        for j in v2s:\r
+          if i == j: \r
+            res += 1\r
+            break\r
+      return res==len(v1s)\r
+    \r
+    \r
+  def getCommonVerts(self, mesh, args):\r
+    res = []\r
+    for v1 in self.verts:\r
+      for v2 in mesh.verts:\r
+        if v1.compare(v2, args, withAll=False):\r
+          res.append((v1, v2))\r
+    return res\r
+\r
+  def getVertices(self, elem):\r
+    return elem.getVertices(self)\r
+\r
+  def getCommonEdges(self, mesh, args):\r
+    res = []\r
+    for e1 in self.edges:\r
+      v1s = self.getVertices(e1)\r
+      for e2 in mesh.edges:\r
+        v2s = mesh.getVertices(e2)\r
+        if self.compareListOfVertices(v1s, v2s):\r
+          res.append((e1, e2))\r
+    return res\r
+\r
+  def getCommonTriangles(self, mesh, args):\r
+    res = []\r
+    for e1 in self.trias:\r
+      v1s = self.getVertices(e1)\r
+      for e2 in mesh.trias:\r
+        v2s = mesh.getVertices(e2)\r
+        if self.compareListOfVertices(v1s, v2s):\r
+          res.append((e1, e2))\r
+    return res\r
+\r
+  def getCommonTetras(self, mesh, args):\r
+    res = []\r
+    for e1 in self.tetras:\r
+      v1s = self.getVertices(e1)\r
+      for e2 in mesh.tetras:\r
+        v2s = mesh.getVertices(e2)\r
+        if self.compareListOfVertices(v1s, v2s):\r
+          res.append((e1, e2))\r
+    return res\r
+\r
+  def areEdgesInTrias(self, args):\r
+    """stop a first KO"""\r
+    done = False\r
+    i = 0\r
+    edges = self.edges\r
+    trias = self.trias\r
+    res = OK + " INFO: %s all edges in trias" % self.nameFile\r
+    for e in edges:\r
+      i += 1\r
+      j = 0\r
+      found = False\r
+      for t in trias:\r
+        j += 1\r
+        if e.inTria(t, args):\r
+          #if verbose: print("INFO: %s edges[%i] in trias[%i]: edge=%s tria=%s" % (self.nameFile, i, j, e, t))\r
+          found = True\r
+          break\r
+      if not found:\r
+        print("ERROR: %s edges[%i] not in trias: edge=%s" % (self.nameFile, i, e))\r
+        if verbose and not done: \r
+          print("Triangles:\n%s" % PP.pformat(self.trias))\r
+          done = True\r
+        res = KO+" ERROR: %s some edges not in trias" % (self.nameFile)\r
+    return res\r
+\r
+\r
+  def areTriasInTetras(self, args):\r
+    """no stop a first KO"""\r
+    done = False\r
+    i = 0\r
+    trias = self.trias\r
+    tetras = self.tetras
+    if tetras == []: #supposed skin without tetrahedra
+      res = OK +" WARNING: %s no tetrahedra in mesh" % (self.nameFile)
+      return res\r
+    res = OK + " INFO: %s all trias in tetras" % self.nameFile\r
+    for t in trias:\r
+      i += 1\r
+      j = 0\r
+      found = False\r
+      for h in tetras:\r
+        j += 1\r
+        if t.inTetra(h, args):\r
+          #if verbose: print("INFO: %s trias[%i] in tetras[%i]: tria=%s tetra=%s" % (self.nameFile, i, j, t, h))\r
+          found = True\r
+          break\r
+      if not found:\r
+        if verbose: print("ERROR: %s trias[%i] not in tetras: tria=%s" % (self.nameFile, i, t))\r
+        if verbose and not done: \r
+          print("INFO: Tetrahedra:\n%s" % PP.pformat(self.tetras))\r
+          done = True\r
+        res = KO+" ERROR: %s some trias not in tetras" % (self.nameFile)\r
+    return res\r
+\r
+  def testIntersection(self, mesh, args):\r
+    """intersection coherency between self and mesh"""\r
+\r
+    def storeAndInfoIntersection():\r
+      """used as macro: avoid duplicate code"""\r
+      #store info in args to use later...\r
+      args.intersections[title+name] = commons\r
+      if commons == []:\r
+        res.append(OK + " INFO: no %s" % title+name)\r
+      else:\r
+        res.append(OK + " INFO: existing %s" % title+name)\r
+      return\r
+      \r
+    res=[]\r
+    name = "%s<->%s" % (self.nameFile, mesh.nameFile)\r
+    \r
+    title = "Vertices intersection: "\r
+    commons = self.getCommonVerts(mesh, args)\r
+    storeAndInfoIntersection()\r
+\r
+    title = "Edges intersection: "\r
+    commons = self.getCommonEdges(mesh, args)\r
+    storeAndInfoIntersection()\r
+\r
+    title = "Triangles intersection: "\r
+    commons = self.getCommonTriangles(mesh, args)\r
+    storeAndInfoIntersection()\r
+\r
+    title = "Tetrahedra intersection: "\r
+    commons = self.getCommonTetras(mesh, args)\r
+    storeAndInfoIntersection()\r
+\r
+    return res\r
+      \r
+  def testIndexGlobal(self, mesh, args):\r
+    """global index coherency between self and mesh"""\r
+    \r
+    def storeAndInfoIndexGlobal():\r
+      """used as macro: avoid duplicate code"""\r
+      #store info in args to use later...\r
+      args.indexglobal[title+name] = problems\r
+      if verbose: print("\nINFO: %s\n%s" % (title+name, PP.pformat(problems)))\r
+      if problems == []:\r
+        res.append(OK + " INFO: coherent %s" % title+name)\r
+      else:\r
+        res.append(KO + " ERROR: some problems %s" % title+name)\r
+      return\r
+\r
+    def testIndexGlobal():\r
+      """used as macro: avoid duplicate code"""\r
+      nameElem = title.split(' ')[0]\r
+      #something like 'Vertices intersection: /tmp/GHS3DPRL_out.000002.mesh<->/tmp/GHS3DPRL_out.000003.mesh'\r
+      commonsTitle = nameElem + " intersection: "+ name\r
+      #if verbose: print "testIndexGlobal",title,commonsTitle\r
+      try:\r
+        intersection = args.intersections[commonsTitle]\r
+      except:\r
+        intersection = []\r
+      problems = []\r
+      for ii, jj in intersection:\r
+        if ii.indexglobal != jj.indexglobal:\r
+          problems.append((ii, jj))\r
+      return problems\r
+\r
+    res=[]\r
+    name = "%s<->%s" % (self.nameFile, mesh.nameFile)\r
+\r
+    title = "Vertices indexglobal: "\r
+    problems = testIndexGlobal()\r
+    storeAndInfoIndexGlobal()\r
+\r
+    title = "Edges indexglobal: "\r
+    problems = testIndexGlobal()\r
+    storeAndInfoIndexGlobal()\r
+\r
+    title = "Triangles indexglobal: "\r
+    problems = testIndexGlobal()\r
+    storeAndInfoIndexGlobal()\r
+\r
+    title = "Tetrahedra indexglobal: "\r
+    problems = testIndexGlobal()\r
+    storeAndInfoIndexGlobal()\r
+\r
+    return res\r
+\r
+\r
+#########################################\r
+# tests\r
\r
+def testAll(args):
+  """test all on meshes from tetra_hpc_mpi"""\r
+  res = [] 
+  if verbose: print("\n*****testAll*****\n")
+  args.skinMesh = None
+  if args.skinInputFile != None:
+    args.skinMesh = XXMesh()
+    #a priori no global numerotation file.global for input tetra_hpc_mpi mesh\r
+    args.skinMesh.initFromFileMesh(args.skinInputFile, args, withGlobal=False)
+    res.append(testStandaloneMesh(args.skinMesh, args))
+    print("\nINFO: testAll skin input file:\n%s" % (PP.pformat(args.skinMesh)))\r
+    \r
+  meshes = []\r
+  for fileName in args.files:\r
+    xxmesh = XXMesh()\r
+    xxmesh.initFromFileMesh(fileName, args)\r
+    meshes.append(xxmesh)\r
+  print("\nINFO: testAll ouput files:\n%s\n" % (PP.pformat(meshes)))\r
+  #test coherence of one by one meshes\r
+  for mesh in meshes:\r
+    res.append(testStandaloneMesh(mesh, args))\r
+  #test coherence of intersections an global numerotation of tetra_hpc_mpi output meshes
+  res.append(testParallelMesh(meshes, args))
+  res.append(testParallelMeshAndSkin(meshes, args))\r
+  res.append(testParallelMeshAndSkinColor(meshes, args))\r
+  return res\r
+
+  \r
+def testStandaloneMesh(mesh, args):
+  """test coherence of one mesh alone"""\r
+  if verbose: print("\nINFO: testStandaloneMesh:\n%s" % PP.pformat(mesh))\r
+  res = []\r
+  res.append(mesh.haveVertsDistinct(args))\r
+  res.append(mesh.areEdgesInTrias(args))\r
+  res.append(mesh.areTriasInTetras(args))\r
+  return res\r
+
+\r
+def testParallelMesh(meshes, args):\r
+  """test intersection and overriding in tetra_hpc_mpi outputs GHS3DPRL_out.00000?.mesh"""\r
+  i = 0\r
+  res = []\r
+  args.intersections = {}\r
+  args.indexglobal = {}\r
+  for m1 in meshes[:-1]:\r
+    i += 1\r
+    for m2 in meshes[i:]:\r
+      res.append(m1.testIntersection(m2, args))\r
+      res.append(m1.testIndexGlobal(m2, args))\r
+  if verbose: \r
+    print("\nINFO: intersections\n%s" % PP.pformat(args.intersections))\r
+    print("\nINFO: indexglobal\n%s" % PP.pformat(args.indexglobal))\r
+  return res\r
+\r
+def testParallelMeshAndSkin(meshes, args):\r
+  """test coherency between input skin and tetra_hpc_mpi outputs GHS3DPRL_out.00000?.mesh"""\r
+  res = []\r
+  if args.skinMesh == None:
+    print("INFO: no skin Mesh for testing intersectionsSkin\n")
+    res = OK + "INFO: no skin Mesh for testing intersectionsSkin"
+    return res
+  nbtriasskin = len(args.skinMesh.trias)\r
+  for m1 in meshes:\r
+    res.append(args.skinMesh.testIntersection(m1, args))\r
+    res.append(args.skinMesh.testIndexGlobal(m1, args))
+  
+  #test total Triangles in output parallel meshes vs input skin mesh\r
+  if True:
+    kk = {} 
+    nbtriaspara = 0
+    for k in args.intersections.keys():
+      if args.skinMesh.nameFile in k:
+        ll = len(args.intersections[k])
+        if "Triangles intersection" in k: 
+          nbtriaspara += ll
+        kk[k] = len(args.intersections[k])\r
+    print("INFO: skin intersections\n%s\n" % PP.pformat(kk))\r
+    if nbtriaspara < nbtriasskin:
+      res.append(KO + " ERROR: problem all skin triangles not in parallel meshes: %i<->%i" % (nbtriasskin, nbtriaspara))\r
+  return res\r
+
+def testParallelMeshAndSkinColor(meshes, args):\r
+  """test coherency between color input skin and tetra_hpc_mpi outputs GHS3DPRL_out.00000?.mesh"""
+  res = []
+  if args.color == True:\r
+    res.append(KO + " ERROR: test color TODO!!!")
+  else:
+    res.append(OK + " WARNING: test color not done")
+  return res\r
+\r
+if __name__ == '__main__':\r
+  parser = AP.ArgumentParser(description='launch test(s) on tetra_hpc_mpi mesh(es)', argument_default=None)\r
+  parser.add_argument(\r
+    '-a', '--testAll', \r
+    help='test all on all meshes',\r
+    action='store_true',\r
+  )\r
+  parser.add_argument(\r
+    '-v', '--verbose', \r
+    help='set verbose, for deep debug',\r
+    action='store_true',\r
+  )\r
+  parser.add_argument(\r
+    '-g', '--globalNumerotation', \r
+    help='read and set files .global, if associated',\r
+    action='store_true',\r
+  )\r
+  parser.add_argument(\r
+    '-c', '--color', \r
+    help='read and test with color',\r
+    action='store_true',\r
+  )\r
+  parser.add_argument(\r
+    '-f', '--files', \r
+    help='launch test(s) on file(s)',\r
+    nargs='*',\r
+    metavar='.../file.mesh'\r
+  )\r
+  parser.add_argument(\r
+    '-s', '--skinInputFile', \r
+    help='launch test(s) on tetra_hpc_mpi input file',\r
+    nargs='?',\r
+    metavar='.../skinInputFile.mesh'\r
+  )\r
+  """\r
+  parser.add_argument(\r
+    '-x', '--xoneargument', \r
+    nargs='?',\r
+    metavar='0|1',\r
+    choices=['0', '1'],\r
+    help='one argument, for example',\r
+    default='0'\r
+  )\r
+  """\r
+  \r
+    \r
+  """
+  args is Namespace, use it as global to store 
+  parameters, data, used arrays and results and other...
+  """\r
+  args = parser.parse_args()
+  \r
+  verbose = args.verbose\r
+  if verbose: print("INFO: args:\n%s" % PP.pformat(args))\r
+\r
+  if len(sys.argv) == 1: #no args as --help\r
+    parser.print_help()\r
+    sys.exit(KOSYS)\r
+\r
+  if args.files == None:\r
+    print("\nERROR: Nothing to do: no files\n%s" % PP.pformat(args))\r
+    parser.print_help()\r
+    sys.exit(KOSYS)\r
+  \r
+  if args.testAll: \r
+    result = testAll(args)\r
+  else:\r
+    result = KO\r
+    print("\nERROR: Nothing to do:\n%s" % PP.pformat(args))\r
+  sys.exit(okToSys(result, verbose=True))\r
+  \r
diff --git a/src/tools/testMeshTest.py b/src/tools/testMeshTest.py
new file mode 100644 (file)
index 0000000..4930a55
--- /dev/null
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# %% LICENSE_SALOME_CEA_BEGIN
+# Copyright (C) 2008-2016  CEA/DEN
+# 
+# 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
+# %% LICENSE_END
+
+
+import unittest
+import testMesh as TM
+from argparse import Namespace
+    
+verbose = False
+
+class TestCase(unittest.TestCase):
+
+  def test_010(self):
+    self.failUnlessEqual(TM.okToSys([]), TM.KOSYS)
+    self.failUnlessEqual(TM.okToSys([[]]), TM.KOSYS)
+    
+    res = TM.OK + " blah blah 0"
+    self.failUnlessEqual(TM.okToSys([[res]]), TM.OKSYS)
+    self.failUnlessEqual(TM.okToSys(res), TM.OKSYS)
+    res = [res]
+    self.failUnlessEqual(TM.okToSys(res), TM.OKSYS)
+    res.append(TM.OK + " blah blah 1")
+    self.failUnlessEqual(TM.okToSys(res), TM.OKSYS)  
+    res.append([TM.OK + " blah blah 2"])
+    self.failUnlessEqual(TM.okToSys(res), TM.OKSYS) 
+    res.append([TM.KO + " blah blah 3"])
+    self.failUnlessEqual(TM.okToSys(res), TM.KOSYS)
+    self.failUnlessEqual(TM.okToSys([]), TM.KOSYS)
+    res = [[[res]],[TM.OK + " blah blah 4"],[]]
+    self.failUnlessEqual(TM.okToSys(res), TM.KOSYS)
+
+  def test_030(self):
+    a = TM.XXVert(1, 1, 1)
+    b = TM.XXVert(2, 2, 2)
+    c = TM.XXVert(1., 1., 1., 3, 4)
+    self.failUnlessEqual(a==c, True)
+    
+    from argparse import Namespace
+    args = Namespace(withColor=True, withIndex=True)
+    self.failUnlessEqual(a.compare(c, args, withAll=True), False)
+    self.failUnlessEqual(a.compare(c, args, withAll=False), True)
+    
+    args = Namespace(withColor=False, withIndex=False)
+    self.failUnlessEqual(a.compare(c, args, withAll=True), True)
+    
+    self.failUnlessEqual(a==b, False)
+    self.failUnlessEqual(a.dist(b), 3**.5)
+    
+    self.failUnlessEqual(str(c), '(1.0 1.0 1.0 (3 4))')
+    self.failUnlessEqual(c.__repr__(), 'XXVert(1.0000 1.0000 1.0000 (3 4))')
+
+
+if __name__ == '__main__':
+  verbose = False
+  unittest.main()
+  pass