The Higher Education and Research forge

Home My Page Projects Code Snippets Project Openings MMD
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

authorAlain <alain.bastide@univ-reunion.fr>
Sun, 28 Jun 2020 01:47:10 +0000 (05:47 +0400)
committerAlain <alain.bastide@univ-reunion.fr>
Sun, 28 Jun 2020 02:58:45 +0000 (06:58 +0400)
.gitignore
CMakeLists.txt
MMD [new file with mode: 0755]
Makefile [new file with mode: 0644]
cmake_install.cmake [new file with mode: 0644]
src/main.c
src/mmd.h

index 39bfe6a..69a9c04 100644 (file)
@@ -39,3 +39,5 @@ CMakeLists.txt.user
 *.odt
 *.tcl
 test/
+Testing/
+CTest*
index 531fe31..d3ea5f8 100644 (file)
@@ -1,5 +1,10 @@
-cmake_minimum_required(VERSION 2.8)
-
+cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR)
+if(POLICY CMP0025)
+  cmake_policy(SET CMP0025 NEW) # CMake 3.0
+endif()
+if(POLICY CMP0053)
+  cmake_policy(SET CMP0053 NEW) # CMake 3.1
+endif()
 ## #include(optimizeArch.cmake)
 
 project(MMD)
@@ -9,7 +14,7 @@ if(NOT CMAKE_BUILD_TYPE)
   set(CMAKE_BUILD_TYPE Release)
 endif()
 
-set(CMAKE_C_FLAGS "-Wall -Wextra -Wabi")
+set(CMAKE_C_FLAGS "-Wall -Wextra")
 set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG -march=skylake     -mtune=skylake")
 set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG -march=skylake         -mtune=skylake")
 
@@ -24,28 +29,49 @@ endif()
 
 #OptimizeForArchitecture()
 
-set (VTK_DIR "/usr/include/vtk-7.1")
+#set (VTK_DIR "/usr/include/vtk-7.1")
 
 find_package(VTK REQUIRED)
-find_package(VTK COMPONENTS
+vtk_module_config(VTK
   vtkCommonCore
   vtkCommonDataModel
-  vtkIOLegacy QUIET)
+  vtkFiltersSources
+  vtkInteractionStyle
+  vtkRendering${VTK_RENDERING_BACKEND}
+)
 include(${VTK_USE_FILE})
-IF(VTK_FOUND)
-  message("found VTK. Version:" ${VTK_VERSION}. VTK_DIR: ${VTK_DIR})
-ELSE(VTK_FOUND)
-  MESSAGE(FATAL_ERROR
-    "Cannot build the executable without VTK. Please set the VTK_DIR")
-ENDIF(VTK_FOUND)
+
+#find_package(VTK REQUIRED)
+#find_package(VTK COMPONENTS
+#  vtkCommonCore
+#  vtkCommonDataModel
+#  vtkIOLegacy 
+#  QUIET)
+#include(${VTK_USE_FILE})
+#IF(VTK_FOUND)
+#  message("found VTK. Version:" ${VTK_VERSION}. VTK_DIR: ${VTK_DIR})
+#ELSE(VTK_FOUND)
+#  MESSAGE(FATAL_ERROR
+#    "Cannot build the executable without VTK. Please set the VTK_DIR")
+#ENDIF(VTK_FOUND)
 
 add_executable(${PROJECT_NAME} ${SRC_FILES})
-target_link_libraries(${PROJECT_NAME} m)
+target_link_libraries(${PROJECT_NAME} m ${VTK_LIBRARIES})
 
 message("CXXFLAGS:" ${CMAKE_CXX_FLAGS})
 message("CFLAGS  :" ${CMAKE_C_FLAGS})
 
 
+include(CTest)
+ENABLE_TESTING()
+
+#ADD_TEST( testname testexecutable args )
+set ( TESTS ${CMAKE_SOURCE_DIR}/test/test )
+add_subdirectory(${TESTS})
+
+
+
+### DOCUMENTATION
 
 ## first we can indicate the documentation build as an option and set it to ON by default
 #option(BUILD_DOC "Build documentation" ON)
diff --git a/MMD b/MMD
new file mode 100755 (executable)
index 0000000..dcace16
Binary files /dev/null and b/MMD differ
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..d40cfd8
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,646 @@
+# CMAKE generated file: DO NOT EDIT!
+# Generated by "Unix Makefiles" Generator, CMake Version 3.17
+
+# Default target executed when no arguments are given to make.
+default_target: all
+
+.PHONY : default_target
+
+# Allow only one "make -f Makefile2" at a time, but pass parallelism.
+.NOTPARALLEL:
+
+
+#=============================================================================
+# Special targets provided by cmake.
+
+# Disable implicit rules so canonical targets will work.
+.SUFFIXES:
+
+
+# Disable VCS-based implicit rules.
+% : %,v
+
+
+# Disable VCS-based implicit rules.
+% : RCS/%
+
+
+# Disable VCS-based implicit rules.
+% : RCS/%,v
+
+
+# Disable VCS-based implicit rules.
+% : SCCS/s.%
+
+
+# Disable VCS-based implicit rules.
+% : s.%
+
+
+.SUFFIXES: .hpux_make_needs_suffix_list
+
+
+# Command-line flag to silence nested $(MAKE).
+$(VERBOSE)MAKESILENT = -s
+
+# Suppress display of executed commands.
+$(VERBOSE).SILENT:
+
+
+# A target that is always out of date.
+cmake_force:
+
+.PHONY : cmake_force
+
+#=============================================================================
+# Set environment variables for the build.
+
+# The shell in which to execute make rules.
+SHELL = /bin/sh
+
+# The CMake executable.
+CMAKE_COMMAND = /usr/bin/cmake
+
+# The command to remove a file.
+RM = /usr/bin/cmake -E rm -f
+
+# Escaping for special characters.
+EQUALS = =
+
+# The top-level source directory on which CMake was run.
+CMAKE_SOURCE_DIR = /home/alain/CloudStation/MMD_QM/MMD/MMD_github/MMD
+
+# The top-level build directory on which CMake was run.
+CMAKE_BINARY_DIR = /home/alain/CloudStation/MMD_QM/MMD/MMD_github/MMD
+
+#=============================================================================
+# Targets provided globally by CMake.
+
+# Special rule for the target rebuild_cache
+rebuild_cache:
+       @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
+       /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+.PHONY : rebuild_cache
+
+# Special rule for the target rebuild_cache
+rebuild_cache/fast: rebuild_cache
+
+.PHONY : rebuild_cache/fast
+
+# Special rule for the target test
+test:
+       @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running tests..."
+       /usr/bin/ctest --force-new-ctest-process $(ARGS)
+.PHONY : test
+
+# Special rule for the target test
+test/fast: test
+
+.PHONY : test/fast
+
+# Special rule for the target edit_cache
+edit_cache:
+       @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
+       /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
+.PHONY : edit_cache
+
+# Special rule for the target edit_cache
+edit_cache/fast: edit_cache
+
+.PHONY : edit_cache/fast
+
+# The main all target
+all: cmake_check_build_system
+       $(CMAKE_COMMAND) -E cmake_progress_start /home/alain/CloudStation/MMD_QM/MMD/MMD_github/MMD/CMakeFiles /home/alain/CloudStation/MMD_QM/MMD/MMD_github/MMD/CMakeFiles/progress.marks
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all
+       $(CMAKE_COMMAND) -E cmake_progress_start /home/alain/CloudStation/MMD_QM/MMD/MMD_github/MMD/CMakeFiles 0
+.PHONY : all
+
+# The main clean target
+clean:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean
+.PHONY : clean
+
+# The main clean target
+clean/fast: clean
+
+.PHONY : clean/fast
+
+# Prepare targets for installation.
+preinstall: all
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
+.PHONY : preinstall
+
+# Prepare targets for installation.
+preinstall/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
+.PHONY : preinstall/fast
+
+# clear depends
+depend:
+       $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
+.PHONY : depend
+
+#=============================================================================
+# Target rules for targets named NightlyMemCheck
+
+# Build rule for target.
+NightlyMemCheck: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyMemCheck
+.PHONY : NightlyMemCheck
+
+# fast build rule for target.
+NightlyMemCheck/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyMemCheck.dir/build.make CMakeFiles/NightlyMemCheck.dir/build
+.PHONY : NightlyMemCheck/fast
+
+#=============================================================================
+# Target rules for targets named ContinuousConfigure
+
+# Build rule for target.
+ContinuousConfigure: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousConfigure
+.PHONY : ContinuousConfigure
+
+# fast build rule for target.
+ContinuousConfigure/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousConfigure.dir/build.make CMakeFiles/ContinuousConfigure.dir/build
+.PHONY : ContinuousConfigure/fast
+
+#=============================================================================
+# Target rules for targets named ContinuousBuild
+
+# Build rule for target.
+ContinuousBuild: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousBuild
+.PHONY : ContinuousBuild
+
+# fast build rule for target.
+ContinuousBuild/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousBuild.dir/build.make CMakeFiles/ContinuousBuild.dir/build
+.PHONY : ContinuousBuild/fast
+
+#=============================================================================
+# Target rules for targets named NightlyConfigure
+
+# Build rule for target.
+NightlyConfigure: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyConfigure
+.PHONY : NightlyConfigure
+
+# fast build rule for target.
+NightlyConfigure/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyConfigure.dir/build.make CMakeFiles/NightlyConfigure.dir/build
+.PHONY : NightlyConfigure/fast
+
+#=============================================================================
+# Target rules for targets named NightlyMemoryCheck
+
+# Build rule for target.
+NightlyMemoryCheck: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyMemoryCheck
+.PHONY : NightlyMemoryCheck
+
+# fast build rule for target.
+NightlyMemoryCheck/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyMemoryCheck.dir/build.make CMakeFiles/NightlyMemoryCheck.dir/build
+.PHONY : NightlyMemoryCheck/fast
+
+#=============================================================================
+# Target rules for targets named ExperimentalTest
+
+# Build rule for target.
+ExperimentalTest: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalTest
+.PHONY : ExperimentalTest
+
+# fast build rule for target.
+ExperimentalTest/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalTest.dir/build.make CMakeFiles/ExperimentalTest.dir/build
+.PHONY : ExperimentalTest/fast
+
+#=============================================================================
+# Target rules for targets named ContinuousUpdate
+
+# Build rule for target.
+ContinuousUpdate: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousUpdate
+.PHONY : ContinuousUpdate
+
+# fast build rule for target.
+ContinuousUpdate/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousUpdate.dir/build.make CMakeFiles/ContinuousUpdate.dir/build
+.PHONY : ContinuousUpdate/fast
+
+#=============================================================================
+# Target rules for targets named NightlyUpdate
+
+# Build rule for target.
+NightlyUpdate: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyUpdate
+.PHONY : NightlyUpdate
+
+# fast build rule for target.
+NightlyUpdate/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyUpdate.dir/build.make CMakeFiles/NightlyUpdate.dir/build
+.PHONY : NightlyUpdate/fast
+
+#=============================================================================
+# Target rules for targets named ExperimentalMemCheck
+
+# Build rule for target.
+ExperimentalMemCheck: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalMemCheck
+.PHONY : ExperimentalMemCheck
+
+# fast build rule for target.
+ExperimentalMemCheck/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalMemCheck.dir/build.make CMakeFiles/ExperimentalMemCheck.dir/build
+.PHONY : ExperimentalMemCheck/fast
+
+#=============================================================================
+# Target rules for targets named ExperimentalSubmit
+
+# Build rule for target.
+ExperimentalSubmit: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalSubmit
+.PHONY : ExperimentalSubmit
+
+# fast build rule for target.
+ExperimentalSubmit/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalSubmit.dir/build.make CMakeFiles/ExperimentalSubmit.dir/build
+.PHONY : ExperimentalSubmit/fast
+
+#=============================================================================
+# Target rules for targets named Experimental
+
+# Build rule for target.
+Experimental: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 Experimental
+.PHONY : Experimental
+
+# fast build rule for target.
+Experimental/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Experimental.dir/build.make CMakeFiles/Experimental.dir/build
+.PHONY : Experimental/fast
+
+#=============================================================================
+# Target rules for targets named ContinuousCoverage
+
+# Build rule for target.
+ContinuousCoverage: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousCoverage
+.PHONY : ContinuousCoverage
+
+# fast build rule for target.
+ContinuousCoverage/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousCoverage.dir/build.make CMakeFiles/ContinuousCoverage.dir/build
+.PHONY : ContinuousCoverage/fast
+
+#=============================================================================
+# Target rules for targets named ExperimentalConfigure
+
+# Build rule for target.
+ExperimentalConfigure: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalConfigure
+.PHONY : ExperimentalConfigure
+
+# fast build rule for target.
+ExperimentalConfigure/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalConfigure.dir/build.make CMakeFiles/ExperimentalConfigure.dir/build
+.PHONY : ExperimentalConfigure/fast
+
+#=============================================================================
+# Target rules for targets named Continuous
+
+# Build rule for target.
+Continuous: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 Continuous
+.PHONY : Continuous
+
+# fast build rule for target.
+Continuous/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Continuous.dir/build.make CMakeFiles/Continuous.dir/build
+.PHONY : Continuous/fast
+
+#=============================================================================
+# Target rules for targets named Nightly
+
+# Build rule for target.
+Nightly: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 Nightly
+.PHONY : Nightly
+
+# fast build rule for target.
+Nightly/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Nightly.dir/build.make CMakeFiles/Nightly.dir/build
+.PHONY : Nightly/fast
+
+#=============================================================================
+# Target rules for targets named NightlySubmit
+
+# Build rule for target.
+NightlySubmit: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlySubmit
+.PHONY : NightlySubmit
+
+# fast build rule for target.
+NightlySubmit/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlySubmit.dir/build.make CMakeFiles/NightlySubmit.dir/build
+.PHONY : NightlySubmit/fast
+
+#=============================================================================
+# Target rules for targets named NightlyStart
+
+# Build rule for target.
+NightlyStart: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyStart
+.PHONY : NightlyStart
+
+# fast build rule for target.
+NightlyStart/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyStart.dir/build.make CMakeFiles/NightlyStart.dir/build
+.PHONY : NightlyStart/fast
+
+#=============================================================================
+# Target rules for targets named ExperimentalCoverage
+
+# Build rule for target.
+ExperimentalCoverage: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalCoverage
+.PHONY : ExperimentalCoverage
+
+# fast build rule for target.
+ExperimentalCoverage/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalCoverage.dir/build.make CMakeFiles/ExperimentalCoverage.dir/build
+.PHONY : ExperimentalCoverage/fast
+
+#=============================================================================
+# Target rules for targets named NightlyCoverage
+
+# Build rule for target.
+NightlyCoverage: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyCoverage
+.PHONY : NightlyCoverage
+
+# fast build rule for target.
+NightlyCoverage/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyCoverage.dir/build.make CMakeFiles/NightlyCoverage.dir/build
+.PHONY : NightlyCoverage/fast
+
+#=============================================================================
+# Target rules for targets named NightlyTest
+
+# Build rule for target.
+NightlyTest: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyTest
+.PHONY : NightlyTest
+
+# fast build rule for target.
+NightlyTest/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyTest.dir/build.make CMakeFiles/NightlyTest.dir/build
+.PHONY : NightlyTest/fast
+
+#=============================================================================
+# Target rules for targets named ExperimentalStart
+
+# Build rule for target.
+ExperimentalStart: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalStart
+.PHONY : ExperimentalStart
+
+# fast build rule for target.
+ExperimentalStart/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalStart.dir/build.make CMakeFiles/ExperimentalStart.dir/build
+.PHONY : ExperimentalStart/fast
+
+#=============================================================================
+# Target rules for targets named NightlyBuild
+
+# Build rule for target.
+NightlyBuild: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyBuild
+.PHONY : NightlyBuild
+
+# fast build rule for target.
+NightlyBuild/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyBuild.dir/build.make CMakeFiles/NightlyBuild.dir/build
+.PHONY : NightlyBuild/fast
+
+#=============================================================================
+# Target rules for targets named ExperimentalBuild
+
+# Build rule for target.
+ExperimentalBuild: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalBuild
+.PHONY : ExperimentalBuild
+
+# fast build rule for target.
+ExperimentalBuild/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalBuild.dir/build.make CMakeFiles/ExperimentalBuild.dir/build
+.PHONY : ExperimentalBuild/fast
+
+#=============================================================================
+# Target rules for targets named ExperimentalUpdate
+
+# Build rule for target.
+ExperimentalUpdate: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalUpdate
+.PHONY : ExperimentalUpdate
+
+# fast build rule for target.
+ExperimentalUpdate/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalUpdate.dir/build.make CMakeFiles/ExperimentalUpdate.dir/build
+.PHONY : ExperimentalUpdate/fast
+
+#=============================================================================
+# Target rules for targets named ContinuousStart
+
+# Build rule for target.
+ContinuousStart: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousStart
+.PHONY : ContinuousStart
+
+# fast build rule for target.
+ContinuousStart/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousStart.dir/build.make CMakeFiles/ContinuousStart.dir/build
+.PHONY : ContinuousStart/fast
+
+#=============================================================================
+# Target rules for targets named ContinuousMemCheck
+
+# Build rule for target.
+ContinuousMemCheck: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousMemCheck
+.PHONY : ContinuousMemCheck
+
+# fast build rule for target.
+ContinuousMemCheck/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousMemCheck.dir/build.make CMakeFiles/ContinuousMemCheck.dir/build
+.PHONY : ContinuousMemCheck/fast
+
+#=============================================================================
+# Target rules for targets named MMD
+
+# Build rule for target.
+MMD: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 MMD
+.PHONY : MMD
+
+# fast build rule for target.
+MMD/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/MMD.dir/build.make CMakeFiles/MMD.dir/build
+.PHONY : MMD/fast
+
+#=============================================================================
+# Target rules for targets named ContinuousTest
+
+# Build rule for target.
+ContinuousTest: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousTest
+.PHONY : ContinuousTest
+
+# fast build rule for target.
+ContinuousTest/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousTest.dir/build.make CMakeFiles/ContinuousTest.dir/build
+.PHONY : ContinuousTest/fast
+
+#=============================================================================
+# Target rules for targets named ContinuousSubmit
+
+# Build rule for target.
+ContinuousSubmit: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousSubmit
+.PHONY : ContinuousSubmit
+
+# fast build rule for target.
+ContinuousSubmit/fast:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousSubmit.dir/build.make CMakeFiles/ContinuousSubmit.dir/build
+.PHONY : ContinuousSubmit/fast
+
+#=============================================================================
+# Target rules for targets named my_test
+
+# Build rule for target.
+my_test: cmake_check_build_system
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 my_test
+.PHONY : my_test
+
+# fast build rule for target.
+my_test/fast:
+       $(MAKE) $(MAKESILENT) -f test/test/CMakeFiles/my_test.dir/build.make test/test/CMakeFiles/my_test.dir/build
+.PHONY : my_test/fast
+
+src/main.o: src/main.c.o
+
+.PHONY : src/main.o
+
+# target to build an object file
+src/main.c.o:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/MMD.dir/build.make CMakeFiles/MMD.dir/src/main.c.o
+.PHONY : src/main.c.o
+
+src/main.i: src/main.c.i
+
+.PHONY : src/main.i
+
+# target to preprocess a source file
+src/main.c.i:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/MMD.dir/build.make CMakeFiles/MMD.dir/src/main.c.i
+.PHONY : src/main.c.i
+
+src/main.s: src/main.c.s
+
+.PHONY : src/main.s
+
+# target to generate assembly for a file
+src/main.c.s:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/MMD.dir/build.make CMakeFiles/MMD.dir/src/main.c.s
+.PHONY : src/main.c.s
+
+src/tensor.o: src/tensor.c.o
+
+.PHONY : src/tensor.o
+
+# target to build an object file
+src/tensor.c.o:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/MMD.dir/build.make CMakeFiles/MMD.dir/src/tensor.c.o
+.PHONY : src/tensor.c.o
+
+src/tensor.i: src/tensor.c.i
+
+.PHONY : src/tensor.i
+
+# target to preprocess a source file
+src/tensor.c.i:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/MMD.dir/build.make CMakeFiles/MMD.dir/src/tensor.c.i
+.PHONY : src/tensor.c.i
+
+src/tensor.s: src/tensor.c.s
+
+.PHONY : src/tensor.s
+
+# target to generate assembly for a file
+src/tensor.c.s:
+       $(MAKE) $(MAKESILENT) -f CMakeFiles/MMD.dir/build.make CMakeFiles/MMD.dir/src/tensor.c.s
+.PHONY : src/tensor.c.s
+
+# Help Target
+help:
+       @echo "The following are some of the valid targets for this Makefile:"
+       @echo "... all (the default if no target is provided)"
+       @echo "... clean"
+       @echo "... depend"
+       @echo "... edit_cache"
+       @echo "... rebuild_cache"
+       @echo "... test"
+       @echo "... Continuous"
+       @echo "... ContinuousBuild"
+       @echo "... ContinuousConfigure"
+       @echo "... ContinuousCoverage"
+       @echo "... ContinuousMemCheck"
+       @echo "... ContinuousStart"
+       @echo "... ContinuousSubmit"
+       @echo "... ContinuousTest"
+       @echo "... ContinuousUpdate"
+       @echo "... Experimental"
+       @echo "... ExperimentalBuild"
+       @echo "... ExperimentalConfigure"
+       @echo "... ExperimentalCoverage"
+       @echo "... ExperimentalMemCheck"
+       @echo "... ExperimentalStart"
+       @echo "... ExperimentalSubmit"
+       @echo "... ExperimentalTest"
+       @echo "... ExperimentalUpdate"
+       @echo "... Nightly"
+       @echo "... NightlyBuild"
+       @echo "... NightlyConfigure"
+       @echo "... NightlyCoverage"
+       @echo "... NightlyMemCheck"
+       @echo "... NightlyMemoryCheck"
+       @echo "... NightlyStart"
+       @echo "... NightlySubmit"
+       @echo "... NightlyTest"
+       @echo "... NightlyUpdate"
+       @echo "... MMD"
+       @echo "... my_test"
+       @echo "... src/main.o"
+       @echo "... src/main.i"
+       @echo "... src/main.s"
+       @echo "... src/tensor.o"
+       @echo "... src/tensor.i"
+       @echo "... src/tensor.s"
+.PHONY : help
+
+
+
+#=============================================================================
+# Special targets to cleanup operation of make.
+
+# Special rule to run CMake to check the build system integrity.
+# No rule that depends on this can have commands that come from listfiles
+# because they might be regenerated.
+cmake_check_build_system:
+       $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
+.PHONY : cmake_check_build_system
+
diff --git a/cmake_install.cmake b/cmake_install.cmake
new file mode 100644 (file)
index 0000000..8526312
--- /dev/null
@@ -0,0 +1,55 @@
+# Install script for directory: /home/alain/CloudStation/MMD_QM/MMD/MMD_github/MMD
+
+# Set the install prefix
+if(NOT DEFINED CMAKE_INSTALL_PREFIX)
+  set(CMAKE_INSTALL_PREFIX "/usr/local")
+endif()
+string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
+
+# Set the install configuration name.
+if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
+  if(BUILD_TYPE)
+    string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
+           CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
+  else()
+    set(CMAKE_INSTALL_CONFIG_NAME "Release")
+  endif()
+  message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
+endif()
+
+# Set the component getting installed.
+if(NOT CMAKE_INSTALL_COMPONENT)
+  if(COMPONENT)
+    message(STATUS "Install component: \"${COMPONENT}\"")
+    set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
+  else()
+    set(CMAKE_INSTALL_COMPONENT)
+  endif()
+endif()
+
+# Install shared libraries without execute permission?
+if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
+  set(CMAKE_INSTALL_SO_NO_EXE "1")
+endif()
+
+# Is this installation the result of a crosscompile?
+if(NOT DEFINED CMAKE_CROSSCOMPILING)
+  set(CMAKE_CROSSCOMPILING "FALSE")
+endif()
+
+if(NOT CMAKE_INSTALL_LOCAL_ONLY)
+  # Include the install script for each subdirectory.
+  include("/home/alain/CloudStation/MMD_QM/MMD/MMD_github/MMD/test/test/cmake_install.cmake")
+
+endif()
+
+if(CMAKE_INSTALL_COMPONENT)
+  set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
+else()
+  set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
+endif()
+
+string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
+       "${CMAKE_INSTALL_MANIFEST_FILES}")
+file(WRITE "/home/alain/CloudStation/MMD_QM/MMD/MMD_github/MMD/${CMAKE_INSTALL_MANIFEST}"
+     "${CMAKE_INSTALL_MANIFEST_CONTENT}")
index fc5ac56..24e4ead 100644 (file)
@@ -23,6 +23,8 @@ connectivity_int  hexaedron_localNodeListNumbers[HEXAHEDRON_FACES]={ \
 
 #define PT1 0
 #define PT2 1
+#define PT3 2
+#define PT4 3
 #define CELL1 0
 #define CELL2 1
 
@@ -186,6 +188,53 @@ void invertListSort(connectivity_int ** result,connectivity_int * vector,connect
   
 }
 
+void intersectTwoIntegerSet(connectivity_int ** output , connectivity_int * lenOutput , connectivity_int * inputOne , connectivity_int  lenInputOne , connectivity_int * inputTwo, connectivity_int  lenInputTwo)
+{
+  
+  (*lenOutput)=0;
+  //  affiche("%ld\n",lenInputOne);
+  //  affiche("%ld\n",lenInputTwo);
+  
+  for(connectivity_int posAi=0;posAi<lenInputOne;posAi++)
+    for(connectivity_int posBi=0;posBi<lenInputTwo;posBi++)
+      {
+        if(inputOne[posAi]==inputTwo[posBi])
+          {
+            (*output)[(*lenOutput)] = inputOne[posAi];
+            (*lenOutput)++;
+          }
+      }
+  
+  removeDuplicates((*output), lenOutput);
+}
+
+
+
+void unionTwoIntegerSet(connectivity_int ** output , connectivity_int * lenOutput , connectivity_int * inputOne , connectivity_int  lenInputOne , connectivity_int * inputTwo, connectivity_int  lenInputTwo)
+{
+  
+  (*lenOutput)=0;
+  //  affiche("%ld\n",lenInputOne);
+  //  affiche("%ld\n",lenInputTwo);
+  
+  (*output) = (connectivity_int * ) malloc(sizeof(connectivity_int)*(lenInputOne+lenInputTwo));
+  
+  for(connectivity_int posAi=0;posAi<lenInputOne;posAi++)
+    {
+      (*output)[(*lenOutput)] = inputOne[posAi];
+      (*lenOutput)++;
+    }
+  
+  for(connectivity_int posBi=0;posBi<lenInputTwo;posBi++)
+    {
+      (*output)[(*lenOutput)] = inputTwo[posBi];
+      (*lenOutput)++;
+    }
+  
+  removeDuplicates((*output), lenOutput);
+}
+
+
 void findListFromList(connectivity_int ** matrix, connectivity_int * matrixRowNumbers, connectivity_int size, connectivity_int * whatToFind, connectivity_int sizewhatToFind )
 {
   
@@ -463,7 +512,7 @@ void allocMemoryForSpecialMatrixConnectivity(connectivity_int *** result, connec
 
 //}
 
-void freeMemory(struct primalMesh * myPrimalMesh)
+void freeMemory(struct primalMesh * myPrimalMesh, struct dualMesh * myDualMesh)
 {
   clock_t t=startFunction(__FUNCTION__);
   
@@ -757,6 +806,36 @@ void freeMemory(struct primalMesh * myPrimalMesh)
     }
   
   
+  
+  /// DUAL MESH
+  
+  
+  if(myDualMesh->internalDualFaces!=NULL)
+    {
+      for(connectivity_int facei=0;facei<myDualMesh->internalDualFacesNumber;facei++)
+        free(myDualMesh->internalDualFaces[facei]);
+      free(myDualMesh->internalDualFaces);  
+    }
+  
+  
+  
+  if(myDualMesh->segmentToInternalDualFace!=NULL)
+    {
+      for(connectivity_int segmenti=0;segmenti<myPrimalMesh->segmentNumber;segmenti++)
+        free(myDualMesh->segmentToInternalDualFace[segmenti]);
+      free(myDualMesh->segmentToInternalDualFace);  
+    }
+  
+  
+  if(myDualMesh->segmentToInternalDualFaceNumber!=NULL)
+    {
+      free(myDualMesh->segmentToInternalDualFaceNumber); 
+    }
+  
+  
+  
+  
+  
   endFunction(__FUNCTION__, t);
   
 }
@@ -782,14 +861,6 @@ void setHexahedreVertex(struct primalMesh * myPrimalMesh)
   
   allocMemoryForMatrixDataType(&(myPrimalMesh->vertex) , myPrimalMesh->vertexNumber,DIM3D);
   
-  //    myPrimalMesh->vertex = (dataType **) malloc(myPrimalMesh->vertexNumber * sizeof(dataType *));
-  //    //ERROR_TEST( (myPrimalMesh->vertex) );
-  //    for(connectivity_int i=0; i<myPrimalMesh->vertexNumber; i++)
-  //    {
-  //        myPrimalMesh->vertex[i] = (dataType *) malloc(DIM3D * sizeof(dataType));
-  //        memset(myPrimalMesh->vertex[i], 0.0, DIM3D*sizeof(dataType));
-  //    }
-  
   for(connectivity_int i=0;i<myPrimalMesh->M+1;i++)
     for(connectivity_int j=0;j<myPrimalMesh->N+1;j++)
       for(connectivity_int k=0;k<myPrimalMesh->P+1;k++)
@@ -798,7 +869,9 @@ void setHexahedreVertex(struct primalMesh * myPrimalMesh)
           myPrimalMesh->vertex[it_vertex][0] = i * L;
           myPrimalMesh->vertex[it_vertex][1] = j * l;
           myPrimalMesh->vertex[it_vertex][2] = k * H;
+#ifdef DEBUG  
           debug_print("%-40s : %ld (%f,%f,%f)\n","myPrimalMesh->vertex", it_vertex, myPrimalMesh->vertex[it_vertex][0], myPrimalMesh->vertex[it_vertex][1], myPrimalMesh->vertex[it_vertex][2]);
+#endif
         }
   
   endFunction(__FUNCTION__, t);
@@ -944,6 +1017,7 @@ void setHexahedreCellToVertex(struct primalMesh * myPrimalMesh)
           myPrimalMesh->cellToVertex[it_cell][7]=it_vertex8;
           
           
+#ifdef DEBUG  
           
           debug_print("%-40s : %ld (%ld %ld %ld %ld %ld %ld %ld %ld)\n",
                       "myPrimalMesh->cellToVertex",
@@ -956,6 +1030,8 @@ void setHexahedreCellToVertex(struct primalMesh * myPrimalMesh)
               myPrimalMesh->cellToVertex[it_cell][5],
               myPrimalMesh->cellToVertex[it_cell][6],
               myPrimalMesh->cellToVertex[it_cell][7] );
+#endif
+        
         }
   endFunction(__FUNCTION__, t);
 }
@@ -1093,6 +1169,7 @@ void setHexahedreVertexToCellNumbers(struct primalMesh * myPrimalMesh)
         }
     }
   
+#ifdef DEBUG  
   
   for(connectivity_int k=0;k<myPrimalMesh->cellNumber;k++)
     {
@@ -1103,7 +1180,7 @@ void setHexahedreVertexToCellNumbers(struct primalMesh * myPrimalMesh)
       }
       debug_print(")\n");
     }
-  
+#endif  
   endFunction(__FUNCTION__, t);
   
 }
@@ -1142,7 +1219,7 @@ void setHexahedreVertexToCells(struct primalMesh * myPrimalMesh)
   
   
   
-  
+#ifdef DEBUG  
   for(connectivity_int k=0;k<myPrimalMesh->vertexNumber;k++)
     {
       debug_print( "%-40s : %ld ( ","myPrimalMesh->vertexToCells", k);
@@ -1153,7 +1230,7 @@ void setHexahedreVertexToCells(struct primalMesh * myPrimalMesh)
         }
       debug_print(")\n");
     }
-  
+#endif
   free(tmp);
   
   endFunction(__FUNCTION__, t);
@@ -1163,154 +1240,6 @@ void setHexahedreVertexToCells(struct primalMesh * myPrimalMesh)
 
 
 
-/*
-void setHexahedreSegmentToVertex(struct primalMesh * myPrimalMesh)
-{
-
-    clock_t t=startFunction(__FUNCTION__);
-    affiche("\n");
-    
-    connectivity_int it_cell=0;
-    
-    // vertex number on faces
-    connectivity_int cN1 =  myPrimalMesh->P*myPrimalMesh->N;
-    
-    connectivity_int it_face=0;
-    connectivity_int it_segment=0;
-    
-    allocMemoryForMatrixConnectivity(&(myPrimalMesh->segmentToVertex),myPrimalMesh->segmentNumber,SEGMENTVERTEX);
-    connectivity_int * vertexList= (connectivity_int *) malloc(SEGMENTVERTEX * sizeof(connectivity_int));
-    connectivity_int position=0;
-    
-    myPrimalMesh->cellToCells = (connectivity_int **) malloc((myPrimalMesh->cellNumber+1) * sizeof(connectivity_int *));
-    //    myPrimalMesh->cellToCellsNumbers = (connectivity_int *) malloc( (myPrimalMesh->cellNumber+1) * sizeof(connectivity_int));
-    connectivity_int * toto=(connectivity_int * ) malloc(sizeof (connectivity_int)*SEGMENTVERTEX);
-    //    connectivity_int * cellList  = (connectivity_int * ) malloc(sizeof (connectivity_int)*cellNumbers);
-    connectivity_int * cellList  = (connectivity_int * ) malloc(sizeof (connectivity_int)*1024);
-    
-    for(connectivity_int i=0;i<myPrimalMesh->M;i++)
-        for(connectivity_int j=0;j<myPrimalMesh->N;j++)
-            for(connectivity_int k=0;k<myPrimalMesh->P;k++)
-            {
-                //it_surface = k + j*(myPrimalMesh->P+1) + i*(myPrimalMesh->P+1)*(myPrimalMesh->N+1);
-                it_cell     = k + j*myPrimalMesh->P + i*cN1; //cN1 = myPrimalMesh->P*myPrimalMesh->N;
-                it_face     = 0;
-                
-                if(myPrimalMesh->cellToVertexNumber[it_cell] == HEXAHEDRON)
-                {
-                
-                
-                
-                    connectivity_int cellNumbers = 0 ;
-                    
-                    for (connectivity_short facei=0;facei<HEXAHEDRON_FACES;facei++)
-                    {
-                        for (connectivity_short vertexi=0;vertexi<QUAD;vertexi++)
-                        {
-                            connectivity_int position;
-                            
-                            //                            myPrimalMesh->segmentToVertex[it_segment][0] =myPrimalMesh->cellToVertex[it_cell][hexaedron_localNodeList[facei][vertexi]];
-                            //                            myPrimalMesh->segmentToVertex[it_segment][1] =myPrimalMesh->cellToVertex[it_cell][hexaedron_localNodeList[facei][(vertexi+1) % QUAD]];
-                            //                            it_segment++;
-                            toto[0] =myPrimalMesh->cellToVertex[it_cell][hexaedron_localNodeList[facei][vertexi]];
-                            toto[1] =myPrimalMesh->cellToVertex[it_cell][hexaedron_localNodeList[facei][(vertexi+1) % QUAD]];
-                            
-                            // select cells
-                            
-                            //cellNumbers += myPrimalMesh->vertexToCellNumbers[toto[0]] + myPrimalMesh->vertexToCellNumbers[toto[1]] ;
-                            
-                            
-                            connectivity_int jj=0;
-                            
-                            for(connectivity_int kk=0;kk<SEGMENTVERTEX;kk++)
-                            {
-                                for(connectivity_int ii=0;ii<myPrimalMesh->vertexToCellNumbers[toto[kk]];ii++)
-                                {
-                                    if(findInList(cellList,cellNumbers, myPrimalMesh->vertexToCells[toto[kk]][ii])==-1)
-                                    {
-                                        cellList[cellNumbers + jj]=myPrimalMesh->vertexToCells[toto[kk]][ii];
-                                        
-                                        jj++;
-                                        
-                                        //cellNumbers++;
-                                    }
-                                }
-                            }
-                            cellNumbers+=jj;
-                            
-                            //                            removeDuplicates(cellList, &cellNumbers);
-                            //                            sortListConnectivity(cellList, cellNumbers);
-                            
-                            jj=0;
-                            
-                            debug_print( "%-40s : Celli (%ld) Facei (%d) Vertexi (%d) -> VERTEX (%7ld %7ld) -> CELL LIST ( ","cellList", it_cell, facei, vertexi,toto[0],toto[1]);
-                            
-                            for(connectivity_int ii=0;ii<cellNumbers;ii++)
-                            {
-                            
-                                debug_print("%ld ",cellList[jj]);
-                                jj++;
-                                
-                            }
-                            
-                            debug_print(")\n");
-                            
-                            
-                        }
-                    }
-                    
-                    
-                    //                    removeDuplicates(cellList, &cellNumbers);
-                    //                    sortListConnectivity(cellList, cellNumbers);
-                    
-                    myPrimalMesh->cellToCells[it_cell]=(connectivity_int *) malloc(sizeof (connectivity_int)*cellNumbers);
-                    
-                    for(connectivity_int kk=0;kk<cellNumbers;kk++)
-                    {
-                        myPrimalMesh->cellToCells[it_cell][kk] = cellList[kk];
-                    }
-                    
-                    myPrimalMesh->cellToCellsNumbers[it_cell] = cellNumbers;
-                    
-                }
-                
-            }
-            
-    for(connectivity_int k=0;k<myPrimalMesh->cellNumber;k++)
-    {
-        debug_print( "%-40s : %ld (%ld) ( ","myPrimalMesh->cellToCells", k, myPrimalMesh->cellToCellsNumbers[k]);
-        
-        for(connectivity_int ii=0;ii<myPrimalMesh->cellToCellsNumbers[k];ii++)
-        {
-            debug_print( "%ld " , myPrimalMesh->cellToCells[k][ii]);
-        }
-        debug_print(")\n");
-    }
-    
-    
-    for(connectivity_int k=0;k<myPrimalMesh->segmentNumber;k++)
-    {
-        debug_print( "%-40s : %ld ( ","myPrimalMesh->segmentToVertex", k);
-        
-        for(connectivity_int ii=0;ii<SEGMENTVERTEX;ii++)
-        {
-            debug_print( "%ld " , myPrimalMesh->segmentToVertex[k][ii]);
-        }
-        
-        debug_print(")\n");
-    }
-    
-    
-    free(toto);
-    free(cellList);
-    free(vertexList);
-    
-    endFunction(__FUNCTION__, t);
-    
-}
-
-*/
-
 void setHexahedreCellToCells(struct primalMesh * myPrimalMesh)
 {
   
@@ -1394,7 +1323,8 @@ void setHexahedreCellToCells(struct primalMesh * myPrimalMesh)
               
             }
         }
-  
+
+#ifdef DEBUG  
   for(connectivity_int k=0;k<myPrimalMesh->cellNumber;k++)
     {
       debug_print( "%-40s : %ld (%ld) ( ","myPrimalMesh->cellToCells", k, myPrimalMesh->cellToCellsNumbers[k]);
@@ -1405,7 +1335,7 @@ void setHexahedreCellToCells(struct primalMesh * myPrimalMesh)
         }
       debug_print(")\n");
     }
-  
+#endif
   
   //  for(connectivity_int k=0;k<myPrimalMesh->segmentNumber;k++)
   //    {
@@ -1480,8 +1410,8 @@ void setHexahedreCellToFacesOwnerNeighbour(struct primalMesh * myPrimalMesh)
   
   for(connectivity_int cellAi=0;cellAi<myPrimalMesh->cellNumber;cellAi++)
     {
-      if(cellAi % 10000 == 0 && cellAi != 0)
-        release_print( "%-40s :  (%ld)\n ","CELLS", cellAi);
+      if(cellAi % 100000 == 0 && cellAi != 0)
+        release_print( "%-40s :  (%ld)\n","CELLS", cellAi);
       
       for (connectivity_int faceAi=0;faceAi<HEXAHEDRON_FACES;faceAi++)
         {
@@ -1599,6 +1529,7 @@ void setHexahedreCellToFacesOwnerNeighbour(struct primalMesh * myPrimalMesh)
     free(cellFaceTest[celli]);
   free(cellFaceTest);
   
+#ifdef DEBUG
   
   for(connectivity_int k=0;k<myPrimalMesh->faceNumber;k++)
     {
@@ -1635,6 +1566,7 @@ void setHexahedreCellToFacesOwnerNeighbour(struct primalMesh * myPrimalMesh)
       debug_print(")\n");
     }
   
+#endif
   
   endFunction(__FUNCTION__, t);
   
@@ -1788,8 +1720,8 @@ void setHexahedreSegments(struct primalMesh * myPrimalMesh)
               
               myPrimalMesh->cellToSegmentOwnerNumber[celli]++;
               
-              if(myPrimalMesh->segmentNumber % 10000 == 0 && myPrimalMesh->segmentNumber != 0)
-                release_print( "%-40s :  (%ld)\n ","SEGMENTS", myPrimalMesh->segmentNumber);
+              if(myPrimalMesh->segmentNumber % (int)floor(myPrimalMesh->cellNumber*10/NBAFFICHE) == 0 && myPrimalMesh->segmentNumber != 0)
+                release_print( "%-40s :  (%ld)\n","SEGMENTS", myPrimalMesh->segmentNumber);
               
               for (connectivity_int cellAi=0;cellAi<myPrimalMesh->cellToCellsNumbers[celli];cellAi++)
                 {      
@@ -1856,6 +1788,7 @@ void setHexahedreSegments(struct primalMesh * myPrimalMesh)
       
     }
   
+#ifdef DEBUG  
   for(connectivity_int celli=0;celli<myPrimalMesh->cellNumber;celli++)
     {
       debug_print( "%-40s : %ld ( ","cellToSegmentOwner", celli);
@@ -1879,7 +1812,6 @@ void setHexahedreSegments(struct primalMesh * myPrimalMesh)
       debug_print(")\n");
     }  
   
-#ifdef DEBUG
   for(connectivity_int segmentAi=0;segmentAi<myPrimalMesh->segmentNumber;segmentAi++)
     {
       debug_print( "%-40s : %ld ( ","myPrimalMesh->segments", segmentAi);
@@ -1910,6 +1842,62 @@ void setHexahedreSegments(struct primalMesh * myPrimalMesh)
 
 
 
+void setHexahedreSegmentsCentres(struct primalMesh * myPrimalMesh)
+{
+  
+  clock_t t=startFunction(__FUNCTION__);
+  affiche("\n");
+  
+  myPrimalMesh->segmentCentres = (dataType ** ) malloc(sizeof (dataType*)*myPrimalMesh->segmentNumber);
+  for(connectivity_int segmenti=0;segmenti<myPrimalMesh->segmentNumber;segmenti++)
+    {
+      myPrimalMesh->segmentCentres[segmenti]  = (dataType * ) malloc(sizeof (dataType)*DIM3D);
+    }
+  
+  
+  for (connectivity_int segmenti=0;segmenti<myPrimalMesh->segmentNumber;segmenti++)
+    {
+      
+      if(segmenti % 100000 == 0 && segmenti != 0)
+        release_print( "%-40s :  (%ld)\n","SEGMENT", segmenti);
+      
+      myPrimalMesh->segmentCentres[segmenti][0] = (
+            myPrimalMesh->vertex[ myPrimalMesh->segments[segmenti][PT1] ][0]
+          +
+          myPrimalMesh->vertex[ myPrimalMesh->segments[segmenti][PT2] ][0]
+          )/2.0;
+      myPrimalMesh->segmentCentres[segmenti][1] = (
+            myPrimalMesh->vertex[ myPrimalMesh->segments[segmenti][PT1] ][1]
+          +
+          myPrimalMesh->vertex[ myPrimalMesh->segments[segmenti][PT2] ][1]
+          )/2.0;
+      myPrimalMesh->segmentCentres[segmenti][2] = (
+            myPrimalMesh->vertex[ myPrimalMesh->segments[segmenti][PT1] ][2]
+          +
+          myPrimalMesh->vertex[ myPrimalMesh->segments[segmenti][PT2] ][2]
+          )/2.0;
+    }
+  
+#ifdef DEBUG
+  for(connectivity_int segmentAi=0;segmentAi<myPrimalMesh->segmentNumber;segmentAi++)
+    {
+      debug_print( "%-40s : %ld ( ","myPrimalMesh->segmentCentres", segmentAi);
+      
+      for(connectivity_int vertexAi=0;vertexAi<DIM3D;vertexAi++)
+        {
+          debug_print( "%lf " , myPrimalMesh->segmentCentres[segmentAi][vertexAi] );
+        }
+      debug_print(")\n");
+    }
+  
+#endif  
+  
+  endFunction(__FUNCTION__, t);
+  
+}
+
+
+
 void setHexahedreSegments2(struct primalMesh * myPrimalMesh)
 {
   
@@ -1931,8 +1919,8 @@ void setHexahedreSegments2(struct primalMesh * myPrimalMesh)
     //  for (long faceAi=(long)(myPrimalMesh->faceNumber-1);faceAi>=0;faceAi--)
     {
       
-      if(faceAi % 1000 == 0 && faceAi != 0)
-        release_print( "%-40s :  (%ld)\n ","FACE", faceAi);
+      if(faceAi % (int)floor(myPrimalMesh->cellNumber*10/NBAFFICHE) == 0 && faceAi != 0)
+        release_print( "%-40s :  (%ld)\n","FACE", faceAi);
       
       
       memcpy(copyFace,myPrimalMesh->faces[faceAi],sizeof (connectivity_int)*(QUAD));
@@ -2050,8 +2038,8 @@ void setHexahedreVertexToSegments(struct primalMesh * myPrimalMesh)
   
   for (connectivity_int segmentAi=0;segmentAi<myPrimalMesh->segmentNumber;segmentAi++)
     {
-      if(segmentAi % 1000 == 0 && segmentAi!=0)
-        release_print( "%-40s :  (%ld)\n ","SEGMENTS", segmentAi);
+      if(segmentAi % (int)floor(myPrimalMesh->cellNumber*10/NBAFFICHE) == 0 && segmentAi!=0)
+        release_print( "%-40s :  (%ld)\n","SEGMENTS", segmentAi);
       
       pointOwner = myPrimalMesh->segments[segmentAi][1];
       
@@ -2122,7 +2110,7 @@ void setHexahedreSegmentToFaces(struct primalMesh * myPrimalMesh)
   
   //connectivity_int testSegment = 0;
   
-//  affiche("%s : REDUIRE LE TEMPS DE CETTE FONCTION EN DEFINISSANT DE NOUVELLES MATRICES avec FACETOCELL puis CELLTOSEGMENTS \n",__FUNCTION__);
+  //  affiche("%s : REDUIRE LE TEMPS DE CETTE FONCTION EN DEFINISSANT DE NOUVELLES MATRICES avec FACETOCELL puis CELLTOSEGMENTS \n",__FUNCTION__);
   
   myPrimalMesh->segmentToFaceOwner  = (connectivity_int ** ) malloc(sizeof (connectivity_int*)*myPrimalMesh->segmentNumber);
   for (connectivity_int ii=0;ii<myPrimalMesh->segmentNumber;ii++) {
@@ -2144,8 +2132,8 @@ void setHexahedreSegmentToFaces(struct primalMesh * myPrimalMesh)
   
   for (connectivity_int celli=0;celli<myPrimalMesh->cellNumber;celli++)
     {
-      if(celli % 10000 == 0 && celli != 0)
-        release_print( "%-40s :  (%ld)\n ","CELL", celli);
+      if(celli % 100000 == 0 && celli != 0)
+        release_print( "%-40s :  (%ld)\n","CELL", celli);
       
       
       
@@ -2374,8 +2362,8 @@ void setHexahedreSegmentToFaces2(struct primalMesh * myPrimalMesh)
   
   for (connectivity_int faceAi=0;faceAi<myPrimalMesh->faceNumber;faceAi++)
     {
-      if(faceAi % 1000 == 0 && faceAi!=0)
-        release_print( "%-40s :  (%ld)\n ","FACES", faceAi);
+      if(faceAi % ((int)(floor(myPrimalMesh->cellNumber*10/NBAFFICHE))) == 0 && faceAi!=0)
+        release_print( "%-40s :  (%ld)\n","FACES", faceAi);
       
       memcpy(copyFace,myPrimalMesh->faces[faceAi],sizeof (connectivity_int)*(QUAD));
       copyFace[QUAD] = copyFace[0];
@@ -2470,7 +2458,7 @@ void setHexahedreSegmentToFaces2(struct primalMesh * myPrimalMesh)
 
 
 
-void setHexahedreDualFaces(struct primalMesh * myPrimalMesh)
+void setDualFaces(struct primalMesh * myPrimalMesh, struct dualMesh * myDualMesh)
 {
   
   clock_t t=startFunction(__FUNCTION__);
@@ -2478,82 +2466,383 @@ void setHexahedreDualFaces(struct primalMesh * myPrimalMesh)
   
   connectivity_int selectedCell = 0;
   connectivity_int selectedVertex = 0;
-  connectivity_int selectedSegment = 0;
-  connectivity_int selectedFace =0;
+  connectivity_int * selectedSegments = 0;
+  connectivity_int selectedSegmentNumber = 0;
+  connectivity_int * selectedFaces;
+  connectivity_int   selectedFacesNumber = 0;
+  
+  myDualMesh->internalDualFaces  = (dataType *** ) malloc(sizeof (dataType**)*myDualMesh->internalDualFacesNumber);
+  
+  myDualMesh->segmentToInternalDualFace = (connectivity_int **) malloc(sizeof (connectivity_int*)*myPrimalMesh->segmentNumber);
+  for(connectivity_int segmenti=0;segmenti<myPrimalMesh->segmentNumber;segmenti++)
+    {
+      myDualMesh->segmentToInternalDualFace[segmenti] = NULL;
+    }  
+  myDualMesh->segmentToInternalDualFaceNumber = (connectivity_int *) malloc(sizeof (connectivity_int)*myPrimalMesh->segmentNumber);
+  memset(myDualMesh->segmentToInternalDualFaceNumber,0,myPrimalMesh->segmentNumber*sizeof (connectivity_int) );
+  
+  
+  connectivity_int * output1;
+  connectivity_int lenOutput1;
+  
+  
+  connectivity_int * output2;
+  connectivity_int lenOutput2;
+  
+  
+  connectivity_int * output3;
+  connectivity_int lenOutput3;
+  
+  output1  = (connectivity_int * ) malloc(sizeof (connectivity_int)*MAXSIZECONNECTIVITYVECTOR);
+  output2  = (connectivity_int * ) malloc(sizeof (connectivity_int)*MAXSIZECONNECTIVITYVECTOR);
+  output3  = (connectivity_int * ) malloc(sizeof (connectivity_int)*MAXSIZECONNECTIVITYVECTOR);
   
   
   for(connectivity_int celli=0;celli<myPrimalMesh->cellNumber;celli++)
     {
       
       selectedCell = celli;
+      if(celli % 100000== 0 && celli != 0)
+        release_print( "%-40s :  (%ld)\n","CELL", celli);
+      
+      unionTwoIntegerSet(&selectedFaces, &selectedFacesNumber,
+                         (myPrimalMesh->cellToFacesOwner[celli]) , myPrimalMesh->cellToFacesOwnerNumber[celli] , 
+                         (myPrimalMesh->cellToFacesNeighbour[celli]) , myPrimalMesh->cellToFacesNeighbourNumber[celli]);
+      
+      
+#ifdef DEBUG      
+      debug_print( " ( ");
+      
+      for(connectivity_int vertexi=0;vertexi<selectedFacesNumber;vertexi++)
+        {
+          debug_print( "%ld " , selectedFaces[vertexi] );
+        }
+      debug_print(" )");
+      debug_print(" \n");
+#endif  
+      
+      unionTwoIntegerSet(&selectedSegments, &selectedSegmentNumber,
+                         (myPrimalMesh->cellToSegmentOwner[celli]) , myPrimalMesh->cellToSegmentOwnerNumber[celli] , 
+                         (myPrimalMesh->cellToSegmentNeighbour[celli]) , myPrimalMesh->cellToSegmentNeighbourNumber[celli]);
       
-      for(connectivity_int vertexi=0;vertexi<myPrimalMesh->cellToVertexNumber[selectedCell];vertexi++)
+      
+      
+      for(connectivity_int segmenti=0;segmenti<selectedSegmentNumber;segmenti++)
         {
+          // select segments attached to one cell          
+          
+          
+          //          for(connectivity_int facei=0;facei<selectedFacesNumber;facei++)
+          //            {          
+          // select faces attached to one segment
+          // We have to intersect previous set and this one
+          
+          intersectTwoIntegerSet(&output1,&lenOutput1,
+                                 selectedFaces,selectedFacesNumber,
+                                 myPrimalMesh->segmentToFaceOwner[selectedSegments[segmenti]],myPrimalMesh->segmentToFaceOwnerNumber[selectedSegments[segmenti]]
+              );
+          
+          intersectTwoIntegerSet(&output2,&lenOutput2,
+                                 selectedFaces,selectedFacesNumber,
+                                 myPrimalMesh->segmentToFaceNeighbour[selectedSegments[segmenti]],myPrimalMesh->segmentToFaceNeighbourNumber[selectedSegments[segmenti]]
+              );
+          
+          unionTwoIntegerSet(&output3, &lenOutput3,
+                             output1 , lenOutput1 , 
+                             output2 , lenOutput2);
           
-          selectedVertex = myPrimalMesh->cellToVertex[selectedCell][vertexi] ;
           
-          for(connectivity_int segmenti=0;segmenti<myPrimalMesh->vertexToSegmentNumber[selectedVertex];segmenti++)
+#ifdef DEBUG
+          
+          debug_print( "Intersect %ld ( ",celli);
+          
+          for(connectivity_int vertexi=0;vertexi<selectedFacesNumber;vertexi++)
             {
+              debug_print( "%ld " , selectedFaces[vertexi] );
+            }
+          debug_print(" ) ");
+          debug_print( "( ");
+          
+          for(connectivity_int vertexi=0;vertexi<selectedSegmentNumber;vertexi++)
+            {
+              debug_print( "%ld " , selectedSegments[vertexi] );
+            }
+          debug_print(" ) ");
+          debug_print( "( ");
+          
+          for(connectivity_int vertexi=0;vertexi<lenOutput1;vertexi++)
+            {
+              debug_print( "%ld " ,output1[vertexi] );
+            }
+          for(connectivity_int vertexi=0;vertexi<lenOutput2;vertexi++)
+            {
+              debug_print( "%ld " ,output2[vertexi] );
+            }
+          debug_print(" )");
+          debug_print(" \n");
+          
+#endif              
+          
+          if(lenOutput3==2) {
+              //selectedSegments[segmenti]
+              myDualMesh->internalDualFaces = (dataType ***) realloc(myDualMesh->internalDualFaces, (myDualMesh->internalDualFacesNumber+1) * sizeof (dataType**));
+              myDualMesh->internalDualFaces[myDualMesh->internalDualFacesNumber] = (dataType **) malloc( HEXAHEDRON_DUAL_FACE_POINT * sizeof (dataType*));   
+              //              memset(myDualMesh->internalDualFaces[myDualMesh->internalDualFacesNumber], 0, HEXAHEDRON_DUAL_FACE_POINT*sizeof(connectivity_int));
               
-              selectedSegment = myPrimalMesh->vertexToSegments[selectedVertex][segmenti];
-              
-              // Est-ce que les segments sont bien attachés à la cellule selectedCell
+              myDualMesh->internalDualFaces[myDualMesh->internalDualFacesNumber][PT1] = (myPrimalMesh->faceCentres[output3[0]]); 
+              myDualMesh->internalDualFaces[myDualMesh->internalDualFacesNumber][PT2] = (myPrimalMesh->volumeCentroid[celli]); 
+              myDualMesh->internalDualFaces[myDualMesh->internalDualFacesNumber][PT3] = (myPrimalMesh->faceCentres[output3[1]]); 
+              myDualMesh->internalDualFaces[myDualMesh->internalDualFacesNumber][PT4] = (myPrimalMesh->segmentCentres[selectedSegments[segmenti]]); 
               
-              for(connectivity_int facei=0;facei<myPrimalMesh->segmentToFaceOwnerNumber[selectedSegment];facei++)
-                {
-                  
-                  selectedFace = myPrimalMesh->segmentToFaceOwner[selectedSegment][facei];
-                  
-                  // Est-ce que les faces sont bien attachés à la cellule selectedCell
-                }              
               
-              for(connectivity_int facei=0;facei<myPrimalMesh->segmentToFaceNeighbourNumber[selectedSegment];facei++)
-                {
-                  
-                  selectedFace = myPrimalMesh->segmentToFaceNeighbour[selectedSegment][facei];
-                  
-                  // Est-ce que les faces sont bien attachés à la cellule selectedCell
-                }       
+              myDualMesh->segmentToInternalDualFace[selectedSegments[segmenti]]= (connectivity_int*) realloc(myDualMesh->segmentToInternalDualFace[selectedSegments[segmenti]] ,sizeof (connectivity_int)*(myDualMesh->segmentToInternalDualFaceNumber[selectedSegments[segmenti]]+1));
               
-              /*
-               * Créer une matrice Dual Faces attachés à selectedVertex
-               * Séparer les faces internes à la cellule et les faces duales sur les faces primales
-               * Faire des faces externes pour les bords du domaine
-               * Détecter les bords du domaine?
-               */
+              myDualMesh->segmentToInternalDualFace[selectedSegments[segmenti]][ myDualMesh->segmentToInternalDualFaceNumber[selectedSegments[segmenti]] ] = myDualMesh->internalDualFacesNumber;
+              myDualMesh->segmentToInternalDualFaceNumber[selectedSegments[segmenti]]++;
               
-            } 
+              myDualMesh->internalDualFacesNumber++;              
+            }
+          //              else 
+          //                {
+          //                  affiche("Error on setDualFaces definition\n");
+          //                  exit(1);
+          //                }
         }
+      //        }
     }
   
 #ifdef DEBUG
   
   
   
-  //  for(connectivity_int segmentAi=0;segmentAi<myPrimalMesh->segmentNumber;segmentAi++)
-  //    {
+  for(connectivity_int faceAi=0;faceAi<myDualMesh->internalDualFacesNumber;faceAi++)
+    {
+      
+      debug_print( "%-40s : %ld","myDualMesh->internalDualFaces", faceAi);
+      
+      for(connectivity_int pointi=0;pointi<HEXAHEDRON_DUAL_FACE_POINT;pointi++)
+        {
+          debug_print( " ( ");
+          
+          for(connectivity_int vertexi=0;vertexi<DIM3D;vertexi++)
+            {
+              debug_print( "%lf " , myDualMesh->internalDualFaces[faceAi][pointi][vertexi] );
+            }
+          debug_print(" )");
+        }
+      debug_print(" \n");
+      
+    }
   
-  //      debug_print( "%-40s : %ld ( ","myPrimalMesh->segmentToFaceOwner", segmentAi);
+  for(connectivity_int segmenti=0;segmenti<myPrimalMesh->segmentNumber;segmenti++)
+    {
+      
+      debug_print( "%-40s : %ld","myDualMesh->segmentToInternalDualFace", segmenti);
+      
+      debug_print( " ( ");
+      
+      
+      for(connectivity_int facei=0;facei<myDualMesh->segmentToInternalDualFaceNumber[segmenti];facei++)
+        {
+          debug_print( "%ld " , myDualMesh->segmentToInternalDualFace[segmenti][facei] );
+        }
+      
+      debug_print(" )");
+      debug_print(" \n");
+      
+    }
   
-  //      for(connectivity_int faceAi=0;faceAi<myPrimalMesh->segmentToFaceOwnerNumber[segmentAi];faceAi++)
-  //        {
-  //          debug_print( "%ld " , myPrimalMesh->segmentToFaceOwner[segmentAi][faceAi] );
-  //        }
   
-  //      debug_print(")\n");
   
-  //    }
   
   
   
+#endif
+  
+  free(output1);
+  free(output2);
+  free(output3);
+  
+  
+  endFunction(__FUNCTION__, t);
+  
+}
+
+
+
+void setDualFacesCentres(struct primalMesh * myPrimalMesh, struct dualMesh * myDualMesh)
+{
+  
+  clock_t t=startFunction(__FUNCTION__);
+  affiche("\n");
+  
+  connectivity_int actualPoint;
+  connectivity_int nextPoint;
+  
+  dataType *fC;
+  
+  
+  fC =(dataType *) calloc(DIM3D, sizeof(dataType));
+  
+  
+  myDualMesh->internalDualFaceCentres  = (dataType ** ) malloc(sizeof (dataType*)*myDualMesh->internalDualFacesNumber);
+  for(connectivity_int i=0; i<myDualMesh->internalDualFacesNumber; i++)
+    {
+      myDualMesh->internalDualFaceCentres[i] = (dataType *) malloc(DIM3D * sizeof(dataType));
+      memset(myDualMesh->internalDualFaceCentres[i], 0.0, DIM3D*sizeof(dataType));
+    }
+  
   
   
+  myDualMesh->internalDualFaceArea  = (dataType ** ) malloc(sizeof (dataType*)*myDualMesh->internalDualFacesNumber);
+  for(connectivity_int i=0; i<myDualMesh->internalDualFacesNumber; i++)
+    {
+      myDualMesh->internalDualFaceArea[i] = (dataType *) malloc(DIM3D * sizeof(dataType));
+      memset(myDualMesh->internalDualFaceArea[i], 0.0, DIM3D*sizeof(dataType));
+    }
+  
   
+  for(connectivity_int faceAi=0;faceAi<myDualMesh->internalDualFacesNumber;faceAi++)
+    {
+      if(faceAi % 1000000== 0 && faceAi != 0)
+        release_print( "%-40s :  (%ld)\n","FACE", faceAi);
+      
+      
+      zeroVector(&fC);
+      
+      for(connectivity_int vertexAi=0;vertexAi<QUAD;vertexAi++)
+        {
+          actualPoint = vertexAi;
+          
+          sumTwoVectors(&fC,fC,myDualMesh->internalDualFaces[faceAi][actualPoint]);
+          
+        }
+      
+      
+      scalarDivVector(&(myDualMesh->internalDualFaceCentres[faceAi]), QUAD,fC);
+
+#ifdef DEBUG      
+      debug_print( "%-40s : %ld %d ( ","myDualMesh->internalDualFaceCentres Esti", faceAi, QUAD);
+      
+      for(connectivity_int ii=0;ii<DIM3D;ii++)
+        {
+          debug_print( "%lf " , myDualMesh->internalDualFaceCentres[faceAi][ii]);
+        }
+      debug_print(")\n");
 #endif
+      if(QUAD==3) {
+          
+          // Triangle
+          affiche("NON IMPLEMENTED ...");
+          exit(1);
+          
+        }
+      else
+        { //https://github.com/OpenFOAM/OpenFOAM-dev/blob/master/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshFaceCentresAndAreas.C
+          dataType *sumN;
+          dataType sumA       = ZEROSCALAR;
+          dataType *sumAc;
+          
+          dataType *c;
+          dataType a          = ZEROSCALAR;
+          dataType * n       ;
+          
+          dataType *result1;
+          dataType *result2;
+          
+          
+          result1 =(dataType *) calloc(DIM3D, sizeof(dataType));
+          sumN =(dataType *) calloc(DIM3D, sizeof(dataType));
+          sumAc =(dataType *) calloc(DIM3D, sizeof(dataType));
+          c =(dataType *) calloc(DIM3D, sizeof(dataType));
+          n =(dataType *) calloc(DIM3D, sizeof(dataType));
+          result2 =(dataType *) calloc(DIM3D, sizeof(dataType));
+          
+          
+          
+          for(connectivity_int vertexAi=0;vertexAi<QUAD;vertexAi++) {
+              
+              actualPoint = vertexAi;
+              nextPoint = (vertexAi + 1) % QUAD;
+              
+              sumThreeVectors(&c, (myDualMesh->internalDualFaces[faceAi][actualPoint]), (myDualMesh->internalDualFaces[faceAi][nextPoint]), (myDualMesh->internalDualFaceCentres[faceAi]) );
+              
+              subTwoVectors(&result1, (myDualMesh->internalDualFaces[faceAi][nextPoint]), (myDualMesh->internalDualFaces[faceAi][actualPoint]));
+              subTwoVectors(&result2, (myDualMesh->internalDualFaceCentres[faceAi]), (myDualMesh->internalDualFaces[faceAi][actualPoint]));
+              
+              crossProduct(&n, result1, result2);
+              mag(&(a), n);
+              
+              sumTwoVectors(&sumN, sumN, n);
+              
+              sumA+=a;
+              scalarDotVector(&result1, a, c);
+              sumTwoVectors(&sumAc, sumAc, result1);
+            }
+          
+          if (sumA < SMALL)
+            {
+              zeroVector( &(myDualMesh->internalDualFaceArea[faceAi]) );
+            }
+          else
+            {
+              scalarDotVector(&(myDualMesh->internalDualFaceCentres[faceAi]), 1.0/(3.0*sumA), sumAc); //correct faceCentres after estimating them
+              scalarDotVector(&(myDualMesh->internalDualFaceArea[faceAi]), 0.5, sumN);
+            }
+          
+          
+          free(sumN);
+          free(sumAc);
+          free(c);
+          free(n)       ;
+          free(result1);
+          free(result2);
+          
+        }
+      
+    }
+  
+  for(connectivity_int segmenti=0;segmenti<myPrimalMesh->segmentNumber;segmenti++)
+    {    
+      dataType * segmentVector = myPrimalMesh->segmentToVertex[segmenti];
+    }
+  
   
   
   
   
+  
+  
+#ifdef DEBUG     
+  for(connectivity_int faceAi=0;faceAi<myDualMesh->internalDualFacesNumber;faceAi++)
+    {          
+      debug_print( "%-40s : %ld %d ( ","myDualMesh->internalDualFaceCentres", faceAi, QUAD);
+      
+      for(connectivity_int ii=0;ii<DIM3D;ii++)
+        {
+          debug_print( "%lf " , myDualMesh->internalDualFaceCentres[faceAi][ii]);
+        }
+      
+      debug_print(")\n");
+      
+      debug_print( "%-40s : %ld ( ","myDualMesh->internalDualFaceArea", faceAi);
+      
+      for(connectivity_int ii=0;ii<DIM3D;ii++)
+        {
+          debug_print( "%lf " , myDualMesh->internalDualFaceArea[faceAi][ii]);
+        }
+      
+      debug_print(")\n");
+    }     
+#endif          
+  
+  
+  
+  
+  
+  
+  free(fC);    
   endFunction(__FUNCTION__, t);
   
 }
@@ -2633,7 +2922,7 @@ void setHexahedreAllocVertexToSegment(struct primalMesh * myPrimalMesh)
     }
   
   
-  
+#ifdef DEBUG  
   for(connectivity_int i=0;i<myPrimalMesh->vertexNumber;i++)
     {
       
@@ -2643,7 +2932,7 @@ void setHexahedreAllocVertexToSegment(struct primalMesh * myPrimalMesh)
                   myPrimalMesh->vertexToSegmentNumber[i]
                   );
     }
-  
+#endif
   endFunction(__FUNCTION__, t);
 }
 
@@ -2691,13 +2980,14 @@ void setHexahedreFaceCentersAreas(struct primalMesh * myPrimalMesh)
       
       scalarDivVector(&(myPrimalMesh->faceCentres[faceAi]), QUAD,fC);
       
+#ifdef DEBUG      
       debug_print( "%-40s : %ld %d ( ","myPrimalMesh->faceCentres Estimated", faceAi, QUAD);
       
       for(connectivity_int ii=0;ii<DIM3D;ii++)
         {
           debug_print( "%lf " , myPrimalMesh->faceCentres[faceAi][ii]);
         }
-      
+#endif
       debug_print(")\n");
       if(QUAD==3) {
           
@@ -2758,23 +3048,6 @@ void setHexahedreFaceCentersAreas(struct primalMesh * myPrimalMesh)
               scalarDotVector(&(myPrimalMesh->faceCentres[faceAi]), 1.0/(3.0*sumA), sumAc); //correct faceCentres after estimating them
               scalarDotVector(&(myPrimalMesh->faceAreas[faceAi]), 0.5, sumN);
             }
-          debug_print( "%-40s : %ld %d ( ","myPrimalMesh->faceCentres", faceAi, QUAD);
-          
-          for(connectivity_int ii=0;ii<DIM3D;ii++)
-            {
-              debug_print( "%lf " , myPrimalMesh->faceCentres[faceAi][ii]);
-            }
-          
-          debug_print(")\n");
-          
-          debug_print( "%-40s : %ld ( ","myPrimalMesh->faceAreas", faceAi);
-          
-          for(connectivity_int ii=0;ii<DIM3D;ii++)
-            {
-              debug_print( "%lf " , myPrimalMesh->faceAreas[faceAi][ii]);
-            }
-          
-          debug_print(")\n");
           
           free(sumN);
           free(sumAc);
@@ -2787,6 +3060,29 @@ void setHexahedreFaceCentersAreas(struct primalMesh * myPrimalMesh)
       
     }
   
+#ifdef DEBUG
+  for(connectivity_int faceAi=0;faceAi<myPrimalMesh->faceNumber;faceAi++)
+    {
+      debug_print( "%-40s : %ld %d ( ","myPrimalMesh->faceCentres", faceAi, QUAD);
+      
+      for(connectivity_int ii=0;ii<DIM3D;ii++)
+        {
+          debug_print( "%lf " , myPrimalMesh->faceCentres[faceAi][ii]);
+        }
+      
+      debug_print(")\n");
+      
+      debug_print( "%-40s : %ld ( ","myPrimalMesh->faceAreas", faceAi);
+      
+      for(connectivity_int ii=0;ii<DIM3D;ii++)
+        {
+          debug_print( "%lf " , myPrimalMesh->faceAreas[faceAi][ii]);
+        }
+      
+      debug_print(")\n");
+    }
+#endif
+  
   free(fC);
   endFunction(__FUNCTION__, t);
   
@@ -2845,7 +3141,8 @@ void setHexahedreEstimateVolumeCentroid(struct primalMesh * myPrimalMesh)
       scalarDivVector(&(myPrimalMesh->volumeCentroid[celli]) , myPrimalMesh->cellToFacesNeighbourNumber[celli]+myPrimalMesh->cellToFacesOwnerNumber[celli], result);
       
     }
-  
+
+#ifdef DEBUG  
   for(connectivity_int celli=0;celli<myPrimalMesh->cellNumber;celli++)
     {
       
@@ -2858,7 +3155,7 @@ void setHexahedreEstimateVolumeCentroid(struct primalMesh * myPrimalMesh)
           myPrimalMesh->volumeCentroid[celli][2]
           );
     }
-  
+#endif  
   
   free(result);
   endFunction(__FUNCTION__, t);
@@ -2885,6 +3182,9 @@ void setHexahedreVolumeCentroid(struct primalMesh * myPrimalMesh)
   // vertex number on faces
   connectivity_int it_face;
   
+  // Estimate centroids
+  setHexahedreEstimateVolumeCentroid(myPrimalMesh);
+  
   
   for(connectivity_int celli=0;celli<myPrimalMesh->cellNumber;celli++)
     {
@@ -2949,7 +3249,8 @@ void setHexahedreVolumeCentroid(struct primalMesh * myPrimalMesh)
       
       
       myPrimalMesh->volume[celli] *= (1.0/3.0);
-      
+
+#ifdef DEBUG      
       debug_print("%-40s : %ld (%lf) (%lf %lf %lf)\n",
                   "myPrimalMesh->volumeCentroid",
                   celli,
@@ -2958,7 +3259,7 @@ void setHexahedreVolumeCentroid(struct primalMesh * myPrimalMesh)
           myPrimalMesh->volumeCentroid[celli][1],
           myPrimalMesh->volumeCentroid[celli][2]
           );
-      
+#endif      
     }
   
   free(result1);
@@ -3045,27 +3346,36 @@ int main (void)
   struct simulationData mySimulationData;
   
   struct primalMesh myPrimalMesh;
+  struct dualMesh myDualMesh;
   struct readWriteVTK myReadWriteVTK;
   
   myReadWriteVTK.mySimulationData = &mySimulationData;
   
   mySimulationData.simulationName = "Ma simulation";
   
-  myPrimalMesh.L = 2; // cell number on X
-  myPrimalMesh.l = 2; // cell number on Y
-  myPrimalMesh.H = 2; // cell number on Z
+  myPrimalMesh.L = 1; // cell number on X
+  myPrimalMesh.l = 1; // cell number on Y
+  myPrimalMesh.H = 1; // cell number on Z
   
 #ifdef DEBUG
   
   myPrimalMesh.M = 2; // cell number on X
   myPrimalMesh.N = 2; // cell number on Y
-  myPrimalMesh.P = 1; // cell number on Z
+  myPrimalMesh.P = 2; // cell number on Z
   
 #else
   
+#ifdef OPTIMCODE
+  affiche("OPTIM finded\n");
   myPrimalMesh.M = 200; // cell number on X
   myPrimalMesh.N = 200; // cell number on Y
-  myPrimalMesh.P = 200; // cell number on Z
+  myPrimalMesh.P = 20; // cell number on Z
+#else
+  myPrimalMesh.M = 20; // cell number on X
+  myPrimalMesh.N = 20; // cell number on Y
+  myPrimalMesh.P = 20; // cell number on Z
+  
+#endif
   
 #endif
   myPrimalMesh.vertex                 = NULL;
@@ -3108,6 +3418,14 @@ int main (void)
   myPrimalMesh.segmentToFaceOwnerNumber      = NULL;
   myPrimalMesh.segmentToFaceNeighbour        = NULL;
   myPrimalMesh.segmentToFaceNeighbourNumber  = NULL;
+  myPrimalMesh.segmentCentres                = NULL;
+  
+  myDualMesh.internalDualFaces               = NULL;
+  myDualMesh.segmentToInternalDualFace       = NULL;
+  myDualMesh.segmentToInternalDualFaceNumber = NULL;
+  
+  
+  
   
   // Rectangular mesh with an ...
   myPrimalMesh.cellNumber   = myPrimalMesh.M * myPrimalMesh.N * myPrimalMesh.P;
@@ -3115,6 +3433,9 @@ int main (void)
   myPrimalMesh.faceNumber = 0;//HEXAHEDRON_FACES*myPrimalMesh.cellNumber;//(myPrimalMesh.M+1) * (myPrimalMesh.N+1) * (myPrimalMesh.P+1);
   myPrimalMesh.segmentNumber = 0;//QUAD*myPrimalMesh.faceNumber;//HEXAHEDRON_SEGMENTS * myPrimalMesh.cellNumber;; //2*(myPrimalMesh.M+1) * (myPrimalMesh.N+1) * (myPrimalMesh.P+1);
   
+  
+  myDualMesh.internalDualFacesNumber = 0;
+  
   // création de **vertex
   setHexahedreVertex(&myPrimalMesh);
   
@@ -3145,12 +3466,25 @@ int main (void)
   setHexahedreSegmentToFaces(&myPrimalMesh);
   
   // centres
+  
+  setHexahedreSegmentsCentres(&myPrimalMesh);
+  
   setHexahedreFaceCentersAreas(&myPrimalMesh);
   
-  setHexahedreEstimateVolumeCentroid(&myPrimalMesh);
   
   setHexahedreVolumeCentroid(&myPrimalMesh);
   
+  // DUAL MESH
+  setDualFaces(&myPrimalMesh,&myDualMesh);
+  
+  setDualFacesCentres(&myPrimalMesh, &myDualMesh);
+  
+  
+  //  FILE *fp;
+  //  fp = fopen("one.dat", "wb");
+  //  fwrite(&(myPrimalMesh), sizeof(myPrimalMesh), 1, fp);
+  //  fclose(fp);  
+  
   // OLD
   
   fflush(stderr);
@@ -3160,8 +3494,9 @@ int main (void)
   affiche("%-40s : %ld\n","Vertex number",myPrimalMesh.vertexNumber);
   affiche("%-40s : %ld\n","Surface number",myPrimalMesh.faceNumber);
   affiche("%-40s : %ld\n","Segment number",myPrimalMesh.segmentNumber);
+  affiche("%-40s : %ld\n","Dual Face number",myDualMesh.internalDualFacesNumber);
   
-  freeMemory(&myPrimalMesh);
+  freeMemory(&myPrimalMesh, &myDualMesh);
   
 }
 
index 0dbd615..877dc9f 100644 (file)
--- a/src/mmd.h
+++ b/src/mmd.h
@@ -14,6 +14,7 @@
 
 #include <vtkCellType.h>
 
+#define NBAFFICHE 10
 
 #define DIM3D 3
 
@@ -34,9 +35,11 @@ static dataType VSMALL  = 1.0E-30;
 
 #define HEXAHEDRON 8
 #define HEXAHEDRON_FACES 6
+#define HEXAHEDRON_DUAL_FACE_POINT 4
 #define HEXAHEDRON_SEGMENTS 12
 #define QUAD 4
 #define SEGMENTVERTEX 2
+#define MAXSIZECONNECTIVITYVECTOR 1024
 
 extern connectivity_int  hexaedron_localNodeList[HEXAHEDRON_FACES][QUAD];
 
@@ -46,6 +49,18 @@ extern connectivity_int  hexaedron_localSegmentList[HEXAHEDRON_SEGMENTS][SEGMENT
 
 extern connectivity_int  hexaedron_localSegmentsListNumbers[HEXAHEDRON_SEGMENTS];
 
+struct dualMesh {
+
+  connectivity_int    internalDualFacesNumber;
+  dataType         ***internalDualFaces;
+  dataType          **internalDualFaceCentres;
+  dataType          **internalDualFaceArea;
+  
+  connectivity_int ** segmentToInternalDualFace;
+  connectivity_int *  segmentToInternalDualFaceNumber;
+  
+  
+};
 
 struct primalMesh {
 
@@ -56,10 +71,10 @@ struct primalMesh {
     connectivity_int P; dataType H;
 
     // Element Number
-    count_int vertexNumber;  // vertex number
-    count_int segmentNumber;  // segment number
-    count_int faceNumber; //surface number
-    count_int cellNumber;  // cell number
+    connectivity_int vertexNumber;  // vertex number
+    connectivity_int segmentNumber;  // segment number
+    connectivity_int faceNumber; //surface number
+    connectivity_int cellNumber;  // cell number
 
     // Cells
     connectivity_int            **         cellToCells; // done
@@ -88,6 +103,7 @@ struct primalMesh {
     // Surfaces
     connectivity_int **     faces;
     connectivity_int **     cellToFaces;
+    connectivity_int *      cellToFacesNumber;
     connectivity_int **     cellToFacesOwner;
     connectivity_int **     cellToFacesNeighbour;
     connectivity_int *      cellToFacesOwnerNumber;
@@ -108,11 +124,11 @@ struct primalMesh {
     connectivity_int *      segmentToFaceOwnerNumber;
     connectivity_int **     segmentToFaceNeighbour;
     connectivity_int *      segmentToFaceNeighbourNumber;
+    dataType       **       segmentCentres;
 
 
-    connectivity_int    *      cellToFacesNumber;
-    connectivity_int    *      faceToVertexNumber; // done
-    connectivity_int    *      faceToCellsNumber; // done
+    connectivity_int *      faceToVertexNumber; // done
+    connectivity_int *      faceToCellsNumber; // done
     connectivity_int **     faceToVertex; // vertexToFaces -> facesTo
     connectivity_int **     faceToSegments;
     connectivity_int **     faceToCells;
@@ -127,6 +143,9 @@ struct primalMesh {
 
 };
 
+
+
+
 struct simulationData {
 
     char *     simulationName;
@@ -154,11 +173,17 @@ struct readWriteVTK {
 #endif // DEBUG
 
 
+//#define debug_print(...) \
+//    do { if (DEBUG_TEST) fprintf(stderr, __VA_ARGS__); fflush(stderr);fflush(stdout);} while (0)
+
+//#define release_print(...) \
+//    do {  printf( __VA_ARGS__); fflush(stderr);fflush(stdout);} while (0)
+
 #define debug_print(...) \
-    do { if (DEBUG_TEST) fprintf(stderr, __VA_ARGS__); fflush(stderr);fflush(stdout);} while (0)
+    do { if (DEBUG_TEST) fprintf(stderr, __VA_ARGS__); } while (0)
 
 #define release_print(...) \
-    do {  printf( __VA_ARGS__); fflush(stderr);fflush(stdout);} while (0)
+    do {  printf( __VA_ARGS__); } while (0)
 
 /*
 #define debug_print(...) \