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>
Sat, 4 Jul 2020 02:49:29 +0000 (06:49 +0400)
committerAlain <alain.bastide@univ-reunion.fr>
Sat, 4 Jul 2020 02:55:14 +0000 (06:55 +0400)
13 files changed:
.gitignore
CMakeLists.txt
README.md
TODO.md
src/CMakeLists.txt [new file with mode: 0644]
src/dual.c
src/main.c
src/memory.c
src/mmd.c
src/mmd.h
src/primal.c
test/CMakeLists.txt
test/test01.c

index 780d182..a838a02 100644 (file)
@@ -45,3 +45,4 @@ Makefile
 test/CMakeFiles
 CMakeFiles
 *.autosave
+doc/
index c65f964..6d87454 100644 (file)
@@ -5,7 +5,7 @@ endif()
 if(POLICY CMP0053)
   cmake_policy(SET CMP0053 NEW) # CMake 3.1
 endif()
-## #include(optimizeArch.cmake)
+
 
 project(MMD)
 file(GLOB SRC_FILES ${CMAKE_SOURCE_DIR}/src/*.c  ${CMAKE_SOURCE_DIR}/src/*.cpp)
@@ -18,6 +18,12 @@ 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")
 
+#set(CMAKE_C_FLAGS_DEBUG "put your flags")
+#set(CMAKE_C_FLAGS_MINSIZEREL "put your flags")
+#set(CMAKE_C_FLAGS_RELWITHDEBINFO "put your flags")
+#set(CMAKE_C_FLAGS_RELEASE "put your flags")
+
+
 if(CMAKE_BUILD_TYPE EQUAL "Debug")
     set(CMAKE_C_FLAGS_RELEASE "-g -DNDEBUG -march=skylake      -mtune=skylake")
 endif()
@@ -37,35 +43,21 @@ vtk_module_config(VTK
   vtkRendering${VTK_RENDERING_BACKEND}
 )
 include(${VTK_USE_FILE})
-#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 ${VTK_LIBRARIES})
 
 message("CXXFLAGS:" ${CMAKE_CXX_FLAGS})
 message("CFLAGS  :" ${CMAKE_C_FLAGS})
 
-
-include(CTest)
-ENABLE_TESTING()
-
 set ( TESTS ${CMAKE_SOURCE_DIR}/test )
-add_subdirectory(${TESTS})
+set ( SOURCES ${CMAKE_SOURCE_DIR}/src )
 
 
+add_subdirectory(${SOURCES})
+add_subdirectory(${TESTS})
+  
+enable_testing ()
+#add_definitions("-DDEBUG")
+#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb -DDEBUG")
+add_test (NAME MyTest COMMAND test01.out)
 
 ### DOCUMENTATION
 
index 84d1b74..dac41a9 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,7 +1,18 @@
-MMD
+# MMD
+
+## Versions
 
 v0.0.3 Dual Mesh elements added
 
 v0.0.2 Improve methods, profiling the code and improve speed
 
 v0.0.1 Geometry for primal mesh on hexahedral elements
+
+
+
+## TO DO
+
+[Link to TODO File](TODO.md)
+
+
+
diff --git a/TODO.md b/TODO.md
index b51c321..12fd4ef 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -1,10 +1,35 @@
 TODO :
 
+
 Reduce the execution time of the functions : 
-1. void setHexahedreSegmentToFaces(struct primalMesh * myPrimalMesh)
-2. void setHexahedreSegments(struct primalMesh * myPrimalMesh)
+1. Improve the "void setHexahedreCellToFacesOwnerNeighbour(struct primalMesh * myPrimalMesh)
+" function which represents more than 50% of the computation time of the dual and primary mesh elements
+2. Finalize Dual mesh :
+
+     * To do 
+     * dual segments to generate global dual surface
+     * Faces = myPrimalMesh->segmentToFaceOwner union myPrimalMesh->segmentToFaceNeighbour
+     * myPrimalMesh->faceToCells
+     * Faces2 = myPrimalMesh->cellToFacesOwner union myPrimalMesh->cellToFacesNeighbour
+     * Faces3 = Faces intersect Face2
+     * 
+     * TODO : 
+     * Dual faces on primal faces and domain boundary 
+     * 
+     * Volumes of dual mesh
+     * 
+     * test Volume dual = volume primal
+     * 
+     * Do
+     * dualFaceToDualSegments
+3. Build Matrix
+     * COO -> CRS 
+4. Solve
+     * LU
+     * CG
+     * Preconditionners
+     * NETlib ? or rewrite
 
-By introducing new vectors such as faceToCells and cellToSegments
 
 
 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7920bff
--- /dev/null
@@ -0,0 +1,21 @@
+add_library (primal primal.c primal.h mmd.h )
+add_library (listop listop.c listop.h mmd.h)
+add_library (dual dual.c dual.h mmd.h)
+add_library (savedata savedata.c savedata.h mmd.h)
+add_library (memory memory.c memory.h mmd.h)
+add_library (tensor tensor.c tensor.h mmd.h)
+add_library (mmd mmd.c mmd.h)
+add_executable(${PROJECT_NAME} main.c)
+#SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-DDEBUG")
+
+target_link_libraries (${PROJECT_NAME}
+                       primal
+                       listop
+                       dual
+                       savedata
+                       tensor
+                       memory
+                       mmd
+                       m
+                       ${VTK_LIBRARIES}
+                       )
index 134833a..a4fd722 100644 (file)
@@ -61,8 +61,8 @@ void setDualFaces(struct primalMesh * myPrimalMesh, struct dualMesh * myDualMesh
     {
       myDualMesh->segmentToInternalDualFace[segmenti] = NULL;
     }  
-  myDualMesh->segmentToInternalDualFaceNumber = (connectivity_int *) malloc(sizeof (connectivity_int)*myPrimalMesh->segmentNumber);
-  memset(myDualMesh->segmentToInternalDualFaceNumber,0,myPrimalMesh->segmentNumber*sizeof (connectivity_int) );
+  myDualMesh->segmentToInternalDualFaceNumber = (connectivity_short *) malloc(sizeof (connectivity_short)*myPrimalMesh->segmentNumber);
+  memset(myDualMesh->segmentToInternalDualFaceNumber,0,myPrimalMesh->segmentNumber*sizeof (connectivity_short) );
   
   
   connectivity_int * output1;
index 1c3265b..85f3786 100644 (file)
@@ -69,9 +69,9 @@ int main (void)
   
 #ifdef OPTIMCODE
   affiche("OPTIM finded\n");
-  myPrimalMesh.M = 200; // cell number on X
-  myPrimalMesh.N = 20; // cell number on Y
-  myPrimalMesh.P = 20; // cell number on Z
+  myPrimalMesh.M = 50; // cell number on X
+  myPrimalMesh.N = 50; // cell number on Y
+  myPrimalMesh.P = 50; // cell number on Z
 #else
   myPrimalMesh.M = 200; // cell number on X
   myPrimalMesh.N = 200; // cell number on Y
@@ -103,7 +103,6 @@ int main (void)
   myPrimalMesh.cellToSegmentNeighbourNumber   = NULL;  
   
   
-  
   // FACES
   myPrimalMesh.faces                  = NULL;
   myPrimalMesh.cellToFacesOwner       = NULL;
@@ -183,7 +182,8 @@ int main (void)
   
   setDualFacesCentres(&myPrimalMesh, &myDualMesh);
   
-  /* To do dual segments to generate global dual surface
+  /* To do 
+   * dual segments to generate global dual surface
    * Faces = myPrimalMesh->segmentToFaceOwner union myPrimalMesh->segmentToFaceNeighbour
    * myPrimalMesh->faceToCells
    * Faces2 = myPrimalMesh->cellToFacesOwner union myPrimalMesh->cellToFacesNeighbour
@@ -195,6 +195,11 @@ int main (void)
    * Volumes of dual mesh
    * 
    * test Volume dual = volume primal
+   * 
+   * Do
+   * dualFaceToDualSegments
+   * 
+   * 
   */
   
   //  FILE *fp;
index 33179e2..d039e26 100644 (file)
@@ -314,7 +314,7 @@ void freeMemory(struct primalMesh * myPrimalMesh, struct dualMesh * myDualMesh)
   
   if(myPrimalMesh->vertexToCells!=NULL){
       
-      free(myPrimalMesh->vertexToCellNumbers);
+      free(myPrimalMesh->vertexToCellNumber);
     }
   
   
index d8c6069..4f40f4e 100644 (file)
--- a/src/mmd.c
+++ b/src/mmd.c
@@ -32,6 +32,8 @@ Author
 
 #include "mmd.h"
 
+
+
 clock_t startFunction(const char * functionName)
 {
   affiche("%-40s : Start\n", functionName);
index 4b62cb8..d9c4112 100644 (file)
--- a/src/mmd.h
+++ b/src/mmd.h
@@ -35,12 +35,12 @@ Author
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include <math.h>
 //#include <quadmath.h>
 
 #include <malloc.h>
-#include <memory.h>
 
 #include <time.h>
 
@@ -96,7 +96,7 @@ struct dualMesh {
   dataType          **internalDualFaceArea;
   
   connectivity_int ** segmentToInternalDualFace;
-  connectivity_int *  segmentToInternalDualFaceNumber;
+  connectivity_short *  segmentToInternalDualFaceNumber;
   
   
 };
@@ -117,18 +117,18 @@ struct primalMesh {
 
     // Cells
     connectivity_int            **         cellToCells; // done
-    connectivity_int                     cellToCellsNumbers; // done
+    connectivity_int             *         cellToCellsNumbers; // done
 
 
     // Vertex
     dataType                    **         vertex;
     connectivity_int            **         cellToVertex; // done
     connectivity_int            **         vertexToCells;
-    connectivity_int            *          vertexToCellNumbers;
+    connectivity_short          *          vertexToCellNumber;
 
     connectivity_int            **         vertexToSegments; // done
-    connectivity_int            *          vertexToSegmentNumber; // done
-    connectivity_int            *          cellToVertexNumber; // done
+    connectivity_short          *          vertexToSegmentNumber; // done
+    connectivity_short          *          cellToVertexNumber; // done
 
 
 
@@ -142,32 +142,32 @@ struct primalMesh {
     // Surfaces
     connectivity_int **     faces;
     connectivity_int **     cellToFaces;
-    connectivity_int *      cellToFacesNumber;
+    connectivity_short      cellToFacesNumber;
     connectivity_int **     cellToFacesOwner;
     connectivity_int **     cellToFacesNeighbour;
-    connectivity_int *      cellToFacesOwnerNumber;
-    connectivity_int *      cellToFacesNeighbourNumber;
+    connectivity_short *    cellToFacesOwnerNumber;
+    connectivity_short *    cellToFacesNeighbourNumber;
     connectivity_int **     cellToSegmentOwner;
-    connectivity_int *      cellToSegmentOwnerNumber;
+    connectivity_short *    cellToSegmentOwnerNumber;
     connectivity_int **     cellToSegmentNeighbour;
-    connectivity_int *      cellToSegmentNeighbourNumber;
+    connectivity_short *    cellToSegmentNeighbourNumber;
     
     connectivity_int **     vertexToFaces;
-    connectivity_int *      vertexToFacesNumber;
+    connectivity_short *    vertexToFacesNumber;
     connectivity_int **     vertexToSegmentOwner;
-    connectivity_int *      vertexToSegmentOwnerNumber;
+    connectivity_short *    vertexToSegmentOwnerNumber;
     connectivity_int **     vertexToSegmentNeighbour;
-    connectivity_int *      vertexToSegmentNeighbourNumber;
+    connectivity_short *    vertexToSegmentNeighbourNumber;
 
     connectivity_int **     segmentToFaceOwner;
-    connectivity_int *      segmentToFaceOwnerNumber;
+    connectivity_short *    segmentToFaceOwnerNumber;
     connectivity_int **     segmentToFaceNeighbour;
-    connectivity_int *      segmentToFaceNeighbourNumber;
+    connectivity_short *    segmentToFaceNeighbourNumber;
     dataType       **       segmentCentres;
 
 
-    connectivity_int *      faceToVertexNumber; // done
-    connectivity_int *      faceToCellsNumber; // done
+    connectivity_short *    faceToVertexNumber; // done
+    connectivity_short *    faceToCellsNumber; // done
     connectivity_int **     faceToVertex; // vertexToFaces -> facesTo
     connectivity_int **     faceToSegments;
     connectivity_int **     faceToCells;
@@ -205,6 +205,9 @@ struct readWriteVTK {
 };
 
 
+
+
+
 #ifdef DEBUG
 #define DEBUG_TEST 1
 #else
@@ -212,11 +215,25 @@ struct readWriteVTK {
 #endif // DEBUG
 
 
-//#define debug_print(...) \
-//    do { if (DEBUG_TEST) fprintf(stderr, __VA_ARGS__); fflush(stderr);fflush(stdout);} while (0)
+// MY ASSERT
+//#ifdef NDEBUG
+//#define ASSERT(expr) (void)0
+//#else
+
+// https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences
+#define P_BLINK "\033[25m"
+#define P_RED "\033[0;31m"
+#define P_YELLOW "\033[0;33m"
+#define P_RESET "\033[0m"
+
+#define P_BACK_RED "\033[1;37;41m"
+#define P_BACK_YELLOW "\033[0;43m"
+#define P_BACK_RESET "\033[0m"
+
+
+#define affiche(...) \
+ do {  printf( __VA_ARGS__); } 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__); } while (0)
@@ -224,15 +241,10 @@ struct readWriteVTK {
 #define release_print(...) \
     do {  printf( __VA_ARGS__); } while (0)
 
-/*
-#define debug_print(...) \
-    { if (DEBUG_TEST) printf( __VA_ARGS__); }
-*/
-/*
-#define debug_print(fmt, ...) \
-        do { if (DEBUG) fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \
-                                __LINE__, __func__, __VA_ARGS__); } while (0)
-*/
+
+#define ASSERT(expr) \
+  printf("%sASSERT%s -> FILE:%s LINE:%d EXPRESSION EVALUATED: \"%s\"\n",P_BACK_RED,P_BACK_RESET,__FILE__, __LINE__, #expr)
 
 #define ERROR_TEST(x) \
 { \
@@ -243,13 +255,11 @@ struct readWriteVTK {
     } \
     } while (0)
 
-#define affiche(...) \
- do {  printf( __VA_ARGS__); } while (0)
-
 
 
 clock_t startFunction(const char * functionName);
 
 void endFunction(const char * functionName, clock_t t);
 
+
 #endif // MMD_H
index 27b414b..06e0e2c 100644 (file)
@@ -88,7 +88,7 @@ void setHexahedreCellToVertexNumber(struct primalMesh * myPrimalMesh)
   connectivity_int it_cell=0;
   
   
-  myPrimalMesh->cellToVertexNumber = (connectivity_int *) malloc(myPrimalMesh->cellNumber * sizeof(connectivity_int));
+  myPrimalMesh->cellToVertexNumber = (connectivity_short *) malloc(myPrimalMesh->cellNumber * sizeof(connectivity_short));
   
   // hexaedron number of vertex on hexaedron
   for(connectivity_int i=0;i<myPrimalMesh->M;i++)
@@ -97,7 +97,7 @@ void setHexahedreCellToVertexNumber(struct primalMesh * myPrimalMesh)
         {
           it_cell     = k + j*myPrimalMesh->P + i*myPrimalMesh->P*myPrimalMesh->N;
           myPrimalMesh->cellToVertexNumber[it_cell]=HEXAHEDRON;
-          debug_print("%-40s : %ld (%ld)\n","myPrimalMesh->cellToVertexNumber", it_cell, myPrimalMesh->cellToVertexNumber[it_cell] );
+          debug_print("%-40s : %ld (%d)\n","myPrimalMesh->cellToVertexNumber", it_cell, myPrimalMesh->cellToVertexNumber[it_cell] );
         }
   endFunction(__FUNCTION__, t);
   
@@ -358,14 +358,14 @@ void setHexahedreVertexToCellNumbers(struct primalMesh * myPrimalMesh)
   clock_t t=startFunction(__FUNCTION__);
   affiche("\n");
   
-  myPrimalMesh->vertexToCellNumbers = (connectivity_int *) malloc(myPrimalMesh->vertexNumber * sizeof(connectivity_int));
-  memset(myPrimalMesh->vertexToCellNumbers, 0, myPrimalMesh->vertexNumber*sizeof(connectivity_int));
+  myPrimalMesh->vertexToCellNumber = (connectivity_short *) malloc(myPrimalMesh->vertexNumber * sizeof(connectivity_short));
+  memset(myPrimalMesh->vertexToCellNumber, 0, myPrimalMesh->vertexNumber*sizeof(connectivity_short));
   
   for(connectivity_int k=0;k<myPrimalMesh->cellNumber;k++)
     {
       for(connectivity_int i=0;i<myPrimalMesh->cellToVertexNumber[k];i++)
         {
-          myPrimalMesh->vertexToCellNumbers[myPrimalMesh->cellToVertex[k][i]]++;
+          myPrimalMesh->vertexToCellNumber[myPrimalMesh->cellToVertex[k][i]]++;
         }
     }
   
@@ -376,7 +376,7 @@ void setHexahedreVertexToCellNumbers(struct primalMesh * myPrimalMesh)
       debug_print( "%-40s : %ld ( ","myPrimalMesh->vertexToCellNumbers", k);
       
       {
-        debug_print( "%ld " , myPrimalMesh->vertexToCellNumbers[k]);
+        debug_print( "%d " , myPrimalMesh->vertexToCellNumber[k]);
       }
       debug_print(")\n");
     }
@@ -400,8 +400,8 @@ void setHexahedreVertexToCells(struct primalMesh * myPrimalMesh)
   
   for(connectivity_int i=0; i<myPrimalMesh->vertexNumber; i++)
     {
-      myPrimalMesh->vertexToCells[i] = (connectivity_int *) malloc(myPrimalMesh->vertexToCellNumbers[i] * sizeof(connectivity_int));
-      memset(myPrimalMesh->vertexToCells[i], 0, myPrimalMesh->vertexToCellNumbers[i]*sizeof(connectivity_int));
+      myPrimalMesh->vertexToCells[i] = (connectivity_int *) malloc(myPrimalMesh->vertexToCellNumber[i] * sizeof(connectivity_int));
+      memset(myPrimalMesh->vertexToCells[i], 0, myPrimalMesh->vertexToCellNumber[i]*sizeof(connectivity_int));
     }
   
   tmp = (connectivity_int *) malloc(myPrimalMesh->vertexNumber * sizeof(connectivity_int));
@@ -424,7 +424,7 @@ void setHexahedreVertexToCells(struct primalMesh * myPrimalMesh)
     {
       debug_print( "%-40s : %ld ( ","myPrimalMesh->vertexToCells", k);
       
-      for(connectivity_int ii=0;ii<myPrimalMesh->vertexToCellNumbers[k];ii++)
+      for(connectivity_int ii=0;ii<myPrimalMesh->vertexToCellNumber[k];ii++)
         {
           debug_print( "%ld " , myPrimalMesh->vertexToCells[k][ii]);
         }
@@ -481,7 +481,7 @@ void setHexahedreCellToCells(struct primalMesh * myPrimalMesh)
                   
                   vertexSelect = myPrimalMesh->cellToVertex[it_cell][vertexi];
                   
-                  for (connectivity_short celli=0;celli<myPrimalMesh->vertexToCellNumbers[vertexSelect];celli++)
+                  for (connectivity_short celli=0;celli<myPrimalMesh->vertexToCellNumber[vertexSelect];celli++)
                     {
                       
                       if(
@@ -594,11 +594,11 @@ void setHexahedreCellToFacesOwnerNeighbour(struct primalMesh * myPrimalMesh)
       myPrimalMesh->cellToFacesNeighbour[ii]  = NULL;//(connectivity_int * ) malloc(sizeof (connectivity_int*)*0);
     }
   
-  myPrimalMesh->cellToFacesOwnerNumber  = (connectivity_int * ) malloc(sizeof (connectivity_int)*myPrimalMesh->cellNumber);
-  memset(myPrimalMesh->cellToFacesOwnerNumber,0,myPrimalMesh->cellNumber*sizeof (connectivity_int) );
+  myPrimalMesh->cellToFacesOwnerNumber  = (connectivity_short * ) malloc(sizeof (connectivity_short)*myPrimalMesh->cellNumber);
+  memset(myPrimalMesh->cellToFacesOwnerNumber,0,myPrimalMesh->cellNumber*sizeof (connectivity_short) );
   
-  myPrimalMesh->cellToFacesNeighbourNumber  = (connectivity_int * ) malloc(sizeof (connectivity_int)*myPrimalMesh->cellNumber);
-  memset(myPrimalMesh->cellToFacesNeighbourNumber,0,myPrimalMesh->cellNumber*sizeof (connectivity_int) );
+  myPrimalMesh->cellToFacesNeighbourNumber  = (connectivity_short * ) malloc(sizeof (connectivity_short)*myPrimalMesh->cellNumber);
+  memset(myPrimalMesh->cellToFacesNeighbourNumber,0,myPrimalMesh->cellNumber*sizeof (connectivity_short) );
   
   
   //    myPrimalMesh->cellToFacesNeighbour = realloc(myPrimalMesh->cellToFacesNeighbour,sizeof (connectivity_int*)*(myPrimalMesh->cellNumber));
@@ -786,8 +786,8 @@ void setHexahedreFaceToCells(struct primalMesh * myPrimalMesh)
       myPrimalMesh->faceToCells[ii]  =  NULL;//(connectivity_int * ) malloc(sizeof (connectivity_int*)*0);
     }
   
-  myPrimalMesh->faceToCellsNumber  = (connectivity_int * ) malloc(sizeof (connectivity_int)*myPrimalMesh->faceNumber);
-  memset(myPrimalMesh->faceToCellsNumber,0,myPrimalMesh->faceNumber*sizeof (connectivity_int) );
+  myPrimalMesh->faceToCellsNumber  = (connectivity_short * ) malloc(sizeof (connectivity_short)*myPrimalMesh->faceNumber);
+  memset(myPrimalMesh->faceToCellsNumber,0,myPrimalMesh->faceNumber*sizeof (connectivity_short) );
   
   
   
@@ -882,8 +882,8 @@ void setHexahedreSegments(struct primalMesh * myPrimalMesh)
       myPrimalMesh->cellToSegmentOwner[celli]  = (connectivity_int * ) malloc(sizeof (connectivity_int)*0);
     }
   
-  myPrimalMesh->cellToSegmentOwnerNumber  = (connectivity_int * ) malloc(sizeof (connectivity_int)*myPrimalMesh->cellNumber);
-  memset(myPrimalMesh->cellToSegmentOwnerNumber, 0, myPrimalMesh->cellNumber*sizeof(connectivity_int));
+  myPrimalMesh->cellToSegmentOwnerNumber  = (connectivity_short * ) malloc(sizeof (connectivity_short)*myPrimalMesh->cellNumber);
+  memset(myPrimalMesh->cellToSegmentOwnerNumber, 0, myPrimalMesh->cellNumber*sizeof(connectivity_short));
   
   myPrimalMesh->cellToSegmentNeighbour  = (connectivity_int ** ) malloc(sizeof (connectivity_int*)*myPrimalMesh->cellNumber);
   for(connectivity_int celli=0;celli<myPrimalMesh->cellNumber;celli++)
@@ -891,8 +891,8 @@ void setHexahedreSegments(struct primalMesh * myPrimalMesh)
       myPrimalMesh->cellToSegmentNeighbour[celli]  = (connectivity_int * ) malloc(sizeof (connectivity_int)*0);
     }
   
-  myPrimalMesh->cellToSegmentNeighbourNumber  = (connectivity_int * ) malloc(sizeof (connectivity_int)*myPrimalMesh->cellNumber);
-  memset(myPrimalMesh->cellToSegmentNeighbourNumber, 0, myPrimalMesh->cellNumber*sizeof(connectivity_int));
+  myPrimalMesh->cellToSegmentNeighbourNumber  = (connectivity_short * ) malloc(sizeof (connectivity_short)*myPrimalMesh->cellNumber);
+  memset(myPrimalMesh->cellToSegmentNeighbourNumber, 0, myPrimalMesh->cellNumber*sizeof(connectivity_short));
   
   /// MODIF
   for (connectivity_int celli=0;celli<myPrimalMesh->cellNumber;celli++)
@@ -1221,16 +1221,16 @@ void setHexahedreVertexToSegments(struct primalMesh * myPrimalMesh)
       myPrimalMesh->vertexToSegmentOwner[ii]  =  NULL;//(connectivity_int * ) malloc(sizeof (connectivity_int*)*0);
     }
   
-  myPrimalMesh->vertexToSegmentOwnerNumber  = (connectivity_int * ) malloc(sizeof (connectivity_int)*myPrimalMesh->vertexNumber);
-  memset(myPrimalMesh->vertexToSegmentOwnerNumber, 0, myPrimalMesh->vertexNumber*sizeof(connectivity_int));
+  myPrimalMesh->vertexToSegmentOwnerNumber  = (connectivity_short * ) malloc(sizeof (connectivity_short)*myPrimalMesh->vertexNumber);
+  memset(myPrimalMesh->vertexToSegmentOwnerNumber, 0, myPrimalMesh->vertexNumber*sizeof(connectivity_short));
   
   myPrimalMesh->vertexToSegmentNeighbour  = (connectivity_int ** ) malloc(sizeof (connectivity_int*)*myPrimalMesh->vertexNumber);
   for (connectivity_int ii=0;ii<myPrimalMesh->vertexNumber;ii++) {
       myPrimalMesh->vertexToSegmentNeighbour[ii]  =  NULL;//(connectivity_int * ) malloc(sizeof (connectivity_int*)*0);
     }
   
-  myPrimalMesh->vertexToSegmentNeighbourNumber  = (connectivity_int * ) malloc(sizeof (connectivity_int)*myPrimalMesh->vertexNumber);
-  memset(myPrimalMesh->vertexToSegmentNeighbourNumber, 0, myPrimalMesh->vertexNumber*sizeof(connectivity_int));
+  myPrimalMesh->vertexToSegmentNeighbourNumber  = (connectivity_short * ) malloc(sizeof (connectivity_short)*myPrimalMesh->vertexNumber);
+  memset(myPrimalMesh->vertexToSegmentNeighbourNumber, 0, myPrimalMesh->vertexNumber*sizeof(connectivity_short));
   
   
   connectivity_int pointOwner = 0;
@@ -1238,7 +1238,7 @@ void setHexahedreVertexToSegments(struct primalMesh * myPrimalMesh)
   
   for (connectivity_int segmentAi=0;segmentAi<myPrimalMesh->segmentNumber;segmentAi++)
     {
-      if(segmentAi % (int)floor(myPrimalMesh->cellNumber*10/NBAFFICHE) == 0 && segmentAi!=0)
+      if(segmentAi % (connectivity_int)floor(myPrimalMesh->cellNumber*10/NBAFFICHE) == 0 && segmentAi!=0)
         release_print( "%-40s :  (%ld)\n","SEGMENTS", segmentAi);
       
       pointOwner = myPrimalMesh->segments[segmentAi][1];
@@ -1317,8 +1317,8 @@ void setHexahedreSegmentToFaces(struct primalMesh * myPrimalMesh)
       myPrimalMesh->segmentToFaceOwner[ii]  =  NULL;//(connectivity_int * ) malloc(sizeof (connectivity_int*)*0);
     }
   
-  myPrimalMesh->segmentToFaceOwnerNumber  = (connectivity_int * ) malloc(sizeof (connectivity_int)*myPrimalMesh->segmentNumber);
-  memset(myPrimalMesh->segmentToFaceOwnerNumber, 0, myPrimalMesh->segmentNumber*sizeof(connectivity_int));
+  myPrimalMesh->segmentToFaceOwnerNumber  = (connectivity_short * ) malloc(sizeof (connectivity_short)*myPrimalMesh->segmentNumber);
+  memset(myPrimalMesh->segmentToFaceOwnerNumber, 0, myPrimalMesh->segmentNumber*sizeof(connectivity_short));
   
   
   myPrimalMesh->segmentToFaceNeighbour  = (connectivity_int ** ) malloc(sizeof (connectivity_int*)*myPrimalMesh->segmentNumber);
@@ -1326,8 +1326,8 @@ void setHexahedreSegmentToFaces(struct primalMesh * myPrimalMesh)
       myPrimalMesh->segmentToFaceNeighbour[ii]  =  NULL;//(connectivity_int * ) malloc(sizeof (connectivity_int*)*0);
     }
   
-  myPrimalMesh->segmentToFaceNeighbourNumber  = (connectivity_int * ) malloc(sizeof (connectivity_int)*myPrimalMesh->segmentNumber);
-  memset(myPrimalMesh->segmentToFaceNeighbourNumber, 0, myPrimalMesh->segmentNumber*sizeof(connectivity_int));
+  myPrimalMesh->segmentToFaceNeighbourNumber  = (connectivity_short * ) malloc(sizeof (connectivity_short)*myPrimalMesh->segmentNumber);
+  memset(myPrimalMesh->segmentToFaceNeighbourNumber, 0, myPrimalMesh->segmentNumber*sizeof(connectivity_short));
   
   
   for (connectivity_int celli=0;celli<myPrimalMesh->cellNumber;celli++)
@@ -1547,8 +1547,8 @@ void setHexahedreSegmentToFaces2(struct primalMesh * myPrimalMesh)
       myPrimalMesh->segmentToFaceOwner[ii]  =  NULL;//(connectivity_int * ) malloc(sizeof (connectivity_int*)*0);
     }
   
-  myPrimalMesh->segmentToFaceOwnerNumber  = (connectivity_int * ) malloc(sizeof (connectivity_int)*myPrimalMesh->segmentNumber);
-  memset(myPrimalMesh->segmentToFaceOwnerNumber, 0, myPrimalMesh->segmentNumber*sizeof(connectivity_int));
+  myPrimalMesh->segmentToFaceOwnerNumber  = (connectivity_short * ) malloc(sizeof (connectivity_short)*myPrimalMesh->segmentNumber);
+  memset(myPrimalMesh->segmentToFaceOwnerNumber, 0, myPrimalMesh->segmentNumber*sizeof(connectivity_short));
   
   
   myPrimalMesh->segmentToFaceNeighbour  = (connectivity_int ** ) malloc(sizeof (connectivity_int*)*myPrimalMesh->segmentNumber);
@@ -1556,8 +1556,8 @@ void setHexahedreSegmentToFaces2(struct primalMesh * myPrimalMesh)
       myPrimalMesh->segmentToFaceNeighbour[ii]  =  NULL;//(connectivity_int * ) malloc(sizeof (connectivity_int*)*0);
     }
   
-  myPrimalMesh->segmentToFaceNeighbourNumber  = (connectivity_int * ) malloc(sizeof (connectivity_int)*myPrimalMesh->segmentNumber);
-  memset(myPrimalMesh->segmentToFaceNeighbourNumber, 0, myPrimalMesh->segmentNumber*sizeof(connectivity_int));
+  myPrimalMesh->segmentToFaceNeighbourNumber  = (connectivity_short * ) malloc(sizeof (connectivity_short)*myPrimalMesh->segmentNumber);
+  memset(myPrimalMesh->segmentToFaceNeighbourNumber, 0, myPrimalMesh->segmentNumber*sizeof(connectivity_short));
   
   
   for (connectivity_int faceAi=0;faceAi<myPrimalMesh->faceNumber;faceAi++)
index 0daaf96..4f6279d 100644 (file)
@@ -1,7 +1,15 @@
-cmake_minimum_required(VERSION 2.8)
-project(test01)
+# rm -rf * && cmake .. && make && make MMD && make test
+
+include_directories (${MMD_SOURCE_DIR}/src)
+add_definitions("-DDEBUG")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb -DDEBUG")
 add_executable(test01.out test01.c)
-enable_testing()
-#add_test(NAME YeahhhTest COMMAND ${CMAKE_COMMAND} -E echo 'Yeahh')
-add_test(NAME Print_test COMMAND ${CMAKE_COMMAND} -E echo 'Yeahh')
-file(GLOB SRC_FILES ${CMAKE_SOURCE_DIR}/../src/*.c  ${CMAKE_SOURCE_DIR}/../src/*.cpp)
+#SET_TARGET_PROPERTIES(test01.out PROPERTIES COMPILE_FLAGS "-DDEBUG")
+target_link_libraries (test01.out
+                       memory
+                       mmd
+                       primal
+                       listop
+                       m
+                       )
index 516a2ad..7b8198b 100644 (file)
@@ -30,11 +30,25 @@ Author
 
 \*---------------------------------------------------------------------------*/
 
+//#include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <assert.h>
 #include "mmd.h"
 
+#ifndef DEBUG
+#define DEBUG
+#endif
+
+
 int main()
   {
-  printf("This is the whole thing.\n");
+  // redirects stderr to stdout below this line.
+  // dup2(1, 2);
+  int a=1;
+  int b=2;
+  affiche("This is the whole thing.\n");
+  ASSERT(a>b); // fonctionne en mode DEBUG
+  //  exit(0);
   }