Salome HOME
PR: add an independant exe that cuts a tetra mesh by a plane. MeshCut is adpated...
authorprascle <prascle>
Tue, 12 Apr 2011 11:24:20 +0000 (11:24 +0000)
committerprascle <prascle>
Tue, 12 Apr 2011 11:24:20 +0000 (11:24 +0000)
22 files changed:
configure.ac
src/Makefile.am
src/Tools/Makefile.am [new file with mode: 0644]
src/Tools/Makefile.in [new file with mode: 0644]
src/Tools/MeshCut/AUTHORS [new file with mode: 0644]
src/Tools/MeshCut/Makefile.am [new file with mode: 0644]
src/Tools/MeshCut/Makefile.in [new file with mode: 0644]
src/Tools/MeshCut/MeshCut_Carre.cxx [new file with mode: 0644]
src/Tools/MeshCut/MeshCut_Carre.hxx [new file with mode: 0644]
src/Tools/MeshCut/MeshCut_Cas.cxx [new file with mode: 0644]
src/Tools/MeshCut/MeshCut_Cas.hxx [new file with mode: 0644]
src/Tools/MeshCut/MeshCut_Cube.cxx [new file with mode: 0644]
src/Tools/MeshCut/MeshCut_Cube.hxx [new file with mode: 0644]
src/Tools/MeshCut/MeshCut_DC.cxx [new file with mode: 0644]
src/Tools/MeshCut/MeshCut_Fonctions.cxx [new file with mode: 0644]
src/Tools/MeshCut/MeshCut_Fonctions.hxx [new file with mode: 0644]
src/Tools/MeshCut/MeshCut_Globals.hxx [new file with mode: 0644]
src/Tools/MeshCut/MeshCut_Maillage.cxx [new file with mode: 0644]
src/Tools/MeshCut/MeshCut_Maillage.hxx [new file with mode: 0644]
src/Tools/MeshCut/MeshCut_Utils.cxx [new file with mode: 0644]
src/Tools/MeshCut/MeshCut_Utils.hxx [new file with mode: 0644]
src/Tools/MeshCut/README [new file with mode: 0644]

index e6913e39aca85d8c169a12aafc4f15987beedb48..b89fd137b158d1c4933bb55da57c2df64be51ff5 100644 (file)
@@ -499,6 +499,8 @@ AC_OUTPUT([ \
   src/StdMeshersGUI/Makefile \
   src/StdMeshers_I/Makefile \
   src/SMESH_PY/Makefile \
+  src/Tools/Makefile \
+  src/Tools/MeshCut/Makefile \
   resources/Makefile \
   resources/SMESHCatalog.xml \
   idl/Makefile \
index e244fbde66ad12192863b52a6cf585cb7de7c418..b7866c89c4f0c12e3c3342b3ff41b2c2d5ba1466 100644 (file)
@@ -41,7 +41,8 @@ SUBDIRS = \
        MEFISTO2 \
        StdMeshers \
        StdMeshers_I \
-       SMESH_PY
+       SMESH_PY \
+       Tools
 
 if SMESH_ENABLE_GUI
   SUBDIRS += \
@@ -55,4 +56,4 @@ endif
 
 DIST_SUBDIRS =         SMDS SMESHDS Controls Driver DriverMED DriverDAT DriverUNV DriverSTL SMESH      \
                SMESH_I SMESHClient SMESH_SWIG MEFISTO2 StdMeshers StdMeshers_I OBJECT          \
-               SMESHFiltersSelection SMESHGUI PluginUtils SMESH_SWIG_WITHIHM StdMeshersGUI SMESH_PY
+               SMESHFiltersSelection SMESHGUI PluginUtils SMESH_SWIG_WITHIHM StdMeshersGUI SMESH_PY Tools
diff --git a/src/Tools/Makefile.am b/src/Tools/Makefile.am
new file mode 100644 (file)
index 0000000..1d2e5a1
--- /dev/null
@@ -0,0 +1,30 @@
+#  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+#  File   : Makefile.in
+#  Author : Patrick GOLDBRONN (CEA)
+#  Modified by : Alexander BORODIN (OCN) - autotools usage
+#  Module : SMESH
+#  $Header$
+#
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+SUBDIRS = MeshCut
+
+DIST_SUBDIRS =         MeshCut
diff --git a/src/Tools/Makefile.in b/src/Tools/Makefile.in
new file mode 100644 (file)
index 0000000..7744fb5
--- /dev/null
@@ -0,0 +1,863 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+#  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(top_srcdir)/adm_local/unix/make_common_starter.am
+subdir = src/Tools
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps =  \
+       $(top_srcdir)/adm_local/unix/config_files/check_Platform.m4 \
+       $(top_srcdir)/adm_local/unix/config_files/check_qwt.m4 \
+       $(top_srcdir)/adm_local/unix/config_files/libtool.m4 \
+       $(top_srcdir)/adm_local/unix/config_files/ltoptions.m4 \
+       $(top_srcdir)/adm_local/unix/config_files/ltsugar.m4 \
+       $(top_srcdir)/adm_local/unix/config_files/ltversion.m4 \
+       $(top_srcdir)/adm_local/unix/config_files/lt~obsolete.m4 \
+       $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-dvi-recursive install-exec-recursive \
+       install-html-recursive install-info-recursive \
+       install-pdf-recursive install-ps-recursive install-recursive \
+       installcheck-recursive installdirs-recursive pdf-recursive \
+       ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
+  distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+       $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+       distdir
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LIBS = @BOOST_LIBS@
+BOOST_LIBSUFFIX = @BOOST_LIBSUFFIX@
+BOOST_LIB_REGEX = @BOOST_LIB_REGEX@
+BOOST_LIB_SIGNALS = @BOOST_LIB_SIGNALS@
+BOOST_LIB_SYSTEM = @BOOST_LIB_SYSTEM@
+BOOST_LIB_THREAD = @BOOST_LIB_THREAD@
+BOOST_PROGRAM_OPTIONS_LIB = @BOOST_PROGRAM_OPTIONS_LIB@
+CASROOT = @CASROOT@
+CAS_CPPFLAGS = @CAS_CPPFLAGS@
+CAS_CXXFLAGS = @CAS_CXXFLAGS@
+CAS_DATADIR = @CAS_DATADIR@
+CAS_DATAEXCHANGE = @CAS_DATAEXCHANGE@
+CAS_KERNEL = @CAS_KERNEL@
+CAS_LDFLAGS = @CAS_LDFLAGS@
+CAS_LDPATH = @CAS_LDPATH@
+CAS_LIBDIR = @CAS_LIBDIR@
+CAS_MATH = @CAS_MATH@
+CAS_MODELER = @CAS_MODELER@
+CAS_OCAF = @CAS_OCAF@
+CAS_OCAFVIS = @CAS_OCAFVIS@
+CAS_STDPLUGIN = @CAS_STDPLUGIN@
+CAS_TKTopAlgo = @CAS_TKTopAlgo@
+CAS_VIEWER = @CAS_VIEWER@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CORBA_CXXFLAGS = @CORBA_CXXFLAGS@
+CORBA_INCLUDES = @CORBA_INCLUDES@
+CORBA_LIBS = @CORBA_LIBS@
+CORBA_ROOT = @CORBA_ROOT@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CXXTMPDPTHFLAGS = @CXXTMPDPTHFLAGS@
+CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@
+CYGPATH_W = @CYGPATH_W@
+C_DEPEND_FLAG = @C_DEPEND_FLAG@
+DEFINED_F77INT64 = @DEFINED_F77INT64@
+DEFS = @DEFS@
+DEPCC = @DEPCC@
+DEPCXX = @DEPCXX@
+DEPCXXFLAGS = @DEPCXXFLAGS@
+DEPDIR = @DEPDIR@
+DOT = @DOT@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_PYTHON_EXTENSION = @DOXYGEN_PYTHON_EXTENSION@
+DOXYGEN_SUPPORT_STL = @DOXYGEN_SUPPORT_STL@
+DOXYGEN_WITH_PYTHON = @DOXYGEN_WITH_PYTHON@
+DOXYGEN_WITH_STL = @DOXYGEN_WITH_STL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DVIPS = @DVIPS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_MULTIPR = @ENABLE_MULTIPR@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FCLIBS = @FCLIBS@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GEOM_CXXFLAGS = @GEOM_CXXFLAGS@
+GEOM_LDFLAGS = @GEOM_LDFLAGS@
+GEOM_ROOT_DIR = @GEOM_ROOT_DIR@
+GLOBAL_INSTALL = @GLOBAL_INSTALL@
+GREP = @GREP@
+GUI_CXXFLAGS = @GUI_CXXFLAGS@
+GUI_LDFLAGS = @GUI_LDFLAGS@
+GUI_ROOT_DIR = @GUI_ROOT_DIR@
+HAVE_SSTREAM = @HAVE_SSTREAM@
+HDF5_INCLUDES = @HDF5_INCLUDES@
+HDF5_LIBS = @HDF5_LIBS@
+HDF5_MT_LIBS = @HDF5_MT_LIBS@
+IDL = @IDL@
+IDLCXXFLAGS = @IDLCXXFLAGS@
+IDLPYFLAGS = @IDLPYFLAGS@
+IDL_CLN_CXX = @IDL_CLN_CXX@
+IDL_CLN_H = @IDL_CLN_H@
+IDL_CLN_OBJ = @IDL_CLN_OBJ@
+IDL_SRV_CXX = @IDL_SRV_CXX@
+IDL_SRV_H = @IDL_SRV_H@
+IDL_SRV_OBJ = @IDL_SRV_OBJ@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KERNEL_CXXFLAGS = @KERNEL_CXXFLAGS@
+KERNEL_LDFLAGS = @KERNEL_LDFLAGS@
+KERNEL_ROOT_DIR = @KERNEL_ROOT_DIR@
+KERNEL_SITE_DIR = @KERNEL_SITE_DIR@
+LATEX = @LATEX@
+LD = @LD@
+LDEXPDYNFLAGS = @LDEXPDYNFLAGS@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_LOCATION_SUFFIX = @LIB_LOCATION_SUFFIX@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LRELEASE = @LRELEASE@
+LTLIBOBJS = @LTLIBOBJS@
+MACHINE = @MACHINE@
+MAKEINFO = @MAKEINFO@
+MDUMP = @MDUMP@
+MED2_INCLUDES = @MED2_INCLUDES@
+MED2_LIBS = @MED2_LIBS@
+MED2_LIBS_C_ONLY = @MED2_LIBS_C_ONLY@
+MED2_MT_LIBS = @MED2_MT_LIBS@
+MED_CPPFLAGS = @MED_CPPFLAGS@
+MED_CXXFLAGS = @MED_CXXFLAGS@
+MED_LDFLAGS = @MED_LDFLAGS@
+MED_ROOT_DIR = @MED_ROOT_DIR@
+MKDIR_P = @MKDIR_P@
+MOC = @MOC@
+MODULE_NAME = @MODULE_NAME@
+MPI_INCLUDES = @MPI_INCLUDES@
+MPI_LIBS = @MPI_LIBS@
+MULTIPR_CPPFLAGS = @MULTIPR_CPPFLAGS@
+MULTIPR_LIBS = @MULTIPR_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OGL_INCLUDES = @OGL_INCLUDES@
+OGL_LIBS = @OGL_LIBS@
+OMNIORB_CXXFLAGS = @OMNIORB_CXXFLAGS@
+OMNIORB_IDL = @OMNIORB_IDL@
+OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@
+OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@
+OMNIORB_IDL_CLN_CXX = @OMNIORB_IDL_CLN_CXX@
+OMNIORB_IDL_CLN_H = @OMNIORB_IDL_CLN_H@
+OMNIORB_IDL_CLN_OBJ = @OMNIORB_IDL_CLN_OBJ@
+OMNIORB_IDL_SRV_CXX = @OMNIORB_IDL_SRV_CXX@
+OMNIORB_IDL_SRV_H = @OMNIORB_IDL_SRV_H@
+OMNIORB_IDL_SRV_OBJ = @OMNIORB_IDL_SRV_OBJ@
+OMNIORB_IDL_TIE_CXX = @OMNIORB_IDL_TIE_CXX@
+OMNIORB_IDL_TIE_H = @OMNIORB_IDL_TIE_H@
+OMNIORB_INCLUDES = @OMNIORB_INCLUDES@
+OMNIORB_LIBS = @OMNIORB_LIBS@
+OMNIORB_ROOT = @OMNIORB_ROOT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PDFLATEX = @PDFLATEX@
+PLATFORM_INCLUDES = @PLATFORM_INCLUDES@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+PYTHON = @PYTHON@
+PYTHONHOME = @PYTHONHOME@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE = @PYTHON_SITE@
+PYTHON_SITE_EXEC = @PYTHON_SITE_EXEC@
+PYTHON_SITE_INSTALL = @PYTHON_SITE_INSTALL@
+PYTHON_SITE_PACKAGE = @PYTHON_SITE_PACKAGE@
+PYTHON_VERSION = @PYTHON_VERSION@
+QRCC = @QRCC@
+QTDIR = @QTDIR@
+QT_ASSISTANT_INCLUDES = @QT_ASSISTANT_INCLUDES@
+QT_ASSISTANT_LIBS = @QT_ASSISTANT_LIBS@
+QT_CORE_LIBS = @QT_CORE_LIBS@
+QT_GUI_LIBS = @QT_GUI_LIBS@
+QT_INCLUDES = @QT_INCLUDES@
+QT_LIBS = @QT_LIBS@
+QT_LIB_DIR = @QT_LIB_DIR@
+QT_MT_INCLUDES = @QT_MT_INCLUDES@
+QT_MT_LIBS = @QT_MT_LIBS@
+QT_OTHER_LIBS = @QT_OTHER_LIBS@
+QT_ROOT = @QT_ROOT@
+QT_VERSION = @QT_VERSION@
+QT_VERSION_ID = @QT_VERSION_ID@
+QWT_INCLUDES = @QWT_INCLUDES@
+QWT_LIBS = @QWT_LIBS@
+RANLIB = @RANLIB@
+ROOT_BUILDDIR = @ROOT_BUILDDIR@
+ROOT_SRCDIR = @ROOT_SRCDIR@
+RST2HTML = @RST2HTML@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SPHINX = @SPHINX@
+STDLIB = @STDLIB@
+STRIP = @STRIP@
+SWIG = @SWIG@
+SWIG_FLAGS = @SWIG_FLAGS@
+TEMP = @TEMP@
+UIC = @UIC@
+VERSION = @VERSION@
+VTKPY_MODULES = @VTKPY_MODULES@
+VTK_INCLUDES = @VTK_INCLUDES@
+VTK_LIBS = @VTK_LIBS@
+WITHMPI = @WITHMPI@
+XMKMF = @XMKMF@
+XVERSION = @XVERSION@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_FC = @ac_ct_FC@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = $(prefix)/bin/salome
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+
+# Documentation directory
+docdir = $(datadir)/doc/salome
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = $(prefix)/lib@LIB_LOCATION_SUFFIX@/salome
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mpi2_ok = @mpi2_ok@
+mpi_ok = @mpi_ok@
+oldincludedir = @oldincludedir@
+para_path = @para_path@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# ============================================================
+# The following is to avoid PACKAGE_... env variable
+# redefinition compilation warnings
+# ============================================================
+#
+AM_CXXFLAGS = @KERNEL_CXXFLAGS@ -include SALOMEconfig.h
+AM_CPPFLAGS = @KERNEL_CXXFLAGS@ -include SALOMEconfig.h
+
+# ============================================================
+# This file defines the common definitions used in several
+# Makefile. This file must be included, if needed, by the file
+# Makefile.am.
+# ============================================================
+# Standard directory for installation
+#
+salomeincludedir = $(includedir)/salome
+salomescriptdir = $(bindir)
+salomepythondir = $(pythondir)/salome
+salomepyexecdir = $(pyexecdir)/salome
+
+# Directory for installing idl files
+salomeidldir = $(prefix)/idl/salome
+
+# Directory for installing resource files
+salomeresdir = $(prefix)/share/salome/resources/@MODULE_NAME@
+
+# Directories for installing admin files
+admlocaldir = $(prefix)/adm_local
+admlocalunixdir = $(admlocaldir)/unix
+admlocalm4dir = $(admlocaldir)/unix/config_files
+
+# Shared modules installation directory
+sharedpkgpythondir = $(salomepythondir)/shared_modules
+
+# extra distributed files
+EXTRA_DIST = $(MOC_FILES:%_moc.cxx=%.h) $(QRC_FILES:qrc_%.cxx=%.qrc) \
+             $(UIC_FILES:ui_%.h=%.ui) $(nodist_salomeres_DATA:%.qm=%.ts)
+
+
+#  File   : Makefile.in
+#  Author : Patrick GOLDBRONN (CEA)
+#  Modified by : Alexander BORODIN (OCN) - autotools usage
+#  Module : SMESH
+#  $Header$
+#
+SUBDIRS = MeshCut
+DIST_SUBDIRS = MeshCut
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/adm_local/unix/make_common_starter.am $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Tools/Makefile'; \
+       $(am__cd) $(top_srcdir) && \
+         $(AUTOMAKE) --gnu src/Tools/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+       @fail= failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+       @fail= failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       rev=''; for subdir in $$list; do \
+         if test "$$subdir" = "."; then :; else \
+           rev="$$subdir $$rev"; \
+         fi; \
+       done; \
+       rev="$$rev ."; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+ctags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       set x; \
+       here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       shift; \
+       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         if test $$# -gt 0; then \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             "$$@" $$unique; \
+         else \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             $$unique; \
+         fi; \
+       fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       test -z "$(CTAGS_ARGS)$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && $(am__cd) $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d "$(distdir)/$$file"; then \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+         else \
+           test -f "$(distdir)/$$file" \
+           || cp -p $$d/$$file "$(distdir)/$$file" \
+           || exit 1; \
+         fi; \
+       done
+       @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test -d "$(distdir)/$$subdir" \
+           || $(MKDIR_P) "$(distdir)/$$subdir" \
+           || exit 1; \
+         fi; \
+       done
+       @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+           $(am__relativize); \
+           new_distdir=$$reldir; \
+           dir1=$$subdir; dir2="$(top_distdir)"; \
+           $(am__relativize); \
+           new_top_distdir=$$reldir; \
+           echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+           echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+           ($(am__cd) $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$new_top_distdir" \
+               distdir="$$new_distdir" \
+               am__remove_distdir=: \
+               am__skip_length_check=: \
+               am__skip_mode_fix=: \
+               distdir) \
+             || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool \
+       mostlyclean-local
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+       install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+       all all-am check check-am clean clean-generic clean-libtool \
+       ctags ctags-recursive distclean distclean-generic \
+       distclean-libtool distclean-tags distdir dvi dvi-am html \
+       html-am info info-am install install-am install-data \
+       install-data-am install-dvi install-dvi-am install-exec \
+       install-exec-am install-html install-html-am install-info \
+       install-info-am install-man install-pdf install-pdf-am \
+       install-ps install-ps-am install-strip installcheck \
+       installcheck-am installdirs installdirs-am maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic \
+       mostlyclean-libtool mostlyclean-local pdf pdf-am ps ps-am tags \
+       tags-recursive uninstall uninstall-am
+
+
+# common rules
+
+# meta object implementation files generation (moc)
+%_moc.cxx: %.h
+       $(MOC) $< -o $@
+
+# translation (*.qm) files generation (lrelease)
+%.qm: %.ts
+       $(LRELEASE) $< -qm $@
+
+# resource files generation (qrcc)
+qrc_%.cxx: %.qrc
+       $(QRCC) $< -o $@ -name $(*F)
+
+# qt forms files generation (uic)
+ui_%.h: %.ui
+       $(UIC) -o $@ $<
+
+# customize clean operation
+mostlyclean-local:
+       rm -f @builddir@/*_moc.cxx
+       rm -f @builddir@/*.qm
+       rm -f @builddir@/ui_*.h
+       rm -f @builddir@/qrc_*.cxx
+
+# tests
+tests: unittest
+
+unittest: $(UNIT_TEST_PROG)
+       @if test "x$(UNIT_TEST_PROG)" != "x"; then \
+           $(UNIT_TEST_PROG);                     \
+       fi;
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/Tools/MeshCut/AUTHORS b/src/Tools/MeshCut/AUTHORS
new file mode 100644 (file)
index 0000000..785c84b
--- /dev/null
@@ -0,0 +1,19 @@
+//  Copyright (C) 2006-2010  EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  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
+//
+//  Authors: Jean Claude LALEUF, Jean Francois HERY, XMESHLAB project, EDF R&D
diff --git a/src/Tools/MeshCut/Makefile.am b/src/Tools/MeshCut/Makefile.am
new file mode 100644 (file)
index 0000000..5862200
--- /dev/null
@@ -0,0 +1,38 @@
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+#  File   : Makefile.in
+#  Author : Patrick GOLDBRONN (CEA)
+#  Modified by : Alexander BORODIN (OCN) - autotools usage
+#  Module : SMESH
+#  $Header$
+#
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+
+bin_PROGRAMS = MeshCut
+
+MeshCut_SOURCES = \
+  MeshCut_Carre.cxx \
+  MeshCut_Cube.cxx \
+  MeshCut_Maillage.cxx \
+  MeshCut_Fonctions.cxx \
+  MeshCut_Utils.cxx \
+  MeshCut_Cas.cxx \
+  MeshCut_DC.cxx
+
+MeshCut_CPPFLAGS =  $(MED2_INCLUDES)
+
+MeshCut_LDFLAGS =  $(MED2_LIBS) $(HDF5_LIBS)
+
diff --git a/src/Tools/MeshCut/Makefile.in b/src/Tools/MeshCut/Makefile.in
new file mode 100644 (file)
index 0000000..2f474db
--- /dev/null
@@ -0,0 +1,924 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+#  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(top_srcdir)/adm_local/unix/make_common_starter.am AUTHORS
+bin_PROGRAMS = MeshCut$(EXEEXT)
+subdir = src/Tools/MeshCut
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps =  \
+       $(top_srcdir)/adm_local/unix/config_files/check_Platform.m4 \
+       $(top_srcdir)/adm_local/unix/config_files/check_qwt.m4 \
+       $(top_srcdir)/adm_local/unix/config_files/libtool.m4 \
+       $(top_srcdir)/adm_local/unix/config_files/ltoptions.m4 \
+       $(top_srcdir)/adm_local/unix/config_files/ltsugar.m4 \
+       $(top_srcdir)/adm_local/unix/config_files/ltversion.m4 \
+       $(top_srcdir)/adm_local/unix/config_files/lt~obsolete.m4 \
+       $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_MeshCut_OBJECTS = MeshCut-MeshCut_Carre.$(OBJEXT) \
+       MeshCut-MeshCut_Cube.$(OBJEXT) \
+       MeshCut-MeshCut_Maillage.$(OBJEXT) \
+       MeshCut-MeshCut_Fonctions.$(OBJEXT) \
+       MeshCut-MeshCut_Utils.$(OBJEXT) MeshCut-MeshCut_Cas.$(OBJEXT) \
+       MeshCut-MeshCut_DC.$(OBJEXT)
+MeshCut_OBJECTS = $(am_MeshCut_OBJECTS)
+MeshCut_LDADD = $(LDADD)
+MeshCut_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+       $(MeshCut_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/adm_local/unix/config_files/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+SOURCES = $(MeshCut_SOURCES)
+DIST_SOURCES = $(MeshCut_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LIBS = @BOOST_LIBS@
+BOOST_LIBSUFFIX = @BOOST_LIBSUFFIX@
+BOOST_LIB_REGEX = @BOOST_LIB_REGEX@
+BOOST_LIB_SIGNALS = @BOOST_LIB_SIGNALS@
+BOOST_LIB_SYSTEM = @BOOST_LIB_SYSTEM@
+BOOST_LIB_THREAD = @BOOST_LIB_THREAD@
+BOOST_PROGRAM_OPTIONS_LIB = @BOOST_PROGRAM_OPTIONS_LIB@
+CASROOT = @CASROOT@
+CAS_CPPFLAGS = @CAS_CPPFLAGS@
+CAS_CXXFLAGS = @CAS_CXXFLAGS@
+CAS_DATADIR = @CAS_DATADIR@
+CAS_DATAEXCHANGE = @CAS_DATAEXCHANGE@
+CAS_KERNEL = @CAS_KERNEL@
+CAS_LDFLAGS = @CAS_LDFLAGS@
+CAS_LDPATH = @CAS_LDPATH@
+CAS_LIBDIR = @CAS_LIBDIR@
+CAS_MATH = @CAS_MATH@
+CAS_MODELER = @CAS_MODELER@
+CAS_OCAF = @CAS_OCAF@
+CAS_OCAFVIS = @CAS_OCAFVIS@
+CAS_STDPLUGIN = @CAS_STDPLUGIN@
+CAS_TKTopAlgo = @CAS_TKTopAlgo@
+CAS_VIEWER = @CAS_VIEWER@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CORBA_CXXFLAGS = @CORBA_CXXFLAGS@
+CORBA_INCLUDES = @CORBA_INCLUDES@
+CORBA_LIBS = @CORBA_LIBS@
+CORBA_ROOT = @CORBA_ROOT@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CXXTMPDPTHFLAGS = @CXXTMPDPTHFLAGS@
+CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@
+CYGPATH_W = @CYGPATH_W@
+C_DEPEND_FLAG = @C_DEPEND_FLAG@
+DEFINED_F77INT64 = @DEFINED_F77INT64@
+DEFS = @DEFS@
+DEPCC = @DEPCC@
+DEPCXX = @DEPCXX@
+DEPCXXFLAGS = @DEPCXXFLAGS@
+DEPDIR = @DEPDIR@
+DOT = @DOT@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_PYTHON_EXTENSION = @DOXYGEN_PYTHON_EXTENSION@
+DOXYGEN_SUPPORT_STL = @DOXYGEN_SUPPORT_STL@
+DOXYGEN_WITH_PYTHON = @DOXYGEN_WITH_PYTHON@
+DOXYGEN_WITH_STL = @DOXYGEN_WITH_STL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DVIPS = @DVIPS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_MULTIPR = @ENABLE_MULTIPR@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FCLIBS = @FCLIBS@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GEOM_CXXFLAGS = @GEOM_CXXFLAGS@
+GEOM_LDFLAGS = @GEOM_LDFLAGS@
+GEOM_ROOT_DIR = @GEOM_ROOT_DIR@
+GLOBAL_INSTALL = @GLOBAL_INSTALL@
+GREP = @GREP@
+GUI_CXXFLAGS = @GUI_CXXFLAGS@
+GUI_LDFLAGS = @GUI_LDFLAGS@
+GUI_ROOT_DIR = @GUI_ROOT_DIR@
+HAVE_SSTREAM = @HAVE_SSTREAM@
+HDF5_INCLUDES = @HDF5_INCLUDES@
+HDF5_LIBS = @HDF5_LIBS@
+HDF5_MT_LIBS = @HDF5_MT_LIBS@
+IDL = @IDL@
+IDLCXXFLAGS = @IDLCXXFLAGS@
+IDLPYFLAGS = @IDLPYFLAGS@
+IDL_CLN_CXX = @IDL_CLN_CXX@
+IDL_CLN_H = @IDL_CLN_H@
+IDL_CLN_OBJ = @IDL_CLN_OBJ@
+IDL_SRV_CXX = @IDL_SRV_CXX@
+IDL_SRV_H = @IDL_SRV_H@
+IDL_SRV_OBJ = @IDL_SRV_OBJ@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KERNEL_CXXFLAGS = @KERNEL_CXXFLAGS@
+KERNEL_LDFLAGS = @KERNEL_LDFLAGS@
+KERNEL_ROOT_DIR = @KERNEL_ROOT_DIR@
+KERNEL_SITE_DIR = @KERNEL_SITE_DIR@
+LATEX = @LATEX@
+LD = @LD@
+LDEXPDYNFLAGS = @LDEXPDYNFLAGS@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_LOCATION_SUFFIX = @LIB_LOCATION_SUFFIX@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LRELEASE = @LRELEASE@
+LTLIBOBJS = @LTLIBOBJS@
+MACHINE = @MACHINE@
+MAKEINFO = @MAKEINFO@
+MDUMP = @MDUMP@
+MED2_INCLUDES = @MED2_INCLUDES@
+MED2_LIBS = @MED2_LIBS@
+MED2_LIBS_C_ONLY = @MED2_LIBS_C_ONLY@
+MED2_MT_LIBS = @MED2_MT_LIBS@
+MED_CPPFLAGS = @MED_CPPFLAGS@
+MED_CXXFLAGS = @MED_CXXFLAGS@
+MED_LDFLAGS = @MED_LDFLAGS@
+MED_ROOT_DIR = @MED_ROOT_DIR@
+MKDIR_P = @MKDIR_P@
+MOC = @MOC@
+MODULE_NAME = @MODULE_NAME@
+MPI_INCLUDES = @MPI_INCLUDES@
+MPI_LIBS = @MPI_LIBS@
+MULTIPR_CPPFLAGS = @MULTIPR_CPPFLAGS@
+MULTIPR_LIBS = @MULTIPR_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OGL_INCLUDES = @OGL_INCLUDES@
+OGL_LIBS = @OGL_LIBS@
+OMNIORB_CXXFLAGS = @OMNIORB_CXXFLAGS@
+OMNIORB_IDL = @OMNIORB_IDL@
+OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@
+OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@
+OMNIORB_IDL_CLN_CXX = @OMNIORB_IDL_CLN_CXX@
+OMNIORB_IDL_CLN_H = @OMNIORB_IDL_CLN_H@
+OMNIORB_IDL_CLN_OBJ = @OMNIORB_IDL_CLN_OBJ@
+OMNIORB_IDL_SRV_CXX = @OMNIORB_IDL_SRV_CXX@
+OMNIORB_IDL_SRV_H = @OMNIORB_IDL_SRV_H@
+OMNIORB_IDL_SRV_OBJ = @OMNIORB_IDL_SRV_OBJ@
+OMNIORB_IDL_TIE_CXX = @OMNIORB_IDL_TIE_CXX@
+OMNIORB_IDL_TIE_H = @OMNIORB_IDL_TIE_H@
+OMNIORB_INCLUDES = @OMNIORB_INCLUDES@
+OMNIORB_LIBS = @OMNIORB_LIBS@
+OMNIORB_ROOT = @OMNIORB_ROOT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PDFLATEX = @PDFLATEX@
+PLATFORM_INCLUDES = @PLATFORM_INCLUDES@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+PYTHON = @PYTHON@
+PYTHONHOME = @PYTHONHOME@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SITE = @PYTHON_SITE@
+PYTHON_SITE_EXEC = @PYTHON_SITE_EXEC@
+PYTHON_SITE_INSTALL = @PYTHON_SITE_INSTALL@
+PYTHON_SITE_PACKAGE = @PYTHON_SITE_PACKAGE@
+PYTHON_VERSION = @PYTHON_VERSION@
+QRCC = @QRCC@
+QTDIR = @QTDIR@
+QT_ASSISTANT_INCLUDES = @QT_ASSISTANT_INCLUDES@
+QT_ASSISTANT_LIBS = @QT_ASSISTANT_LIBS@
+QT_CORE_LIBS = @QT_CORE_LIBS@
+QT_GUI_LIBS = @QT_GUI_LIBS@
+QT_INCLUDES = @QT_INCLUDES@
+QT_LIBS = @QT_LIBS@
+QT_LIB_DIR = @QT_LIB_DIR@
+QT_MT_INCLUDES = @QT_MT_INCLUDES@
+QT_MT_LIBS = @QT_MT_LIBS@
+QT_OTHER_LIBS = @QT_OTHER_LIBS@
+QT_ROOT = @QT_ROOT@
+QT_VERSION = @QT_VERSION@
+QT_VERSION_ID = @QT_VERSION_ID@
+QWT_INCLUDES = @QWT_INCLUDES@
+QWT_LIBS = @QWT_LIBS@
+RANLIB = @RANLIB@
+ROOT_BUILDDIR = @ROOT_BUILDDIR@
+ROOT_SRCDIR = @ROOT_SRCDIR@
+RST2HTML = @RST2HTML@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SPHINX = @SPHINX@
+STDLIB = @STDLIB@
+STRIP = @STRIP@
+SWIG = @SWIG@
+SWIG_FLAGS = @SWIG_FLAGS@
+TEMP = @TEMP@
+UIC = @UIC@
+VERSION = @VERSION@
+VTKPY_MODULES = @VTKPY_MODULES@
+VTK_INCLUDES = @VTK_INCLUDES@
+VTK_LIBS = @VTK_LIBS@
+WITHMPI = @WITHMPI@
+XMKMF = @XMKMF@
+XVERSION = @XVERSION@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_FC = @ac_ct_FC@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = $(prefix)/bin/salome
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+
+# Documentation directory
+docdir = $(datadir)/doc/salome
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = $(prefix)/lib@LIB_LOCATION_SUFFIX@/salome
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mpi2_ok = @mpi2_ok@
+mpi_ok = @mpi_ok@
+oldincludedir = @oldincludedir@
+para_path = @para_path@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# ============================================================
+# The following is to avoid PACKAGE_... env variable
+# redefinition compilation warnings
+# ============================================================
+#
+AM_CXXFLAGS = @KERNEL_CXXFLAGS@ -include SALOMEconfig.h
+AM_CPPFLAGS = @KERNEL_CXXFLAGS@ -include SALOMEconfig.h
+
+# ============================================================
+# This file defines the common definitions used in several
+# Makefile. This file must be included, if needed, by the file
+# Makefile.am.
+# ============================================================
+# Standard directory for installation
+#
+salomeincludedir = $(includedir)/salome
+salomescriptdir = $(bindir)
+salomepythondir = $(pythondir)/salome
+salomepyexecdir = $(pyexecdir)/salome
+
+# Directory for installing idl files
+salomeidldir = $(prefix)/idl/salome
+
+# Directory for installing resource files
+salomeresdir = $(prefix)/share/salome/resources/@MODULE_NAME@
+
+# Directories for installing admin files
+admlocaldir = $(prefix)/adm_local
+admlocalunixdir = $(admlocaldir)/unix
+admlocalm4dir = $(admlocaldir)/unix/config_files
+
+# Shared modules installation directory
+sharedpkgpythondir = $(salomepythondir)/shared_modules
+
+# extra distributed files
+EXTRA_DIST = $(MOC_FILES:%_moc.cxx=%.h) $(QRC_FILES:qrc_%.cxx=%.qrc) \
+             $(UIC_FILES:ui_%.h=%.ui) $(nodist_salomeres_DATA:%.qm=%.ts)
+
+MeshCut_SOURCES = \
+  MeshCut_Carre.cxx \
+  MeshCut_Cube.cxx \
+  MeshCut_Maillage.cxx \
+  MeshCut_Fonctions.cxx \
+  MeshCut_Utils.cxx \
+  MeshCut_Cas.cxx \
+  MeshCut_DC.cxx
+
+MeshCut_CPPFLAGS = $(MED2_INCLUDES)
+MeshCut_LDFLAGS = $(MED2_LIBS) $(HDF5_LIBS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cxx .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/adm_local/unix/make_common_starter.am $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Tools/MeshCut/Makefile'; \
+       $(am__cd) $(top_srcdir) && \
+         $(AUTOMAKE) --gnu src/Tools/MeshCut/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+       @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+       for p in $$list; do echo "$$p $$p"; done | \
+       sed 's/$(EXEEXT)$$//' | \
+       while read p p1; do if test -f $$p || test -f $$p1; \
+         then echo "$$p"; echo "$$p"; else :; fi; \
+       done | \
+       sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+           -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+       sed 'N;N;N;s,\n, ,g' | \
+       $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+         { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+           if ($$2 == $$4) files[d] = files[d] " " $$1; \
+           else { print "f", $$3 "/" $$4, $$1; } } \
+         END { for (d in files) print "f", d, files[d] }' | \
+       while read type dir files; do \
+           if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+           test -z "$$files" || { \
+           echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+           $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+           } \
+       ; done
+
+uninstall-binPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+       files=`for p in $$list; do echo "$$p"; done | \
+         sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+             -e 's/$$/$(EXEEXT)/' `; \
+       test -n "$$list" || exit 0; \
+       echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+       cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+       @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+       echo " rm -f" $$list; \
+       rm -f $$list || exit $$?; \
+       test -n "$(EXEEXT)" || exit 0; \
+       list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+       echo " rm -f" $$list; \
+       rm -f $$list
+MeshCut$(EXEEXT): $(MeshCut_OBJECTS) $(MeshCut_DEPENDENCIES) 
+       @rm -f MeshCut$(EXEEXT)
+       $(MeshCut_LINK) $(MeshCut_OBJECTS) $(MeshCut_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MeshCut-MeshCut_Carre.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MeshCut-MeshCut_Cas.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MeshCut-MeshCut_Cube.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MeshCut-MeshCut_DC.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MeshCut-MeshCut_Fonctions.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MeshCut-MeshCut_Maillage.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MeshCut-MeshCut_Utils.Po@am__quote@
+
+.cxx.o:
+@am__fastdepCXX_TRUE@  $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cxx.obj:
+@am__fastdepCXX_TRUE@  $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cxx.lo:
+@am__fastdepCXX_TRUE@  $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+MeshCut-MeshCut_Carre.o: MeshCut_Carre.cxx
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MeshCut-MeshCut_Carre.o -MD -MP -MF $(DEPDIR)/MeshCut-MeshCut_Carre.Tpo -c -o MeshCut-MeshCut_Carre.o `test -f 'MeshCut_Carre.cxx' || echo '$(srcdir)/'`MeshCut_Carre.cxx
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/MeshCut-MeshCut_Carre.Tpo $(DEPDIR)/MeshCut-MeshCut_Carre.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='MeshCut_Carre.cxx' object='MeshCut-MeshCut_Carre.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MeshCut-MeshCut_Carre.o `test -f 'MeshCut_Carre.cxx' || echo '$(srcdir)/'`MeshCut_Carre.cxx
+
+MeshCut-MeshCut_Carre.obj: MeshCut_Carre.cxx
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MeshCut-MeshCut_Carre.obj -MD -MP -MF $(DEPDIR)/MeshCut-MeshCut_Carre.Tpo -c -o MeshCut-MeshCut_Carre.obj `if test -f 'MeshCut_Carre.cxx'; then $(CYGPATH_W) 'MeshCut_Carre.cxx'; else $(CYGPATH_W) '$(srcdir)/MeshCut_Carre.cxx'; fi`
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/MeshCut-MeshCut_Carre.Tpo $(DEPDIR)/MeshCut-MeshCut_Carre.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='MeshCut_Carre.cxx' object='MeshCut-MeshCut_Carre.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MeshCut-MeshCut_Carre.obj `if test -f 'MeshCut_Carre.cxx'; then $(CYGPATH_W) 'MeshCut_Carre.cxx'; else $(CYGPATH_W) '$(srcdir)/MeshCut_Carre.cxx'; fi`
+
+MeshCut-MeshCut_Cube.o: MeshCut_Cube.cxx
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MeshCut-MeshCut_Cube.o -MD -MP -MF $(DEPDIR)/MeshCut-MeshCut_Cube.Tpo -c -o MeshCut-MeshCut_Cube.o `test -f 'MeshCut_Cube.cxx' || echo '$(srcdir)/'`MeshCut_Cube.cxx
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/MeshCut-MeshCut_Cube.Tpo $(DEPDIR)/MeshCut-MeshCut_Cube.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='MeshCut_Cube.cxx' object='MeshCut-MeshCut_Cube.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MeshCut-MeshCut_Cube.o `test -f 'MeshCut_Cube.cxx' || echo '$(srcdir)/'`MeshCut_Cube.cxx
+
+MeshCut-MeshCut_Cube.obj: MeshCut_Cube.cxx
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MeshCut-MeshCut_Cube.obj -MD -MP -MF $(DEPDIR)/MeshCut-MeshCut_Cube.Tpo -c -o MeshCut-MeshCut_Cube.obj `if test -f 'MeshCut_Cube.cxx'; then $(CYGPATH_W) 'MeshCut_Cube.cxx'; else $(CYGPATH_W) '$(srcdir)/MeshCut_Cube.cxx'; fi`
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/MeshCut-MeshCut_Cube.Tpo $(DEPDIR)/MeshCut-MeshCut_Cube.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='MeshCut_Cube.cxx' object='MeshCut-MeshCut_Cube.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MeshCut-MeshCut_Cube.obj `if test -f 'MeshCut_Cube.cxx'; then $(CYGPATH_W) 'MeshCut_Cube.cxx'; else $(CYGPATH_W) '$(srcdir)/MeshCut_Cube.cxx'; fi`
+
+MeshCut-MeshCut_Maillage.o: MeshCut_Maillage.cxx
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MeshCut-MeshCut_Maillage.o -MD -MP -MF $(DEPDIR)/MeshCut-MeshCut_Maillage.Tpo -c -o MeshCut-MeshCut_Maillage.o `test -f 'MeshCut_Maillage.cxx' || echo '$(srcdir)/'`MeshCut_Maillage.cxx
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/MeshCut-MeshCut_Maillage.Tpo $(DEPDIR)/MeshCut-MeshCut_Maillage.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='MeshCut_Maillage.cxx' object='MeshCut-MeshCut_Maillage.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MeshCut-MeshCut_Maillage.o `test -f 'MeshCut_Maillage.cxx' || echo '$(srcdir)/'`MeshCut_Maillage.cxx
+
+MeshCut-MeshCut_Maillage.obj: MeshCut_Maillage.cxx
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MeshCut-MeshCut_Maillage.obj -MD -MP -MF $(DEPDIR)/MeshCut-MeshCut_Maillage.Tpo -c -o MeshCut-MeshCut_Maillage.obj `if test -f 'MeshCut_Maillage.cxx'; then $(CYGPATH_W) 'MeshCut_Maillage.cxx'; else $(CYGPATH_W) '$(srcdir)/MeshCut_Maillage.cxx'; fi`
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/MeshCut-MeshCut_Maillage.Tpo $(DEPDIR)/MeshCut-MeshCut_Maillage.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='MeshCut_Maillage.cxx' object='MeshCut-MeshCut_Maillage.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MeshCut-MeshCut_Maillage.obj `if test -f 'MeshCut_Maillage.cxx'; then $(CYGPATH_W) 'MeshCut_Maillage.cxx'; else $(CYGPATH_W) '$(srcdir)/MeshCut_Maillage.cxx'; fi`
+
+MeshCut-MeshCut_Fonctions.o: MeshCut_Fonctions.cxx
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MeshCut-MeshCut_Fonctions.o -MD -MP -MF $(DEPDIR)/MeshCut-MeshCut_Fonctions.Tpo -c -o MeshCut-MeshCut_Fonctions.o `test -f 'MeshCut_Fonctions.cxx' || echo '$(srcdir)/'`MeshCut_Fonctions.cxx
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/MeshCut-MeshCut_Fonctions.Tpo $(DEPDIR)/MeshCut-MeshCut_Fonctions.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='MeshCut_Fonctions.cxx' object='MeshCut-MeshCut_Fonctions.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MeshCut-MeshCut_Fonctions.o `test -f 'MeshCut_Fonctions.cxx' || echo '$(srcdir)/'`MeshCut_Fonctions.cxx
+
+MeshCut-MeshCut_Fonctions.obj: MeshCut_Fonctions.cxx
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MeshCut-MeshCut_Fonctions.obj -MD -MP -MF $(DEPDIR)/MeshCut-MeshCut_Fonctions.Tpo -c -o MeshCut-MeshCut_Fonctions.obj `if test -f 'MeshCut_Fonctions.cxx'; then $(CYGPATH_W) 'MeshCut_Fonctions.cxx'; else $(CYGPATH_W) '$(srcdir)/MeshCut_Fonctions.cxx'; fi`
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/MeshCut-MeshCut_Fonctions.Tpo $(DEPDIR)/MeshCut-MeshCut_Fonctions.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='MeshCut_Fonctions.cxx' object='MeshCut-MeshCut_Fonctions.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MeshCut-MeshCut_Fonctions.obj `if test -f 'MeshCut_Fonctions.cxx'; then $(CYGPATH_W) 'MeshCut_Fonctions.cxx'; else $(CYGPATH_W) '$(srcdir)/MeshCut_Fonctions.cxx'; fi`
+
+MeshCut-MeshCut_Utils.o: MeshCut_Utils.cxx
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MeshCut-MeshCut_Utils.o -MD -MP -MF $(DEPDIR)/MeshCut-MeshCut_Utils.Tpo -c -o MeshCut-MeshCut_Utils.o `test -f 'MeshCut_Utils.cxx' || echo '$(srcdir)/'`MeshCut_Utils.cxx
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/MeshCut-MeshCut_Utils.Tpo $(DEPDIR)/MeshCut-MeshCut_Utils.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='MeshCut_Utils.cxx' object='MeshCut-MeshCut_Utils.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MeshCut-MeshCut_Utils.o `test -f 'MeshCut_Utils.cxx' || echo '$(srcdir)/'`MeshCut_Utils.cxx
+
+MeshCut-MeshCut_Utils.obj: MeshCut_Utils.cxx
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MeshCut-MeshCut_Utils.obj -MD -MP -MF $(DEPDIR)/MeshCut-MeshCut_Utils.Tpo -c -o MeshCut-MeshCut_Utils.obj `if test -f 'MeshCut_Utils.cxx'; then $(CYGPATH_W) 'MeshCut_Utils.cxx'; else $(CYGPATH_W) '$(srcdir)/MeshCut_Utils.cxx'; fi`
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/MeshCut-MeshCut_Utils.Tpo $(DEPDIR)/MeshCut-MeshCut_Utils.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='MeshCut_Utils.cxx' object='MeshCut-MeshCut_Utils.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MeshCut-MeshCut_Utils.obj `if test -f 'MeshCut_Utils.cxx'; then $(CYGPATH_W) 'MeshCut_Utils.cxx'; else $(CYGPATH_W) '$(srcdir)/MeshCut_Utils.cxx'; fi`
+
+MeshCut-MeshCut_Cas.o: MeshCut_Cas.cxx
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MeshCut-MeshCut_Cas.o -MD -MP -MF $(DEPDIR)/MeshCut-MeshCut_Cas.Tpo -c -o MeshCut-MeshCut_Cas.o `test -f 'MeshCut_Cas.cxx' || echo '$(srcdir)/'`MeshCut_Cas.cxx
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/MeshCut-MeshCut_Cas.Tpo $(DEPDIR)/MeshCut-MeshCut_Cas.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='MeshCut_Cas.cxx' object='MeshCut-MeshCut_Cas.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MeshCut-MeshCut_Cas.o `test -f 'MeshCut_Cas.cxx' || echo '$(srcdir)/'`MeshCut_Cas.cxx
+
+MeshCut-MeshCut_Cas.obj: MeshCut_Cas.cxx
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MeshCut-MeshCut_Cas.obj -MD -MP -MF $(DEPDIR)/MeshCut-MeshCut_Cas.Tpo -c -o MeshCut-MeshCut_Cas.obj `if test -f 'MeshCut_Cas.cxx'; then $(CYGPATH_W) 'MeshCut_Cas.cxx'; else $(CYGPATH_W) '$(srcdir)/MeshCut_Cas.cxx'; fi`
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/MeshCut-MeshCut_Cas.Tpo $(DEPDIR)/MeshCut-MeshCut_Cas.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='MeshCut_Cas.cxx' object='MeshCut-MeshCut_Cas.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MeshCut-MeshCut_Cas.obj `if test -f 'MeshCut_Cas.cxx'; then $(CYGPATH_W) 'MeshCut_Cas.cxx'; else $(CYGPATH_W) '$(srcdir)/MeshCut_Cas.cxx'; fi`
+
+MeshCut-MeshCut_DC.o: MeshCut_DC.cxx
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MeshCut-MeshCut_DC.o -MD -MP -MF $(DEPDIR)/MeshCut-MeshCut_DC.Tpo -c -o MeshCut-MeshCut_DC.o `test -f 'MeshCut_DC.cxx' || echo '$(srcdir)/'`MeshCut_DC.cxx
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/MeshCut-MeshCut_DC.Tpo $(DEPDIR)/MeshCut-MeshCut_DC.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='MeshCut_DC.cxx' object='MeshCut-MeshCut_DC.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MeshCut-MeshCut_DC.o `test -f 'MeshCut_DC.cxx' || echo '$(srcdir)/'`MeshCut_DC.cxx
+
+MeshCut-MeshCut_DC.obj: MeshCut_DC.cxx
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MeshCut-MeshCut_DC.obj -MD -MP -MF $(DEPDIR)/MeshCut-MeshCut_DC.Tpo -c -o MeshCut-MeshCut_DC.obj `if test -f 'MeshCut_DC.cxx'; then $(CYGPATH_W) 'MeshCut_DC.cxx'; else $(CYGPATH_W) '$(srcdir)/MeshCut_DC.cxx'; fi`
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/MeshCut-MeshCut_DC.Tpo $(DEPDIR)/MeshCut-MeshCut_DC.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='MeshCut_DC.cxx' object='MeshCut-MeshCut_DC.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MeshCut_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MeshCut-MeshCut_DC.obj `if test -f 'MeshCut_DC.cxx'; then $(CYGPATH_W) 'MeshCut_DC.cxx'; else $(CYGPATH_W) '$(srcdir)/MeshCut_DC.cxx'; fi`
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       set x; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       shift; \
+       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         if test $$# -gt 0; then \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             "$$@" $$unique; \
+         else \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             $$unique; \
+         fi; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       test -z "$(CTAGS_ARGS)$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && $(am__cd) $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d "$(distdir)/$$file"; then \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+         else \
+           test -f "$(distdir)/$$file" \
+           || cp -p $$d/$$file "$(distdir)/$$file" \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+       for dir in "$(DESTDIR)$(bindir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+       clean-generic clean-libtool ctags distclean distclean-compile \
+       distclean-generic distclean-libtool distclean-tags distdir dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-binPROGRAMS install-data install-data-am install-dvi \
+       install-dvi-am install-exec install-exec-am install-html \
+       install-html-am install-info install-info-am install-man \
+       install-pdf install-pdf-am install-ps install-ps-am \
+       install-strip installcheck installcheck-am installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+       mostlyclean-local pdf pdf-am ps ps-am tags uninstall \
+       uninstall-am uninstall-binPROGRAMS
+
+
+# common rules
+
+# meta object implementation files generation (moc)
+%_moc.cxx: %.h
+       $(MOC) $< -o $@
+
+# translation (*.qm) files generation (lrelease)
+%.qm: %.ts
+       $(LRELEASE) $< -qm $@
+
+# resource files generation (qrcc)
+qrc_%.cxx: %.qrc
+       $(QRCC) $< -o $@ -name $(*F)
+
+# qt forms files generation (uic)
+ui_%.h: %.ui
+       $(UIC) -o $@ $<
+
+# customize clean operation
+mostlyclean-local:
+       rm -f @builddir@/*_moc.cxx
+       rm -f @builddir@/*.qm
+       rm -f @builddir@/ui_*.h
+       rm -f @builddir@/qrc_*.cxx
+
+# tests
+tests: unittest
+
+unittest: $(UNIT_TEST_PROG)
+       @if test "x$(UNIT_TEST_PROG)" != "x"; then \
+           $(UNIT_TEST_PROG);                     \
+       fi;
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/Tools/MeshCut/MeshCut_Carre.cxx b/src/Tools/MeshCut/MeshCut_Carre.cxx
new file mode 100644 (file)
index 0000000..e668bce
--- /dev/null
@@ -0,0 +1,35 @@
+#include "MeshCut_Carre.hxx"
+
+#include <iostream>
+
+using namespace MESHCUT;
+using namespace std;
+
+Carre::Carre(float _x0, float _x1, float _y0, float _y1)
+{
+  x0 = _x0;
+  x1 = _x1;
+  y0 = _y0;
+  y1 = _y1;
+}
+
+bool Carre::disjoint(Carre* c2)
+{
+  return (x0 > c2->x1 || x1 < c2->x0 || y0 > c2->y1 || y1 < c2->y0);
+}
+
+bool Carre::contientNoeud(int ngnoeud, Maillage *MAILLAGE)
+{
+  float x = *(MAILLAGE->XX + ngnoeud - 1);
+  float y = *(MAILLAGE->YY + ngnoeud - 1);
+  return (x >= x0 && x <= x1 && y >= y0 && y <= y1);
+}
+
+void Carre::affichage()
+{
+  cout << "x0=" << x0 << " ";
+  cout << "x1=" << x1 << " ";
+  cout << "y0=" << y0 << " ";
+  cout << "y1=" << y1 << " ";
+}
+
diff --git a/src/Tools/MeshCut/MeshCut_Carre.hxx b/src/Tools/MeshCut/MeshCut_Carre.hxx
new file mode 100644 (file)
index 0000000..6a4c0d2
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef __MESHCUT_CARRE_HXX__
+#define __MESHCUT_CARRE_HXX__
+
+#include "MeshCut_Maillage.hxx"
+
+namespace MESHCUT
+  {
+    class Carre
+    {
+    public:
+      float x0, x1, y0, y1;
+    public:
+      Carre(float _x0, float _x1, float _y0, float _y1);
+      bool disjoint(Carre* c2);
+      bool contientNoeud(int ngnoeud, Maillage *MAILLAGE);
+      void affichage();
+    };
+  }
+
+#endif
diff --git a/src/Tools/MeshCut/MeshCut_Cas.cxx b/src/Tools/MeshCut/MeshCut_Cas.cxx
new file mode 100644 (file)
index 0000000..09e2784
--- /dev/null
@@ -0,0 +1,926 @@
+#include "MeshCut_Cas.hxx"
+
+#include "MeshCut_Globals.hxx"
+
+using namespace MESHCUT;
+using namespace std;
+
+/*!
+ * Le cas 1 traduit le fait que deux des sommets du T4 initial sont dans le plan de coupe.
+ * Le point d'intersection franc trouvé est sur l'arête opposée à ces deux points du T4.
+
+ * Le T4 initial produit deux nouveaux T4.
+ */
+void MESHCUT::cas1(int VN[6], int it4)
+{
+
+  //  cout << "Cas 1 - it4=" << it4 << ", VN = " << VN[0] << " " << VN[1] << " " << VN[2] << " " << VN[3] << " " << VN[4]
+  //      << " " << VN[5] << " " << endl;
+
+  // Numéros des noeuds du TETRA4
+  int ng0 = MAILLAGE1->CNX[TETRA4][4 * it4 + 0];
+  int ng1 = MAILLAGE1->CNX[TETRA4][4 * it4 + 1];
+  int ng2 = MAILLAGE1->CNX[TETRA4][4 * it4 + 2];
+  int ng3 = MAILLAGE1->CNX[TETRA4][4 * it4 + 3];
+
+  int i1, i2;
+
+  if (VN[0] != -1)
+    {
+      // Le sommet de T4new1 servant à la détermination du groupe est le noeud 1 du T4 d'origine
+
+      // cout << "cas 1/0" << endl;
+      newCNX[TETRA4].push_back(VN[0]);
+      newCNX[TETRA4].push_back(ng1);
+      newCNX[TETRA4].push_back(ng2);
+      newCNX[TETRA4].push_back(ng3);
+      cptNouvellesMailles[TETRA4]++;
+      i1 = cptNouvellesMailles[TETRA4] - 1;
+
+      newCNX[TETRA4].push_back(ng0);
+      newCNX[TETRA4].push_back(VN[0]);
+      newCNX[TETRA4].push_back(ng2);
+      newCNX[TETRA4].push_back(ng3);
+      cptNouvellesMailles[TETRA4]++;
+      i2 = cptNouvellesMailles[TETRA4] - 1;
+
+      if (POSN[ng1 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i1);
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i2);
+        }
+      else
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i2);
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i1);
+        }
+    }
+
+  else if (VN[1] != -1)
+    {
+      // Le sommet de T4new1 servant à la détermination du groupe est le noeud 0 du T4 d'origine
+
+      // cout << "cas 1/1" << endl;
+      newCNX[TETRA4].push_back(ng0);
+      newCNX[TETRA4].push_back(ng1);
+      newCNX[TETRA4].push_back(VN[1]);
+      newCNX[TETRA4].push_back(ng3);
+      cptNouvellesMailles[TETRA4]++;
+      i1 = cptNouvellesMailles[TETRA4] - 1;
+
+      newCNX[TETRA4].push_back(ng1);
+      newCNX[TETRA4].push_back(ng2);
+      newCNX[TETRA4].push_back(VN[1]);
+      newCNX[TETRA4].push_back(ng3);
+      cptNouvellesMailles[TETRA4]++;
+      i2 = cptNouvellesMailles[TETRA4] - 1;
+
+      if (POSN[ng0 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i1);
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i2);
+        }
+      else
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i2);
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i1);
+        }
+    }
+
+  else if (VN[2] != -1)
+    {
+      // Le sommet de T4new1 servant à la détermination du groupe est le noeud 0 du T4 d'origine
+
+      // cout << "cas 1/2" << endl;
+      newCNX[TETRA4].push_back(ng0);
+      newCNX[TETRA4].push_back(ng1);
+      newCNX[TETRA4].push_back(ng2);
+      newCNX[TETRA4].push_back(VN[2]);
+      cptNouvellesMailles[TETRA4]++;
+      i1 = cptNouvellesMailles[TETRA4] - 1;
+
+      newCNX[TETRA4].push_back(ng1);
+      newCNX[TETRA4].push_back(ng2);
+      newCNX[TETRA4].push_back(VN[2]);
+      newCNX[TETRA4].push_back(ng3);
+      cptNouvellesMailles[TETRA4]++;
+      i2 = cptNouvellesMailles[TETRA4] - 1;
+
+      if (POSN[ng0 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i1);
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i2);
+        }
+      else
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i2);
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i1);
+        }
+    }
+
+  else if (VN[3] != -1)
+    {
+      // Le sommet de T4new1 servant à la détermination du groupe est le noeud 1 du T4 d'origine
+
+      // cout << "cas 1/3" << endl;
+      newCNX[TETRA4].push_back(ng0);
+      newCNX[TETRA4].push_back(ng1);
+      newCNX[TETRA4].push_back(VN[3]);
+      newCNX[TETRA4].push_back(ng3);
+      cptNouvellesMailles[TETRA4]++;
+      i1 = cptNouvellesMailles[TETRA4] - 1;
+
+      newCNX[TETRA4].push_back(ng0);
+      newCNX[TETRA4].push_back(VN[3]);
+      newCNX[TETRA4].push_back(ng2);
+      newCNX[TETRA4].push_back(ng3);
+      cptNouvellesMailles[TETRA4]++;
+      i2 = cptNouvellesMailles[TETRA4] - 1;
+
+      if (POSN[ng1 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i1);
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i2);
+        }
+      else
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i2);
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i1);
+        }
+    }
+
+  else if (VN[4] != -1)
+    {
+      // Le sommet de T4new1 servant à la détermination du groupe est le noeud 1 du T4 d'origine
+
+      // cout << "cas 1/4" << endl;
+      newCNX[TETRA4].push_back(ng0);
+      newCNX[TETRA4].push_back(ng1);
+      newCNX[TETRA4].push_back(ng2);
+      newCNX[TETRA4].push_back(VN[4]);
+      cptNouvellesMailles[TETRA4]++;
+      i1 = cptNouvellesMailles[TETRA4] - 1;
+
+      newCNX[TETRA4].push_back(ng0);
+      newCNX[TETRA4].push_back(VN[4]);
+      newCNX[TETRA4].push_back(ng2);
+      newCNX[TETRA4].push_back(ng3);
+      cptNouvellesMailles[TETRA4]++;
+      i2 = cptNouvellesMailles[TETRA4] - 1;
+
+      if (POSN[ng1 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i1);
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i2);
+        }
+      else
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i2);
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i1);
+        }
+    }
+
+  else if (VN[5] != -1)
+    {
+      // Le sommet de T4new1 servant à la détermination du groupe est le noeud 3 du T4 d'origine
+
+      // cout << "cas 1/5" << endl;
+      newCNX[TETRA4].push_back(ng0);
+      newCNX[TETRA4].push_back(ng1);
+      newCNX[TETRA4].push_back(VN[5]);
+      newCNX[TETRA4].push_back(ng3);
+      cptNouvellesMailles[TETRA4]++;
+      i1 = cptNouvellesMailles[TETRA4] - 1;
+
+      newCNX[TETRA4].push_back(ng0);
+      newCNX[TETRA4].push_back(ng1);
+      newCNX[TETRA4].push_back(ng2);
+      newCNX[TETRA4].push_back(VN[5]);
+      cptNouvellesMailles[TETRA4]++;
+      i2 = cptNouvellesMailles[TETRA4] - 1;
+
+      if (POSN[ng3 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i1);
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i2);
+        }
+      else
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i2);
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i1);
+        }
+    }
+
+  else
+    ERREUR(" Configuration intersections non reconnue (cas cptPI=1) ");
+
+  //int nl1 = MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i1;
+  //int nl2 = MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + i2;
+  // cout << "La maille TETRA4 " << it4 << " produit les mailles TETRA4-" << nl1 << " et TETRA4-" << nl2 << endl;
+
+}
+
+/*!  Deux points d'intersection
+ *  Le cas 2 traduit le fait qu'un des sommets du T4 est dans le plan de coupe.
+ *  Ce sommet est celui des quatre qui n'appartient à aucune des deux arêtes sur lesquelles
+ *  un point d'intersection non -1 a été calculé.
+ *
+ *  Le T4 initial produit un nouveau T4 et un élément PYRAM5.
+ *
+ */
+void MESHCUT::cas2(int VN[6], int it4)
+{
+
+  //  cout << "Cas 2 - it4=" << it4 << ", VN = " << VN[0] << " " << VN[1] << " " << VN[2] << " " << VN[3] << " " << VN[4]
+  //      << " " << VN[5] << " " << endl;
+
+  // Numéros des noeuds du TETRA4
+  int ng0 = MAILLAGE1->CNX[TETRA4][4 * it4 + 0];
+  int ng1 = MAILLAGE1->CNX[TETRA4][4 * it4 + 1];
+  int ng2 = MAILLAGE1->CNX[TETRA4][4 * it4 + 2];
+  int ng3 = MAILLAGE1->CNX[TETRA4][4 * it4 + 3];
+
+  if (VN[0] != -1 && VN[1] != -1)
+    {
+      // Le sommet du nouveau T4 est le noeud 0 du T4 d'origine
+
+      // cout << "cas 2.01" << endl;
+      newCNX[TETRA4].push_back(VN[0]);
+      newCNX[TETRA4].push_back(ng3);
+      newCNX[TETRA4].push_back(VN[1]);
+      newCNX[TETRA4].push_back(ng0);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PYRAM5].push_back(VN[0]);
+      newCNX[PYRAM5].push_back(ng1);
+      newCNX[PYRAM5].push_back(ng2);
+      newCNX[PYRAM5].push_back(VN[1]);
+      newCNX[PYRAM5].push_back(ng3);
+      cptNouvellesMailles[PYRAM5]++;
+
+      if (POSN[ng0 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+    }
+  else if (VN[0] != -1 && VN[2] != -1)
+    {
+      // Le sommet du nouveau T4 est le noeud 0 du T4 d'origine
+
+      // cout << "cas 2.02" << endl;
+      newCNX[TETRA4].push_back(VN[0]);
+      newCNX[TETRA4].push_back(VN[2]);
+      newCNX[TETRA4].push_back(ng2);
+      newCNX[TETRA4].push_back(ng0);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PYRAM5].push_back(VN[0]);
+      newCNX[PYRAM5].push_back(VN[2]);
+      newCNX[PYRAM5].push_back(ng3);
+      newCNX[PYRAM5].push_back(ng1);
+      newCNX[PYRAM5].push_back(ng2);
+      cptNouvellesMailles[PYRAM5]++;
+
+      if (POSN[ng0 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+    }
+  else if (VN[0] != -1 && VN[3] != -1)
+    {
+      // Le sommet du nouveau T4 est le noeud 1 du T4 d'origine
+
+      // cout << "cas 2.03" << endl;
+      newCNX[TETRA4].push_back(VN[0]);
+      newCNX[TETRA4].push_back(VN[3]);
+      newCNX[TETRA4].push_back(ng3);
+      newCNX[TETRA4].push_back(ng1);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PYRAM5].push_back(VN[0]);
+      newCNX[PYRAM5].push_back(VN[3]);
+      newCNX[PYRAM5].push_back(ng2);
+      newCNX[PYRAM5].push_back(ng0);
+      newCNX[PYRAM5].push_back(ng3);
+      cptNouvellesMailles[PYRAM5]++;
+
+      if (POSN[ng1 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+    }
+  else if (VN[0] != -1 && VN[4] != -1)
+    {
+      // Le sommet du nouveau T4 est le noeud 1 du T4 d'origine
+
+      // cout << "cas 2.04" << endl;
+      newCNX[TETRA4].push_back(VN[0]);
+      newCNX[TETRA4].push_back(ng2);
+      newCNX[TETRA4].push_back(VN[4]);
+      newCNX[TETRA4].push_back(ng1);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PYRAM5].push_back(ng0);
+      newCNX[PYRAM5].push_back(ng3);
+      newCNX[PYRAM5].push_back(VN[4]);
+      newCNX[PYRAM5].push_back(VN[0]);
+      newCNX[PYRAM5].push_back(ng2);
+      cptNouvellesMailles[PYRAM5]++;
+
+      if (POSN[ng1 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+    }
+
+  else if (VN[0] != -1 && VN[5] != -1)
+    ERREUR("Cas 2/05 interdit");
+
+  else if (VN[1] != -1 && VN[2] != -1)
+    {
+      // Le sommet du nouveau T4 est le noeud 0 du T4 d'origine
+
+      // cout << "cas 2.12" << endl;
+      newCNX[TETRA4].push_back(ng1);
+      newCNX[TETRA4].push_back(VN[2]);
+      newCNX[TETRA4].push_back(VN[1]);
+      newCNX[TETRA4].push_back(ng0);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PYRAM5].push_back(ng2);
+      newCNX[PYRAM5].push_back(ng3);
+      newCNX[PYRAM5].push_back(VN[2]);
+      newCNX[PYRAM5].push_back(VN[1]);
+      newCNX[PYRAM5].push_back(ng1);
+      cptNouvellesMailles[PYRAM5]++;
+
+      if (POSN[ng0 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+    }
+  else if (VN[1] != -1 && VN[3] != -1)
+    {
+      // Le sommet du nouveau T4 est le noeud 2 du T4 d'origine
+
+      // cout << "cas 2.13" << endl;
+      newCNX[TETRA4].push_back(VN[1]);
+      newCNX[TETRA4].push_back(ng3);
+      newCNX[TETRA4].push_back(VN[3]);
+      newCNX[TETRA4].push_back(ng2);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PYRAM5].push_back(ng0);
+      newCNX[PYRAM5].push_back(ng1);
+      newCNX[PYRAM5].push_back(VN[3]);
+      newCNX[PYRAM5].push_back(VN[1]);
+      newCNX[PYRAM5].push_back(ng3);
+      cptNouvellesMailles[PYRAM5]++;
+
+      if (POSN[ng2 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+    }
+
+  else if (VN[1] != -1 && VN[4] != -1)
+    ERREUR("Cas 2/14 exclu");
+
+  else if (VN[1] != -1 && VN[5] != -1)
+    {
+      // Le sommet du nouveau T4 est le noeud 2 du T4 d'origine
+
+      // cout << "cas 2.15" << endl;
+      newCNX[TETRA4].push_back(ng1);
+      newCNX[TETRA4].push_back(ng2);
+      newCNX[TETRA4].push_back(VN[1]);
+      newCNX[TETRA4].push_back(VN[5]);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PYRAM5].push_back(VN[1]);
+      newCNX[PYRAM5].push_back(VN[5]);
+      newCNX[PYRAM5].push_back(ng3);
+      newCNX[PYRAM5].push_back(ng0);
+      newCNX[PYRAM5].push_back(ng1);
+      cptNouvellesMailles[PYRAM5]++;
+
+      if (POSN[ng2 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+    }
+
+  else if (VN[2] != -1 && VN[3] != -1)
+    ERREUR("Cas 2/23 exclu");
+
+  else if (VN[2] != -1 && VN[4] != -1)
+    {
+      // Le sommet du nouveau T4 est le noeud 3 du T4 d'origine
+
+      // cout << "cas 2.24" << endl;
+      newCNX[TETRA4].push_back(VN[2]);
+      newCNX[TETRA4].push_back(VN[4]);
+      newCNX[TETRA4].push_back(ng2);
+      newCNX[TETRA4].push_back(ng3);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PYRAM5].push_back(ng0);
+      newCNX[PYRAM5].push_back(VN[2]);
+      newCNX[PYRAM5].push_back(VN[4]);
+      newCNX[PYRAM5].push_back(ng1);
+      newCNX[PYRAM5].push_back(ng2);
+      cptNouvellesMailles[PYRAM5]++;
+
+      if (POSN[ng3 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+    }
+
+  else if (VN[2] != -1 && VN[5] != -1)
+    {
+      // Le sommet du nouveau T4 est le noeud 3 du T4 d'origine
+
+      // cout << "cas 2.25" << endl;
+      newCNX[TETRA4].push_back(ng1);
+      newCNX[TETRA4].push_back(VN[5]);
+      newCNX[TETRA4].push_back(VN[2]);
+      newCNX[TETRA4].push_back(ng3);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PYRAM5].push_back(ng0);
+      newCNX[PYRAM5].push_back(ng2);
+      newCNX[PYRAM5].push_back(VN[5]);
+      newCNX[PYRAM5].push_back(VN[2]);
+      newCNX[PYRAM5].push_back(ng1);
+      cptNouvellesMailles[PYRAM5]++;
+
+      if (POSN[ng3 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+    }
+
+  else if (VN[3] != -1 && VN[4] != -1)
+    {
+      // Le sommet du nouveau T4 est le noeud 1 du T4 d'origine
+
+      // cout << "cas 2.34" << endl;
+      newCNX[TETRA4].push_back(ng0);
+      newCNX[TETRA4].push_back(VN[3]);
+      newCNX[TETRA4].push_back(VN[4]);
+      newCNX[TETRA4].push_back(ng1);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PYRAM5].push_back(VN[3]);
+      newCNX[PYRAM5].push_back(VN[4]);
+      newCNX[PYRAM5].push_back(ng3);
+      newCNX[PYRAM5].push_back(ng2);
+      newCNX[PYRAM5].push_back(ng0);
+      cptNouvellesMailles[PYRAM5]++;
+
+      if (POSN[ng1 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+    }
+
+  else if (VN[3] != -1 && VN[5] != -1)
+    {
+      // Le sommet du nouveau T4 est le noeud 2 du T4 d'origine
+
+      // cout << "cas 2.35" << endl;
+      newCNX[TETRA4].push_back(VN[3]);
+      newCNX[TETRA4].push_back(VN[5]);
+      newCNX[TETRA4].push_back(ng2);
+      newCNX[TETRA4].push_back(ng0);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PYRAM5].push_back(VN[3]);
+      newCNX[PYRAM5].push_back(ng1);
+      newCNX[PYRAM5].push_back(ng3);
+      newCNX[PYRAM5].push_back(VN[5]);
+      newCNX[PYRAM5].push_back(ng0);
+      cptNouvellesMailles[PYRAM5]++;
+
+      if (POSN[ng2 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+    }
+
+  else if (VN[4] != -1 && VN[5] != -1)
+    {
+      // Le sommet du nouveau T4 est le noeud 3 du T4 d'origine
+
+      // cout << "cas 2.35" << endl;
+      newCNX[TETRA4].push_back(ng0);
+      newCNX[TETRA4].push_back(VN[4]);
+      newCNX[TETRA4].push_back(VN[5]);
+      newCNX[TETRA4].push_back(ng3);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PYRAM5].push_back(ng1);
+      newCNX[PYRAM5].push_back(VN[4]);
+      newCNX[PYRAM5].push_back(VN[5]);
+      newCNX[PYRAM5].push_back(ng2);
+      newCNX[PYRAM5].push_back(ng0);
+      cptNouvellesMailles[PYRAM5]++;
+
+      if (POSN[ng3 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PYRAM5].push_back(MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1);
+        }
+    }
+
+  else
+    ERREUR(" Configuration intersections non reconnue (cas cptPI=2) ");
+
+  // int ngT4 = MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1;
+  // int ngP5 = MAILLAGE1->EFFECTIFS_TYPES[PYRAM5] + cptNouvellesMailles[PYRAM5] - 1;
+  // cout << "La maille TETRA4 " << it4 << " produit les mailles TETRA4-" << ngT4 << " et PYRAM5-" << ngP5 << endl;
+
+}
+
+/*! Trois points d'intersection
+ *  ATTENTION: pour les PENTA6 on adopte la convention d'orientation SALOME :
+ *
+ *  N1 N2 N3 N4 N5 N6
+ *
+ *  où N1 N2 N3 sont les sommets du haut et N4 N5 N6 les sommets du bas
+ *  (selon l'orientation donnée par le sens des triangles)
+ */
+void MESHCUT::cas3(int VN[6], int it4)
+{
+
+  // cout << "Cas 3 - it4="<<it4<<", VN = " << VN[0] << " " << VN[1] << " " << VN[2] << " " << VN[3] << " " << VN[4] << " " << VN[5] << " " << endl;
+
+  // Numéros des noeuds du TETRA4
+  int ng0 = MAILLAGE1->CNX[TETRA4][4 * it4 + 0];
+  int ng1 = MAILLAGE1->CNX[TETRA4][4 * it4 + 1];
+  int ng2 = MAILLAGE1->CNX[TETRA4][4 * it4 + 2];
+  int ng3 = MAILLAGE1->CNX[TETRA4][4 * it4 + 3];
+
+  if (VN[0] != -1 && VN[1] != -1 && VN[2] != -1)
+    {
+
+      // Le sommet du nouveau T4 est le noeud 0 du T4 d'origine
+
+      newCNX[TETRA4].push_back(ng0);
+      newCNX[TETRA4].push_back(VN[0]);
+      newCNX[TETRA4].push_back(VN[1]);
+      newCNX[TETRA4].push_back(VN[2]);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PENTA6].push_back(ng1);
+      newCNX[PENTA6].push_back(ng3);
+      newCNX[PENTA6].push_back(ng2);
+      newCNX[PENTA6].push_back(VN[0]);
+      newCNX[PENTA6].push_back(VN[2]);
+      newCNX[PENTA6].push_back(VN[1]);
+      cptNouvellesMailles[PENTA6]++;
+
+      if (POSN[ng0 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + cptNouvellesMailles[PENTA6] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + cptNouvellesMailles[PENTA6] - 1);
+        }
+    }
+
+  else if (VN[0] != -1 && VN[3] != -1 && VN[4] != -1)
+    {
+      // Le sommet du nouveau T4 est le noeud 1 du T4 d'origine
+
+      //cout << "cas 3.2 (noeud sommet 1)" << endl;
+      newCNX[TETRA4].push_back(VN[0]);
+      newCNX[TETRA4].push_back(ng1);
+      newCNX[TETRA4].push_back(VN[3]);
+      newCNX[TETRA4].push_back(VN[4]);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PENTA6].push_back(ng0);
+      newCNX[PENTA6].push_back(ng2);
+      newCNX[PENTA6].push_back(ng3);
+      newCNX[PENTA6].push_back(VN[0]);
+      newCNX[PENTA6].push_back(VN[3]);
+      newCNX[PENTA6].push_back(VN[4]);
+      cptNouvellesMailles[PENTA6]++;
+
+      if (POSN[ng1 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + cptNouvellesMailles[PENTA6] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + cptNouvellesMailles[PENTA6] - 1);
+        }
+    }
+  else if (VN[1] != -1 && VN[3] != -1 && VN[5] != -1)
+    {
+      // Le sommet du nouveau T4 est le noeud 2 du T4 d'origine
+
+      //cout << "cas 3.3 (noeud sommet 2)" << endl;
+
+      newCNX[TETRA4].push_back(VN[1]);
+      newCNX[TETRA4].push_back(VN[3]);
+      newCNX[TETRA4].push_back(ng2);
+      newCNX[TETRA4].push_back(VN[5]);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PENTA6].push_back(ng0);
+      newCNX[PENTA6].push_back(ng3);
+      newCNX[PENTA6].push_back(ng1);
+      newCNX[PENTA6].push_back(VN[1]);
+      newCNX[PENTA6].push_back(VN[5]);
+      newCNX[PENTA6].push_back(VN[3]);
+      cptNouvellesMailles[PENTA6]++;
+
+      if (POSN[ng2 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + cptNouvellesMailles[PENTA6] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + cptNouvellesMailles[PENTA6] - 1);
+        }
+    }
+  else if (VN[2] != -1 && VN[4] != -1 && VN[5] != -1)
+    {
+      // Le sommet du nouveau T4 est le noeud 3 du T4 d'origine
+
+      newCNX[TETRA4].push_back(VN[2]);
+      newCNX[TETRA4].push_back(VN[4]);
+      newCNX[TETRA4].push_back(VN[5]);
+      newCNX[TETRA4].push_back(ng3);
+      cptNouvellesMailles[TETRA4]++;
+
+      newCNX[PENTA6].push_back(ng0);
+      newCNX[PENTA6].push_back(ng1);
+      newCNX[PENTA6].push_back(ng2);
+      newCNX[PENTA6].push_back(VN[2]);
+      newCNX[PENTA6].push_back(VN[4]);
+      newCNX[PENTA6].push_back(VN[5]);
+      cptNouvellesMailles[PENTA6]++;
+
+      if (POSN[ng3 - 1] == 1)
+        {
+          GMplus[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMmoins[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + cptNouvellesMailles[PENTA6] - 1);
+        }
+      else
+        {
+          GMmoins[TETRA4].push_back(MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1);
+          GMplus[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + cptNouvellesMailles[PENTA6] - 1);
+        }
+    }
+  else
+    {
+      //      cout << "Cas 3 - it4=" << it4 << ", VN = " << VN[0] << " " << VN[1] << " " << VN[2] << " " << VN[3] << " "
+      //          << VN[4] << " " << VN[5] << " " << endl;
+      //
+      //      int n0 = *(MAILLAGE1->CNX[TETRA4] + it4 * 4 + 0);
+      //      float x0 = MAILLAGE1->XX[n0 - 1];
+      //      float y0 = MAILLAGE1->YY[n0 - 1];
+      //      float z0 = MAILLAGE1->ZZ[n0 - 1];
+      //
+      //      int n1 = *(MAILLAGE1->CNX[TETRA4] + it4 * 4 + 1);
+      //      float x1 = MAILLAGE1->XX[n1 - 1];
+      //      float y1 = MAILLAGE1->YY[n1 - 1];
+      //      float z1 = MAILLAGE1->ZZ[n1 - 1];
+      //
+      //      int n2 = *(MAILLAGE1->CNX[TETRA4] + it4 * 4 + 2);
+      //      float x2 = MAILLAGE1->XX[n2 - 1];
+      //      float y2 = MAILLAGE1->YY[n2 - 1];
+      //      float z2 = MAILLAGE1->ZZ[n2 - 1];
+      //
+      //      int n3 = *(MAILLAGE1->CNX[TETRA4] + it4 * 4 + 3);
+      //      float x3 = MAILLAGE1->XX[n3 - 1];
+      //      float y3 = MAILLAGE1->YY[n3 - 1];
+      //      float z3 = MAILLAGE1->ZZ[n3 - 1];
+      //
+      //      cout << x0 << " " << y0 << " " << z0 << " " << endl;
+      //      cout << x1 << " " << y1 << " " << z1 << " " << endl;
+      //      cout << x2 << " " << y2 << " " << z2 << " " << endl;
+      //      cout << x3 << " " << y3 << " " << z3 << " " << endl;
+
+      ERREUR(" Configuration intersections non reconnue (cas cptPI=3) ");
+    }
+
+  // int ngT4 = MAILLAGE1->EFFECTIFS_TYPES[TETRA4] + cptNouvellesMailles[TETRA4] - 1;
+  // int ngP6 = MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + cptNouvellesMailles[PENTA6] - 1;
+  // cout << "La maille TETRA4 " << it4 << " produit les mailles TETRA4-" << ngT4 << " et PENTA6-" << ngP6 << endl;
+}
+
+/*! Quatre points d'intersection
+ *
+ *  ATTENTION: pour les PENTA6 on adopte la convention d'orientation SALOME
+ *
+ *  N1 N2 N3 N4 N5 N6
+ *
+ *  où N1 N2 N3 sont les sommets du haut et N4 N5 N6 les sommets du bas
+ *  (selon l'orientation donnée par le sens des triangles)
+ */
+void MESHCUT::cas4(int VN[6], int it4)
+{
+
+  //  cout << "Cas 4 - it4=" << it4 << ", VN = " << VN[0] << " " << VN[1] << " " << VN[2] << " " << VN[3] << " " << VN[4]
+  //      << " " << VN[5] << " " << endl;
+
+  // Numéros des noeuds du TETRA4
+  int ng0 = MAILLAGE1->CNX[TETRA4][4 * it4 + 0];
+  int ng1 = MAILLAGE1->CNX[TETRA4][4 * it4 + 1];
+  int ng2 = MAILLAGE1->CNX[TETRA4][4 * it4 + 2];
+  int ng3 = MAILLAGE1->CNX[TETRA4][4 * it4 + 3];
+
+  int i1, i2; // Numéros locaux dans le type des mailles créées
+
+  if (VN[0] == -1 && VN[5] == -1)
+    {
+      // Les deux arêtes opposées sont [0,1] et [2,3]
+
+      newCNX[PENTA6].push_back(ng0);
+      newCNX[PENTA6].push_back(VN[1]);
+      newCNX[PENTA6].push_back(VN[2]);
+      newCNX[PENTA6].push_back(ng1);
+      newCNX[PENTA6].push_back(VN[3]);
+      newCNX[PENTA6].push_back(VN[4]);
+      cptNouvellesMailles[PENTA6]++;
+      i1 = cptNouvellesMailles[PENTA6] - 1;
+
+      newCNX[PENTA6].push_back(ng3);
+      newCNX[PENTA6].push_back(VN[4]);
+      newCNX[PENTA6].push_back(VN[2]);
+      newCNX[PENTA6].push_back(ng2);
+      newCNX[PENTA6].push_back(VN[3]);
+      newCNX[PENTA6].push_back(VN[1]);
+      cptNouvellesMailles[PENTA6]++;
+      i2 = cptNouvellesMailles[PENTA6] - 1;
+
+      if (POSN[ng0 - 1] == 1)
+        {
+          GMplus[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + i1);
+          GMmoins[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + i2);
+        }
+      else
+        {
+          GMplus[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + i2);
+          GMmoins[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + i1);
+        }
+
+    } // if ( VN[0]==-1 && VN[5]==-1 )
+
+  else if (VN[1] == -1 && VN[4] == -1)
+    {
+      // Les deux arêtes opposées sont [0,2] et [1,3]
+
+      newCNX[PENTA6].push_back(ng2);
+      newCNX[PENTA6].push_back(VN[3]);
+      newCNX[PENTA6].push_back(VN[5]);
+      newCNX[PENTA6].push_back(ng0);
+      newCNX[PENTA6].push_back(VN[0]);
+      newCNX[PENTA6].push_back(VN[2]);
+      cptNouvellesMailles[PENTA6]++;
+      i1 = cptNouvellesMailles[PENTA6] - 1;
+
+      newCNX[PENTA6].push_back(ng1);
+      newCNX[PENTA6].push_back(VN[3]);
+      newCNX[PENTA6].push_back(VN[0]);
+      newCNX[PENTA6].push_back(ng3);
+      newCNX[PENTA6].push_back(VN[5]);
+      newCNX[PENTA6].push_back(VN[2]);
+      cptNouvellesMailles[PENTA6]++;
+      i2 = cptNouvellesMailles[PENTA6] - 1;
+
+      if (POSN[ng0 - 1] == 1)
+        {
+          GMplus[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + i1);
+          GMmoins[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + i2);
+        }
+      else
+        {
+          GMplus[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + i2);
+          GMmoins[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + i1);
+        }
+    }
+
+  else if (VN[2] == -1 && VN[3] == -1)
+    {
+      // Les deux arêtes opposées sont [0,3] et [1,2]
+
+      newCNX[PENTA6].push_back(ng0);
+      newCNX[PENTA6].push_back(VN[0]);
+      newCNX[PENTA6].push_back(VN[1]);
+      newCNX[PENTA6].push_back(ng3);
+      newCNX[PENTA6].push_back(VN[4]);
+      newCNX[PENTA6].push_back(VN[5]);
+      cptNouvellesMailles[PENTA6]++;
+      i1 = cptNouvellesMailles[PENTA6] - 1;
+
+      newCNX[PENTA6].push_back(ng2);
+      newCNX[PENTA6].push_back(VN[5]);
+      newCNX[PENTA6].push_back(VN[1]);
+      newCNX[PENTA6].push_back(ng1);
+      newCNX[PENTA6].push_back(VN[4]);
+      newCNX[PENTA6].push_back(VN[0]);
+      cptNouvellesMailles[PENTA6]++;
+      i2 = cptNouvellesMailles[PENTA6] - 1;
+
+      if (POSN[ng0 - 1] == 1)
+        {
+          GMplus[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + i1);
+          GMmoins[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + i2);
+        }
+      else
+        {
+          GMplus[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + i2);
+          GMmoins[PENTA6].push_back(MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + i1);
+        }
+    }
+  else
+    ERREUR(" Configuration intersections non reconnue (cas cptPI=4) ");
+
+  // int nl1 = MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + i1;
+  // int nl2 = MAILLAGE1->EFFECTIFS_TYPES[PENTA6] + i2;
+  // cout << "La maille TETRA4 " << it4 << " produit les mailles PENTA6-" << nl1 << " et PENTA6-" << nl2 << endl;
+}
diff --git a/src/Tools/MeshCut/MeshCut_Cas.hxx b/src/Tools/MeshCut/MeshCut_Cas.hxx
new file mode 100644 (file)
index 0000000..8b3cd5e
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef __MESHCUT_CAS_HXX__
+#define __MESHCUT_CAS_HXX__
+
+namespace MESHCUT
+  {
+    void cas1(int VN[6], int it4);
+    void cas2(int VN[6], int it4);
+    void cas3(int VN[6], int it4);
+    void cas4(int VN[6], int it4);
+  }
+
+#endif
diff --git a/src/Tools/MeshCut/MeshCut_Cube.cxx b/src/Tools/MeshCut/MeshCut_Cube.cxx
new file mode 100644 (file)
index 0000000..42f036e
--- /dev/null
@@ -0,0 +1,39 @@
+#include "MeshCut_Cube.hxx"
+
+#include <iostream>
+
+using namespace MESHCUT;
+using namespace std;
+
+Cube::Cube(float _x0, float _x1, float _y0, float _y1, float _z0, float _z1)
+{
+  x0 = _x0;
+  x1 = _x1;
+  y0 = _y0;
+  y1 = _y1;
+  z0 = _z0;
+  z1 = _z1;
+}
+
+bool Cube::disjoint(Cube* c2)
+{
+  return (x0 > c2->x1 || x1 < c2->x0 || y0 > c2->y1 || y1 < c2->y0 || z0 > c2->z1 || z1 < c2->z0);
+}
+
+bool Cube::contientNoeud(int ngnoeud, Maillage *MAILLAGE)
+{
+  float x = *(MAILLAGE->XX + ngnoeud - 1);
+  float y = *(MAILLAGE->YY + ngnoeud - 1);
+  float z = *(MAILLAGE->ZZ + ngnoeud - 1);
+  return (x >= x0 && x <= x1 && y >= y0 && y <= y1 && z >= z0 && z <= z1);
+}
+
+void Cube::affichage()
+{
+  cout << "x0=" << x0 << " ";
+  cout << "x1=" << x1 << " ";
+  cout << "y0=" << y0 << " ";
+  cout << "y1=" << y1 << " ";
+  cout << "z0=" << z0 << " ";
+  cout << "z1=" << z1 << " ";
+}
diff --git a/src/Tools/MeshCut/MeshCut_Cube.hxx b/src/Tools/MeshCut/MeshCut_Cube.hxx
new file mode 100644 (file)
index 0000000..b74f9fa
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef __MESHCUT_CUBE_HXX__
+#define __MESHCUT_CUBE_HXX__
+
+#include "MeshCut_Maillage.hxx"
+
+namespace MESHCUT
+  {
+    class Cube
+    {
+    public:
+      float x0, x1, y0, y1, z0, z1;
+    public:
+      Cube(float _x0, float _x1, float _y0, float _y1, float _z0, float _z1);
+      bool disjoint(Cube* c2);
+      bool contientNoeud(int ngnoeud, Maillage *MAILLAGE);
+      void affichage();
+    };
+  }
+
+#endif
diff --git a/src/Tools/MeshCut/MeshCut_DC.cxx b/src/Tools/MeshCut/MeshCut_DC.cxx
new file mode 100644 (file)
index 0000000..6086a17
--- /dev/null
@@ -0,0 +1,1100 @@
+// Classes et fonctions XMeshLab
+
+#include "MeshCut_Utils.hxx"
+#include "MeshCut_Maillage.hxx"
+
+#include "MeshCut_Carre.hxx"
+#include "MeshCut_Cube.hxx"
+
+#include "MeshCut_Fonctions.hxx"
+#include "MeshCut_Cas.hxx"
+
+#include "MeshCut_Globals.hxx"
+
+#include <iostream>
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
+
+using namespace MESHCUT;
+using namespace std;
+
+// ==================================  DECLARATION DES VARIABLES GLOBALES  ==================================================
+
+std::map<std::string, int> MESHCUT::intersections;
+
+int MESHCUT::indexNouvellesMailles, MESHCUT::indexNouveauxNoeuds, MESHCUT::offsetMailles;
+std::string MESHCUT::str_id_GMplus, MESHCUT::str_id_GMmoins;
+Maillage *MESHCUT::MAILLAGE1, *MESHCUT::MAILLAGE2;
+
+std::vector<float> MESHCUT::newXX, MESHCUT::newYY, MESHCUT::newZZ;
+std::map<TYPE_MAILLE, std::vector<int> > MESHCUT::newCNX;
+std::map<TYPE_MAILLE, int> MESHCUT::cptNouvellesMailles;
+std::map<TYPE_MAILLE, std::vector<int> > MESHCUT::GMplus, MESHCUT::GMmoins;
+
+float *MESHCUT::DNP;
+int *MESHCUT::POSN;
+
+std::string MESHCUT::str_id_maillagenew;
+
+float MESHCUT::normale[3], MESHCUT::pointPlan[3];
+float MESHCUT::d;
+float MESHCUT::epsilon;
+
+bool MESHCUT::debug;
+int MESHCUT::Naretes;
+
+// ==================================   PROGRAMME PRINCIPAL  ==================================================
+
+int main(int argc, char *argv[])
+{
+
+  debug = false;
+  string ficMEDin;
+  string ficMEDout;
+  float xNormal;
+  float yNormal;
+  float zNormal;
+  float xm;
+  float ym;
+  float zm;
+  float tolerance;
+  try
+    {
+      if (argc != 13)
+        throw std::exception();
+      char *ficMEDin0 = argv[1];
+      ficMEDin = (string) ficMEDin0;
+      char *ficMEDout0 = argv[2];
+      ficMEDout = (string) ficMEDout0;
+      char *id_maillagenew = argv[3];
+      str_id_maillagenew = (string) id_maillagenew;
+
+      // Groupes créés
+      char *id_GMplus = argv[4];
+      str_id_GMplus = (string) id_GMplus;
+      char *id_GMmoins = argv[5];
+      str_id_GMmoins = (string) id_GMmoins;
+
+      // Vecteur normal au plan de coupe
+      char *charxn = argv[6];
+      xNormal = char2float(charxn);
+      char *charyn = argv[7];
+      yNormal = char2float(charyn);
+      char *charzn = argv[8];
+      zNormal = char2float(charzn);
+
+      // Point du plan de coupe
+      char *charxm = argv[9];
+      xm = char2float(charxm);
+      char *charym = argv[10];
+      ym = char2float(charym);
+      char *charzm = argv[11];
+      zm = char2float(charzm);
+
+      // Tolérance :  epsilon = tolérance * longueur arête moyenne - où epsilon est la tolérance absolue (distance)
+      char *chtolerance = argv[12];
+      tolerance = char2float(chtolerance);
+    }
+  catch (...)
+    {
+      cout << endl;
+      cout << "                 Cut a tetrahedron mesh by a plane" << endl;
+      cout << "                 ---------------------------------" << endl;
+      cout << "Syntax:" << endl << endl;
+      cout << argv[0] << " input.med output.med resuMeshName aboveGroup belowGroup nx ny nz px py pz T " << endl;
+      cout << endl << "where:" << endl;
+      cout << "  input.med    = name of the original mesh file in med format" << endl;
+      cout << "  output.med   = name of the result mesh file in med format" << endl;
+      cout << "  resuMeshName = name of the result mesh" << endl;
+      cout << "  aboveGroup   = name of the group of volumes above the cut plane" << endl;
+      cout << "  belowGroups  = name of the group of volumes below the cut plane" << endl;
+      cout << "  nx ny nz     = vector normal to the cut plane" << endl;
+      cout << "  px py pz     = a point of the cut plane" << endl;
+      cout << "  T            = 0 < T < 1 : vertices of a tetrahedron are considered as belonging" << endl;
+      cout << "                 the cut plane if their distance to the plane is inferior to L*T" << endl;
+      cout << "                 where L is the mean edge size of the tetrahedron" << endl;
+      ERREUR("--> check arguments!");
+    }
+
+  cout << "Découpe plane :" << endl;
+  cout << "\t" << "Maillage source: " << ficMEDin << endl;
+  cout << "\t" << "Maillage cible:  " << ficMEDout << endl;
+  cout << "\t" << "ID nouveau maillage:  " << str_id_maillagenew << endl;
+  cout << "\t" << "Nom GMplus:  " << str_id_GMplus << endl;
+  cout << "\t" << "Nom GMmoins: " << str_id_GMmoins << endl;
+  cout << "\t" << "Vecteur normal du plan de coupe: xn=" << xNormal << " yn=" << yNormal << " zn=" << zNormal << endl;
+  cout << "\t" << "Point du plan de coupe: xm=" << xm << " ym=" << ym << " zm=" << zm << endl;
+  cout << "\t" << "Tolérance: " << tolerance << endl;
+  cout << endl;
+
+  if (tolerance <= 0.0)
+    ERREUR("L'argument tolérance doit être strictement positif");
+
+  // Il faut normer la normale
+  float normeNormal = sqrt(xNormal * xNormal + yNormal * yNormal + zNormal * zNormal);
+  if (normeNormal == 0.0)
+    ERREUR("Vecteur normal nul");
+  normale[0] = xNormal / normeNormal;
+  normale[1] = yNormal / normeNormal;
+  normale[2] = zNormal / normeNormal;
+
+  pointPlan[0] = xm;
+  pointPlan[1] = ym;
+  pointPlan[2] = zm;
+
+  // Calcul du coefficient d de l'équation du plan  xn x + yn y + zn n + d = 0
+  d = -normale[0] * xm - normale[1] * ym - normale[2] * zm;
+
+  intersections.clear();
+
+  // Initialisation des compteurs de nouvelles mailles
+  for (int itm = (int) POI1; itm <= (int) HEXA20; itm++)
+    {
+      TYPE_MAILLE tm = (TYPE_MAILLE) itm;
+      cptNouvellesMailles[tm] = 0;
+    }
+
+  int V[6];
+  int S[4]; // Signature du T4 courant
+  int NG[4]; // Num. globaux des sommets
+
+  // Acquisition maillage initial
+  //cout << chrono() << " - Acquisition du maillage initial" << endl;
+  MAILLAGE1 = new Maillage((string) "TEMP");
+  MAILLAGE1->inputMED(ficMEDin);
+  cout << chrono() << " - Fin d'acquisition maillage" << endl;
+  indexNouveauxNoeuds = MAILLAGE1->nombreNoeudsMaillage;
+
+  // Le maillage ne contient aucun TETRA4 : on rend le maillage initial sans modification
+  if (!MAILLAGE1->EFFECTIFS_TYPES[TETRA4])
+    {
+      cout << "WARNING : le maillage ne contient aucun élément TETRA4, il ne sera donc pas modifié" << endl;
+      MAILLAGE1->ID = str_id_maillagenew;
+      MAILLAGE1->outputMED(ficMEDout);
+      cout << chrono() << " - Terminé" << endl << endl;
+      exit(0);
+    }
+  // A partir de cet instant le maillage contient forcément des TETRA4
+
+
+  // Chargement des distances noeud-plan DNP
+  DNP = (float*) malloc(sizeof(float) * MAILLAGE1->nombreNoeudsMaillage);
+  for (int k = 0; k < MAILLAGE1->nombreNoeudsMaillage; k++)
+    DNP[k] = distanceNoeudPlan(k + 1);
+  cout << chrono() << " - Fin de chargement des distances noeud-plan" << endl;
+
+  // Longueur d'arête moyenne des T4 intersectant le plan de coupe
+  float LONGUEURS = 0.0;
+  int cptLONGUEURS = 0;
+  for (int it4 = 0; it4 < MAILLAGE1->EFFECTIFS_TYPES[TETRA4]; it4++)
+    {
+      bool plus = false;
+      bool moins = false;
+      int *offset = MAILLAGE1->CNX[TETRA4] + 4 * it4;
+      for (int is = 0; is < 4; is++)
+        {
+          int ng = *(offset + is);
+          if (DNP[ng - 1] > 0.0)
+            plus = true;
+          else if (DNP[ng - 1] < 0.0)
+            moins = true;
+        }
+      if (plus && moins)
+        {
+          // Ce tetra est à cheval sur le plan de coupe: on calcule ses longueurs d'arêtes
+          LONGUEURS += longueurSegment(*(offset + 0), *(offset + 1));
+          cptLONGUEURS++;
+          LONGUEURS += longueurSegment(*(offset + 0), *(offset + 2));
+          cptLONGUEURS++;
+          LONGUEURS += longueurSegment(*(offset + 0), *(offset + 3));
+          cptLONGUEURS++;
+          LONGUEURS += longueurSegment(*(offset + 1), *(offset + 2));
+          cptLONGUEURS++;
+          LONGUEURS += longueurSegment(*(offset + 1), *(offset + 3));
+          cptLONGUEURS++;
+          LONGUEURS += longueurSegment(*(offset + 2), *(offset + 3));
+          cptLONGUEURS++;
+        }
+    }
+
+  // Aucun TETRA4 intercepté par le plan de coupe : on rend MAILLAGE1
+  if (cptLONGUEURS == 0)
+    {
+      cout
+          << "WARNING : le plan de coupe n'intersecte aucun élément TETRA4, le maillage initial ne sera donc pas modifié"
+          << endl;
+      MAILLAGE1->ID = str_id_maillagenew;
+      MAILLAGE1->outputMED(ficMEDout);
+      cout << chrono() << " - Terminé" << endl << endl;
+      exit(0);
+    }
+  // A partir de cet instant le maillage contient forcément des TETRA4 intersectant le plan de coupe
+
+
+  float longueurMoyenne = LONGUEURS / cptLONGUEURS;
+  epsilon = tolerance * longueurMoyenne;
+
+  int nT4coupe = cptLONGUEURS / 6;
+  cout << chrono() << " - Fin du calcul de la longueur moyenne des arêtes TETRA4 au voisinage du plan de coupe" << endl;
+
+  cout << "Nombre de TETRA4 impliqués dans la coupe = " << nT4coupe << endl;
+  cout << "Longueur moyenne = " << longueurMoyenne << endl;
+  cout << "Tolérance = " << tolerance << endl;
+  cout << "Epsilon = " << epsilon << endl;
+
+  // Détermination des positions de noeuds par rapport au plan de coupe - POSN
+  POSN = (int*) malloc(sizeof(int) * MAILLAGE1->nombreNoeudsMaillage);
+  for (int k = 0; k < MAILLAGE1->nombreNoeudsMaillage; k++)
+    {
+      if (DNP[k] > epsilon)
+        POSN[k] = 1;
+      else if (DNP[k] < -epsilon)
+        POSN[k] = -1;
+      else
+        POSN[k] = 0;
+    }
+  cout << chrono() << " - Fin du positionnement des points par rapport au plan de coupe" << endl;
+  cout << "Début de la boucle sur les TETRA4" << endl;
+
+  for (int it4 = 0; it4 < MAILLAGE1->EFFECTIFS_TYPES[TETRA4]; it4++)
+    {
+
+      for (int is = 0; is < 4; is++)
+        {
+          int ng = *(MAILLAGE1->CNX[TETRA4] + 4 * it4 + is);
+          NG[is] = ng;
+          S[is] = *(POSN + ng - 1);
+        }
+
+      // -------------------------------------------------------------------
+
+      if (S[0] == -1 && S[1] == -1 && S[2] == -1 && S[3] == -1)
+        GMmoins[TETRA4].push_back(it4);
+
+      else if (S[0] == -1 && S[1] == -1 && S[2] == -1 && S[3] == 0)
+        GMmoins[TETRA4].push_back(it4);
+
+      else if (S[0] == -1 && S[1] == -1 && S[2] == -1 && S[3] == 1)
+        { // Cas 3 - Arêtes 2 4 5
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = -1;
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas3(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == -1 && S[1] == -1 && S[2] == 0 && S[3] == -1)
+        GMmoins[TETRA4].push_back(it4);
+
+      else if (S[0] == -1 && S[1] == -1 && S[2] == 0 && S[3] == 0)
+        GMmoins[TETRA4].push_back(it4);
+
+      else if (S[0] == -1 && S[1] == -1 && S[2] == 0 && S[3] == 1)
+        { // Cas 2, arêtes 2 4
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = -1;
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == -1 && S[1] == -1 && S[2] == 1 && S[3] == -1)
+        { // Cas 3, arêtes 1 3 5
+          V[0] = -1;
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = -1;
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = -1;
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas3(V, it4);
+        }
+
+      else if (S[0] == -1 && S[1] == -1 && S[2] == 1 && S[3] == 0)
+        { // Cas 2, arêtes 1 3
+          V[0] = -1;
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = -1;
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = -1;
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      else if (S[0] == -1 && S[1] == -1 && S[2] == 1 && S[3] == 1)
+        { // Cas 4, arêtes 1 2 3 4
+          V[0] = -1;
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = -1;
+          cas4(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == -1 && S[1] == 0 && S[2] == -1 && S[3] == -1)
+        GMmoins[TETRA4].push_back(it4);
+
+      else if (S[0] == -1 && S[1] == 0 && S[2] == -1 && S[3] == 0)
+        GMmoins[TETRA4].push_back(it4);
+
+      else if (S[0] == -1 && S[1] == 0 && S[2] == -1 && S[3] == 1)
+        { // Cas 2, arêtes 2 5
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas2(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == -1 && S[1] == 0 && S[2] == 0 && S[3] == -1)
+        GMmoins[TETRA4].push_back(it4);
+
+      else if (S[0] == -1 && S[1] == 0 && S[2] == 0 && S[3] == 0)
+        GMmoins[TETRA4].push_back(it4);
+
+      else if (S[0] == -1 && S[1] == 0 && S[2] == 0 && S[3] == 1)
+        { // Cas 1, arête 2
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = -1;
+          cas1(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == -1 && S[1] == 0 && S[2] == 1 && S[3] == -1)
+        { // Cas 2, arêtes 1 5
+          V[0] = -1;
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas2(V, it4);
+        }
+
+      else if (S[0] == -1 && S[1] == 0 && S[2] == 1 && S[3] == 0)
+        { // Cas 1, arête 1
+          V[0] = -1;
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = -1;
+          cas1(V, it4);
+        }
+
+      else if (S[0] == -1 && S[1] == 0 && S[2] == 1 && S[3] == 1)
+        { // Cas 2, arêtes 1 2
+          V[0] = -1;
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == -1 && S[1] == 1 && S[2] == -1 && S[3] == -1)
+        { // Cas 3, arêtes 0 3 4
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = -1;
+          cas3(V, it4);
+        }
+
+      else if (S[0] == -1 && S[1] == 1 && S[2] == -1 && S[3] == 0)
+        { // Cas 2, arêtes 0 3
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = -1;
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      else if (S[0] == -1 && S[1] == 1 && S[2] == -1 && S[3] == 1)
+        { // Cas 4, arêtes 0 2 3 5
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = -1;
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = -1;
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas4(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == -1 && S[1] == 1 && S[2] == 0 && S[3] == -1)
+        { // Cas 2, arêtes 0 4
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      else if (S[0] == -1 && S[1] == 1 && S[2] == 0 && S[3] == 0)
+        { // Cas 1, arête 0
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = -1;
+          cas1(V, it4);
+        }
+
+      else if (S[0] == -1 && S[1] == 1 && S[2] == 0 && S[3] == 1)
+        { // Cas 2, arêtes 0 2
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = -1;
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == -1 && S[1] == 1 && S[2] == 1 && S[3] == -1)
+        { // Cas 4, arêtes 0 1 4 5
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas4(V, it4);
+        }
+
+      else if (S[0] == -1 && S[1] == 1 && S[2] == 1 && S[3] == 0)
+        { // Cas 2, arêtes 0 1
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      else if (S[0] == -1 && S[1] == 1 && S[2] == 1 && S[3] == 1)
+        { // Cas 3, arêtes 0 1 2
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = -1;
+          cas3(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 0 && S[1] == -1 && S[2] == -1 && S[3] == -1)
+        GMmoins[TETRA4].push_back(it4);
+
+      else if (S[0] == 0 && S[1] == -1 && S[2] == -1 && S[3] == 0)
+        GMmoins[TETRA4].push_back(it4);
+
+      else if (S[0] == 0 && S[1] == -1 && S[2] == -1 && S[3] == 1)
+        { // Cas 2, arêtes 4 5
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas2(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 0 && S[1] == -1 && S[2] == 0 && S[3] == -1)
+        GMmoins[TETRA4].push_back(it4);
+
+      else if (S[0] == 0 && S[1] == -1 && S[2] == 0 && S[3] == 0)
+        GMmoins[TETRA4].push_back(it4);
+
+      else if (S[0] == 0 && S[1] == -1 && S[2] == 0 && S[3] == 1)
+        { // Cas 1, arête 4
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = -1;
+          cas1(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 0 && S[1] == -1 && S[2] == 1 && S[3] == -1)
+        { // Cas 2, arêtes 3 5
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = -1;
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas2(V, it4);
+        }
+
+      else if (S[0] == 0 && S[1] == -1 && S[2] == 1 && S[3] == 0)
+        { // Cas 1, arête 3
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = -1;
+          V[5] = -1;
+          cas1(V, it4);
+        }
+
+      else if (S[0] == 0 && S[1] == -1 && S[2] == 1 && S[3] == 1)
+        { // Cas 2, arêtes 3 4
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 0 && S[1] == 0 && S[2] == -1 && S[3] == -1)
+        GMmoins[TETRA4].push_back(it4);
+
+      else if (S[0] == 0 && S[1] == 0 && S[2] == -1 && S[3] == 0)
+        GMmoins[TETRA4].push_back(it4);
+
+      else if (S[0] == 0 && S[1] == 0 && S[2] == -1 && S[3] == 1)
+        { // Cas 1, arête 5
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas1(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 0 && S[1] == 0 && S[2] == 0 && S[3] == -1)
+        GMmoins[TETRA4].push_back(it4);
+
+      else if (S[0] == 0 && S[1] == 0 && S[2] == 0 && S[3] == 0)
+        {
+          cout << "WARNING : TETRA4 numéro " << it4
+              << " entièrement inclus dans la zone de tolérance autour du plan de coupe" << endl;
+          cout << "   --> affecté au groupe " << str_id_GMmoins << endl;
+          GMmoins[TETRA4].push_back(it4);
+        }
+
+      else if (S[0] == 0 && S[1] == 0 && S[2] == 0 && S[3] == 1)
+        GMplus[TETRA4].push_back(it4);
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 0 && S[1] == 0 && S[2] == 1 && S[3] == -1)
+        { // Cas 1, arête 5
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas1(V, it4);
+        }
+
+      else if (S[0] == 0 && S[1] == 0 && S[2] == 1 && S[3] == 0)
+        GMplus[TETRA4].push_back(it4);
+
+      else if (S[0] == 0 && S[1] == 0 && S[2] == 1 && S[3] == 1)
+        GMplus[TETRA4].push_back(it4);
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 0 && S[1] == 1 && S[2] == -1 && S[3] == -1)
+        { // Cas 2, arêtes 3 4
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      else if (S[0] == 0 && S[1] == 1 && S[2] == -1 && S[3] == 0)
+        { // Cas 1, arête 3
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = -1;
+          V[5] = -1;
+          cas1(V, it4);
+        }
+
+      else if (S[0] == 0 && S[1] == 1 && S[2] == -1 && S[3] == 1)
+        { // Cas 2, arêtes 3 5
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = -1;
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas2(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 0 && S[1] == 1 && S[2] == 0 && S[3] == -1)
+        { // Cas 1, arête 4
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = -1;
+          cas1(V, it4);
+        }
+
+      else if (S[0] == 0 && S[1] == 1 && S[2] == 0 && S[3] == 0)
+        GMplus[TETRA4].push_back(it4);
+
+      else if (S[0] == 0 && S[1] == 1 && S[2] == 0 && S[3] == 1)
+        GMplus[TETRA4].push_back(it4);
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 0 && S[1] == 1 && S[2] == 1 && S[3] == -1)
+        { // Cas 2, arêtes 4 5
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas2(V, it4);
+        }
+
+      else if (S[0] == 0 && S[1] == 1 && S[2] == 1 && S[3] == 0)
+        GMplus[TETRA4].push_back(it4);
+
+      else if (S[0] == 0 && S[1] == 1 && S[2] == 1 && S[3] == 1)
+        GMplus[TETRA4].push_back(it4);
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 1 && S[1] == -1 && S[2] == -1 && S[3] == -1)
+        { // Cas 3, arêtes 0 1 2
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = -1;
+          cas3(V, it4);
+        }
+
+      else if (S[0] == 1 && S[1] == -1 && S[2] == -1 && S[3] == 0)
+        { // Cas 2, arêtes 0 1
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      else if (S[0] == 1 && S[1] == -1 && S[2] == -1 && S[3] == 1)
+        { // Cas 4, arêtes 0 1 4 5
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas4(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 1 && S[1] == -1 && S[2] == 0 && S[3] == -1)
+        { // Cas 2, arêtes 0 2
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = -1;
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      else if (S[0] == 1 && S[1] == -1 && S[2] == 0 && S[3] == 0)
+        { // Cas 1, arête 0
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = -1;
+          cas1(V, it4);
+        }
+
+      else if (S[0] == 1 && S[1] == -1 && S[2] == 0 && S[3] == 1)
+        { // Cas 2, arêtes 0 4
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 1 && S[1] == -1 && S[2] == 1 && S[3] == -1)
+        { // Cas 4, arêtes 0 2 3 5
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = -1;
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = -1;
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas4(V, it4);
+        }
+
+      else if (S[0] == 1 && S[1] == -1 && S[2] == 1 && S[3] == 0)
+        { // Cas 2, arêtes 0 3
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = -1;
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      else if (S[0] == 1 && S[1] == -1 && S[2] == 1 && S[3] == 1)
+        { // Cas 3, arêtes 0 3 4
+          V[0] = intersectionSegmentPlan(it4, 0);
+          V[1] = -1;
+          V[2] = -1;
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = -1;
+          cas3(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 1 && S[1] == 0 && S[2] == -1 && S[3] == -1)
+        { // Cas 2, arêtes 1 2
+          V[0] = -1;
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      else if (S[0] == 1 && S[1] == 0 && S[2] == -1 && S[3] == 0)
+        { // Cas 1, arête 1
+          V[0] = -1;
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = -1;
+          cas1(V, it4);
+        }
+
+      else if (S[0] == 1 && S[1] == 0 && S[2] == -1 && S[3] == 1)
+        { // Cas 2, arêtes 1 5
+          V[0] = -1;
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = -1;
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas2(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 1 && S[1] == 0 && S[2] == 0 && S[3] == -1)
+        { // Cas 1, arête 2
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = -1;
+          cas1(V, it4);
+        }
+
+      else if (S[0] == 1 && S[1] == 0 && S[2] == 0 && S[3] == 0)
+        GMplus[TETRA4].push_back(it4);
+
+      else if (S[0] == 1 && S[1] == 0 && S[2] == 0 && S[3] == 1)
+        GMplus[TETRA4].push_back(it4);
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 1 && S[1] == 0 && S[2] == 1 && S[3] == -1)
+        { // Cas 2, arêtes 2 5
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = -1;
+          V[4] = -1;
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas2(V, it4);
+        }
+
+      else if (S[0] == 1 && S[1] == 0 && S[2] == 1 && S[3] == 0)
+        GMplus[TETRA4].push_back(it4);
+
+      else if (S[0] == 1 && S[1] == 0 && S[2] == 1 && S[3] == 1)
+        GMplus[TETRA4].push_back(it4);
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 1 && S[1] == 1 && S[2] == -1 && S[3] == -1)
+        { // Cas 4, arêtes 1 2 3 4
+          V[0] = -1;
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = -1;
+          cas4(V, it4);
+        }
+
+      else if (S[0] == 1 && S[1] == 1 && S[2] == -1 && S[3] == 0)
+        { // Cas 2, arêtes 1 3
+          V[0] = -1;
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = -1;
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = -1;
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      else if (S[0] == 1 && S[1] == 1 && S[2] == -1 && S[3] == 1)
+        { // Cas 3, arêtes 1 3 5
+          V[0] = -1;
+          V[1] = intersectionSegmentPlan(it4, 1);
+          V[2] = -1;
+          V[3] = intersectionSegmentPlan(it4, 3);
+          V[4] = -1;
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas3(V, it4);
+        }
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 1 && S[1] == 1 && S[2] == 0 && S[3] == -1)
+        { // Cas 2, arêtes 2 4
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = -1;
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = -1;
+          cas2(V, it4);
+        }
+
+      else if (S[0] == 1 && S[1] == 1 && S[2] == 0 && S[3] == 0)
+        GMplus[TETRA4].push_back(it4);
+
+      else if (S[0] == 1 && S[1] == 1 && S[2] == 0 && S[3] == 1)
+        GMplus[TETRA4].push_back(it4);
+
+      // -------------------------------------------------------------------
+
+      else if (S[0] == 1 && S[1] == 1 && S[2] == 1 && S[3] == -1)
+        { // Cas 3, arêtes 2 4 5
+          V[0] = -1;
+          V[1] = -1;
+          V[2] = intersectionSegmentPlan(it4, 2);
+          V[3] = -1;
+          V[4] = intersectionSegmentPlan(it4, 4);
+          V[5] = intersectionSegmentPlan(it4, 5);
+          cas3(V, it4);
+        }
+
+      else if (S[0] == 1 && S[1] == 1 && S[2] == 1 && S[3] == 0)
+        GMplus[TETRA4].push_back(it4);
+
+      else if (S[0] == 1 && S[1] == 1 && S[2] == 1 && S[3] == 1)
+        GMplus[TETRA4].push_back(it4);
+
+      else
+        ERREUR("Cas non prévu");
+
+    }
+  cout << chrono() << " - Fin de la boucle sur les TETRA4" << endl;
+
+  // cout << "indexNouveauxNoeuds = " << indexNouveauxNoeuds << endl;
+  newXX.resize(indexNouveauxNoeuds - MAILLAGE1->nombreNoeudsMaillage);
+  newYY.resize(indexNouveauxNoeuds - MAILLAGE1->nombreNoeudsMaillage);
+  newZZ.resize(indexNouveauxNoeuds - MAILLAGE1->nombreNoeudsMaillage);
+
+  if (cptNouvellesMailles[TETRA4])
+    newCNX[TETRA4].resize(4 * cptNouvellesMailles[TETRA4]);
+  if (cptNouvellesMailles[PYRAM5])
+    newCNX[PYRAM5].resize(5 * cptNouvellesMailles[PYRAM5]);
+  if (cptNouvellesMailles[PENTA6])
+    newCNX[PENTA6].resize(6 * cptNouvellesMailles[PENTA6]);
+
+  // =========================================================================================
+  //                          2. Constitution du maillage final
+  // =========================================================================================
+
+  cout << chrono() << " - Constitution du maillage final" << endl;
+
+  MAILLAGE2 = new Maillage(str_id_maillagenew);
+  MAILLAGE2->dimensionMaillage = MAILLAGE1->dimensionMaillage;
+  MAILLAGE2->dimensionEspace = MAILLAGE1->dimensionEspace;
+  strcpy(MAILLAGE2->axisname, MAILLAGE1->axisname);
+  strcpy(MAILLAGE2->unitname, MAILLAGE1->unitname);
+  MAILLAGE2->nombreNoeudsMaillage = indexNouveauxNoeuds;
+  MAILLAGE2->nombreMaillesMaillage = MAILLAGE1->nombreMaillesMaillage + cptNouvellesMailles[TETRA4]
+      + cptNouvellesMailles[PYRAM5] + cptNouvellesMailles[PENTA6];
+
+  // ---------- Coordonnées
+  // Optimisation de la mémoire au détriment du temps
+
+  // Héritage des coordonnées MAILLAGE1
+  MAILLAGE2->XX = (float*) malloc(sizeof(float) * MAILLAGE2->nombreNoeudsMaillage);
+  for (int i = 0; i < MAILLAGE1->nombreNoeudsMaillage; i++)
+    *(MAILLAGE2->XX + i) = *(MAILLAGE1->XX + i);
+  free(MAILLAGE1->XX);
+  MAILLAGE2->YY = (float*) malloc(sizeof(float) * MAILLAGE2->nombreNoeudsMaillage);
+  for (int i = 0; i < MAILLAGE1->nombreNoeudsMaillage; i++)
+    *(MAILLAGE2->YY + i) = *(MAILLAGE1->YY + i);
+  free(MAILLAGE1->YY);
+  MAILLAGE2->ZZ = (float*) malloc(sizeof(float) * MAILLAGE2->nombreNoeudsMaillage);
+  for (int i = 0; i < MAILLAGE1->nombreNoeudsMaillage; i++)
+    *(MAILLAGE2->ZZ + i) = *(MAILLAGE1->ZZ + i);
+  free(MAILLAGE1->ZZ);
+
+  // Coordonnées des noeuds créés
+  for (int i = 0; i < MAILLAGE2->nombreNoeudsMaillage - MAILLAGE1->nombreNoeudsMaillage; i++)
+    {
+      *(MAILLAGE2->XX + MAILLAGE1->nombreNoeudsMaillage + i) = newXX[i];
+      *(MAILLAGE2->YY + MAILLAGE1->nombreNoeudsMaillage + i) = newYY[i];
+      *(MAILLAGE2->ZZ + MAILLAGE1->nombreNoeudsMaillage + i) = newZZ[i];
+      // cout << "Nouveaux noeuds, indice " << i << " : " << newXX[i] << " " << newYY[i] << " " << newZZ[i] << " " << endl;
+    }
+
+  // Legacy mailles maillage 1 +
+  for (int itm = (int) POI1; itm <= (int) HEXA20; itm++)
+    {
+      TYPE_MAILLE tm = (TYPE_MAILLE) itm;
+      if (tm != TETRA4 && tm != PYRAM5 && tm != PENTA6)
+        {
+          // Pour les types autres que TETRA4 PYRAM5 PENTA6 on fait seulement pointer CNX2 vers CNX1
+          if (MAILLAGE1->EFFECTIFS_TYPES[tm])
+            MAILLAGE2->CNX[tm] = MAILLAGE1->CNX[tm];
+          MAILLAGE2->EFFECTIFS_TYPES[tm] = MAILLAGE1->EFFECTIFS_TYPES[tm];
+        }
+      else
+        {
+          // Pour les types TETRA4 PYRAM5 PENTA6 on recopie CNX1 et on ajoute à la suite les newCNX
+          // cout << "Legacy " << tm << " effectif " << MAILLAGE1->EFFECTIFS_TYPES[tm] << endl;
+          int tailleType = Nnoeuds(tm);
+
+          MAILLAGE2->CNX[tm] = (int*) malloc(sizeof(int) * tailleType * (MAILLAGE1->EFFECTIFS_TYPES[tm]
+              + cptNouvellesMailles[tm]));
+          for (int i = 0; i < MAILLAGE1->EFFECTIFS_TYPES[tm]; i++)
+            for (int j = 0; j < tailleType; j++)
+              *(MAILLAGE2->CNX[tm] + tailleType * i + j) = *(MAILLAGE1->CNX[tm] + tailleType * i + j);
+
+          for (int i = 0; i < cptNouvellesMailles[tm]; i++)
+            for (int j = 0; j < tailleType; j++)
+              *(MAILLAGE2->CNX[tm] + tailleType * (MAILLAGE1->EFFECTIFS_TYPES[tm] + i) + j) = newCNX[tm][i * tailleType
+                  + j];
+
+          MAILLAGE2->EFFECTIFS_TYPES[tm] = MAILLAGE1->EFFECTIFS_TYPES[tm] + cptNouvellesMailles[tm];
+        }
+    }
+
+  // Restit CNX
+
+  //   cout << "Maillage 2 - CNX TETRA4 : " << endl;
+  //  ;
+  //  for (int i = 0; i < MAILLAGE2->EFFECTIFS_TYPES[TETRA4]; i++)
+  //    {
+  //      cout << "Maille " << i << " : ";
+  //      for (int j = 0; j < 4; j++)
+  //        cout << MAILLAGE2->CNX[TETRA4][i * 4 + j] << " ";
+  //      cout << endl;
+  //    }
+  //  cout << endl;
+  //  cout << "Maillage 2 - CNX PENTA6 : " << endl;
+  //  ;
+  //  for (int i = 0; i < MAILLAGE2->EFFECTIFS_TYPES[PENTA6]; i++)
+  //    {
+  //      cout << "Maille " << i << " : ";
+  //      for (int j = 0; j < 6; j++)
+  //        cout << MAILLAGE2->CNX[PENTA6][i * 6 + j] << " ";
+  //      cout << endl;
+  //    }
+  //  cout << endl;
+
+  // Groupes de mailles
+  MAILLAGE2->GM = MAILLAGE1->GM;
+  MAILLAGE2->GM[str_id_GMplus] = GMplus;
+  MAILLAGE2->GM[str_id_GMmoins] = GMmoins;
+
+  MAILLAGE2->GN = MAILLAGE1->GN;
+
+  cout << chrono() << " - Ecriture du fichier MED" << endl;
+
+  MAILLAGE2->outputMED(ficMEDout);
+  cout << chrono() << " - Terminé" << endl << endl;
+
+  return 0;
+
+}
diff --git a/src/Tools/MeshCut/MeshCut_Fonctions.cxx b/src/Tools/MeshCut/MeshCut_Fonctions.cxx
new file mode 100644 (file)
index 0000000..2ecbe06
--- /dev/null
@@ -0,0 +1,169 @@
+#include "MeshCut_Fonctions.hxx"
+#include "MeshCut_Globals.hxx"
+
+#include <iostream>
+#include <cmath>
+
+using namespace MESHCUT;
+using namespace std;
+
+//=================================================================================================
+//                                    intersectionSegmentPlan
+//=================================================================================================
+
+float MESHCUT::longueurSegment(int ngA, int ngB)
+{
+  float A[3], B[3];
+  A[0] = MAILLAGE1->XX[ngA - 1];
+  A[1] = MAILLAGE1->YY[ngA - 1];
+  A[2] = MAILLAGE1->ZZ[ngA - 1];
+  B[0] = MAILLAGE1->XX[ngB - 1];
+  B[1] = MAILLAGE1->YY[ngB - 1];
+  B[2] = MAILLAGE1->ZZ[ngB - 1];
+  float dx = B[0] - A[0];
+  float dy = B[1] - A[1];
+  float dz = B[2] - A[2];
+  return sqrt(dx * dx + dy * dy + dz * dz);
+}
+
+float MESHCUT::distanceNoeudPlan(float point[3])
+{
+  return normale[0] * point[0] + normale[1] * point[1] + normale[2] * point[2] + d;
+}
+
+float MESHCUT::distanceNoeudPlan(int ng)
+{
+  float A[3];
+  A[0] = MAILLAGE1->XX[ng - 1];
+  A[1] = MAILLAGE1->YY[ng - 1];
+  A[2] = MAILLAGE1->ZZ[ng - 1];
+  return distanceNoeudPlan(A);
+}
+
+int MESHCUT::positionNoeudPlan(int indiceNoeud)
+{
+  if (distanceNoeudPlan(indiceNoeud + 1) > epsilon)
+    return 1;
+  else if (distanceNoeudPlan(indiceNoeud + 1) < -epsilon)
+    return -1;
+  else
+    return 0;
+}
+
+/*!
+ * Equation paramétrique de la droite AB:    OP = OA + lambda AB
+ *
+ * Fonction caractéristique du plan : PI(X,Y,Z) = nx X + ny Y + nz Z + d
+ *
+ * Pour un point P de la droite: PI(OP) = PI(OA) + lambda n.AB     avec n=(nx,ny,nz),
+ * L'intersection AB/plan est donnée par le point P tel que PI(OP)=0.
+ *
+ * Il lui correspond la coordonnée   lambda = - PI(OA) / n.AB.
+ *
+ * Cette intersection est dans le segment si lambda est dans [0,1]
+ */
+int MESHCUT::intersectionSegmentPlan(int it4, int na)
+{
+
+  int ngA, ngB; // Numéros des noeuds extrémités AB
+  float lambda, ps; //, ab; // ab = longueur AB
+  float A[3], B[3];
+
+  // Détermination des ng des extrémités de l'arête passée en argument na
+  int * offset = MAILLAGE1->CNX[TETRA4] + 4 * it4;
+  if (na == 0)
+    {
+      ngA = *(offset + 0);
+      ngB = *(offset + 1);
+    }
+  else if (na == 1)
+    {
+      ngA = *(offset + 0);
+      ngB = *(offset + 2);
+    }
+  else if (na == 2)
+    {
+      ngA = *(offset + 0);
+      ngB = *(offset + 3);
+    }
+  else if (na == 3)
+    {
+      ngA = *(offset + 1);
+      ngB = *(offset + 2);
+    }
+  else if (na == 4)
+    {
+      ngA = *(offset + 1);
+      ngB = *(offset + 3);
+    }
+  else if (na == 5)
+    {
+      ngA = *(offset + 2);
+      ngB = *(offset + 3);
+    }
+  else
+    ERREUR("Numéro d'arête supérieur à 6");
+
+  string cle1 = int2string(ngA) + (string) "_" + int2string(ngB);
+  string cle2 = int2string(ngB) + (string) "_" + int2string(ngA);
+
+  if (intersections[cle1])
+    return intersections[cle1];
+
+  else
+    {
+
+      A[0] = MAILLAGE1->XX[ngA - 1];
+      A[1] = MAILLAGE1->YY[ngA - 1];
+      A[2] = MAILLAGE1->ZZ[ngA - 1];
+      B[0] = MAILLAGE1->XX[ngB - 1];
+      B[1] = MAILLAGE1->YY[ngB - 1];
+      B[2] = MAILLAGE1->ZZ[ngB - 1];
+
+      //      // Longueur AB
+      //      float lx = B[0] - A[0], ly = B[1] - A[1], lz = B[2] - A[2];
+      //      ab = sqrt(lx * lx + ly * ly + lz * lz);
+      //      // La longueur maximale théorique est 2 epsilon
+      //      if (ab < 2 * epsilon * 0.9)
+      //        ERREUR("Arête de longueur inférieure au minimum théorique 2 epsilon");
+
+      // Calcul du produit scalaire AB.n
+      ps = 0.0;
+      for (int k = 0; k < 3; k++)
+        ps += (B[k] - A[k]) * normale[k];
+      // ps = ps / ab ;
+
+      if (debug)
+        {
+          cout << "Routine ISP : arête " << na << " -  ngA=" << ngA << " ngB=" << ngB << endl;
+          cout << "A : " << A[0] << ' ' << A[1] << ' ' << A[2] << endl;
+          cout << "B : " << B[0] << ' ' << B[1] << ' ' << B[2] << endl;
+          cout << "N : " << normale[0] << ' ' << normale[1] << ' ' << normale[2] << endl;
+        }
+
+      if (fabs(ps) == 0.0)
+        ERREUR("Erreur sur ps nul");
+
+      // PS non nul: l'intersection AB/plan existe
+
+      lambda = -distanceNoeudPlan(A) / ps;
+
+      float inter[3];
+      for (int k = 0; k < 3; k++)
+        inter[k] = A[k] + lambda * (B[k] - A[k]);
+      newXX.push_back(inter[0]);
+      newYY.push_back(inter[1]);
+      newZZ.push_back(inter[2]);
+      indexNouveauxNoeuds++;
+      intersections[cle1] = indexNouveauxNoeuds;
+      intersections[cle2] = indexNouveauxNoeuds;
+
+      //      cout << "création noeud " << indexNouveauxNoeuds << " : " << inter[0] << " " << inter[1] << " " << inter[2]
+      //          << endl;
+      if (debug)
+        cout << " sortie nouveau noeud, lambda = " << lambda << " , noeud = " << indexNouveauxNoeuds << endl;
+      return indexNouveauxNoeuds;
+
+    }
+}
+
diff --git a/src/Tools/MeshCut/MeshCut_Fonctions.hxx b/src/Tools/MeshCut/MeshCut_Fonctions.hxx
new file mode 100644 (file)
index 0000000..e446d1f
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef __MESHCUT_FONCTION_HXX__
+#define __MESHCUT_FONCTION_HXX__
+
+namespace MESHCUT
+  {
+    float longueurSegment(int ngA, int ngB);
+
+    float distanceNoeudPlan(float point[3]);
+
+    float distanceNoeudPlan(int ng);
+
+    int positionNoeudPlan(int indiceNoeud);
+
+    int intersectionSegmentPlan(int it4, int na);
+  }
+
+#endif
diff --git a/src/Tools/MeshCut/MeshCut_Globals.hxx b/src/Tools/MeshCut/MeshCut_Globals.hxx
new file mode 100644 (file)
index 0000000..b585159
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef __MESHCUT_GLOBALS_HXX__
+#define __MESHCUT_GLOBALS_HXX__
+
+#include "MeshCut_Maillage.hxx"
+
+#include <map>
+#include <string>
+#include <vector>
+
+namespace MESHCUT
+  {
+    /*! Table des points d'intersection calculés.
+     *  Si on a calculé une intersection entre le plan et un segment reliant N1 et N2
+     *  de numéros globaux n1 et n2, on stocke dans ce tableau, sous les libellés "n1_n2" et "n2_n1",
+     *  le numéro global du point d'intersection (noeud créé).
+     *  On évite ainsi de calculer deux fois l'intersection d'une même arête de T4 avec le plan
+     */
+    extern std::map<std::string, int> intersections;
+
+    extern int indexNouvellesMailles, indexNouveauxNoeuds, offsetMailles;
+    extern std::string str_id_GMplus, str_id_GMmoins;
+    extern Maillage *MAILLAGE1, *MAILLAGE2;
+
+    extern std::vector<float> newXX, newYY, newZZ;
+    extern std::map<TYPE_MAILLE, std::vector<int> > newCNX;
+    extern std::map<TYPE_MAILLE, int> cptNouvellesMailles;
+    extern std::map<TYPE_MAILLE, std::vector<int> > GMplus, GMmoins;
+
+    extern float *DNP; //!< Distance Noeud Plan
+    extern int *POSN; //!<  Version -1/0/+1 du précédent, selon epsilon
+
+    extern std::string str_id_maillagenew;
+
+    extern float normale[3], pointPlan[3]; //!<  Définition du plan de coupe
+    extern float d; //!<  coefficient constant de l'équation du plan de coupe
+    extern float epsilon; //!<  distance en dessous de laquelle un point est considéré comme appartenant au plan de coupe
+
+    extern bool debug;
+    extern int Naretes;
+  }
+
+#endif
diff --git a/src/Tools/MeshCut/MeshCut_Maillage.cxx b/src/Tools/MeshCut/MeshCut_Maillage.cxx
new file mode 100644 (file)
index 0000000..856378d
--- /dev/null
@@ -0,0 +1,1775 @@
+#include "MeshCut_Maillage.hxx"
+#include "MeshCut_Cube.hxx"
+
+#include <iostream>
+#include <sstream>
+#include <list>
+#include <algorithm>
+#include <cmath>
+#include <cstring>
+
+using namespace MESHCUT;
+using namespace std;
+
+Maillage::Maillage(std::string _ID)
+{
+  ID = _ID;
+  nombreNoeudsMaillage = 0;
+  nombreMaillesMaillage = 0;
+  //nPOI1=0; nSEG2=0; nSEG3=0; nTRIA3=0; nTRIA6=0; nQUAD4=0; nQUAD8=0; nTETRA4=0; nTETRA10=0; nPYRAM5=0; nPYRAM13=0; nPENTA6=0; nPENTA15=0; nHEXA8=0; nHEXA20=0;
+  GM.clear();
+  GN.clear();
+  for (int itm = (int) POI1; itm <= (int) HEXA20; itm++)
+    EFFECTIFS_TYPES[(TYPE_MAILLE) itm] = 0;
+}
+
+Maillage::~Maillage()
+{
+}
+
+void Maillage::creationGMtype(TYPE_MAILLE tm, std::string nomGMtype)
+{
+  //cout << "Creation GM type, groupe " << nomGMtype << endl;
+  for (int nl = 0; nl < EFFECTIFS_TYPES[tm]; nl++)
+    GM[nomGMtype][tm].push_back(nl);
+  GM[nomGMtype][tm].resize(EFFECTIFS_TYPES[tm]);
+  sort(GM[nomGMtype][tm].begin(), GM[nomGMtype][tm].end());
+}
+
+void Maillage::afficheMailles(TYPE_MAILLE tm)
+{
+  cout << "Affichage des mailles du type " << TM2string(tm) << " (effectif " << EFFECTIFS_TYPES[tm] << "): " << endl;
+  if (EFFECTIFS_TYPES[tm])
+    {
+      // Boucle sur les connectivités d'un type tm
+      int nnoeuds = Nnoeuds(tm);
+      for (int i = 0; i < EFFECTIFS_TYPES[tm]; i++)
+        {
+          cout << "\tMaille " << i << " :" << endl;
+          //Boucle sur les noeuds de la maille de numéro local i dans le type tm
+          int * offset = CNX[tm] + nnoeuds * i;
+          for (int j = 0; j < nnoeuds; j++)
+            {
+              int ngnoeud = *(offset + j);
+              //cout << "\t\t" << X[ngnoeud-1] << " " << Y[ngnoeud-1] << " " << Z[ngnoeud-1] << endl;
+              cout << "\t" << ngnoeud << "\t" << *(XX + ngnoeud - 1) << " " << *(YY + ngnoeud - 1) << " " << *(ZZ + ngnoeud - 1) << endl;
+            }
+        }
+      cout << endl;
+    }
+}
+
+void Maillage::listeMaillesType(TYPE_MAILLE tm)
+{
+  cout << "La fonction \"Restitution des mailles par type\" est obsolète " << endl;
+
+  //  cout << "Restitution des mailles du type " << TM2string(tm) << " (effectif " << EFFECTIFS_TYPES[tm] << "): " << endl;
+  //  if (EFFECTIFS_TYPES[tm])
+  //    for (int i = 0; i < IDS_MAILLES[tm].size(); i++)
+  //      cout << IDS_MAILLES[tm][i] << " ";
+  //  cout << endl;
+}
+
+void Maillage::listeMaillesTousTypes()
+{
+  for (int itm = (int) POI1; itm <= (int) HEXA20; itm++)
+    {
+      TYPE_MAILLE tm = (TYPE_MAILLE) itm;
+      listeMaillesType(tm);
+    }
+}
+
+void Maillage::listeMaillesParGM()
+{
+  cout << "Liste des mailles par GM : " << endl;
+  for (map<string, map<TYPE_MAILLE, vector<int> > >::iterator I = GM.begin(); I != GM.end(); I++)
+    listeMaillesGM(I->first);
+}
+
+void Maillage::listeMaillesGM(std::string nomGM)
+{
+  cout << "Liste des mailles du groupe " << nomGM << " : " << endl;
+  for (int itm = (int) POI1; itm <= (int) HEXA20; itm++)
+    {
+      TYPE_MAILLE tm = (TYPE_MAILLE) itm;
+      if (GM[nomGM][tm].size())
+        {
+          cout << "\t" << TM2string(tm) << " : ";
+          for (unsigned int j = 0; j < GM[nomGM][tm].size(); j++)
+            cout << GM[nomGM][tm][j] << " ";
+          cout << endl;
+        }
+    }
+}
+
+//void Maillage::listeMaillesGMordonne(std::string nomGM)
+//{
+//  cout << "Liste ordonnée des mailles du groupe " << nomGM << " (" << GM[nomGM].size() << " mailles) : ";
+//  sort(GM[nomGM].begin(), GM[nomGM].end());
+//  for (int j = 0; j < GM[nomGM].size(); j++)
+//    cout << GM[nomGM][j] << " ";
+//  cout << endl;
+//}
+
+void Maillage::listeNoeuds()
+{
+  cout << "Liste des noeuds du maillage : " << endl;
+  for (int i = 0; i < nombreNoeudsMaillage; i++)
+    cout << "\t" << *(XX + i) << " " << *(YY + i) << " " << *(ZZ + i) << endl;
+  cout << endl;
+}
+
+void Maillage::listeNoeudsGN(std::string nomGN)
+{
+  cout << "Liste brute des noeuds du groupe " << nomGN << " (" << GN[nomGN].size() << " noeuds) : ";
+  for (unsigned int j = 0; j < GN[nomGN].size(); j++)
+    cout << GN[nomGN][j] << " ";
+  cout << endl;
+}
+
+void Maillage::listeNoeudsGNordonne(std::string nomGN)
+{
+  cout << "Liste ordonnée des noeuds du groupe " << nomGN << " (" << GN[nomGN].size() << " noeuds) : ";
+  sort(GN[nomGN].begin(), GN[nomGN].end());
+  for (unsigned int j = 0; j < GN[nomGN].size(); j++)
+    cout << GN[nomGN][j] << " ";
+  cout << endl;
+}
+
+std::vector<float> Maillage::G(int i, TYPE_MAILLE tm)
+{
+  vector<float> G;
+  float x = 0.0;
+  float y = 0.0;
+  float z = 0.0;
+  int nn = NnoeudsGeom(tm);
+  for (int j = 0; j < nn; j++)
+    {
+      int ng = CNX[tm][nn * i + j];
+      x += XX[ng - 1];
+      y += YY[ng - 1];
+      z += ZZ[ng - 1];
+    }
+  G.push_back(x / nn);
+  G.push_back(y / nn);
+  G.push_back(z / nn);
+  G.resize(3);
+  return G;
+}
+
+float Maillage::distanceNoeudMaille(int ngnoeud, int imaille, TYPE_MAILLE tm)
+{
+  float x, y, z;
+  float x0 = XX[ngnoeud - 1];
+  float y0 = YY[ngnoeud - 1];
+  float z0 = ZZ[ngnoeud - 1];
+  int nn = NnoeudsGeom(tm);
+  float d1 = 1000000000000.0;
+  float d;
+  for (int j = 0; j < nn; j++)
+    {
+      int ng = CNX[tm][nn * imaille + j]; // Noeud courant dans la maille
+      x = XX[ng - 1];
+      y = YY[ng - 1];
+      z = ZZ[ng - 1];
+      d = sqrt((x - x0) * (x - x0) + (y - y0) * (y - y0) + (z - z0) * (z - z0));
+      if (d < d1)
+        d1 = d;
+    }
+  return d1;
+}
+
+/*!
+ *  Retourne le ng du noeud le plus proche de ngnoeud dans la maille imaille du type tm
+ */
+int Maillage::noeudVoisin(int ngnoeud, int imaille, TYPE_MAILLE tm)
+{
+  float x, y, z;
+  int ngv;
+  float x0 = XX[ngnoeud - 1];
+  float y0 = YY[ngnoeud - 1];
+  float z0 = ZZ[ngnoeud - 1];
+  int nn = NnoeudsGeom(tm);
+  float d1 = 1000000000000.0;
+  float d;
+  for (int j = 0; j < nn; j++)
+    {
+      int ng = CNX[tm][nn * imaille + j]; // Noeud courant dans la maille
+      x = XX[ng - 1];
+      y = YY[ng - 1];
+      z = ZZ[ng - 1];
+      d = sqrt((x - x0) * (x - x0) + (y - y0) * (y - y0) + (z - z0) * (z - z0));
+      if (d < d1)
+        {
+          d1 = d;
+          ngv = ng;
+        }
+    }
+  return ngv;
+}
+
+float Maillage::distanceNoeudNoeud(int ng1, int ng2)
+{
+  float x1, x2, y1, y2, z1, z2;
+  x1 = XX[ng1 - 1];
+  y1 = YY[ng1 - 1];
+  z1 = ZZ[ng1 - 1];
+  x2 = XX[ng2 - 1];
+  y2 = YY[ng2 - 1];
+  z2 = ZZ[ng2 - 1];
+  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2));
+}
+
+//void Maillage::encombrements()
+//{
+//  float ex = 0.0;
+//  float ey = 0.0;
+//  float ez = 0.0;
+//
+//  for (int itm = (int) SEG2; itm <= (int) HEXA20; itm++)
+//    {
+//      TYPE_MAILLE tm = (TYPE_MAILLE) itm;
+//      if (MAILLAGE->EFFECTIFS_TYPES[tm])
+//        {
+//          int nnoeuds = Nnoeuds(tm);
+//          for (int i = 0; i < CON[tm].size() / nnoeuds; i++)
+//            {
+//              //Boucle sur les noeuds de la maille de numéro local i dans le type tm
+//              for (int j = 0; j < nnoeuds; j++)
+//                {
+//                  //..... CON[tm][nnoeuds*i+j];
+//                }
+//            }
+//        }
+//    }
+//  // Boucle sur les connectivités d'un type tm
+//}
+
+void Maillage::inputMED(std::string fichierMED)
+{
+  //cout << endl << "Début procédure inputMED, fichier "<< fichierMED << endl;
+
+  //  int i, j, k, ichamp, igauss, ipt, ival;
+  int j;
+  //  med_err ret = 0; // Code retour
+  med_idt fid; // Descripteur de fichier MED
+  char maa[MED_NAME_SIZE + 1]; // nom du maillage de longueur maxi MED_NAME_SIZE
+  med_int spacedim;
+  med_int mdim; // Dimension du maillage
+  med_mesh_type type;
+  char desc[MED_COMMENT_SIZE + 1]; // Description du maillage
+
+  // Profils
+  //  med_int nprofils;
+  //  int iprofil;
+  //  char nomprofil[MED_NAME_SIZE + 1] = "";
+  //  med_int nvalprofil, nvalprofil2;
+  //  med_int *pflval;
+
+  // Champs
+  //  med_int nChamps, nCompChamp, nval;
+  //  char *compChamp, *unitChamp, *nomChamp;
+  //char nomChamp [ MED_NAME_SIZE+1 ] = "";
+  //  med_field_type typeChamp;
+  //  med_int nGauss, ngpdt, numdt, numo;
+  med_int nPasTemps;
+  //  char locname[MED_NAME_SIZE + 1] = "";
+  //  med_geometry_type type_geo;
+  //  med_int ngauss;
+  char dtunit[MED_SNAME_SIZE + 1] = "";
+  //  med_float dt = 0.0;
+  //  med_bool local;
+  //  med_int nbrefmaa;
+
+  med_sorting_type sortingtype;
+  med_axis_type axistype;
+
+  // Initialisations
+  FAMILLES.clear();
+  FAM_TYPES.clear();
+  FAMILLES_NOEUDS.clear();
+  GROUPES_MAILLES.clear();
+  GROUPES_NOEUDS.clear();
+  RESIDU.clear(); // Sera initialisé à 1 par la routine acquisitionTYPE_inputMED
+  tailleFAMILLES.clear();
+  tailleGROUPES.clear();
+
+  // Ouverture du fichier MED en lecture seule
+  fid = MEDfileOpen(string2char(fichierMED), MED_ACC_RDONLY);
+  if (fid < 0)
+    {
+      ERREUR("Erreur a l'ouverture du fichier\n");
+    }
+  //cout << chrono() << " --- inputMED: MEDfileOpen: ouverture du maillage en lecture seule, OK" << endl;
+
+  // Lecture des infos concernant le premier maillage
+  if (MEDmeshInfo(fid, 1, maa, &spacedim, &mdim, &type, desc, dtunit, &sortingtype, &nPasTemps, &axistype, axisname,
+                  unitname) < 0)
+    ERREUR("Erreur a la lecture des informations sur le maillage ");
+  //cout << chrono() << " --- inputMED: MEDmeshInfo: OK" << endl;
+
+  cerr << "maa=" << maa << endl;
+  cerr << "spacedim=" << spacedim << endl;
+  cerr << "mdim=" << mdim << endl;
+  cerr << "type=" << type << endl;
+  cerr << "desc=" << desc << endl;
+  cerr << "dtunit=" << dtunit << endl;
+  cerr << "sortingtype=" << sortingtype << endl;
+  cerr << "nPasTemps=" << nPasTemps << endl;
+  cerr << "axistype=" << axistype << endl;
+  cerr << "axisname=" << axisname << endl;
+  cerr << "unitname=" << unitname << endl;
+
+  dimensionMaillage = mdim;
+  dimensionEspace = spacedim;
+
+  ID = (string) maa;
+
+  //  nGauss = MEDnGauss(fid);
+  //  if (debug > 0)
+  //    cout << "Nombre d'éléments portant des points de Gauss: " << (int) nGauss << endl;
+  //  map<string, int> REFGAUSS;
+  //  map<string, int>::iterator iterGAUSS;
+  //  for (igauss = 1; igauss <= nGauss; igauss++)
+  //    {
+  //      if (MEDgaussInfo(fid, igauss, locname, &type_geo, &ngauss) < 0)
+  //        ERREUR("Erreur MEDgaussInfo");
+  //      if (debug == 2)
+  //        {
+  //          cout << endl << "  Retour MEDgaussInfo, localisation gauss n°" << igauss << " : " << endl;
+  //          cout << "    locname  = " << locname << endl;
+  //          cout << "    type_geo = " << type_geo << endl;
+  //          cout << "    ngauss   = " << ngauss << endl;
+  //          cout << endl;
+  //        }
+  //      REFGAUSS[(string) locname] = (int) ngauss;
+  //    }
+  //
+  //  if (debug == 2)
+  //    {
+  //      cout << endl << "Restitution de la table REFGAUSS:" << endl;
+  //      for (iterGAUSS = REFGAUSS.begin(); iterGAUSS != REFGAUSS.end(); iterGAUSS++)
+  //        {
+  //          cout << iterGAUSS->first << " : " << iterGAUSS->second << endl;
+  //        }
+  //    }
+  //
+  //  nprofils = MEDnProfil(fid);
+  //  if (debug)
+  //    cout << endl << endl << "Nombre de profils: " << nprofils << endl;
+  //  for (iprofil = 1; iprofil <= nprofils; iprofil++)
+  //    {
+  //      if (MEDprofilInfo(fid, iprofil, nomprofil, &nvalprofil) < 0)
+  //        ERREUR("ERREUR MEDprofilInfo");
+  //      nvalprofil2 = MEDnValProfil(fid, nomprofil);
+  //      if (debug == 2)
+  //        {
+  //          cout << "Profil " << iprofil << " : " << endl;
+  //          cout << "    Nom profil : " << nomprofil << endl;
+  //          cout << "    Nombre de valeurs profil (par MEDprofilInfo) : " << nvalprofil << endl;
+  //          cout << "    Nombre de valeurs profil (par MEDnValProfil) : " << nvalprofil2 << endl;
+  //        }
+  //      if (nvalprofil != nvalprofil2)
+  //        ERREUR("Discordance nvalprofil (entre MEDprofilInfo et MEDnValProfil)");
+  //      pflval = (med_int*) malloc(sizeof(med_int) * nvalprofil);
+  //      if (MEDprofilLire(fid, pflval, nomprofil) < 0)
+  //        ERREUR("ERREUR MEDprofilLire");
+  //      //cout << "    Affichage des 100 premières valeurs:" << endl;
+  //      //for (ival=0;ival<min(100,nvalprofil);ival++) cout << " " << *(pflval+ival) ;
+  //      free(pflval);
+  //    }
+  //
+  //  nChamps = MEDnChamp(fid, 0);
+  //  cout << "Nombre de champs : " << (int) nChamps << endl;
+  //
+  //  if (nChamps > 0)
+  //    {
+  //
+  //      for (ichamp = 1; ichamp <= nChamps; ichamp++)
+  //        {
+  //          //for (ichamp=4; ichamp<=4; ichamp++ ) {
+  //          cout << endl << endl;
+  //          cout << endl << endl << " ====================================================================" << endl;
+  //          cout << endl << endl << "                             CHAMP " << ichamp << endl;
+  //          cout << endl << endl << " ====================================================================" << endl;
+  //          cout << endl << endl;
+  //
+  //          nCompChamp = MEDnChamp(fid, ichamp);
+  //          if (nCompChamp < 0)
+  //            ERREUR("Erreur Ncomposantes champ");
+  //          cout << "Nombre de composantes du champ " << ichamp << " : " << (int) nCompChamp << endl;
+  //
+  //          nomChamp = (char*) malloc(MED_NAME_SIZE + 1);
+  //          compChamp = (char*) malloc(nCompChamp * MED_SNAME_SIZE + 1);
+  //          unitChamp = (char*) malloc(nCompChamp * MED_SNAME_SIZE + 1);
+  //
+  //          if (MEDchampInfo(fid, ichamp, nomChamp, &typeChamp, compChamp, unitChamp, nCompChamp) < 0)
+  //            ERREUR("Erreur MEDchampInfo");
+  //
+  //          cout << "Infos sur le champ " << ichamp << " : " << endl;
+  //          cout << "  Nom:  " << (string) nomChamp << endl;
+  //          cout << "  Type:  " << typeChamp << endl;
+  //          cout << "  Noms des composantes:  " << (string) compChamp << endl;
+  //          cout << "  Unités des composantes:  " << (string) unitChamp << endl;
+  //
+  //          infoChamps((string) "NOEUDS", MED_NODE, MED_NONE, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //          infoChamps((string) "POI1", MED_CELL, MED_POINT1, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //          infoChamps((string) "SEG2", MED_CELL, MED_SEG2, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //          infoChamps((string) "SEG3", MED_CELL, MED_SEG3, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //          infoChamps((string) "TRIA3", MED_CELL, MED_TRIA3, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //          infoChamps((string) "TRIA6", MED_CELL, MED_TRIA6, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //          infoChamps((string) "QUAD4", MED_CELL, MED_QUAD4, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //          infoChamps((string) "QUAD8", MED_CELL, MED_QUAD8, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //          infoChamps((string) "TETRA4", MED_CELL, MED_TETRA4, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //          infoChamps((string) "TETRA10", MED_CELL, MED_TETRA10, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //          infoChamps((string) "PYRAM5", MED_CELL, MED_PYRA5, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //          infoChamps((string) "PYRAM13", MED_CELL, MED_PYRA13, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //          infoChamps((string) "PENTA6", MED_CELL, MED_PENTA6, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //          infoChamps((string) "PENTA15", MED_CELL, MED_PENTA15, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //          infoChamps((string) "HEXA8", MED_CELL, MED_HEXA8, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //          infoChamps((string) "HEXA20", MED_CELL, MED_HEXA20, fid, maa, nomChamp, typeChamp, nCompChamp, REFGAUSS);
+  //
+  //        }
+  //
+  //      cout << endl << "Rappel des codes de géométries: " << endl;
+  //      cout << " TETRA4 = " << MED_TETRA4 << endl;
+  //      cout << " PENTA6 = " << MED_PENTA6 << endl;
+  //      cout << " HEXA8 = " << MED_HEXA8 << endl;
+  //
+  //    }
+  //  else
+  //    cout << "Pas de champs dans ce maillage" << endl;
+
+  // ##################################################################################################
+  // ##################################################################################################
+  //
+  //                  A C Q U I S I T I O N     D E S     F A M I L L E S
+  //
+  // ##################################################################################################
+  // ##################################################################################################
+
+
+  med_int nFamilles;
+  char nomGroupeChar[MED_LNAME_SIZE + 1];
+  if ((nFamilles = MEDnFamily(fid, maa)) < 0)
+    ERREUR("ERREUR MEDnFamily");
+
+  // Initialisation des tailles:   tailleFAMILLES  et  tailleGROUPES
+
+  //   for (int i = 0; i < nFamilles; i++)
+  //    {
+  //      char nomfam[MED_NAME_SIZE + 1];
+  //      char *attdes, *gro;
+  //      med_int numfam, *attide, *attval, natt, ngro;
+  //
+  //      if ((ngro = MEDnFamilyGroup(fid, maa, i + 1)) < 0)
+  //        ERREUR("ERREUR MEDnFamilyGroup");
+  //      if ((natt = MEDnFamily23Attribute(fid, maa, i + 1)) < 0)
+  //        ERREUR("ERREUR MEDnFamily23Attribute");
+  //
+  //      attide = (med_int *) malloc(sizeof(med_int) * natt);
+  //      attval = (med_int *) malloc(sizeof(med_int) * natt);
+  //      attdes = (char *) malloc(MED_COMMENT_SIZE * natt + 1);
+  //      gro = (char *) malloc(MED_LNAME_SIZE * ngro + 1);
+  //
+  //      if (MEDfamilyInfo(fid, maa, (med_int)(i + 1), nomfam, &numfam, attide, attval, attdes, &natt, gro, &ngro) < 0)
+  //        ERREUR("ERREUR MEDfamilyInfo");
+  //
+  //      free(attide);
+  //      free(attval);
+  //      free(attdes);
+  //      free(gro);
+  //    }
+
+  for (int i = 0; i < nFamilles; i++)
+    {
+      char nomfam[MED_NAME_SIZE + 1];
+      char *attdes, *gro;
+      med_int numfam, *attide, *attval, natt, ngro;
+
+      if ((ngro = MEDnFamilyGroup(fid, maa, i + 1)) < 0)
+        ERREUR("ERREUR MEDnFamilyGroup");
+      if ((natt = MEDnFamily23Attribute(fid, maa, i + 1)) < 0)
+        ERREUR("ERREUR MEDnFamily23Attribute");
+
+      attide = (med_int *) malloc(sizeof(med_int) * natt);
+      attval = (med_int *) malloc(sizeof(med_int) * natt);
+      attdes = (char *) malloc(MED_COMMENT_SIZE * natt + 1);
+      gro = (char *) malloc(MED_LNAME_SIZE * ngro + 1);
+
+      if (MEDfamilyInfo(fid, maa, (med_int) (i + 1), nomfam, &numfam, gro) < 0)
+        ERREUR("ERREUR MEDfamilyInfo");
+
+      for (int ig = 1; ig <= ngro; ig++)
+        {
+          for (j = 0; j < MED_LNAME_SIZE; j++)
+            nomGroupeChar[j] = gro[(ig - 1) * MED_LNAME_SIZE + j];
+          nomGroupeChar[MED_LNAME_SIZE] = '\0';
+          //cout << "Groupe lu : " << (string)nomGroupeChar << endl;
+          tailleGROUPES[strip((string) nomGroupeChar)]++;
+          if (numfam > 0)
+            GROUPES_NOEUDS[strip((string) nomGroupeChar)].push_back((int) numfam);
+          else if (numfam < 0)
+            GROUPES_MAILLES[strip((string) nomGroupeChar)].push_back((int) numfam);
+        }
+
+      free(attide);
+      free(attval);
+      free(attdes);
+      free(gro);
+    }
+
+  // ##################################################################################################
+  // ##################################################################################################
+  //
+  //                  A C Q U I S I T I O N     D E S     N O E U D S
+  //
+  // ##################################################################################################
+  // ##################################################################################################
+
+  //  class Noeud *n;
+  //  list<Noeud*> listeNoeuds;
+  //  float x, y, z, rx, ry, rz, tx, ty, tz;
+  string line, IDnoeud;
+  float x0, x1, y0, y1, z0, z1;
+
+  vector<int> RESIDU_NOEUDS; // Table de vérité du résidu des noeuds
+
+  ostringstream OSCOORD;
+
+  med_int nnoe = 0; // Nbre de noeuds
+  med_float *coo1; // Table des coordonnées
+  //  char nomcoo[mdim * MED_SNAME_SIZE + 1]; // Table des noms des coordonnées
+  //  char unicoo[mdim * MED_SNAME_SIZE + 1]; // Table des unités des coordonnées
+  char *nomnoe;
+
+  med_int *numnoe;
+  med_int *nufano;
+  //  med_grid_type rep;
+  //  med_bool inonoe, inunoe;
+  //  med_int profil[2] = { 2, 3 };
+  med_bool coordinatechangement;
+  med_bool geotransformation;
+
+  // Combien de noeuds a lire ?
+  nnoe = MEDmeshnEntity(fid, maa, MED_NO_DT, MED_NO_IT, MED_NODE, MED_NO_GEOTYPE, MED_COORDINATE, MED_NO_CMODE,
+                        &coordinatechangement, &geotransformation);
+
+  if (nnoe < 0)
+    ERREUR("Erreur a la lecture du nombre de noeuds");
+
+  nombreNoeudsMaillage = nnoe;
+
+  // Lecture des familles des noeuds
+  med_int *famNoeuds = (med_int*) malloc(sizeof(med_int) * nnoe);
+  if (nnoe > 0)
+    {
+      if (MEDmeshEntityFamilyNumberRd(fid, maa, MED_NO_DT, MED_NO_IT, MED_NODE, MED_NONE, famNoeuds) < 0)
+        ERREUR("Erreur a la lecture des familles de noeuds (MEDmeshEntityFamilyNumberRd)");
+    }
+
+  /* Allocations memoires */
+  if (nnoe > 0)
+    {
+      // table des coordonnees - profil : (dimension * nombre de noeuds )
+      coo1 = (med_float*) calloc(nnoe * mdim, sizeof(med_float));
+      // table des des numeros, des numeros de familles des noeuds - profil : (nombre de noeuds)
+      numnoe = (med_int*) malloc(sizeof(med_int) * nnoe);
+      nufano = (med_int*) malloc(sizeof(med_int) * nnoe);
+      // table des noms des noeuds - profil : (nnoe*MED_SNAME_SIZE+1)
+      nomnoe = (char*) malloc(MED_SNAME_SIZE * nnoe + 1);
+    }
+
+  // Lecture des composantes des coordonnees des noeuds
+  if (nnoe > 0)
+    if (MEDmeshNodeCoordinateRd(fid, maa, MED_NO_DT, MED_NO_IT, MED_FULL_INTERLACE, coo1) < 0)
+      ERREUR("Erreur a la lecture des coordonnees des noeuds");
+
+  //   // Les noeuds ont-ils un nom? un numéro?
+  //  if (nnoe > 0)
+  //    {
+  //      if (MEDnomLire(fid, maa, nomnoe, nnoe, MED_NODE, (med_geometry_type) 0) < 0)
+  //        inonoe = MED_FALSE;
+  //      else
+  //        inonoe = MED_TRUE;
+  //      if (MEDnumLire(fid, maa, numnoe, nnoe, MED_NODE, (med_geometry_type) 0) < 0)
+  //        inunoe = MED_FALSE;
+  //      else
+  //        inunoe = MED_TRUE;
+  //    }
+  //
+  //  if (inonoe)
+  //    cout << "WARNING input MED : les noms des noeuds sont ignorés" << endl;
+  //  if (inunoe)
+  //    cout << "WARNING input MED : les numéros des noeuds sont ignorés" << endl;
+  //
+  //  if (inonoe)
+  //    {
+  //      char str[MED_SNAME_SIZE + 1];
+  //      for (int inoeud = 0; inoeud < nnoe; inoeud++)
+  //        {
+  //          strncpy(str, nomnoe + inoeud * MED_SNAME_SIZE, MED_SNAME_SIZE);
+  //          str[MED_SNAME_SIZE] = '\0';
+  //          IDS_NOEUDS.push_back((string) str);
+  //        }
+  //    }
+  //  else if (inunoe)
+  //    {
+  //      for (int inoeud = 0; inoeud < nnoe; inoeud++)
+  //        {
+  //          int numnoeud = *(numnoe + inoeud);
+  //          IDS_NOEUDS.push_back((string) "N" + int2string(numnoeud));
+  //        }
+  //    }
+  //  else
+  //    for (int inoeud = 0; inoeud < nnoe; inoeud++)
+  //      IDS_NOEUDS.push_back((string) "N" + int2string(inoeud + 1));
+  //  IDS_NOEUDS.resize(nnoe);
+
+  /* ====================================================================== */
+  /*               BOUCLE SUR LES NOEUDS LUS DANS LE FICHIER MED            */
+  /* ====================================================================== */
+
+  //  X.resize(nnoe);
+  //  Y.resize(nnoe);
+  //  Z.resize(nnoe);
+
+  // Initialisation de l'enveloppe
+  x0 = coo1[0];
+  x1 = coo1[0];
+  y0 = coo1[1];
+  y1 = coo1[1];
+  if (mdim == 3)
+    {
+      z0 = coo1[2];
+      z1 = coo1[2];
+    }
+  else
+    {
+      z0 = 0.0;
+      z1 = 0.0;
+    }
+
+  // Allocation mémoire pour les coordonnées XX YY ZZ
+  XX = (float*) malloc(sizeof(float) * nombreNoeudsMaillage);
+  if (mdim > 1)
+    YY = (float*) malloc(sizeof(float) * nombreNoeudsMaillage);
+  if (mdim > 2)
+    ZZ = (float*) malloc(sizeof(float) * nombreNoeudsMaillage);
+
+  for (int i = 0; i < nnoe; i++)
+    {
+
+      // Chargement des coordonnées X, Y et Z
+      // Calcul de l'enveloppe du maillage
+
+      FAMILLES_NOEUDS[*(famNoeuds + i)].push_back(i + 1); // ATTENTION! Les num. de noeuds commencent à 1
+      tailleFAMILLES[*(famNoeuds + i)]++;
+
+      // IDnoeud = "N"+int2string(i+1);
+
+      float * XXi = XX + i;
+      float * YYi = YY + i;
+      float * ZZi = ZZ + i;
+
+      if (mdim == 3)
+        {
+          *XXi = (float) coo1[3 * i];
+          *YYi = (float) coo1[3 * i + 1];
+          *ZZi = (float) coo1[3 * i + 2];
+          if (*XXi < x0)
+            x0 = *XXi;
+          else if (*XXi > x1)
+            x1 = *XXi;
+          if (*YYi < y0)
+            y0 = *YYi;
+          else if (*YYi > y1)
+            y1 = *YYi;
+          if (*ZZi < z0)
+            z0 = *ZZi;
+          else if (*ZZi > z1)
+            z1 = *ZZi;
+        }
+      else if (mdim == 2)
+        {
+          *XXi = (float) coo1[2 * i];
+          *YYi = (float) coo1[2 * i + 1];
+          if (*XXi < x0)
+            x0 = *XXi;
+          else if (*XXi > x1)
+            x1 = *XXi;
+          if (*YYi < y0)
+            y0 = *YYi;
+          else if (*YYi > y1)
+            y1 = *YYi;
+        }
+      else if (mdim == 1)
+        {
+          *XXi = (float) coo1[1 * i];
+          if (*XXi < x0)
+            x0 = *XXi;
+          else if (*XXi > x1)
+            x1 = *XXi;
+        }
+
+      // Chargement des numéros de noeuds
+      //      if (inunoe)
+      //        NUM_NOEUDS.push_back(*(numnoe + i));
+      //      else
+      //        NUM_NOEUDS.push_back(i + 1);
+
+    } // boucle sur les noeuds
+
+  //  NUM_NOEUDS.resize(nnoe);
+
+  // Enveloppe du maillage
+  enveloppeMaillage = new Cube(x0, x1, y0, y1, z0, z1);
+
+  // Libération mémoire
+  if (nnoe > 0)
+    {
+      free(coo1);
+      free(nomnoe);
+      free(numnoe);
+      free(nufano);
+    }
+
+  // ##################################################################################################
+  // ##################################################################################################
+  //
+  //                  A C Q U I S I T I O N     D E S     M A I L L E S
+  //
+  // ##################################################################################################
+  // ##################################################################################################
+
+  for (int itm = (int) POI1; itm <= (int) HEXA20; itm++)
+    {
+      TYPE_MAILLE tm = (TYPE_MAILLE) itm;
+      EFFECTIFS_TYPES[tm] = MEDmeshnEntity(fid, maa, MED_NO_DT, MED_NO_IT, MED_CELL, InstanceMGE(tm), MED_CONNECTIVITY,
+                                           MED_NODAL, &coordinatechangement, &geotransformation);
+      if (EFFECTIFS_TYPES[tm])
+        acquisitionTYPE_inputMED(tm, EFFECTIFS_TYPES[tm], fid, maa, mdim);
+    }
+
+  // Resize des vecteurs des maps FAMILLES et FAM_TYPES
+  map<int, vector<int> >::iterator IF;
+  for (IF = FAMILLES.begin(); IF != FAMILLES.end(); IF++)
+    {
+      IF->second.resize(tailleFAMILLES[IF->first]);
+      FAM_TYPES[IF->first].resize(tailleFAMILLES[IF->first]);
+    }
+
+  for (int itm = (int) POI1; itm <= (int) HEXA20; itm++)
+    nombreMaillesMaillage += EFFECTIFS_TYPES[(TYPE_MAILLE) itm];
+
+  // ##################################################################################################
+  // ##################################################################################################
+  //
+  //          A C Q U I S I T I O N     D E S     G R O U P E S
+  //          D E    M A I L L E S    E T    D E    N O E U D S
+  //
+  // ##################################################################################################
+  // ##################################################################################################
+
+  // =============================================================================================
+  //                 Chargement des groupes dans GM et GN
+  // =============================================================================================
+
+  string nomGM;
+  vector<int> vfam;
+  map<string, vector<int> >::iterator iterGRO;
+
+  int cptGM = 0;
+  for (iterGRO = GROUPES_MAILLES.begin(); iterGRO != GROUPES_MAILLES.end(); iterGRO++)
+    {
+      nomGM = iterGRO->first;
+      vfam = iterGRO->second;
+      cptGM++;
+      map<TYPE_MAILLE, int> effectifGroupeType;
+      for (unsigned int i = 0; i < vfam.size(); i++)
+        {
+          int numf = vfam[i];
+          // Parcours simultané des vecteurs FAMILLES[numf] et FAM_TYPES[numfam] pour obtention du num local
+          // et du type des mailles de la famille numf
+          for (unsigned int imaille = 0; imaille < FAMILLES[numf].size(); imaille++)
+            {
+              TYPE_MAILLE tm = FAM_TYPES[numf][imaille];
+              int nl = FAMILLES[numf][imaille];
+              GM[nomGM][tm].push_back(nl);
+              effectifGroupeType[tm]++;
+            }
+        }
+
+      // Resize d'un GM
+      for (map<TYPE_MAILLE, vector<int> >::iterator I = GM[nomGM].begin(); I != GM[nomGM].end(); I++)
+        {
+          TYPE_MAILLE tm = I->first;
+          GM[nomGM][tm].resize(effectifGroupeType[tm]);
+          sort(GM[nomGM][tm].begin(), GM[nomGM][tm].end());
+        }
+    }
+
+  int cptGN = 0;
+  for (iterGRO = GROUPES_NOEUDS.begin(); iterGRO != GROUPES_NOEUDS.end(); iterGRO++)
+    {
+      nomGM = iterGRO->first;
+      vfam = iterGRO->second;
+      cptGN++;
+      int cptNoeudsGN = 0;
+      for (unsigned int i = 0; i < vfam.size(); i++)
+        {
+          int numf = vfam[i];
+          // Parcours vecteurs FAMILLES_NOEUDS[numf]
+          for (unsigned int inoeud = 0; inoeud < FAMILLES_NOEUDS[numf].size(); inoeud++)
+            {
+              GN[nomGM].push_back(FAMILLES_NOEUDS[numf][inoeud]);
+              cptNoeudsGN++;
+            }
+        }
+      GN[nomGM].resize(cptNoeudsGN);
+      sort(GN[nomGM].begin(), GN[nomGM].end());
+    }
+
+  MEDfileClose(fid);
+  //  cout << "Fin procédure inputMED" << endl << endl;
+}
+
+void Maillage::acquisitionTYPE_inputMED(TYPE_MAILLE TYPE, int nTYPE, med_idt fid, char maa[MED_NAME_SIZE + 1],
+                                        med_int mdim)
+{
+
+  //  int taille, numeromaille, numeroFamille;
+  int numeroFamille;
+  string line, IDmaille, IDnoeud, typeMaille;
+  //  char str[MED_SNAME_SIZE + 1]; // Conteneur pour un nom de maille
+  //  bool rejetMaille;
+  med_int tTYPE = (med_int) Nnoeuds(TYPE);
+  char *nomTYPE = (char*) malloc(MED_SNAME_SIZE * nTYPE + 1);
+  med_int *numTYPE = (med_int*) malloc(sizeof(med_int) * nTYPE);
+  med_int *famTYPE = (med_int*) malloc(sizeof(med_int) * nTYPE);
+
+  //med_int *conTYPE = (med_int*) malloc(sizeof(med_int)*tTYPE*nTYPE);
+  CNX[TYPE] = (int*) malloc(sizeof(int) * tTYPE * nTYPE);
+
+  med_bool inomTYPE, inumTYPE, ifamTYPE;
+  med_geometry_type typeBanaliseMED = InstanceMGE(TYPE);
+
+  if (MEDmeshElementRd(fid, maa, MED_NO_DT, MED_NO_IT, MED_CELL, typeBanaliseMED, MED_NODAL, MED_FULL_INTERLACE,
+                       CNX[TYPE], &inomTYPE, nomTYPE, &inumTYPE, numTYPE, &ifamTYPE, famTYPE) < 0)
+    ERREUR("Erreur a la lecture des coordonnees des noeuds");
+
+  // Conversion HL
+  conversionCNX(CNX[TYPE], TYPE, nTYPE);
+
+  //  CON[TYPE].resize(tTYPE * nTYPE);
+  //  for (int i = 0; i < tTYPE * nTYPE; i++)
+  //    CON[TYPE][i] = (int) *(conTYPE + i);
+  //  CNX[TYPE] = (int*) malloc(sizeof(int) * tTYPE * nTYPE);
+  //  for (int i = 0; i < tTYPE * nTYPE; i++)
+  //    *(CNX[TYPE] + i) = (int) *(conTYPE + i);
+
+  for (int i = 0; i < nTYPE; i++)
+    {
+      numeroFamille = (int) *(famTYPE + i);
+      FAMILLES[numeroFamille].push_back(i);
+      tailleFAMILLES[numeroFamille]++;
+      FAM_TYPES[numeroFamille].push_back(TYPE);
+
+      // Chargement des numéros de mailles
+      //      if (inumTYPE)
+      //        NUM_MAILLES[TYPE].push_back(*(numTYPE + i));
+      //      else
+      //        NUM_MAILLES[TYPE].push_back(NGLOBAL(TYPE, i));
+
+    }
+  //  NUM_MAILLES[TYPE].resize(nTYPE);
+
+  //   if (inomTYPE)
+  //    {
+  //      char str[MED_SNAME_SIZE + 1];
+  //      for (int imaille = 0; imaille < nTYPE; imaille++)
+  //        {
+  //          strncpy(str, nomTYPE + imaille * MED_SNAME_SIZE, MED_SNAME_SIZE);
+  //          str[MED_SNAME_SIZE] = '\0';
+  //          IDS_MAILLES[TYPE].push_back((string) str);
+  //        }
+  //    }
+  //  else if (inumTYPE)
+  //    {
+  //      for (int imaille = 0; imaille < nTYPE; imaille++)
+  //        {
+  //          int nummaille = *(numTYPE + imaille);
+  //          IDS_MAILLES[TYPE].push_back((string) "M" + int2string(nummaille));
+  //        }
+  //    }
+  //  else
+  //    {
+  //      for (int imaille = 0; imaille < nTYPE; imaille++)
+  //        {
+  //          IDS_MAILLES[TYPE].push_back((string) "M" + int2string(imaille + 1));
+  //        }
+  //    }
+  //  IDS_MAILLES[TYPE].resize(nTYPE);
+}
+
+void Maillage::outputMED(std::string fichierMED)
+{
+  // int i, j, k;
+  int nTYPE, tTYPE;
+  string line, s, stype, nomnoeud;
+  //  med_err ret = 0; // Code retour
+  //  int ig, jg;
+  //  cout << endl << endl << "Début procédure outputMED, fichier " << fichierMED << endl;
+
+  // Sortie sur erreur en cas de maillage sans noeuds
+  if (nombreNoeudsMaillage <= 0)
+    {
+      ERREUR("Ce maillage ne contient aucun noeud\n"); /* cout << "Maillage sans noeuds" << endl; */
+    }
+
+  // ########################################################################
+  //    Ouverture du fichier MED et création du maillage
+  // ########################################################################
+
+  // Ouverture du fichier MED en création
+  med_idt fid = MEDfileOpen(string2char(fichierMED), MED_ACC_CREAT);
+  if (fid < 0)
+    {
+      ERREUR("Erreur MEDfileOpen\n");
+      cout << "Erreur MEDfileOpen" << endl;
+    }
+
+  // Création du maillage
+  char maa[MED_NAME_SIZE + 1]; // Nom du maillage de longueur maxi MED_NAME_SIZE
+  strcpy(maa, string2char(ID));
+
+  med_int mdim; // Dimension du maillage
+  if (dimensionMaillage == 0)
+    {
+      mdim = 3;
+      cout << "ATTENTION, dimension 3 attribuée par défaut!" << endl;
+    }
+  else
+    mdim = dimensionMaillage;
+  med_int spacedim = 3;
+  if (dimensionEspace)
+    spacedim = dimensionEspace;
+
+  //med_int profil[2] = { 2, 3 };
+  char desc[MED_COMMENT_SIZE + 1]; // Description du maillage
+  strcpy(desc, string2char(ID));
+  med_mesh_type type = MED_UNSTRUCTURED_MESH;
+  cerr << "maa=" << maa << endl;
+  cerr << "spacedim=" << spacedim << endl;
+  cerr << "mdim=" << mdim << endl;
+  cerr << "type=" << type << endl;
+  cerr << "axisname=" << axisname << endl;
+  cerr << "unitname=" << unitname << endl;
+  if (MEDmeshCr(fid, maa, spacedim, mdim, type, desc, "s", MED_SORT_DTIT, MED_CARTESIAN, axisname, unitname) < 0)
+    {
+      ERREUR("Erreur MEDmeshCr");
+      cout << "Erreur MEDmeshCr" << endl;
+    }
+
+  // =============================  CREATION FAMILLE ZERO
+  char nomfam[MED_NAME_SIZE + 1];
+  med_int numfam;
+  //  char attdes[MED_COMMENT_SIZE + 1];
+  //  med_int natt, attide, attval;
+  int ngro;
+  //  char gro[MED_LNAME_SIZE + 1];
+
+  strcpy(nomfam, "FAMILLE_0");
+  numfam = 0;
+  if (MEDfamilyCr(fid, maa, nomfam, numfam, 0, MED_NO_GROUP) < 0)
+    ERREUR("Erreur MEDfamilyCr (creation famille 0)");
+
+  // ########################################################################
+  //          GROUPES DE NOEUDS
+  // ########################################################################
+
+  int nGroupesNoeuds = GN.size();
+
+  vector<vector<int> > ETIQUETTES_N;
+  ETIQUETTES_N.resize(nombreNoeudsMaillage);
+  vector<unsigned int> INDEX_N;
+  INDEX_N.resize(GN.size());
+  vector<string> NOMSFAM;
+  vector<vector<int> > ETIQFAM;
+  int cptNOMFAM = 0;
+  map<string, int> NUMFAMETIQ; //  clé = étiquette  -  valeur = numéros de familles
+
+
+  if (nGroupesNoeuds)
+    {
+
+      // Pérennisation d'un ordre sur les GM dans le vecteur NOMS_GROUPES_MAILLES
+      vector<string> NOMS_GROUPES_NOEUDS;
+      for (map<string, vector<int> >::iterator ITGN = GN.begin(); ITGN != GN.end(); ITGN++)
+        {
+          string nomGN = ITGN->first;
+          NOMS_GROUPES_NOEUDS.push_back(nomGN);
+        }
+      NOMS_GROUPES_NOEUDS.resize(GN.size());
+
+      // Tri des vecteurs de noeuds de GN
+      for (unsigned int ig = 0; ig < NOMS_GROUPES_NOEUDS.size(); ig++)
+        sort(GN[NOMS_GROUPES_NOEUDS[ig]].begin(), GN[NOMS_GROUPES_NOEUDS[ig]].end());
+
+      // Construction des étiquettes (familles)
+
+      // Initialisation des index de groupes
+      for (unsigned int ig = 0; ig < NOMS_GROUPES_NOEUDS.size(); ig++)
+        INDEX_N[ig] = 0;
+
+      for (int k = 1; k <= nombreNoeudsMaillage; k++)
+        { // k: num. global de noeud
+          int tailleEtiquette = 0;
+          string etiq = (string) "";
+          // Boucle sur les groupes
+          for (unsigned int ig = 0; ig < NOMS_GROUPES_NOEUDS.size(); ig++)
+            {
+              if (INDEX_N[ig] < GN[NOMS_GROUPES_NOEUDS[ig]].size())
+                {
+                  string nomgroupe = NOMS_GROUPES_NOEUDS[ig];
+                  if (k == GN[nomgroupe][INDEX_N[ig]])
+                    {
+                      // Attention: l'indice 0 dans le vecteur ETIQUETTES correspond
+                      // à l'élément (noeud ou maille) de num. global 1
+                      // Par ailleurs, le numéro de groupe dans l'étiquette commence à 0
+                      ETIQUETTES_N[k - 1].push_back(ig);
+                      tailleEtiquette++;
+                      etiq += int2string(ig);
+                      INDEX_N[ig]++;
+                    }
+                }
+            }
+          ETIQUETTES_N[k - 1].resize(tailleEtiquette);
+          // Stockage de l'étiquette dans NOMSFAM ETIQFAM, si pas déjà stockée
+          //          bool trouve = false;
+          //          for (int i = 0; i < NOMSFAM.size(); i++)
+          //            if (NOMSFAM[i] == ((string) "ETIQUETTE_" + etiq))
+          //              {
+          //                trouve = true;
+          //                break;
+          //              }
+          if (!NUMFAMETIQ[etiq] && etiq != (string) "")
+            {
+              NOMSFAM.push_back((string) "ETIQN_" + etiq);
+              ETIQFAM.push_back(ETIQUETTES_N[k - 1]);
+              NUMFAMETIQ[etiq] = cptNOMFAM + 1; // Famille de noeuds, num>0
+              cptNOMFAM++;
+            }
+        }
+
+      NOMSFAM.resize(cptNOMFAM);
+      ETIQFAM.resize(cptNOMFAM);
+
+      // Création des familles de noeuds
+      for (unsigned int ifam = 0; ifam < NOMSFAM.size(); ifam++)
+        {
+          strcpy(nomfam, string2char(NOMSFAM[ifam]));
+          // Numéro de famille: ifam+1 (positif pour les noeuds + non nul)
+          numfam = ifam + 1;
+          ngro = ETIQFAM[ifam].size();
+
+          // Noms des groupes de la famille: variable nomsGN
+          char gro[ngro * MED_LNAME_SIZE + 1];
+          int cptGN = 0;
+          for (unsigned int ign = 0; ign < ETIQFAM[ifam].size(); ign++)
+            {
+              string nomGNcourant = NOMS_GROUPES_NOEUDS[ETIQFAM[ifam][ign]];
+              // ATTENTION! Il faut mettre à la fin de chaque segment un \0 qui est ensuite écrasé
+              // par le premier caractère du champ suivant dans le strcat !!!!
+              if (ign == 0)
+                {
+                  // Premier groupe
+                  strcpy(gro, string2char(nomGNcourant));
+                  for (int jg = nomGNcourant.size(); jg < MED_LNAME_SIZE; jg++)
+                    gro[jg] = ' ';
+                  gro[MED_LNAME_SIZE] = '\0';
+                }
+              else
+                {
+                  strcat(gro, string2char(nomGNcourant));
+                  for (int jg = nomGNcourant.size(); jg < MED_LNAME_SIZE; jg++)
+                    gro[cptGN * MED_LNAME_SIZE + jg] = ' ';
+                  gro[(cptGN + 1) * MED_LNAME_SIZE] = '\0';
+                }
+              cptGN++;
+            }
+
+          // Création de la famille
+          if (MEDfamilyCr(fid, maa, nomfam, numfam, 0, MED_NO_GROUP) < 0)
+            ERREUR("Erreur MEDfamilyCr");
+
+        }
+
+    }
+
+  // ########################################################################
+  //          NOEUDS
+  // ########################################################################
+
+  //  float x, y, z;
+
+  med_int nnoe = nombreNoeudsMaillage; // Nombre de noeuds
+  med_float *coo; // Table des coordonnées
+
+  // Noms des coordonnées (variable nomcoo)
+  char nomcoo[mdim * MED_SNAME_SIZE + 1];
+  string strX = (string) "X";
+  while (strX.size() < MED_SNAME_SIZE)
+    strX += (string) " ";
+  string strY = (string) "Y";
+  while (strY.size() < MED_SNAME_SIZE)
+    strY += (string) " ";
+  string strZ = (string) "Z";
+  while (strZ.size() < MED_SNAME_SIZE)
+    strZ += (string) " ";
+  if (mdim == 3)
+    strcpy(nomcoo, string2char(strX + strY + strZ));
+  else if (mdim == 2)
+    strcpy(nomcoo, string2char(strX + strY));
+  else
+    strcpy(nomcoo, string2char(strX));
+  nomcoo[mdim * MED_SNAME_SIZE] = '\0';
+
+  // Unités des coordonnées (variable unicoo)
+  char unicoo[mdim * MED_SNAME_SIZE + 1];
+  string strmesure = (string) "SI";
+  while (strmesure.size() < MED_SNAME_SIZE)
+    strmesure += (string) " ";
+  if (mdim == 3)
+    strcpy(unicoo, string2char(strmesure + strmesure + strmesure));
+  else if (mdim == 2)
+    strcpy(unicoo, string2char(strmesure + strmesure));
+  else
+    strcpy(unicoo, string2char(strmesure));
+  unicoo[mdim * MED_SNAME_SIZE] = '\0';
+
+  // Tables des noms, numeros, numeros de familles des noeuds
+  //    autant d'elements que de noeuds - les noms ont pout longueur MED_SNAME_SIZE
+  char *nomnoe;
+  med_int *numnoe = NULL;
+  med_int *nufano;
+  med_bool inonoe = MED_FALSE;
+  med_bool inunoe = MED_FALSE;
+
+  // Allocations memoire
+  if (nnoe > 0)
+    {
+      // table des coordonnees - profil : (dimension * nombre de noeuds )
+      coo = (med_float*) calloc(nnoe * mdim, sizeof(med_float));
+
+      // table des des numeros, des numeros de familles des noeuds - profil : (nombre de noeuds)
+      //      numnoe = (med_int*) malloc(sizeof(med_int) * nnoe);
+      nufano = (med_int*) malloc(sizeof(med_int) * nnoe);
+
+      // table des noms des noeuds - profil : (nnoe*MED_SNAME_SIZE+1)
+      nomnoe = (char*) ""; // ATTENTION!
+
+      //      nomnoe = (char*) malloc(MED_SNAME_SIZE * nnoe + 1);
+      //      for (int inoeud = 0; inoeud < IDS_NOEUDS.size(); inoeud++)
+      //        {
+      //          string nomNoeud = IDS_NOEUDS[inoeud];
+      //          if (inoeud == 0)
+      //            {
+      //              // Premier groupe
+      //              strcpy(nomnoe, string2char(nomNoeud));
+      //              for (int jg = nomNoeud.size(); jg < MED_SNAME_SIZE; jg++)
+      //                nomnoe[jg] = ' ';
+      //              nomnoe[MED_SNAME_SIZE] = '\0';
+      //            }
+      //          else
+      //            {
+      //              strcat(nomnoe, string2char(nomNoeud));
+      //              for (int jg = nomNoeud.size(); jg < MED_SNAME_SIZE; jg++)
+      //                nomnoe[inoeud * MED_SNAME_SIZE + jg] = ' ';
+      //              nomnoe[(inoeud + 1) * MED_SNAME_SIZE] = '\0';
+      //            }
+      //        }
+    }
+
+  // Chargement des coordonnées, numéros de familles et numéros de noeuds
+  if (dimensionMaillage == 3)
+    {
+      int i3 = 0;
+      for (int i = 0; i < nnoe; i++)
+        {
+          //          coo[i3] = X[i];
+          //          coo[i3 + 1] = Y[i];
+          //          coo[i3 + 2] = Z[i];
+          //          i3 = i3 + 3;
+          coo[i3] = *(XX + i);
+          coo[i3 + 1] = *(YY + i);
+          coo[i3 + 2] = *(ZZ + i);
+          i3 = i3 + 3;
+
+          // Numéros de familles  -  Le num. global de noeud est i+1
+          if (nGroupesNoeuds)
+            {
+              vector<int> v = ETIQUETTES_N[i];
+              string sv = (string) "";
+              for (unsigned int j = 0; j < v.size(); j++)
+                sv += int2string(v[j]); // Etiquette du noeud au format string
+              // cout << "Noeud " << i + 1 << " : sv=" << sv << endl;
+              *(nufano + i) = (med_int) NUMFAMETIQ[sv];
+            }
+          else
+            *(nufano + i) = (med_int) 0;
+
+          // Numéros de noeuds
+          // *(numnoe + i) = (med_int) NUM_NOEUDS[i];
+        }
+    }
+  else /* dimension 2 */
+    {
+      int i2 = 0;
+      for (int i = 0; i < nnoe; i++)
+        {
+          coo[i2] = *(XX + i);
+          coo[i2 + 1] = *(YY + i);
+          i2 = i2 + 2;
+          // Numéros de familles  -  Le num. global de noeud est i+1
+          if (nGroupesNoeuds)
+            {
+              vector<int> v = ETIQUETTES_N[i];
+              string sv = (string) "";
+              for (unsigned int j = 0; j < v.size(); j++)
+                sv += int2string(v[j]); // Etiquette du noeud au format string
+              // cout << "Noeud " << i + 1 << " : sv=" << sv << endl;
+              *(nufano + i) = (med_int) NUMFAMETIQ[sv];
+            }
+          else
+            *(nufano + i) = (med_int) 0;
+          // Numéros de noeuds
+          // *(numnoe + i) = (med_int) NUM_NOEUDS[i];
+        }
+    }
+
+  //   // Restitution coo
+  //  int i3 = 0;
+  //  for (int i = 0; i < nnoe; i++)
+  //    {
+  //      cout << "Noeud " << i << " : " << coo[i3] << " " << coo[i3 + 1] << " " << coo[i3 + 2] << endl;
+  //      i3 = i3 + 3;
+  //    }
+
+  if (MEDmeshNodeWr(fid, maa, MED_NO_DT, MED_NO_IT, MED_UNDEF_DT, MED_FULL_INTERLACE, nnoe, coo, inonoe, nomnoe,
+                    inunoe, numnoe, MED_TRUE, nufano) < 0)
+    {
+      ERREUR("Erreur MEDmeshNodeWr");
+      cout << "Erreur MEDmeshNodeWr" << endl;
+    }
+
+  // ########################################################################
+  //          GROUPES DE MAILLES
+  // ########################################################################
+
+  int nGroupesMailles = GM.size();
+
+  map<TYPE_MAILLE, vector<vector<int> > > ETIQUETTES_M; // [ tm => [ nl => [ig1, ig2, ... ] ] ]
+  // INDEX_M :
+  //  Clé :       tm
+  //  Valeur :    vect. des compteurs par indice de GM dans NOMS_GROUPES_MAILLES
+  map<TYPE_MAILLE, vector<unsigned int> > INDEX_M;
+  NOMSFAM.clear();
+  ETIQFAM.clear();
+  NUMFAMETIQ.clear(); //  clé = étiquette  -  valeur = numéros de familles
+  cptNOMFAM = 0;
+
+  if (nGroupesMailles)
+    {
+
+      // Pérennisation d'un ordre sur les GM dans le vecteur NOMS_GROUPES_MAILLES
+      vector<string> NOMS_GROUPES_MAILLES;
+      for (map<string, map<TYPE_MAILLE, vector<int> > >::iterator ITGM = GM.begin(); ITGM != GM.end(); ITGM++)
+        {
+          string nomGM = ITGM->first;
+          NOMS_GROUPES_MAILLES.push_back(nomGM);
+        }
+      NOMS_GROUPES_MAILLES.resize(GM.size());
+      // Tri des vecteurs d'entiers de GM
+      for (unsigned int ig = 0; ig < NOMS_GROUPES_MAILLES.size(); ig++)
+        {
+          string nomGM = NOMS_GROUPES_MAILLES[ig];
+          for (map<TYPE_MAILLE, vector<int> >::iterator I = GM[nomGM].begin(); I != GM[nomGM].end(); I++)
+            {
+              TYPE_MAILLE tm = I->first;
+              sort(GM[nomGM][tm].begin(), GM[nomGM][tm].end());
+            }
+        }
+
+      // Construction des étiquettes (familles)
+
+      // Initialisation 0 des index de groupes, et resize ETIQUETTES_M[tm]
+      for (int itm = (int) POI1; itm <= (int) HEXA20; itm++)
+        {
+          TYPE_MAILLE tm = (TYPE_MAILLE) itm;
+          if (EFFECTIFS_TYPES[tm])
+            {
+              for (unsigned int ig = 0; ig < NOMS_GROUPES_MAILLES.size(); ig++)
+                INDEX_M[tm].push_back(0);
+              ETIQUETTES_M[tm].resize(EFFECTIFS_TYPES[tm]);
+            }
+        }
+
+      for (int itm = (int) POI1; itm <= (int) HEXA20; itm++)
+        {
+          TYPE_MAILLE tm = (TYPE_MAILLE) itm;
+          int efftm = EFFECTIFS_TYPES[tm];
+          // cout << endl << "*************** coucou ***************" << endl;
+          // cout << "*************** Type " << TM2string(tm) << " effectif = " << efftm << endl;
+          if (efftm)
+            {
+              // cout << "Traitement du type " << TM2string(tm) << endl;
+              for (int nl = 0; nl < efftm; nl++)
+                {
+                  // nl = num. local de la maille dans son type
+                  // cout << "\tMaille " << TM2string(tm) << " n° " << nl << endl;
+
+                  int tailleEtiquette = 0;
+                  string etiq = (string) "";
+                  // Boucle sur les groupes
+                  for (unsigned int ig = 0; ig < NOMS_GROUPES_MAILLES.size(); ig++)
+                    {
+                      string nomGM = NOMS_GROUPES_MAILLES[ig];
+                      // cout << "\t\t" << "Groupe " << nomGM << endl;
+
+                      if (INDEX_M[tm][ig] < GM[nomGM][tm].size())
+                        {
+                          if (nl == GM[nomGM][tm][INDEX_M[tm][ig]])
+                            {
+                              // Attention: l'indice 0 dans le vecteur ETIQUETTES correspond
+                              // à l'élément (noeud ou maille) de num. global 1
+                              // Par ailleurs, le numéro de groupe dans l'étiquette commence à 0
+                              // cout << "\t\t\t" << "La maille est dans le groupe " << nomGM << endl;
+                              ETIQUETTES_M[tm][nl].push_back(ig);
+                              tailleEtiquette++;
+                              etiq += int2string(ig);
+                              INDEX_M[tm][ig]++;
+                              // cout << "\t\t\t  OK" << endl;
+                            }
+                        }
+                    }
+
+                  ETIQUETTES_M[tm][nl].resize(tailleEtiquette);
+                  // Stockage de l'étiquette dans NOMSFAM ETIQFAM, si pas déjà stockée
+                  //                  bool trouve = false;
+                  //                  for (int i = 0; i < NOMSFAM.size(); i++)
+                  //                    if (NOMSFAM[i] == ((string) "ETIQUETTE_" + etiq))
+                  //                      {
+                  //                        trouve = true;
+                  //                        break;
+                  //                      }
+
+                  if (!NUMFAMETIQ[etiq] && etiq != (string) "")
+                    {
+                      NOMSFAM.push_back((string) "ETIQM_" + etiq);
+                      ETIQFAM.push_back(ETIQUETTES_M[tm][nl]);
+                      NUMFAMETIQ[etiq] = -cptNOMFAM - 1; // Famille de mailles, num<0
+                      cptNOMFAM++;
+                    }
+
+                }
+
+            } // if (efftm)
+        }
+
+      NOMSFAM.resize(cptNOMFAM);
+      ETIQFAM.resize(cptNOMFAM);
+
+      // Création des familles de mailles
+      for (unsigned int ifam = 0; ifam < NOMSFAM.size(); ifam++)
+        {
+          strcpy(nomfam, string2char(NOMSFAM[ifam]));
+          // Numéro de famille: -ifam-1 (négatif pour les mailles, et non nul)
+          numfam = -ifam - 1;
+          ngro = ETIQFAM[ifam].size();
+
+          // Noms des groupes de la famille
+          char gro[ngro * MED_LNAME_SIZE + 1];
+          int cptGM = 0;
+          for (unsigned int ign = 0; ign < ETIQFAM[ifam].size(); ign++)
+            {
+              string nomGMcourant = NOMS_GROUPES_MAILLES[ETIQFAM[ifam][ign]];
+              // ATTENTION! Il faut mettre à la fin de chaque segment un \0 qui est ensuite écrasé
+              // par le premier caractère du champ suivant dans le strcat !!!!
+              if (ign == 0)
+                {
+                  // Premier groupe
+                  strcpy(gro, string2char(nomGMcourant));
+                  for (int jg = nomGMcourant.size(); jg < MED_LNAME_SIZE; jg++)
+                    gro[jg] = ' ';
+                  gro[MED_LNAME_SIZE] = '\0';
+                }
+              else
+                {
+                  strcat(gro, string2char(nomGMcourant));
+                  for (int jg = nomGMcourant.size(); jg < MED_LNAME_SIZE; jg++)
+                    gro[cptGM * MED_LNAME_SIZE + jg] = ' ';
+                  gro[(cptGM + 1) * MED_LNAME_SIZE] = '\0';
+                }
+              cptGM++;
+            }
+
+          // Création de la famille
+          if (MEDfamilyCr(fid, maa, nomfam, numfam, 1, gro) < 0)
+            ERREUR("Erreur MEDfamilyCr");
+        }
+
+    }
+
+  // ########################################################################
+  //                                MAILLES
+  // ########################################################################
+  //               Appel de la routine ecritureTypeNew
+
+  med_bool inomTYPE = MED_FALSE;
+  med_bool inumTYPE = MED_FALSE;
+
+  med_geometry_type MGE;
+
+  for (int itm = (int) POI1; itm <= (int) HEXA20; itm++)
+    {
+      TYPE_MAILLE tm = (TYPE_MAILLE) itm;
+      if (EFFECTIFS_TYPES[tm])
+        {
+          nTYPE = EFFECTIFS_TYPES[tm];
+          tTYPE = Nnoeuds(tm);
+          MGE = InstanceMGE(tm);
+          stype = TM2string(tm);
+
+          // Noms des mailles
+          //          char *nomTYPE = (char*) malloc(MED_SNAME_SIZE * nTYPE + 1);
+          //          strcpy(nomTYPE, ""); // ATTENTION!
+
+          char *nomTYPE = (char*)""; // Attention! Ne pas faire strcpy !
+
+          //           for (int imaille = 0; imaille < IDS_MAILLES[tm].size(); imaille++)
+          //            {
+          //              string nomMaille = IDS_MAILLES[tm][imaille];
+          //              if (imaille == 0)
+          //                {
+          //                  // Premier groupe
+          //                  strcpy(nomTYPE, string2char(nomMaille));
+          //                  for (int jg = nomMaille.size(); jg < MED_SNAME_SIZE; jg++)
+          //                    nomTYPE[jg] = ' ';
+          //                  nomTYPE[MED_SNAME_SIZE] = '\0';
+          //                }
+          //              else
+          //                {
+          //                  strcat(nomTYPE, string2char(nomMaille));
+          //                  for (int jg = nomMaille.size(); jg < MED_SNAME_SIZE; jg++)
+          //                    nomTYPE[imaille * MED_SNAME_SIZE + jg] = ' ';
+          //                  nomTYPE[(imaille + 1) * MED_SNAME_SIZE] = '\0';
+          //                }
+          //            }
+
+          med_int *numTYPE = NULL; //  (med_int*) malloc(sizeof(med_int)*nTYPE);
+
+          med_int *famTYPE = (med_int*) malloc(sizeof(med_int) * nTYPE);
+
+          //          med_int *conTYPE = (med_int*) malloc(sizeof(med_int) * tTYPE * nTYPE);
+          //          for (int i = 0; i < nTYPE * tTYPE; i++)
+          //            *(conTYPE + i) = (med_int) CON[tm][i];
+
+          // Chargement famTYPE
+          if (nGroupesMailles)
+            {
+              // Boucle sur les mailles du type (indice = num. local)
+              for (int nl = 0; nl < nTYPE; nl++)
+                {
+                  // Construction de l'étiquette de la maille au format string
+                  vector<int> v = ETIQUETTES_M[tm][nl];
+                  string sv = (string) "";
+                  for (unsigned int j = 0; j < v.size(); j++)
+                    sv += int2string(v[j]);
+                  // Accès au num. de la famille
+                  *(famTYPE + nl) = (med_int) NUMFAMETIQ[sv];
+                } // Boucle sur les mailles du type
+            } // if (nGroupesMailles)
+          else
+            for (int nl = 0; nl < nTYPE; nl++)
+              *(famTYPE + nl) = (med_int) 0;
+
+          // Formatage MED des CNX
+          conversionCNX(CNX[tm], tm, nTYPE);
+
+          // Chargement numTYPE
+          //for (int nl=0; nl<nTYPE; nl++)    *(numTYPE+nl) = (med_int) ( NUM_MAILLES[tm][nl] );
+          cerr << "maa=" << maa << endl;
+          cerr << "MGE=" << MGE << endl;
+          cerr << "nTYPE=" << nTYPE << endl;
+          cerr << "inomTYPE=" << inomTYPE << endl;
+          //cerr << "nomTYPE=" << nomTYPE << endl;
+          cerr << "inumTYPE=" << inumTYPE << endl;
+          this->afficheMailles(tm);
+          if (MEDmeshElementWr(fid, maa, MED_NO_DT, MED_NO_IT, MED_UNDEF_DT, MED_CELL, MGE, MED_NODAL,
+                               MED_FULL_INTERLACE, nTYPE, CNX[tm], inomTYPE, nomTYPE, inumTYPE, numTYPE, MED_FALSE,
+                               famTYPE) < 0)
+            {
+              ERREUR("Erreur MEDmeshElementWr");
+              cout << "Erreur MEDmeshElementWr, type " << stype << endl;
+            }
+          if (MEDmeshEntityFamilyNumberWr(fid, maa, MED_NO_DT, MED_NO_IT,
+                                          MED_CELL, MGE, nTYPE, famTYPE) < 0)
+            {
+              ERREUR("Erreur MEDmeshEntityFamilyNumberWr");
+              cout << "Erreur MEDmeshEntityFamilyNumberWr, type " << stype << endl;
+            }
+
+          // free(nomTYPE);
+          // free(numTYPE);
+          free(famTYPE);
+          // free(conTYPE);
+
+        } // Effectif non vide
+    }
+
+  // ########################################################################
+  //                            Fermeture du fichier MED
+  // ########################################################################
+
+  if (MEDfileClose(fid) < 0)
+    {
+      ERREUR("Erreur a la fermeture du fichier MED\n");
+      cout << "Erreur a la fermeture du fichier MED" << endl;
+    }
+
+  // cout << endl << endl << "Fin procédure outputMED" << endl;
+} // outputMED
+
+
+int Maillage::NGLOBAL(TYPE_MAILLE typeMaille, int nlocal)
+{
+  // Attention, les num. globaux commencent à 1, les num. locaux à 0
+  int cpt = 1 + nlocal;
+  for (int itm = (int) POI1; itm < (int) typeMaille; itm++)
+    { // Attention! inférieur strict!
+      TYPE_MAILLE tm = (TYPE_MAILLE) itm;
+      cpt += EFFECTIFS_TYPES[tm];
+    }
+  return cpt;
+}
+
+TYPE_MAILLE Maillage::TYPE(int nglobal)
+{
+  // Attention, les num. globaux commencent à 1, les num. locaux à 0
+  TYPE_MAILLE resultat;
+  int cpt = 0;
+  for (int itm = (int) POI1; itm <= (int) HEXA20; itm++)
+    {
+      TYPE_MAILLE tm = (TYPE_MAILLE) itm;
+      cpt += EFFECTIFS_TYPES[tm];
+      if (nglobal <= cpt)
+        {
+          resultat = tm;
+          break;
+        }
+    }
+  return resultat;
+}
+
+int Maillage::NLOCAL(int nglobal, TYPE_MAILLE tm)
+{
+  // Attention, les num. globaux commencent à 1, les num. locaux à 0
+  int nPOI1 = EFFECTIFS_TYPES[POI1];
+  int nSEG2 = EFFECTIFS_TYPES[SEG2];
+  int nSEG3 = EFFECTIFS_TYPES[SEG3];
+  int nTRIA3 = EFFECTIFS_TYPES[TRIA3];
+  int nTRIA6 = EFFECTIFS_TYPES[TRIA6];
+  int nQUAD4 = EFFECTIFS_TYPES[QUAD4];
+  int nQUAD8 = EFFECTIFS_TYPES[QUAD8];
+  int nTETRA4 = EFFECTIFS_TYPES[TETRA4];
+  int nTETRA10 = EFFECTIFS_TYPES[TETRA10];
+  int nPYRAM5 = EFFECTIFS_TYPES[PYRAM5];
+  int nPYRAM13 = EFFECTIFS_TYPES[PYRAM13];
+  int nPENTA6 = EFFECTIFS_TYPES[PENTA6];
+  int nPENTA15 = EFFECTIFS_TYPES[PENTA15];
+  int nHEXA8 = EFFECTIFS_TYPES[HEXA8];
+  int nHEXA20 = EFFECTIFS_TYPES[HEXA20];
+
+  if (nglobal <= nPOI1)
+    {
+      return nglobal - 1;
+    }
+  else if (nglobal <= nPOI1 + nSEG2)
+    {
+      return nglobal - nPOI1 - 1;
+    }
+  else if (nglobal <= nPOI1 + nSEG2 + nSEG3)
+    {
+      return nglobal - nPOI1 - nSEG2 - 1;
+    }
+  else if (nglobal <= nPOI1 + nSEG2 + nSEG3 + nTRIA3)
+    {
+      return nglobal - nPOI1 - nSEG2 - nSEG3 - 1;
+    }
+  else if (nglobal <= nPOI1 + nSEG2 + nSEG3 + nTRIA3 + nTRIA6)
+    {
+      return nglobal - nPOI1 - nSEG2 - nSEG3 - nTRIA3 - 1;
+    }
+  else if (nglobal <= nPOI1 + nSEG2 + nSEG3 + nTRIA3 + nTRIA6 + nQUAD4)
+    {
+      return nglobal - nPOI1 - nSEG2 - nSEG3 - nTRIA3 - nTRIA6 - 1;
+    }
+  else if (nglobal <= nPOI1 + nSEG2 + nSEG3 + nTRIA3 + nTRIA6 + nQUAD4 + nQUAD8)
+    {
+      return nglobal - nPOI1 - nSEG2 - nSEG3 - nTRIA3 - nTRIA6 - nQUAD4 - 1;
+    }
+  else if (nglobal <= nPOI1 + nSEG2 + nSEG3 + nTRIA3 + nTRIA6 + nQUAD4 + nQUAD8 + nTETRA4)
+    {
+      return nglobal - nPOI1 - nSEG2 - nSEG3 - nTRIA3 - nTRIA6 - nQUAD4 - nQUAD8 - 1;
+    }
+  else if (nglobal <= nPOI1 + nSEG2 + nSEG3 + nTRIA3 + nTRIA6 + nQUAD4 + nQUAD8 + nTETRA4 + nTETRA10)
+    {
+      return nglobal - nPOI1 - nSEG2 - nSEG3 - nTRIA3 - nTRIA6 - nQUAD4 - nQUAD8 - nTETRA4 - 1;
+    }
+  else if (nglobal <= nPOI1 + nSEG2 + nSEG3 + nTRIA3 + nTRIA6 + nQUAD4 + nQUAD8 + nTETRA4 + nTETRA10 + nPYRAM5)
+    {
+      return nglobal - nPOI1 - nSEG2 - nSEG3 - nTRIA3 - nTRIA6 - nQUAD4 - nQUAD8 - nTETRA4 - nTETRA10 - 1;
+    }
+  else if (nglobal <= nPOI1 + nSEG2 + nSEG3 + nTRIA3 + nTRIA6 + nQUAD4 + nQUAD8 + nTETRA4 + nTETRA10 + nPYRAM5
+      + nPYRAM13)
+    {
+      return nglobal - nPOI1 - nSEG2 - nSEG3 - nTRIA3 - nTRIA6 - nQUAD4 - nQUAD8 - nTETRA4 - nTETRA10 - nPYRAM5 - 1;
+    }
+  else if (nglobal <= nPOI1 + nSEG2 + nSEG3 + nTRIA3 + nTRIA6 + nQUAD4 + nQUAD8 + nTETRA4 + nTETRA10 + nPYRAM5
+      + nPYRAM13 + nPENTA6)
+    {
+      return nglobal - nPOI1 - nSEG2 - nSEG3 - nTRIA3 - nTRIA6 - nQUAD4 - nQUAD8 - nTETRA4 - nTETRA10 - nPYRAM5
+          - nPYRAM13 - 1;
+    }
+  else if (nglobal <= nPOI1 + nSEG2 + nSEG3 + nTRIA3 + nTRIA6 + nQUAD4 + nQUAD8 + nTETRA4 + nTETRA10 + nPYRAM5
+      + nPYRAM13 + nPENTA6 + nPENTA15)
+    {
+      return nglobal - nPOI1 - nSEG2 - nSEG3 - nTRIA3 - nTRIA6 - nQUAD4 - nQUAD8 - nTETRA4 - nTETRA10 - nPYRAM5
+          - nPYRAM13 - nPENTA6 - 1;
+    }
+  else if (nglobal <= nPOI1 + nSEG2 + nSEG3 + nTRIA3 + nTRIA6 + nQUAD4 + nQUAD8 + nTETRA4 + nTETRA10 + nPYRAM5
+      + nPYRAM13 + nPENTA6 + nPENTA15 + nHEXA8)
+    {
+      return nglobal - nPOI1 - nSEG2 - nSEG3 - nTRIA3 - nTRIA6 - nQUAD4 - nQUAD8 - nTETRA4 - nTETRA10 - nPYRAM5
+          - nPYRAM13 - nPENTA6 - nPENTA15 - 1;
+    }
+  else if (nglobal <= nPOI1 + nSEG2 + nSEG3 + nTRIA3 + nTRIA6 + nQUAD4 + nQUAD8 + nTETRA4 + nTETRA10 + nPYRAM5
+      + nPYRAM13 + nPENTA6 + nPENTA15 + nHEXA8 + nHEXA20)
+    {
+      return nglobal - nPOI1 - nSEG2 - nSEG3 - nTRIA3 - nTRIA6 - nQUAD4 - nQUAD8 - nTETRA4 - nTETRA10 - nPYRAM5
+          - nPYRAM13 - nPENTA6 - nPENTA15 - nHEXA8 - 1;
+    }
+  else
+    ERREUR("Routine NLOCAL: type non reconnu");
+  return 0;
+}
+
+/*!
+ *  Suppression de mailles dans un type :
+ *
+ *  - Contraction de la connectivité concernée
+ *  - Réécriture des GM avec les nouveaux numéros locaux des éléments du type concerné
+ *  - Mise à jour nombreMaillesMaillage
+ *
+ *  Les noeuds ne sont pas affectés.
+ */
+void Maillage::eliminationMailles(TYPE_MAILLE tm, vector<int> listeMaillesSuppr)
+{
+  map<int, int> TABLE_NL; // Table des num. locaux dans le type tm
+
+  // cout << "Fonction eliminationMailles, listeMaillesSuppr.size()=" << listeMaillesSuppr.size() << endl;
+
+  // ************* Modification de la connectivité du type concerné
+
+  int* CNX2;
+  int nNoeudsType = Nnoeuds(tm);
+  int tailleCNX2 = nNoeudsType * (EFFECTIFS_TYPES[tm] - listeMaillesSuppr.size());
+  CNX2 = (int*) malloc(sizeof(int) * tailleCNX2);
+  // Recopie sélective des connectivités
+  int isuppr = 0; // indice dans listeMaillesSuppr
+  int ih2 = 0; // nouveau numéro local ( remarque: ih2 = ih1 - isuppr )
+  for (int ih1 = 0; ih1 < EFFECTIFS_TYPES[tm]; ih1++)
+    {
+      if (listeMaillesSuppr[isuppr] != ih1)
+        {
+          for (int jh1 = 0; jh1 < nNoeudsType; jh1++)
+            *(CNX2 + nNoeudsType * ih2 + jh1) = *(CNX[tm] + nNoeudsType * ih1 + jh1);
+          ih2++;
+        }
+      else
+        isuppr++;
+    }
+  free(CNX[tm]);
+  CNX[tm] = CNX2;
+
+  // ************* Construction de la table de correspondance des NL dans le type concerné
+  unsigned int offset = 0;
+  for (int i = 0; i < EFFECTIFS_TYPES[tm]; i++)
+    {
+      if (offset < listeMaillesSuppr.size())
+        {
+          if (i < listeMaillesSuppr[offset])
+            TABLE_NL[i] = i - offset;
+          else if (i == listeMaillesSuppr[offset])
+            {
+              TABLE_NL[i] = -1; // Element à supprimer
+              offset++;
+            }
+        }
+      else
+        TABLE_NL[i] = i - offset;
+    }
+
+  // Contrôle
+  if (offset != listeMaillesSuppr.size())
+    {
+      ERREUR("Incohérence offset, fonction eliminationMailles");
+      exit(0);
+    }
+
+  // ************* Mise à jour du type concerné dans les GM
+  for (map<string, map<TYPE_MAILLE, vector<int> > >::iterator I = GM.begin(); I != GM.end(); I++)
+    {
+      string nomGM = I->first;
+
+      if (GM[nomGM][tm].size())
+        {
+
+          vector<int> mailles = GM[nomGM][tm];
+          vector<int> mailles2; //mailles2.resize(mailles.size()-listeMaillesSuppr.size());
+          unsigned int cptMailles = 0;
+          for (unsigned int i = 0; i < mailles.size(); i++)
+            {
+              int nl2 = TABLE_NL[mailles[i]];
+              if (nl2 != -1)
+                {
+                  mailles2.push_back(nl2);
+                  cptMailles++;
+                }
+            }
+          // Vérification
+          if (cptMailles != mailles.size() - listeMaillesSuppr.size())
+            {
+              int delta = mailles.size() - listeMaillesSuppr.size();
+              cout << "mailles.size() = " << mailles.size() << endl;
+              cout << "cptMailles = " << cptMailles << endl;
+              cout << "delta = " << delta << endl;
+              ERREUR("Incohérence sur le nombre de mailles conservées, fonction eliminationMailles");
+              exit(0);
+            }
+
+          GM[nomGM][tm].clear();
+          mailles2.resize(cptMailles);
+          GM[nomGM][tm] = mailles2;
+
+        }
+    }
+
+  // ************* Mise à jour des effectifs
+  EFFECTIFS_TYPES[tm] = EFFECTIFS_TYPES[tm] - listeMaillesSuppr.size();
+  nombreMaillesMaillage = nombreMaillesMaillage - listeMaillesSuppr.size();
+
+  TABLE_NL.clear();
+}
+
diff --git a/src/Tools/MeshCut/MeshCut_Maillage.hxx b/src/Tools/MeshCut/MeshCut_Maillage.hxx
new file mode 100644 (file)
index 0000000..fad49ec
--- /dev/null
@@ -0,0 +1,146 @@
+#ifndef __MESHCUT_MAILLAGE_HXX__
+#define __MESHCUT_MAILLAGE_HXX__
+
+#include "MeshCut_Utils.hxx"
+
+#include <string>
+#include <vector>
+#include <map>
+
+namespace MESHCUT
+  {
+    class Maillage
+    {
+    public:
+      // Toutes ces variables doivent être placées au niveau du principal pour être connues de toutes les fonctions
+
+      // Vecteurs des familles d'éléments
+      std::map<int, std::vector<int> > FAMILLES;
+      std::map<int, std::vector<TYPE_MAILLE> > FAM_TYPES;
+
+      // Vecteurs des familles de noeuds
+      std::map<int, std::vector<int> > FAMILLES_NOEUDS;
+
+      // Description des groupes (par familles)
+      std::map<std::string, std::vector<int> > GROUPES_MAILLES;
+      std::map<std::string, std::vector<int> > GROUPES_NOEUDS;
+
+      // Commun noeuds et mailles
+      std::map<int, int> tailleFAMILLES; // la clé est un num. de famille
+      std::map<std::string, int> tailleGROUPES; // Tailles des vecteurs GROUPES_MAILLES et GROUPES_NOEUDS - la clé est un nom de groupe (de noeuds ou de mailles)
+
+      // Résidus mailles
+      std::map<TYPE_MAILLE, std::vector<int> > RESIDU;
+
+    public:
+      std::string ID;
+      int nombreNoeudsMaillage; // ****** MED-OBLIGATOIRE ******
+      int nombreMaillesMaillage; // ****** MED-OBLIGATOIRE ******
+
+      class Cube *enveloppeMaillage;
+
+      int dimensionMaillage; // ****** MED-OBLIGATOIRE ******
+      int dimensionEspace; // ****** MED-OBLIGATOIRE ******
+
+      char axisname[3*MED_SNAME_SIZE+1]; // ****** MED-OBLIGATOIRE ******
+      char unitname[3*MED_SNAME_SIZE+1]; // ****** MED-OBLIGATOIRE ******
+
+      float *XX;
+      float *YY;
+      float *ZZ; // ****** MED-OBLIGATOIRE ******
+
+      // Effectifs des éléments par type
+      std::map<TYPE_MAILLE, int> EFFECTIFS_TYPES; // ****** MED-OBLIGATOIRE ******
+
+      // Connectivités des types
+      // Le numéro global du j-ième noeud de la maille de numéro global i est stocké à l'adresse
+      //           CNX[tm]+t*(i-1)+(j-1)
+      // (t = taille du type, i.e. nombre de noeuds de l'élément)
+      std::map<TYPE_MAILLE, int*> CNX; // ****** MED-OBLIGATOIRE ******
+
+      // Enveloppes cubiques
+      std::map<TYPE_MAILLE, float*> EC;
+
+      // Description des groupes
+      std::map<std::string, std::map<TYPE_MAILLE, std::vector<int> > > GM;
+      std::map<std::string, std::vector<int> > GN;
+
+      //  std::vector<std::string> IDS_NOEUDS; // Indice = num. global - 1
+      //  std::map<TYPE_MAILLE, std::vector<std::string> > IDS_MAILLES; // Indice = num local de maille dans le type
+      //
+      //  std::vector<int> NUM_NOEUDS; // Indice = num. global - 1
+      //  std::map<TYPE_MAILLE, std::vector<int> > NUM_MAILLES; // Indice = num local de maille dans le type
+
+      Maillage(std::string _ID);
+      virtual ~Maillage();
+
+      void creationGMtype(TYPE_MAILLE tm, std::string nomGMtype);
+      void afficheMailles(TYPE_MAILLE tm);
+      void listeMaillesType(TYPE_MAILLE tm);
+      void listeMaillesTousTypes();
+      void listeMaillesParGM();
+      void listeMaillesGM(std::string nomGM);
+      // void listeMaillesGMordonne(std::string nomGM);
+      void listeNoeuds();
+      void listeNoeudsGN(std::string nomGN);
+      void listeNoeudsGNordonne(std::string nomGN);
+      std::vector<float> G(int i, TYPE_MAILLE tm);
+      float distanceNoeudMaille(int ngnoeud, int imaille, TYPE_MAILLE tm);
+      int noeudVoisin(int ngnoeud, int imaille, TYPE_MAILLE tm);
+      float distanceNoeudNoeud(int ng1, int ng2);
+      //  void encombrements()
+
+      void inputMED(std::string fichierMED);
+      void outputMED(std::string fichierMED);
+      void outputMEDold(std::string fichierMED);
+
+      void inputHL(std::string fichierHL /*, std::string ficDICnoeuds, std::string ficDICmailles, bool DICO */);
+      void outputHL(std::string fichierHL);
+
+      void outputVRML(std::string ficVRML, float rNoeuds, char *renduAretes, char *renduFaces, float transparence);
+      // std::string vrmlType(TYPE_MAILLE tm, char *renduAretes, char *renduFaces, float transparence);
+      // void Maillage::creationGMtype(TYPE_MAILLE tm, std::vector<int> CON_TYPE);
+      int NGLOBAL(TYPE_MAILLE typeMaille, int nlocal);
+      int NLOCAL(int nglobal, TYPE_MAILLE tm);
+      TYPE_MAILLE TYPE(int nglobal);
+      void eliminationMailles(TYPE_MAILLE typeMaille, std::vector<int> listeMaillesSuppr);
+
+      // acquisitionTYPE_inputMED appelée par inputMED
+      void
+          acquisitionTYPE_inputMED(TYPE_MAILLE TYPE, int nTYPE, med_idt fid, char maa[MED_NAME_SIZE + 1], med_int mdim);
+
+      // void infoChamps(std::string type, med_entity_type MEM, med_geometry_type MGE, med_idt fid, char *maa,
+      //                 char *nomChamp, med_field_type typeChamp, med_int nCompChamp, std::map<std::string, int> REFGAUSS);
+
+      bool NoeudDansHEXA8(int n, int n0, int n1, int n2, int n3, int n4, int n5, int n6, int n7, float epsilon);
+      bool NoeudDansPENTA6(int n, int n0, int n1, int n2, int n3, int n4, int n5, float epsilon);
+      bool NoeudDansPYRAM5(int n, int n0, int n1, int n2, int n3, int n4, float epsilon);
+      bool NoeudDansTETRA4(int n, int n1, int n2, int n3, int n4, float epsilon);
+      bool NoeudDansQUAD4(int n, int n1, int n2, int n3, int n4, float epsilon);
+      bool NoeudDansTRIA3(int n, int n1, int n2, int n3, float epsilon);
+      double volumeTETRA(int n1, int n2, int n3, int n4);
+      double aireTRIA(int n1, int n2, int n3);
+      double DET3(int n1, int n2, int n3);
+      double DET2(int n1, int n2);
+      void * chargeEnveloppesCubiques(TYPE_MAILLE tm);
+      void * chargeEnveloppesCarrees(TYPE_MAILLE tm);
+      bool noeudDeMaille(int ngnoeud, int i, TYPE_MAILLE tm);
+      bool NoeudDansMaille3D(int n, int i, TYPE_MAILLE tm, float epsilon);
+      bool NoeudDansMaille2D(int n, int i, TYPE_MAILLE tm, float epsilon);
+      bool NoeudDansEnveloppeMaille2D(int n, int i, TYPE_MAILLE tm, float epsilon);
+      bool NoeudDansEnveloppeMaille3D(int n, int i, TYPE_MAILLE tm, float epsilon);
+      void * afficheEnveloppesCubiques(TYPE_MAILLE tm);
+      void * afficheEnveloppesCarrees(TYPE_MAILLE tm);
+
+      std::vector<int> noeudsGeomCommuns(int i1, TYPE_MAILLE tm1, int i2, TYPE_MAILLE tm2);
+      void creationGMresidu();
+
+      float longueurMoyenne();
+      // void Maillage::infoChamps2(std::string type, med_entity_type MEM, med_geometry_type MGE, med_idt fid,
+      //                            char *maa, char *nomChamp, med_field_type typeChamp, med_int nCompChamp, map<string,
+      //                            int> REFGAUSS);
+
+    };
+  }
+
+#endif
diff --git a/src/Tools/MeshCut/MeshCut_Utils.cxx b/src/Tools/MeshCut/MeshCut_Utils.cxx
new file mode 100644 (file)
index 0000000..2d71b59
--- /dev/null
@@ -0,0 +1,1084 @@
+#include "MeshCut_Utils.hxx"
+
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <cstdlib>
+#include <cstring>
+
+using namespace std;
+using namespace MESHCUT;
+
+//string pathUsers = (string) "/var/www/XMeshLab/users/";
+
+bool MESHCUT::estUnTypeMaille(std::string S)
+{
+  if (S == (string) "POI1" || S == (string) "SEG2" || S == (string) "SEG3" || S == (string) "TRIA3" || S
+      == (string) "TRIA6" || S == (string) "QUAD4" || S == (string) "QUAD8" || S == (string) "QUAD9" || S
+      == (string) "TETRA4" || S == (string) "TETRA10" || S == (string) "PYRAM5" || S == (string) "PYRAM13" || S
+      == (string) "PENTA6" || S == (string) "PENTA15" || S == (string) "HEXA8" || S == (string) "HEXA20" || S
+      == (string) "HEXA27")
+    return true;
+  else
+    return false;
+}
+
+void MESHCUT::ERREUR(const char* msg)
+{
+  cout << endl << "====== ERREUR ====== " << msg << endl << endl;
+  exit(-1);
+}
+
+char* MESHCUT::string2char(std::string str)
+{
+  // créer le buffer pour copier la chaîne
+  size_t size = str.size() + 1;
+  char* buffer = new char[size];
+  // copier la chaîne
+  strncpy(buffer, str.c_str(), size);
+
+  // libérer la mémoire
+  //delete [] buffer;
+
+  return buffer;
+}
+
+std::string MESHCUT::int2string(int k)
+{
+  std::stringstream oss;
+  oss << k;
+  return oss.str(); //  oss.seekp (ios_base::beg);
+}
+
+float MESHCUT::char2float(const char* ch)
+{
+  return atof(ch);
+}
+
+std::string MESHCUT::float2string(float f)
+{
+  stringstream buf;
+  buf << fixed << f;
+  string s = buf.str();
+  return s;
+}
+
+bool MESHCUT::appartient(std::string e, std::string tableau[], int taille)
+{
+  for (int i = 0; i < taille; i++)
+    if (tableau[i] == e)
+      return true;
+  return false;
+}
+
+float MESHCUT::arrondi(float x)
+{
+  if (x > 0 and x < 1.0e-5)
+    return 0;
+  else if (x < 0 and x > -1.0e-5)
+    return 0;
+  else
+    return x;
+}
+
+int MESHCUT::numNoeudPointe(std::string b1, std::string b2, std::string b3)
+{
+  if (b1 == "1" && b2 == "1" && b3 == "2")
+    return 2;
+  else if (b1 == "1" && b2 == "2" && b3 == "1")
+    return 1;
+  else if (b1 == "1" && b2 == "2" && b3 == "2")
+    return 2;
+  else if (b1 == "2" && b2 == "1" && b3 == "1")
+    return 3;
+  else if (b1 == "2" && b2 == "1" && b3 == "2")
+    return 3;
+  else if (b1 == "2" && b2 == "2" && b3 == "1")
+    return 1;
+  else
+    return -1;
+}
+
+std::string MESHCUT::strip(std::string S)
+{
+  if (S.empty())
+    return S;
+  int startIndex = S.find_first_not_of(" ");
+  int endIndex = S.find_last_not_of(" ");
+  return S.substr(startIndex, (endIndex - startIndex + 1));
+}
+
+std::string MESHCUT::entierSur10_g(int i)
+{
+  if (i > 999999999)
+    ERREUR("Tentative d'ecriture sur 10 caracteres d'un entier plus grand que 999999999");
+  if (i < 10)
+    return int2string(i) + (string) "         ";
+  else if (i < 100)
+    return int2string(i) + (string) "        ";
+  else if (i < 1000)
+    return int2string(i) + (string) "       ";
+  else if (i < 10000)
+    return int2string(i) + (string) "      ";
+  else if (i < 100000)
+    return int2string(i) + (string) "     ";
+  else if (i < 1000000)
+    return int2string(i) + (string) "    ";
+  else if (i < 10000000)
+    return int2string(i) + (string) "   ";
+  else if (i < 100000000)
+    return int2string(i) + (string) "  ";
+  else if (i < 1000000000)
+    return int2string(i) + (string) " ";
+  else
+    return int2string(i);
+}
+
+std::string MESHCUT::entierSur10_d(int i)
+{
+  if (i > 999999999)
+    ERREUR("Tentative d'ecriture sur 10 caracteres d'un entier plus grand que 999999999");
+  if (i < 10)
+    return (string) "         " + int2string(i);
+  else if (i < 100)
+    return (string) "        " + int2string(i);
+  else if (i < 1000)
+    return (string) "       " + int2string(i);
+  else if (i < 10000)
+    return (string) "      " + int2string(i);
+  else if (i < 100000)
+    return (string) "     " + int2string(i);
+  else if (i < 1000000)
+    return (string) "    " + int2string(i);
+  else if (i < 10000000)
+    return (string) "   " + int2string(i);
+  else if (i < 100000000)
+    return (string) "  " + int2string(i);
+  else if (i < 1000000000)
+    return (string) " " + int2string(i);
+  else
+    return int2string(i);
+}
+
+std::string MESHCUT::typeEnsight(std::string type)
+{
+  if (type == (string) "POI1")
+    return (string) "point";
+  else if (type == (string) "SEG2")
+    return (string) "bar2";
+  else if (type == (string) "SEG3")
+    return (string) "bar2";// ATTENTION, triche!
+  else if (type == (string) "TRIA3")
+    return (string) "tria3";
+  else if (type == (string) "TRIA6")
+    return (string) "tria3";// ATTENTION, triche!
+  else if (type == (string) "QUAD4")
+    return (string) "quad4";
+  else if (type == (string) "QUAD8")
+    return (string) "quad4"; // ATTENTION, triche!
+  else if (type == (string) "QUAD9")
+    ERREUR("Type QUAD9 non supporte par Ensight");
+  else if (type == (string) "TETRA4")
+    return (string) "tetra4";
+  else if (type == (string) "TETRA10")
+    return (string) "tetra4"; // ATTENTION, triche!
+  else if (type == (string) "PYRAM5")
+    return (string) "pyramid5";
+  else if (type == (string) "PYRAM13")
+    return (string) "pyramid5"; // ATTENTION, triche!
+  else if (type == (string) "PENTA6")
+    return (string) "penta6";
+  else if (type == (string) "PENTA15")
+    return (string) "penta6"; // ATTENTION, triche!
+  else if (type == (string) "HEXA8")
+    return (string) "hexa8";
+  else if (type == (string) "HEXA20")
+    return (string) "hexa8"; // ATTENTION, triche!
+  else if (type == (string) "HEXA27")
+    ERREUR("Type HEXA27 non supporte par Ensight");
+  else
+    ERREUR("Type maille non reconnu (routine \"typeEnsight\"");
+  return (string) "";
+}
+
+int MESHCUT::Nnoeuds(TYPE_MAILLE type)
+{
+  switch (type)
+  {
+    case POI1:
+      {
+        return 1;
+        break;
+      }
+    case SEG2:
+      {
+        return 2;
+        break;
+      }
+    case SEG3:
+      {
+        return 3;
+        break;
+      }
+    case TRIA3:
+      {
+        return 3;
+        break;
+      }
+    case TRIA6:
+      {
+        return 6;
+        break;
+      }
+    case QUAD4:
+      {
+        return 4;
+        break;
+      }
+    case QUAD8:
+      {
+        return 8;
+        break;
+      }
+      //case QUAD9:                   { return 9; break; }
+    case TETRA4:
+      {
+        return 4;
+        break;
+      }
+    case TETRA10:
+      {
+        return 10;
+        break;
+      }
+    case PYRAM5:
+      {
+        return 5;
+        break;
+      }
+    case PYRAM13:
+      {
+        return 13;
+        break;
+      }
+    case PENTA6:
+      {
+        return 6;
+        break;
+      }
+    case PENTA15:
+      {
+        return 15;
+        break;
+      }
+    case HEXA8:
+      {
+        return 8;
+        break;
+      }
+    case HEXA20:
+      {
+        return 20;
+        break;
+      }
+      //case HEXA27:                      { return 27;    break; }
+    default:
+      ERREUR("Type maille non reconnu (routine Nnoeuds)");
+  }
+  return 0;
+}
+
+int MESHCUT::NnoeudsGeom(TYPE_MAILLE type)
+{
+  switch (type)
+  {
+    case POI1:
+      {
+        return 1;
+        break;
+      }
+    case SEG2:
+      {
+        return 2;
+        break;
+      }
+    case SEG3:
+      {
+        return 2;
+        break;
+      }
+    case TRIA3:
+      {
+        return 3;
+        break;
+      }
+    case TRIA6:
+      {
+        return 3;
+        break;
+      }
+    case QUAD4:
+      {
+        return 4;
+        break;
+      }
+    case QUAD8:
+      {
+        return 4;
+        break;
+      }
+      //case QUAD9:                   { return 9; break; }
+    case TETRA4:
+      {
+        return 4;
+        break;
+      }
+    case TETRA10:
+      {
+        return 4;
+        break;
+      }
+    case PYRAM5:
+      {
+        return 5;
+        break;
+      }
+    case PYRAM13:
+      {
+        return 5;
+        break;
+      }
+    case PENTA6:
+      {
+        return 6;
+        break;
+      }
+    case PENTA15:
+      {
+        return 6;
+        break;
+      }
+    case HEXA8:
+      {
+        return 8;
+        break;
+      }
+    case HEXA20:
+      {
+        return 8;
+        break;
+      }
+      //case HEXA27:                      { return 27;    break; }
+    default:
+      ERREUR("Type maille non reconnu (routine NnoeudsGeom)");
+  }
+  return 0;
+}
+
+int MESHCUT::codeGMSH(std::string type)
+{
+  if (type == (string) "POI1")
+    ERREUR("POI1 non pris en charge par GMSH");
+  else if (type == (string) "SEG2")
+    return 1;
+  else if (type == (string) "SEG3")
+    return 8;
+  else if (type == (string) "TRIA3")
+    return 2;
+  else if (type == (string) "TRIA6")
+    return 9;
+  else if (type == (string) "QUAD4")
+    return 3;
+  else if (type == (string) "QUAD8")
+    return 16;
+  else if (type == (string) "QUAD9")
+    return 10;
+  else if (type == (string) "TETRA4")
+    return 4;
+  else if (type == (string) "TETRA10")
+    return 11;
+  else if (type == (string) "PYRAM5")
+    return 7;
+  else if (type == (string) "PENTA6")
+    return 6;
+  else if (type == (string) "PENTA15")
+    return 18;
+  else if (type == (string) "HEXA8")
+    return 5;
+  else if (type == (string) "HEXA20")
+    return 17;
+  else if (type == (string) "HEXA27")
+    return 12;
+  else
+    ERREUR("Type maille non reconnu (routine codeGMSH)");
+  return 0;
+}
+
+std::string MESHCUT::floatEnsight(float x)
+{
+  char buf[12];
+  string s;
+  if (x < 0.0)
+    sprintf(buf, "%1.5E", x);
+  else
+    sprintf(buf, " %1.5E", x);
+  s = (string) buf;
+  s.erase(10, 1);
+  return s;
+}
+
+bool MESHCUT::typeComplexe(std::string type)
+{
+  if (type == (string) "SEG3")
+    return true;
+  else if (type == (string) "TRIA6")
+    return true;
+  else if (type == (string) "QUAD8")
+    return true;
+  else if (type == (string) "QUAD9")
+    return true;
+  else if (type == (string) "TETRA10")
+    return true;
+  else if (type == (string) "PYRAM13")
+    return true;
+  else if (type == (string) "PENTA15")
+    return true;
+  else if (type == (string) "HEXA20")
+    return true;
+  else if (type == (string) "HEXA27")
+    return true;
+  else
+    return false;
+}
+
+std::string MESHCUT::ASTER8(std::string s)
+{
+  if (s.size() == 0)
+    return (s + (string) "        ");
+  else if (s.size() == 1)
+    return (s + (string) "       ");
+  else if (s.size() == 2)
+    return (s + (string) "      ");
+  else if (s.size() == 3)
+    return (s + (string) "     ");
+  else if (s.size() == 4)
+    return (s + (string) "    ");
+  else if (s.size() == 5)
+    return (s + (string) "   ");
+  else if (s.size() == 6)
+    return (s + (string) "  ");
+  else if (s.size() == 7)
+    return (s + (string) " ");
+  else if (s.size() == 8)
+    return (s);
+  else
+    ERREUR("Depassement de la longueur max 8 pour une chaine ASTER");
+  return (s);
+}
+
+/*!
+ *  Distance à laquelle doit se tenir l'observateur sur un axe
+ *  pour voir sous 90° un objet centré de dimensions a et b selon les deux autres axes.
+ *  Si on ne tient pas compte de la dimension de l'objet selon l'axe choisi,
+ *  la formule d_obs=max(a,b)/2 donne la cote
+ *  qui permet de voir l'objet plat dans un angle de 90°.
+ *  A cela il faut ajouter la dimension de l'objet selon l'axe d'observation = c.
+ *
+ *  @param a dimensions de l'objet selon un des axes normal à l'axe d'observation
+ *  @param b dimensions de l'objet selon l'autre axe normal à l'axe d'observation
+ *  @param c est la dimension de l'objet selon l'axe d'observation
+ */
+float MESHCUT::dObservateur(float a, float b, float c)
+{
+  return (max(a, b) / 2.0 + c);
+}
+
+int MESHCUT::copieFichier(std::string source, std::string cible)
+{
+  FILE *fsource, *fcible;
+  char buffer[512];
+  int NbLu;
+  if ((fsource = fopen(string2char(source), "rb")) == NULL)
+    return -1;
+  if ((fcible = fopen(string2char(cible), "wb")) == NULL)
+    {
+      fclose(fsource);
+      return -2;
+    }
+  while ((NbLu = fread(buffer, 1, 512, fsource)) != 0)
+    fwrite(buffer, 1, NbLu, fcible);
+  fclose(fcible);
+  fclose(fsource);
+  return 0;
+}
+
+med_geometry_type MESHCUT::InstanceMGE(TYPE_MAILLE TYPE)
+{
+  med_geometry_type typeBanaliseMED;
+
+  switch (TYPE)
+  {
+    case POI1:
+      typeBanaliseMED = MED_POINT1;
+      break; // Attention, piège !
+    case SEG2:
+      typeBanaliseMED = MED_SEG2;
+      break;
+    case SEG3:
+      typeBanaliseMED = MED_SEG3;
+      break;
+    case TRIA3:
+      typeBanaliseMED = MED_TRIA3;
+      break;
+    case TRIA6:
+      typeBanaliseMED = MED_TRIA6;
+      break;
+    case QUAD4:
+      typeBanaliseMED = MED_QUAD4;
+      break;
+    case QUAD8:
+      typeBanaliseMED = MED_QUAD8;
+      break;
+    case TETRA4:
+      typeBanaliseMED = MED_TETRA4;
+      break;
+    case TETRA10:
+      typeBanaliseMED = MED_TETRA10;
+      break;
+    case PYRAM5:
+      typeBanaliseMED = MED_PYRA5;
+      break; // Attention, piège !
+    case PYRAM13:
+      typeBanaliseMED = MED_PYRA13;
+      break; // Attention, piège !
+    case PENTA6:
+      typeBanaliseMED = MED_PENTA6;
+      break;
+    case PENTA15:
+      typeBanaliseMED = MED_PENTA15;
+      break;
+    case HEXA8:
+      typeBanaliseMED = MED_HEXA8;
+      break;
+    case HEXA20:
+      typeBanaliseMED = MED_HEXA20;
+      break;
+    default:
+      ERREUR("Routine InstanceMGE, type inconnu ");
+  }
+  return typeBanaliseMED;
+}
+
+int MESHCUT::chrono()
+{
+  return clock() / CLOCKS_PER_SEC;
+}
+
+TYPE_MAILLE MESHCUT::typeMaille(std::string type)
+{
+  if (type == (string) "POI1")
+    return POI1;
+  else if (type == (string) "SEG2")
+    return SEG2;
+  else if (type == (string) "SEG3")
+    return SEG3;
+  else if (type == (string) "TRIA3")
+    return TRIA3;
+  else if (type == (string) "TRIA6")
+    return TRIA6;
+  else if (type == (string) "QUAD4")
+    return QUAD4;
+  else if (type == (string) "QUAD8")
+    return QUAD8;
+  else if (type == (string) "TETRA4")
+    return TETRA4;
+  else if (type == (string) "TETRA10")
+    return TETRA10;
+  else if (type == (string) "PYRAM5")
+    return PYRAM5;
+  else if (type == (string) "PYRAM13")
+    return PYRAM13;
+  else if (type == (string) "PENTA6")
+    return PENTA6;
+  else if (type == (string) "PENTA15")
+    return PENTA15;
+  else if (type == (string) "HEXA8")
+    return HEXA8;
+  else if (type == (string) "HEXA20")
+    return HEXA20;
+  else
+    ERREUR("ERREUR procédure typeMaille, type non reconnu");
+  return POI1;
+}
+
+std::string MESHCUT::MGE2string(med_geometry_type MGE)
+{
+  if (MGE == MED_NONE)
+    return (string) "NOEUD";
+  else if (MGE == MED_POINT1)
+    return (string) "POI1";
+  else if (MGE == MED_SEG2)
+    return (string) "SEG2";
+  else if (MGE == MED_SEG3)
+    return (string) "SEG3";
+  else if (MGE == MED_TRIA3)
+    return (string) "TRIA3";
+  else if (MGE == MED_TRIA6)
+    return (string) "TRIA6";
+  else if (MGE == MED_QUAD4)
+    return (string) "QUAD4";
+  else if (MGE == MED_QUAD8)
+    return (string) "QUAD8";
+  else if (MGE == MED_TETRA4)
+    return (string) "TETRA4";
+  else if (MGE == MED_TETRA10)
+    return (string) "TETRA10";
+  else if (MGE == MED_PYRA5)
+    return (string) "PYRAM5";
+  else if (MGE == MED_PYRA13)
+    return (string) "PYRAM13";
+  else if (MGE == MED_PENTA6)
+    return (string) "PENTA6";
+  else if (MGE == MED_PENTA15)
+    return (string) "PENTA15";
+  else if (MGE == MED_HEXA8)
+    return (string) "HEXA8";
+  else if (MGE == MED_HEXA20)
+    return (string) "HEXA20";
+  else
+    ERREUR("ERREUR procédure MGE2string, type non reconnu");
+  return (string) "NOEUD";
+}
+
+std::string MESHCUT::TM2string(TYPE_MAILLE MGE)
+{
+  if (MGE == POI1)
+    return (string) "POI1";
+  else if (MGE == SEG2)
+    return (string) "SEG2";
+  else if (MGE == SEG3)
+    return (string) "SEG3";
+  else if (MGE == TRIA3)
+    return (string) "TRIA3";
+  else if (MGE == TRIA6)
+    return (string) "TRIA6";
+  else if (MGE == QUAD4)
+    return (string) "QUAD4";
+  else if (MGE == QUAD8)
+    return (string) "QUAD8";
+  else if (MGE == TETRA4)
+    return (string) "TETRA4";
+  else if (MGE == TETRA10)
+    return (string) "TETRA10";
+  else if (MGE == PYRAM5)
+    return (string) "PYRAM5";
+  else if (MGE == PYRAM13)
+    return (string) "PYRAM13";
+  else if (MGE == PENTA6)
+    return (string) "PENTA6";
+  else if (MGE == PENTA15)
+    return (string) "PENTA15";
+  else if (MGE == HEXA8)
+    return (string) "HEXA8";
+  else if (MGE == HEXA20)
+    return (string) "HEXA20";
+  else
+    ERREUR("ERREUR procédure TM2string, type non reconnu");
+  return (string) "POI1";
+}
+
+TYPE_MAILLE MESHCUT::string2TM(std::string stm)
+{
+  if (stm == (string) "POI1")
+    return POI1;
+  else if (stm == (string) "SEG2")
+    return SEG2;
+  else if (stm == (string) "SEG3")
+    return SEG3;
+  else if (stm == (string) "TRIA3")
+    return TRIA3;
+  else if (stm == (string) "TRIA6")
+    return TRIA6;
+  else if (stm == (string) "QUAD4")
+    return QUAD4;
+  else if (stm == (string) "QUAD8")
+    return QUAD8;
+  else if (stm == (string) "TETRA4")
+    return TETRA4;
+  else if (stm == (string) "TETRA10")
+    return TETRA10;
+  else if (stm == (string) "PYRAM5")
+    return PYRAM5;
+  else if (stm == (string) "PYRAM13")
+    return PYRAM13;
+  else if (stm == (string) "PENTA6")
+    return PENTA6;
+  else if (stm == (string) "PENTA15")
+    return PENTA15;
+  else if (stm == (string) "HEXA8")
+    return HEXA8;
+  else if (stm == (string) "HEXA20")
+    return HEXA20;
+  else
+    ERREUR("ERREUR procédure string2TM, type non reconnu");
+  return POI1;
+}
+
+std::string MESHCUT::coordIndex_ILS(TYPE_MAILLE tm)
+{
+  if (tm == SEG2)
+    return (string) " 0,1 ";
+  else if (tm == SEG3)
+    return (string) " 0,1 "; // Idem SEG2
+  else if (tm == TRIA3)
+    return (string) " 0,1,2,0 ";
+  else if (tm == TRIA6)
+    return (string) " 0,1,2,0 ";
+  else if (tm == QUAD4)
+    return (string) " 0,1,2,3,0 ";
+  else if (tm == QUAD8)
+    return (string) " 0,1,2,3,0 ";
+  else if (tm == TETRA4)
+    return (string) " 0,1,2,0,-1, 0,3,-1, 1,3,-1, 2,3,-1 ";
+  else if (tm == TETRA10)
+    return (string) " 0,1,2,0,-1, 0,3,-1, 1,3,-1, 2,3,-1 ";
+  else if (tm == PYRAM5)
+    return (string) " 0,1,2,3,0,-1, 0,4,-1, 1,4,-1, 2,4,-1, 3,4,-1 ";
+  else if (tm == PYRAM13)
+    return (string) " 0,1,2,3,0,-1, 0,4,-1, 1,4,-1, 2,4,-1, 3,4,-1 ";
+  else if (tm == PENTA6)
+    return (string) " 0,1,2,0,-1, 3,4,5,3,-1, 0,3,-1, 1,4,-1, 2,5,-1 ";
+  else if (tm == PENTA15)
+    return (string) " 0,1,2,0,-1, 3,4,5,3,-1, 0,3,-1, 1,4,-1, 2,5,-1 ";
+  else if (tm == HEXA8)
+    return (string) " 0,1,2,3,0,-1, 4,5,6,7,4,-1, 0,4,-1, 1,5,-1, 2,6,-1, 3,7,-1 ";
+  else if (tm == HEXA20)
+    return (string) " 0,1,2,3,0,-1, 4,5,6,7,4,-1, 0,4,-1, 1,5,-1, 2,6,-1, 3,7,-1 ";
+  else
+    return (string) "";
+}
+
+std::string MESHCUT::coordIndex_IFS(TYPE_MAILLE tm)
+{
+  if (tm == SEG2)
+    return (string) "  ";
+  else if (tm == SEG3)
+    return (string) "  "; // Idem SEG2
+  else if (tm == TRIA3)
+    return (string) " 0,1,2,0,-1, 0,2,1,0,-1 ";
+  else if (tm == TRIA6)
+    return (string) " 0,1,2,0,-1, 0,2,1,0,-1 ";
+  else if (tm == QUAD4)
+    return (string) " 0,1,2,3,0,-1, 0,3,2,1,0,-1 ";
+  else if (tm == QUAD8)
+    return (string) " 0,1,2,3,0,-1, 0,3,2,1,0,-1 ";
+  else if (tm == TETRA4)
+    return (string) " 0,1,2,0,-1, 0,2,1,0,-1, 0,3,1,0,-1, 0,1,3,0,-1, 1,3,2,1,-1, 1,2,3,1,-1, 0,2,3,0,-1, 0,3,2,0,-1 ";
+  else if (tm == TETRA10)
+    return (string) " 0,1,2,0,-1, 0,2,1,0,-1, 0,3,1,0,-1, 0,1,3,0,-1, 1,3,2,1,-1, 1,2,3,1,-1, 0,2,3,0,-1, 0,3,2,0,-1 ";
+  else if (tm == PYRAM5)
+    return (string) " 0,1,2,3,0,-1, 0,3,2,1,0,-1, 0,1,4,0,-1, 0,4,1,0,-1, 1,2,4,1,-1, 1,4,2,1,-1, 2,4,3,2,-1, 2,3,4,2,-1, 3,4,0,3,-1, 3,0,4,3,-1 ";
+  else if (tm == PYRAM13)
+    return (string) " 0,1,2,3,0,-1, 0,3,2,1,0,-1, 0,1,4,0,-1, 0,4,1,0,-1, 1,2,4,1,-1, 1,4,2,1,-1, 2,4,3,2,-1, 2,3,4,2,-1, 3,4,0,3,-1, 3,0,4,3,-1 ";
+  else if (tm == PENTA6)
+    return (string) " 0,1,2,0,-1, 0,2,1,0,-1, 3,4,5,3,-1, 3,5,4,3,-1, 0,1,4,3,0,-1, 0,3,4,1,0,-1, 1,4,5,2,1,-1, 1,2,5,4,1,-1, 0,3,5,2,0,-1, 0,2,5,3,0,-1 ";
+  else if (tm == PENTA15)
+    return (string) " 0,1,2,0,-1, 0,2,1,0,-1, 3,4,5,3,-1, 3,5,4,3,-1, 0,1,4,3,0,-1, 0,3,4,1,0,-1, 1,4,5,2,1,-1, 1,2,5,4,1,-1, 0,3,5,2,0,-1, 0,2,5,3,0,-1 ";
+  else if (tm == HEXA8)
+    return (string) " 0,1,2,3,0,-1, 0,3,2,1,0,-1, 1,5,6,2,1,-1, 1,2,6,5,1,-1, 5,4,7,6,5,-1, 5,6,7,4,5,-1, 4,0,3,7,4,-1, 4,7,3,0,4,-1, 0,4,5,1,0,-1, 0,1,5,4,0,-1, 3,7,6,2,3,-1, 3,2,6,7,3,-1 ";
+  else if (tm == HEXA20)
+    return (string) " 0,1,2,3,0,-1, 0,3,2,1,0,-1, 1,5,6,2,1,-1, 1,2,6,5,1,-1, 5,4,7,6,5,-1, 5,6,7,4,5,-1, 4,0,3,7,4,-1, 4,7,3,0,4,-1, 0,4,5,1,0,-1, 0,1,5,4,0,-1, 3,7,6,2,3,-1, 3,2,6,7,3,-1 ";
+  else
+    return (string) "";
+}
+
+std::string MESHCUT::SIGNE(double x)
+{
+  if (x < 0)
+    return "-";
+  else if (x > 0)
+    return "+";
+  else
+    return "0";
+}
+
+void MESHCUT::champType(std::string type, med_entity_type MEM, med_geometry_type MGE, med_idt fid, med_idt fidout,
+                        char *maa, char *nomChamp, char *nomChampMoy, med_field_type typeChamp, char *compChamp,
+                        char *unitChamp, med_int nCompChamp, std::map<std::string, int> REFGAUSS, int ichamp)
+{
+
+  bool debug = true;
+  int ipt, nmailles, ngauss, imaille, igauss, icomp;
+  //  int ival, ngpdt;
+  med_int nval, numdt, numo, nPasTemps;
+  char dtunit[MED_SNAME_SIZE + 1] = "";
+  char locname[MED_NAME_SIZE + 1] = "";
+  char nomprofil[MED_NAME_SIZE + 1] = "";
+  med_float dt = 0.0;
+  med_float *valr = NULL;
+  med_float *valr2 = NULL;
+  med_bool local;
+  //  med_int nbrefmaa;
+  med_field_type fieldType;
+
+  if (MEDfieldInfo(fid, ichamp, nomChamp, maa, &local, &fieldType, compChamp, unitChamp, dtunit, &nPasTemps) < 0)
+    ERREUR("Erreur MEDfieldInfo");
+  cout << type << " : " << (int) nPasTemps << " pas de temps  " << endl;
+
+  for (ipt = 1; ipt <= nPasTemps; ipt++)
+    {
+      //for (ipt=1; ipt<=min(nPasTemps,1); ipt++) {
+      if (debug)
+        cout << endl;
+      if (debug)
+        cout << "************************************************************" << endl;
+      if (debug)
+        cout << "                    CHAMP " << ichamp << endl;
+      if (debug)
+        cout << "          " << nomChamp << endl;
+      if (debug)
+        cout << "          " << type << "   ---   Pas de temps " << ipt << endl;
+      if (debug)
+        cout << "************************************************************" << endl;
+      if (debug)
+        cout << endl;
+
+      if (MEDfieldComputingStepInfo(fid, nomChamp, ipt, &numdt, &numo, &dt) < 0)
+        {
+          cout << endl;
+          cout << endl << "####################################################################" << endl;
+          cout << "                   ERREUR MEDpasdetempsInfo                         " << endl;
+          cout << endl << "####################################################################" << endl;
+          cout << "                  Champ: " << (string) nomChamp << endl;
+          cout << "                  Géométrie: " << MGE2string(MGE) << endl;
+          cout << "                  Pas de temps " << ipt << " ignoré" << endl;
+
+          continue;
+        }
+
+      med_int profilesize, nintegrationpoint;
+      nval = MEDfieldnValueWithProfile(fid, nomChamp, numdt, numo, MEM, MGE, ipt, MED_COMPACT_PFLMODE, nomprofil,
+                                       &profilesize, locname, &nintegrationpoint);
+      if (debug)
+        cout << "     Nombre de valeurs dans ce pas de temps : " << (int) nval << endl;
+
+      if (typeChamp == MED_FLOAT64)
+        valr = (med_float*) calloc(nCompChamp * nval, sizeof(med_float));
+      else
+        ERREUR("Type de champ non pris en compte");
+
+      if (MEDfieldValueWithProfileRd(fid, maa, numdt, numo, MEM, MGE, MED_COMPACT_PFLMODE, nomprofil,
+                                     MED_FULL_INTERLACE, MED_ALL_CONSTITUENT, (unsigned char*) valr) < 0)
+        {
+          cout << endl;
+          cout << endl << "####################################################################" << endl;
+          cout << "                         ERREUR MEDchampLire                        " << endl;
+          cout << endl << "####################################################################" << endl;
+          cout << endl;
+          cout << "   Champ: " << (string) nomChamp << endl;
+          cout << "   Géométrie: " << MGE2string(MGE) << endl;
+          cout << "   Pas de temps " << ipt << " ignoré" << endl;
+          cout << endl << endl;
+          continue;
+        }
+
+      if (debug)
+        cout << "       profil  = " << (string) nomprofil << endl;
+      // Localisation du champ aux points de Gauss
+      if (debug)
+        cout << "       locname = " << (string) locname << endl;
+
+      if (REFGAUSS[(string) locname])
+        {
+          ngauss = REFGAUSS[(string) locname];
+          if (debug)
+            cout << "       " << ngauss << " points de Gauss par élément)" << endl;
+        }
+      else
+        ngauss = 1;
+
+      nmailles = nval / ngauss;
+      if (debug)
+        cout << "      Nbre de mailles: " << nmailles << endl;
+
+      if (debug)
+        {
+          cout << endl << "       Liste des valeurs du champ brut aux 3 premiers éléments:" << endl;
+          for (imaille = 0; imaille < min(nmailles, 3); imaille++)
+            {
+              cout << "         Maille " << imaille << endl;
+              for (igauss = 0; igauss < ngauss; igauss++)
+                {
+                  cout << "             PG " << igauss << " : ";
+                  for (icomp = 0; icomp < nCompChamp; icomp++)
+                    cout << " " << *(valr + imaille * ngauss * nCompChamp + igauss * nCompChamp + icomp);
+                  cout << endl;
+                }
+              cout << endl;
+            }
+          cout << endl;
+        }
+
+      if (ngauss > 1)
+        {
+
+          valr2 = (med_float*) calloc(nCompChamp * nmailles, sizeof(med_float));
+
+          if (debug)
+            cout << endl << "       Moyenne sur les PG des mailles" << endl;
+          for (imaille = 0; imaille < nmailles; imaille++)
+            {
+              for (icomp = 0; icomp < nCompChamp; icomp++)
+                {
+                  float valCompMaille = 0.0;
+                  for (igauss = 0; igauss < ngauss; igauss++)
+                    valCompMaille += *(valr + imaille * ngauss * nCompChamp + igauss * nCompChamp + icomp);
+                  *(valr2 + imaille * nCompChamp + icomp) = valCompMaille / ngauss;
+
+                }
+            }
+
+          //cout << endl << "Nom champ moy = " <<  (string)nomChampMoy << endl;
+          //cout << endl << "Type champ = " <<  typeChamp << endl;
+          //cout << endl << "Comp champ = " <<  (string)compChamp << endl;
+          //cout << endl << "Unit champ = " <<  (string)unitChamp << endl;
+          //cout << endl << "N comp champ = " <<  nCompChamp << endl;
+
+          if (MEDfieldValueWithProfileWr(fidout, nomChampMoy, numdt, numo, dt, MEM, MGE, MED_COMPACT_PFLMODE,
+                                         nomprofil, MED_NO_LOCALIZATION, MED_FULL_INTERLACE, MED_ALL_CONSTITUENT,
+                                         (med_int) nmailles, (unsigned char*) valr2) < 0)
+            {
+              cout << endl;
+              cout << endl << "********************************************************************" << endl;
+              cout << "********************                         ***********************" << endl;
+              cout << "********************   ERREUR MEDchampEcr    ***********************" << endl;
+              cout << "********************                         ***********************" << endl;
+              cout << "********************************************************************" << endl;
+              cout << endl;
+              cout << "   Champ: " << (string) nomChampMoy << endl;
+              cout << "   Géométrie: " << MGE2string(MGE) << endl;
+              cout << "   Pas de temps " << ipt << " ignoré" << endl;
+              cout << endl << endl;
+              continue;
+            }
+
+          if (debug)
+            cout << "    Ecriture des valeurs moyennées dans le nouveau champ: OK " << endl;
+
+          // Restitution du champ moyenné
+          if (debug)
+            {
+              cout << endl << "       Liste des valeurs du champ moyenné aux 3 premiers éléments:" << endl;
+              for (imaille = 0; imaille < min(nmailles, 3); imaille++)
+                {
+                  cout << "         Maille " << imaille << endl;
+                  for (icomp = 0; icomp < nCompChamp; icomp++)
+                    cout << " " << *(valr2 + imaille * nCompChamp + icomp);
+                  cout << endl;
+                }
+              cout << endl;
+            }
+
+        }
+
+      free(valr);
+      free(valr2);
+
+    } // boucle sur les pas de temps
+
+  cout << endl;
+}
+
+std::string MESHCUT::nomMaille(TYPE_MAILLE tm, int nl)
+{
+  return (TM2string(tm) + (string) "_" + int2string(nl));
+}
+
+bool MESHCUT::appartientVN(int n, std::vector<int> V)
+{
+  bool app = false;
+  for (unsigned int i = 0; i < V.size(); i++)
+    if (n == V[i])
+      {
+        app = true;
+        break;
+      }
+  return app;
+}
+
+float MESHCUT::distance2(float x1, float y1, float z1, float x2, float y2, float z2)
+{
+  return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) + (z2 - z1) * (z2 - z1);
+}
+
+/*!
+ *  Conversion HL-MED d'une table de connectivités
+ */
+void MESHCUT::conversionCNX(int *CNXtm, TYPE_MAILLE tm, int N)
+{
+
+  int n = Nnoeuds(tm);
+
+  if (tm == TETRA4)
+    {
+      for (int i = 0; i < N; i++)
+        {
+          int i1 = CNXtm[i * n + 1];
+          int i2 = CNXtm[i * n + 2];
+          CNXtm[i * n + 1] = i2;
+          CNXtm[i * n + 2] = i1;
+        }
+    }
+  else if (tm == PYRAM5)
+    {
+      for (int i = 0; i < N; i++)
+        {
+          int i1 = CNXtm[i * n + 1];
+          int i3 = CNXtm[i * n + 3];
+          CNXtm[i * n + 1] = i3;
+          CNXtm[i * n + 3] = i1;
+        }
+    }
+  else if (tm == PENTA6)
+    {
+      for (int i = 0; i < N; i++)
+        {
+          int i0 = CNXtm[i * n + 0];
+          int i1 = CNXtm[i * n + 1];
+          int i2 = CNXtm[i * n + 2];
+          int i3 = CNXtm[i * n + 3];
+          int i4 = CNXtm[i * n + 4];
+          int i5 = CNXtm[i * n + 5];
+          CNXtm[i * n + 0] = i3;
+          CNXtm[i * n + 1] = i4;
+          CNXtm[i * n + 2] = i5;
+          CNXtm[i * n + 3] = i0;
+          CNXtm[i * n + 4] = i1;
+          CNXtm[i * n + 5] = i2;
+        }
+    }
+
+  else if (tm == HEXA8)
+    {
+      for (int i = 0; i < N; i++)
+        {
+          int i0 = CNXtm[i * n + 0];
+          int i1 = CNXtm[i * n + 1];
+          int i2 = CNXtm[i * n + 2];
+          int i3 = CNXtm[i * n + 3];
+          int i4 = CNXtm[i * n + 4];
+          int i5 = CNXtm[i * n + 5];
+          int i6 = CNXtm[i * n + 6];
+          int i7 = CNXtm[i * n + 7];
+          CNXtm[i * n + 0] = i4;
+          CNXtm[i * n + 1] = i5;
+          CNXtm[i * n + 2] = i6;
+          CNXtm[i * n + 3] = i7;
+          CNXtm[i * n + 4] = i0;
+          CNXtm[i * n + 5] = i1;
+          CNXtm[i * n + 6] = i2;
+          CNXtm[i * n + 7] = i3;
+        }
+    }
+}
+
diff --git a/src/Tools/MeshCut/MeshCut_Utils.hxx b/src/Tools/MeshCut/MeshCut_Utils.hxx
new file mode 100644 (file)
index 0000000..0bc9a52
--- /dev/null
@@ -0,0 +1,62 @@
+#ifndef __MESHCUT_UTILS_HXX__
+#define __MESHCUT_UTILS_HXX__
+
+extern "C"
+  {
+#include <med.h>
+  }
+
+#include <string>
+#include <vector>
+#include <map>
+
+namespace MESHCUT
+  {
+
+    enum TYPE_MAILLE
+    {
+      POI1, SEG2, SEG3, TRIA3, TRIA6, QUAD4, QUAD8, TETRA4, TETRA10, PYRAM5, PYRAM13, PENTA6, PENTA15, HEXA8, HEXA20
+    };
+
+    bool estUnTypeMaille(std::string S);
+    void ERREUR(const char* msg);
+    char* string2char(std::string str);
+    std::string int2string(int k);
+    float char2float(const char* ch);
+    std::string float2string(float f);
+    bool appartient(std::string e, std::string tableau[], int taille);
+    float arrondi(float x);
+    int numNoeudPointe(std::string b1, std::string b2, std::string b3);
+    std::string strip(std::string S);
+    std::string entierSur10_g(int i);
+    std::string entierSur10_d(int i);
+    std::string typeEnsight(std::string type);
+    int Nnoeuds(TYPE_MAILLE type);
+    int NnoeudsGeom(TYPE_MAILLE type);
+    int codeGMSH(std::string type);
+    std::string floatEnsight(float x);
+    bool typeComplexe(std::string type);
+    std::string ASTER8(std::string s);
+    float dObservateur(float a, float b, float c);
+
+    int copieFichier(std::string source, std::string cible);
+    med_geometry_type InstanceMGE(TYPE_MAILLE TYPE);
+    int chrono();
+    TYPE_MAILLE typeMaille(std::string type);
+    std::string MGE2string(med_geometry_type MGE);
+    std::string TM2string(TYPE_MAILLE MGE);
+    TYPE_MAILLE string2TM(std::string stm);
+    std::string coordIndex_ILS(TYPE_MAILLE tm);
+    std::string coordIndex_IFS(TYPE_MAILLE tm);
+    std::string SIGNE(double x);
+    void champType(std::string type, med_entity_type MEM, med_geometry_type MGE, med_idt fid, med_idt fidout,
+                   char *maa, char *nomChamp, char *nomChampMoy, med_field_type typeChamp, char *compChamp,
+                   char *unitChamp, med_int nCompChamp, std::map<std::string, int> REFGAUSS, int ichamp);
+    std::string nomMaille(TYPE_MAILLE tm, int nl);
+    bool appartientVN(int n, std::vector<int> V);
+    float distance2(float x1, float y1, float z1, float x2, float y2, float z2);
+    void conversionCNX(int *CNXtm, TYPE_MAILLE tm, int N);
+
+  }
+
+#endif
diff --git a/src/Tools/MeshCut/README b/src/Tools/MeshCut/README
new file mode 100644 (file)
index 0000000..6dbff87
--- /dev/null
@@ -0,0 +1,26 @@
+
+
+                 Cut a tetrahedron mesh by a plane
+                 ---------------------------------
+                 
+MeshCut allows to cut a mesh constituted of linear tetrahedrons by a plane.
+The tetrahedrons intersected by the plane are cut and replaced by elements of various types,
+(tetrahedron, pyramid, pentahedron).
+
+MeshCut is a standalone program, reading and producing med files.                
+                 
+Syntax:
+
+MeshCut input.med output.med resuMeshName aboveGroup belowGroup nx ny nz px py pz T
+
+where:
+  input.med    = name of the original mesh file in med format
+  output.med   = name of the result mesh file in med format
+  resuMeshName = name of the result mesh
+  aboveGroup   = name of the group of volumes above the cut plane
+  belowGroups  = name of the group of volumes below the cut plane
+  nx ny nz     = vector normal to the cut plane
+  px py pz     = a point of the cut plane
+  T            = 0 < T < 1 : vertices of a tetrahedron are considered as belonging
+                 the cut plane if their distance to the plane is inferior to L*T
+                 where L is the mean edge size of the tetrahedron