diff --git a/.clang-format b/.clang-format
new file mode 100644
index 00000000..355f43f8
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,67 @@
+---
+Language: Cpp
+# BasedOnStyle: Google
+AccessModifierOffset: -1
+AlignAfterOpenBracket: true
+AlignConsecutiveAssignments: false
+AlignEscapedNewlinesLeft: true
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: true
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakBeforeMultilineStrings: true
+AlwaysBreakTemplateDeclarations: true
+BinPackArguments: true
+BinPackParameters: true
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Attach
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+ColumnLimit: 80
+CommentPragmas: '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: true
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DerivePointerAlignment: true
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
+IndentCaseLabels: true
+IndentWidth: 2
+IndentWrappedFunctionNames: false
+KeepEmptyLinesAtTheStartOfBlocks: false
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: false
+PenaltyBreakBeforeFirstCallParameter: 1
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 200
+PointerAlignment: Left
+SpaceAfterCStyleCast: false
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 2
+SpacesInAngles: false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Auto
+TabWidth: 8
+UseTab: Never
+...
+
diff --git a/.gitignore b/.gitignore
index b8bd0267..3f57688c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,3 +26,7 @@
*.exe
*.out
*.app
+
+# QtCreator local project file
+CMakeLists.txt.user
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000..3d05328a
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,83 @@
+cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
+
+set(CGOGN_VERSION_MAJOR 2)
+set(CGOGN_VERSION_MINOR 0)
+set(CGOGN_VERSION_PATCH 0)
+
+project(CGoGN
+ VERSION ${CGOGN_VERSION_MAJOR}.${CGOGN_VERSION_MINOR}.${CGOGN_VERSION_PATCH}
+ LANGUAGES CXX
+)
+
+#### Default build type
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Release")
+endif()
+
+
+#### Here are located the FindPackages that we need
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
+
+#### Compile Options
+include(cmake/CompilerOptions.cmake)
+include(cmake/GenerateCppcheck.cmake)
+include(cmake/EnableCoverageReport.cmake)
+
+
+#### Build configuration
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
+set(CGOGN_SOURCE_DIR ${CMAKE_SOURCE_DIR}/cgogn)
+
+
+#### ThirdParty options
+option(CGOGN_PROVIDE_EIGEN "Use the version of eigen that is packaged with CGoGN" ON)
+option(CGOGN_BUILD_TESTS "build cgogn unit tests using google test framework" ON)
+
+
+#### RPATH
+if(UNIX)
+ # RPATH is a field in ELF binaries that is used as a hint by the system
+ # loader to find needed shared libraries.
+ #
+ # In the build directory, cmake creates binaries with absolute paths in
+ # RPATH. And by default, it strips RPATH from installed binaries. Here we
+ # use CMAKE_INSTALL_RPATH to set a relative RPATH. By doing so, we avoid
+ # the need to play with LD_LIBRARY_PATH to get applications to run.
+ set(CMAKE_INSTALL_RPATH "../lib:../../lib")
+
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set(CMAKE_MACOSX_RPATH ON)
+ endif()
+endif(UNIX)
+
+## Deduce build type of not forced by setting the CMAKE_BUILD_TYPE var
+setBuildType()
+
+
+if(CGOGN_BUILD_TESTS)
+ if(NOT gtest_inited)
+ set(gtest_inited ON CACHE INTERNAL "" FORCE)
+ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+ endif()
+endif(CGOGN_BUILD_TESTS)
+
+
+add_subdirectory(doc)
+
+add_subdirectory(thirdparty)
+
+add_subdirectory(${CGOGN_SOURCE_DIR})
+
+add_subdirectory(test)
+
+add_subdirectory(utest)
+
+## TODO a mettre dans un fichier cmake particulier
+
+# --- coverage ---
+ENABLE_COVERAGE_REPORT(TARGETS ${CGOGN_SOURCE_DIR})
+
+# --- CPPCheck ---
+GENERATE_CPPCHECK( SOURCES ${CGOGN_SOURCE_DIR} ENABLE_IDS all INCLUDES ${CGOGN_SOURCE_DIR})
diff --git a/QTcreator_IGGstyle.xml b/QTcreator_IGGstyle.xml
new file mode 100644
index 00000000..223bba21
--- /dev/null
+++ b/QTcreator_IGGstyle.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+ CodeStyleData
+
+ false
+ false
+ false
+ false
+ false
+ true
+ true
+ false
+ true
+ false
+ false
+ false
+ true
+ true
+ false
+ true
+ false
+ false
+ false
+ 4
+ true
+ true
+ 2
+ false
+ 4
+
+
+
+ DisplayName
+ IGGstyle
+
+
diff --git a/README.md b/README.md
index aa85d976..fc938fc9 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,18 @@
CGoGN is a geometric modeling C++ library that provides an efficient implementation of combinatorial maps.
+## Building and installing CGoGN
+* run cmake from the build directory of your choice (this build directory must not be cgogn_path)
+* you can specify build type and install path by modifying CMAKE_BUILD_TYPE and CMAKE_INSTALL_PREFIX either by using cmake-gui or ccmake, or by specifying -DCMAKE_BUILD_TYPE="" -DCMAKE_INSTALL_PREFIX="" when running cmake
+* CMAKE_BUILD_TYPE default value is "Release"
+* LINUX and MacOS
+ * make -jN or ninja in the build directory
+ * make (or ninja) install in the build directory if you want to install
+* Windows
+ * VS 2013 or better required
+ * Installation : open INSTALL solution in VS and build it
+
+
## Contribution HowTo
* Fork this GitHub repository
diff --git a/cgogn/CMakeLists.txt b/cgogn/CMakeLists.txt
new file mode 100644
index 00000000..4f3a3050
--- /dev/null
+++ b/cgogn/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_subdirectory(utils)
+add_subdirectory(core)
diff --git a/cgogn/core/CMakeLists.txt b/cgogn/core/CMakeLists.txt
new file mode 100644
index 00000000..5856b6fa
--- /dev/null
+++ b/cgogn/core/CMakeLists.txt
@@ -0,0 +1,60 @@
+project(cgogn_core
+ LANGUAGES CXX
+)
+
+set(HEADER_FILES
+ basic/dll.h
+ basic/dart.h
+ basic/dart_marker.h
+ basic/cell.h
+ basic/cell_marker.h
+
+ container/chunk_array_container.h
+ container/chunk_array_factory.h
+ container/chunk_array_gen.h
+ container/chunk_array.h
+ container/chunk_stack.h
+
+ map/map_base_data.h
+ map/map_base.h
+ map/cmap1.h
+ map/cmap2.h
+ map/cmap3.h
+ map/cmap_tri.h
+ map/attribute_handler.h
+
+ io/surface_import.h
+)
+
+set(SOURCE_FILES
+ basic/cell_marker.cpp
+ basic/dart_marker.cpp
+
+ container/chunk_array_container.cpp
+
+ map/map_base_data.cpp
+)
+
+add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES})
+
+set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "_d")
+
+target_include_directories(${PROJECT_NAME} PUBLIC
+ $
+ $
+ $
+)
+
+target_link_libraries(${PROJECT_NAME} cgogn_utils)
+
+install(DIRECTORY basic container
+ DESTINATION include/cgogn/cgogn_core
+ FILES_MATCHING PATTERN "*.h"
+)
+
+install(TARGETS ${PROJECT_NAME}
+ EXPORT ${PROJECT_NAME}Targets
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
diff --git a/cgogn/core/basic/cell.h b/cgogn/core/basic/cell.h
new file mode 100644
index 00000000..46a9c17a
--- /dev/null
+++ b/cgogn/core/basic/cell.h
@@ -0,0 +1,155 @@
+/*******************************************************************************
+* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
+* Copyright (C) 2015, IGG Group, ICube, University of Strasbourg, France *
+* *
+* This library is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU Lesser General Public License as published by the *
+* Free Software Foundation; either version 2.1 of the License, or (at your *
+* option) any later version. *
+* *
+* This library is distributed in the hope that it will be useful, but WITHOUT *
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
+* for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with this library; if not, write to the Free Software Foundation, *
+* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
+* *
+* Web site: http://cgogn.unistra.fr/ *
+* Contact information: cgogn@unistra.fr *
+* *
+*******************************************************************************/
+
+#ifndef CORE_BASIC_CELL_H_
+#define CORE_BASIC_CELL_H_
+
+#include
+
+#include
+#include
+
+/**
+ * \file core/basic/cell.h
+ * \brief Orbit and cell definitions used in cgogn.
+ */
+namespace cgogn
+{
+
+enum Orbit: unsigned int
+{
+ DART = 0,
+ PHI1,
+ PHI2,
+ PHI1_PHI2,
+ PHI1_PHI3,
+ PHI2_PHI3,
+ PHI21,
+ PHI21_PHI31,
+};
+
+static const unsigned int NB_ORBITS = Orbit::PHI21_PHI31 + 1;
+
+inline std::string orbit_name(Orbit orbit)
+{
+ switch(orbit)
+ {
+ case Orbit::DART: return "Orbit::DART"; break;
+ case Orbit::PHI1: return "Orbit::PHI1"; break;
+ case Orbit::PHI2: return "Orbit::PHI2"; break;
+ case Orbit::PHI1_PHI2: return "Orbit::PHI1_PHI2"; break;
+ case Orbit::PHI1_PHI3: return "Orbit::PHI1_PHI3"; break;
+ case Orbit::PHI2_PHI3: return "Orbit::PHI2_PHI3"; break;
+ case Orbit::PHI21: return "Orbit::PHI21"; break;
+ case Orbit::PHI21_PHI31: return "Orbit::PHI21_PHI31"; break;
+ default: cgogn_assert_not_reached("This orbit does not exist"); break;
+ }
+ return "UNKNOWN";
+}
+
+
+/**
+ * \brief Cellular typing
+ *
+ * \details warning to automatic conversion
+ * cell -> Dart (or const Dart&) ok
+ * Dart -> Cell (or const Cell&) ok
+ * \tparam ORBIT The type of the orbit used to create the Cell
+ */
+template
+class Cell
+{
+public:
+
+ /**
+ * \brief the dart representing this cell
+ */
+ Dart dart;
+
+ /**
+ * \brief Creates a new empty Cell as a nil dart.
+ */
+ inline Cell() : dart()
+ {}
+
+ /**
+ * \brief Creates a new Cell with a dart.
+ * \param[in] d dart to convert to a cell of a given orbit
+ */
+ inline Cell(Dart d) : dart(d)
+ {}
+
+ /**
+ * \brief Copy constructor.
+ * Creates a new Cell from an another one.
+ * \param[in] c a cell
+ */
+ inline Cell(const Cell& c) : dart(c.dart)
+ {}
+
+ //TODO
+ // Cell(Cell&& ) = delete;
+
+ /**
+ * \brief Cast operator.
+ * \return the dart
+ */
+ inline operator Dart() const { return dart; }
+
+ /**
+ * \brief Tests the validity of the cell.
+ * \retval true if the cell is valid
+ * \retval false otherwise
+ */
+ inline bool is_valid() const { return !dart.is_nil(); }
+
+ /**
+ * \brief Assigns to the left hand side cell the value
+ * of the right hand side cell.
+ * \param[in] rhs the cell to assign
+ * \return The cell with the assigned value
+ */
+ Cell operator=(Cell rhs) { dart = rhs.dart; return *this; }
+
+
+ //TODO
+ // Cell operator=(Cell&& rhs) { dart = rhs.dart return *this; }
+
+ /**
+ * \brief Prints a cell to a stream.
+ * \param[out] out the stream to print on
+ * \param[in] rhs the cell to print
+ */
+ friend std::ostream& operator<<(std::ostream &out, const Cell& rhs) { return out << rhs.dart; }
+
+ /**
+ * \brief Reads a cell from a stream.
+ * \param[in] in the stream to read from
+ * \param[out] rhs the cell read
+ */
+ friend std::istream& operator>>(std::istream &in, Cell& rhs) { in >> rhs.dart; return in; }
+};
+
+} // namespace cgogn
+
+#endif // CORE_BASIC_CELL_H_
diff --git a/cgogn/core/basic/cell_marker.cpp b/cgogn/core/basic/cell_marker.cpp
new file mode 100644
index 00000000..d32126ea
--- /dev/null
+++ b/cgogn/core/basic/cell_marker.cpp
@@ -0,0 +1,34 @@
+/*******************************************************************************
+* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
+* Copyright (C) 2015, IGG Group, ICube, University of Strasbourg, France *
+* *
+* This library is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU Lesser General Public License as published by the *
+* Free Software Foundation; either version 2.1 of the License, or (at your *
+* option) any later version. *
+* *
+* This library is distributed in the hope that it will be useful, but WITHOUT *
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
+* for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with this library; if not, write to the Free Software Foundation, *
+* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
+* *
+* Web site: http://cgogn.unistra.fr/ *
+* Contact information: cgogn@unistra.fr *
+* *
+*******************************************************************************/
+
+#define CGOGN_CORE_DLL_EXPORT
+
+#include
+
+namespace cgogn
+{
+
+//CellMarkerGen::~CellMarkerGen()
+//{}
+
+} // namespace cgogn
diff --git a/cgogn/core/basic/cell_marker.h b/cgogn/core/basic/cell_marker.h
new file mode 100644
index 00000000..443b2ea1
--- /dev/null
+++ b/cgogn/core/basic/cell_marker.h
@@ -0,0 +1,207 @@
+/*******************************************************************************
+* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
+* Copyright (C) 2015, IGG Group, ICube, University of Strasbourg, France *
+* *
+* This library is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU Lesser General Public License as published by the *
+* Free Software Foundation; either version 2.1 of the License, or (at your *
+* option) any later version. *
+* *
+* This library is distributed in the hope that it will be useful, but WITHOUT *
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
+* for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with this library; if not, write to the Free Software Foundation, *
+* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
+* *
+* Web site: http://cgogn.unistra.fr/ *
+* Contact information: cgogn@unistra.fr *
+* *
+*******************************************************************************/
+
+#ifndef CORE_BASIC_CELL_MARKER_H_
+#define CORE_BASIC_CELL_MARKER_H_
+
+#include
+#include
+#include
+
+namespace cgogn
+{
+
+//class CGOGN_CORE_API CellMarkerGen
+//{
+//public:
+// typedef CellMarkerGen Self;
+// CellMarkerGen()
+// {}
+
+// virtual ~CellMarkerGen();
+
+// CellMarkerGen(const Self& dm) = delete;
+// CellMarkerGen(Self&& dm) = delete;
+// CellMarkerGen& operator=(Self&& dm) = delete;
+// CellMarkerGen& operator=(const Self& dm) = delete;
+//};
+
+template
+class CellMarkerT // : public CellMarkerGen
+{
+ static_assert(ORBIT < NB_ORBITS, "Unknown orbit parameter");
+
+public:
+
+// typedef CellMarkerGen Inherit;
+ typedef CellMarkerT