diff --git a/packages/00_core.cmake b/packages/00_core.cmake
index e885ad53f..e96787ca1 100644
--- a/packages/00_core.cmake
+++ b/packages/00_core.cmake
@@ -1,486 +1,487 @@
 #===============================================================================
 # @file   core.cmake
 #
 # @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date   Mon Nov 21 18:19:15 2011
 #
 # @brief  package description for core
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu 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 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
 set(AKANTU_CORE ON CACHE INTERNAL "core package for Akantu" FORCE)
 
 set(AKANTU_CORE_FILES
   common/aka_array.cc
   common/aka_array.hh
   common/aka_array_tmpl.hh
   common/aka_blas_lapack.hh
   common/aka_circular_array.hh
   common/aka_circular_array_inline_impl.cc
   common/aka_common.cc
   common/aka_common.hh
   common/aka_common_inline_impl.cc
   common/aka_csr.hh
   common/aka_error.cc
   common/aka_error.hh
   common/aka_event_handler_manager.hh
   common/aka_extern.cc
   common/aka_fwd.hh
   common/aka_grid_dynamic.hh
   common/aka_math.cc
   common/aka_math.hh
   common/aka_math_tmpl.hh
   common/aka_memory.cc
   common/aka_memory.hh
   common/aka_memory_inline_impl.cc
   common/aka_random_generator.hh
   common/aka_safe_enum.hh
   common/aka_static_memory.cc
   common/aka_static_memory.hh
   common/aka_static_memory_inline_impl.cc
   common/aka_static_memory_tmpl.hh
   common/aka_typelist.hh
   common/aka_types.hh
   common/aka_visitor.hh
   common/aka_voigthelper.hh
   common/aka_voigthelper.cc
 
   fe_engine/element_class.cc
   fe_engine/element_class.hh
   fe_engine/element_class_tmpl.hh
   fe_engine/element_classes/element_class_hexahedron_8_inline_impl.cc
   fe_engine/element_classes/element_class_pentahedron_6_inline_impl.cc
   fe_engine/element_classes/element_class_point_1_inline_impl.cc
   fe_engine/element_classes/element_class_quadrangle_4_inline_impl.cc
   fe_engine/element_classes/element_class_quadrangle_8_inline_impl.cc
   fe_engine/element_classes/element_class_segment_2_inline_impl.cc
   fe_engine/element_classes/element_class_segment_3_inline_impl.cc
   fe_engine/element_classes/element_class_tetrahedron_10_inline_impl.cc
   fe_engine/element_classes/element_class_tetrahedron_4_inline_impl.cc
   fe_engine/element_classes/element_class_triangle_3_inline_impl.cc
   fe_engine/element_classes/element_class_triangle_6_inline_impl.cc
 
   fe_engine/fe_engine.cc
   fe_engine/fe_engine.hh
   fe_engine/fe_engine_inline_impl.cc
   fe_engine/fe_engine_template.hh
   fe_engine/fe_engine_template_tmpl.hh
   fe_engine/geometrical_data_tmpl.hh
   fe_engine/geometrical_element.cc
   fe_engine/integration_element.cc
   fe_engine/integrator.hh
   fe_engine/integrator_gauss.hh
   fe_engine/integrator_gauss_inline_impl.cc
   fe_engine/interpolation_element.cc
   fe_engine/interpolation_element_tmpl.hh
   fe_engine/shape_functions.hh
   fe_engine/shape_functions_inline_impl.cc
   fe_engine/shape_lagrange.cc
   fe_engine/shape_lagrange.hh
   fe_engine/shape_lagrange_inline_impl.cc
   fe_engine/shape_linked.cc
   fe_engine/shape_linked.hh
   fe_engine/shape_linked_inline_impl.cc
   fe_engine/element.hh
 
 
 #  fem/by_element_type.hh
 
 #  fem/by_element_type_tmpl.hh
 #
 #  fem/element_class.cc
 #  fem/element_class.hh
 #  fem/element.hh
 #  fem/element_class_tmpl.hh
 #  fem/element_classes/element_class_hexahedron_8_inline_impl.cc
 #  fem/element_classes/element_class_pentahedron_6_inline_impl.cc
 #  fem/element_classes/element_class_point_1_inline_impl.cc
 #  fem/element_classes/element_class_quadrangle_4_inline_impl.cc
 #  fem/element_classes/element_class_quadrangle_8_inline_impl.cc
 #  fem/element_classes/element_class_segment_2_inline_impl.cc
 #  fem/element_classes/element_class_segment_3_inline_impl.cc
 #  fem/element_classes/element_class_tetrahedron_10_inline_impl.cc
 #  fem/element_classes/element_class_tetrahedron_4_inline_impl.cc
 #  fem/element_classes/element_class_triangle_3_inline_impl.cc
 #  fem/element_classes/element_class_triangle_6_inline_impl.cc
 #
 #  fem/element_group.cc
 #  fem/element_group.hh
 #  fem/element_group_inline_impl.cc
 #  fem/fem.cc
 #  fem/fem.hh
 #  fem/fem_inline_impl.cc
 #  fem/fem_template.hh
 #  fem/fem_template_tmpl.hh
 #  fem/geometrical_data_tmpl.hh
 #  fem/geometrical_element.cc
 #  fem/group_manager.cc
 #  fem/group_manager.hh
 #  fem/group_manager_inline_impl.cc
 #  fem/integration_element.cc
 #  fem/integrator.hh
 #  fem/integrator_gauss.hh
 #  fem/integrator_gauss_inline_impl.cc
 #  fem/interpolation_element.cc
 #  fem/interpolation_element_tmpl.hh
 #  fem/mesh.cc
 #  fem/mesh.hh
 #  fem/mesh_filter.hh
 #  fem/mesh_data.cc
 #  fem/mesh_data.hh
 #  fem/mesh_data_tmpl.hh
 #  fem/mesh_inline_impl.cc
 #  fem/node_group.cc
 #  fem/node_group.hh
 #  fem/node_group_inline_impl.cc
 #  fem/shape_functions.hh
 #  fem/shape_functions_inline_impl.cc
 #  fem/shape_lagrange.cc
 #  fem/shape_lagrange.hh
 #  fem/shape_lagrange_inline_impl.cc
 #  fem/shape_linked.cc
 #  fem/shape_linked.hh
 #  fem/shape_linked_inline_impl.cc
 
   io/dumper/dumpable.hh
+  io/dumper/dumpable.cc
   io/dumper/dumpable_inline_impl.hh
   io/dumper/dumper_field.hh
   io/dumper/dumper_material_padders.hh
   io/dumper/dumper_filtered_connectivity.hh
   io/dumper/dumper_element_type.hh
   io/dumper/dumper_element_partition.hh
 
   io/mesh_io.cc
   io/mesh_io.hh
   io/mesh_io/mesh_io_abaqus.cc
   io/mesh_io/mesh_io_abaqus.hh
   io/mesh_io/mesh_io_diana.cc
   io/mesh_io/mesh_io_diana.hh
   io/mesh_io/mesh_io_msh.cc
   io/mesh_io/mesh_io_msh.hh
   io/model_io.cc
   io/model_io.hh
 
   io/parser/algebraic_parser.hh
   io/parser/input_file_parser.hh
   io/parser/parsable.cc
   io/parser/parsable.hh
   io/parser/parsable_tmpl.hh
   io/parser/parser.cc
   io/parser/parser.hh
   io/parser/parser_tmpl.hh
   io/parser/cppargparse/cppargparse.hh
   io/parser/cppargparse/cppargparse.cc
   io/parser/cppargparse/cppargparse_tmpl.hh
 
   mesh/element_group.cc
   mesh/element_group.hh
   mesh/element_group_inline_impl.cc
   mesh/element_type_map.hh
   mesh/element_type_map_tmpl.hh
   mesh/element_type_map_filter.hh
   mesh/group_manager.cc
   mesh/group_manager.hh
   mesh/group_manager_inline_impl.cc
   mesh/mesh.cc
   mesh/mesh.hh
   mesh/mesh_filter.hh
   mesh/mesh_data.cc
   mesh/mesh_data.hh
   mesh/mesh_data_tmpl.hh
   mesh/mesh_inline_impl.cc
   mesh/node_group.cc
   mesh/node_group.hh
   mesh/node_group_inline_impl.cc
 
   mesh_utils/mesh_partition.cc
   mesh_utils/mesh_partition.hh
   mesh_utils/mesh_partition/mesh_partition_mesh_data.cc
   mesh_utils/mesh_partition/mesh_partition_mesh_data.hh
   mesh_utils/mesh_partition/mesh_partition_scotch.hh
   mesh_utils/mesh_pbc.cc
   mesh_utils/mesh_utils.cc
   mesh_utils/mesh_utils.hh
   mesh_utils/mesh_utils_inline_impl.cc
   mesh_utils/mesh_graph.cc
   mesh_utils/mesh_graph.hh
 
   model/boundary_condition.hh
   model/boundary_condition_functor.hh
   model/boundary_condition_functor_inline_impl.cc
   model/boundary_condition_tmpl.hh
   model/integration_scheme/generalized_trapezoidal.hh
   model/integration_scheme/generalized_trapezoidal_inline_impl.cc
   model/integration_scheme/integration_scheme_1st_order.hh
   model/integration_scheme/integration_scheme_2nd_order.hh
   model/integration_scheme/newmark-beta.hh
   model/integration_scheme/newmark-beta_inline_impl.cc
   model/model.cc
   model/model.hh
   model/model_inline_impl.cc
 
   model/solid_mechanics/material.cc
   model/solid_mechanics/material.hh
   model/solid_mechanics/material_inline_impl.cc
   model/solid_mechanics/material_list.hh
   model/solid_mechanics/material_random_internal.hh
   model/solid_mechanics/material_selector.hh
   model/solid_mechanics/material_selector_tmpl.hh
   model/solid_mechanics/materials/internal_field.hh
   model/solid_mechanics/materials/internal_field_tmpl.hh
   model/solid_mechanics/materials/material_elastic.cc
   model/solid_mechanics/materials/material_elastic.hh
   model/solid_mechanics/materials/material_elastic_inline_impl.cc
   model/solid_mechanics/materials/material_thermal.cc
   model/solid_mechanics/materials/material_thermal.hh
   model/solid_mechanics/materials/random_internal_field.hh
   model/solid_mechanics/materials/random_internal_field_tmpl.hh
   model/solid_mechanics/solid_mechanics_model.cc
   model/solid_mechanics/solid_mechanics_model.hh
   model/solid_mechanics/solid_mechanics_model_inline_impl.cc
   model/solid_mechanics/solid_mechanics_model_mass.cc
   model/solid_mechanics/solid_mechanics_model_material.cc
   model/solid_mechanics/solid_mechanics_model_tmpl.hh
   model/solid_mechanics/solid_mechanics_model_event_handler.hh
 
   model/solid_mechanics/materials/material_damage/material_damage.hh
   model/solid_mechanics/materials/material_damage/material_damage_tmpl.hh
   model/solid_mechanics/materials/material_damage/material_marigo.cc
   model/solid_mechanics/materials/material_damage/material_marigo.hh
   model/solid_mechanics/materials/material_damage/material_marigo_inline_impl.cc
   model/solid_mechanics/materials/material_damage/material_mazars.cc
   model/solid_mechanics/materials/material_damage/material_mazars.hh
   model/solid_mechanics/materials/material_damage/material_mazars_inline_impl.cc
   model/solid_mechanics/materials/material_finite_deformation/material_neohookean.cc
   model/solid_mechanics/materials/material_finite_deformation/material_neohookean.hh
   model/solid_mechanics/materials/material_finite_deformation/material_neohookean_inline_impl.cc
   model/solid_mechanics/materials/material_plastic/material_plastic.cc
   model/solid_mechanics/materials/material_plastic/material_plastic.hh
   model/solid_mechanics/materials/material_plastic/material_plastic_inline_impl.cc
   model/solid_mechanics/materials/material_plastic/material_linear_isotropic_hardening.cc
   model/solid_mechanics/materials/material_plastic/material_linear_isotropic_hardening.hh
   model/solid_mechanics/materials/material_plastic/material_linear_isotropic_hardening_inline_impl.cc
   model/solid_mechanics/materials/material_viscoelastic/material_standard_linear_solid_deviatoric.cc
   model/solid_mechanics/materials/material_viscoelastic/material_standard_linear_solid_deviatoric.hh
 
   solver/solver.cc
   solver/solver.hh
   solver/sparse_matrix.cc
   solver/sparse_matrix.hh
   solver/sparse_matrix_inline_impl.cc
 
   synchronizer/communication_buffer.hh
   synchronizer/communication_buffer_inline_impl.cc
   synchronizer/data_accessor.cc
   synchronizer/data_accessor.hh
   synchronizer/data_accessor_inline_impl.cc
   synchronizer/distributed_synchronizer.cc
   synchronizer/distributed_synchronizer.hh
   synchronizer/distributed_synchronizer_tmpl.hh
   synchronizer/dof_synchronizer.cc
   synchronizer/dof_synchronizer.hh
   synchronizer/dof_synchronizer_inline_impl.cc
   synchronizer/filtered_synchronizer.cc
   synchronizer/filtered_synchronizer.hh
   synchronizer/mpi_type_wrapper.hh
   synchronizer/pbc_synchronizer.cc
   synchronizer/pbc_synchronizer.hh
   synchronizer/real_static_communicator.hh
   synchronizer/static_communicator.cc
   synchronizer/static_communicator.hh
   synchronizer/static_communicator_dummy.hh
   synchronizer/static_communicator_inline_impl.hh
   synchronizer/synchronizer.cc
   synchronizer/synchronizer.hh
   synchronizer/synchronizer_registry.cc
   synchronizer/synchronizer_registry.hh
   )
 
 
 set(AKANTU_CORE_DEB_DEPEND
   libboost-dev
   )
 
 set(AKANTU_CORE_TESTS
   test_csr
   test_facet_element_mapping
   test_facet_extraction_tetrahedron_4
   test_facet_extraction_triangle_3
   test_grid
   test_interpolate_stress
   test_local_material
   test_material_damage_non_local
   test_material_thermal
   test_matrix
   test_mesh_boundary
   test_mesh_data
   test_mesh_io_msh
   test_mesh_io_msh_physical_names
   test_mesh_partitionate_mesh_data
   test_parser
   test_dumper
   test_pbc_tweak
   test_purify_mesh
   test_solid_mechanics_model_bar_traction2d
   test_solid_mechanics_model_bar_traction2d_structured
   test_solid_mechanics_model_bar_traction2d_structured_pbc
   test_solid_mechanics_model_boundary_condition
   test_solid_mechanics_model_circle_2
   test_solid_mechanics_model_cube3d
   test_solid_mechanics_model_cube3d_pbc
   test_solid_mechanics_model_cube3d_tetra10
   test_solid_mechanics_model_square
   test_solid_mechanics_model_material_eigenstrain
   test_static_memory
   test_surface_extraction_tetrahedron_4
   test_surface_extraction_triangle_3
   test_vector
   test_vector_iterator
   test_weight
   test_math
   test_material_standard_linear_solid_deviatoric_relaxation
   test_material_standard_linear_solid_deviatoric_relaxation_tension
   test_material_plasticity
   )
 
 set(AKANTU_CORE_MANUAL_FILES
   manual.sty
   manual.cls
   manual.tex
   manual-macros.sty
   manual-titlepages.tex
   manual-introduction.tex
   manual-gettingstarted.tex
   manual-io.tex
   manual-solidmechanicsmodel.tex
   manual-constitutive-laws.tex
   manual-lumping.tex
   manual-elements.tex
   manual-appendix-elements.tex
   manual-appendix-materials.tex
   manual-appendix-packages.tex
   manual-backmatter.tex
   manual-bibliography.bib
   manual-bibliographystyle.bst
 
   figures/bc_and_ic_example.pdf
   figures/boundary.pdf
   figures/boundary.svg
   figures/dirichlet.pdf
   figures/dirichlet.svg
   figures/doc_wheel.pdf
   figures/doc_wheel.svg
   figures/dynamic_analysis.png
   figures/explicit_dynamic.pdf
   figures/explicit_dynamic.svg
   figures/static.pdf
   figures/static.svg
   figures/hooke_law.pdf
   figures/hot-point-1.png
   figures/hot-point-2.png
   figures/implicit_dynamic.pdf
   figures/implicit_dynamic.svg
   figures/insertion.pdf
   figures/interpolate.pdf
   figures/interpolate.svg
   figures/problemDomain.pdf_tex
   figures/problemDomain.pdf
   figures/static_analysis.png
   figures/stress_strain_el.pdf
   figures/tangent.pdf
   figures/tangent.svg
   figures/vectors.pdf
   figures/vectors.svg
 
   figures/stress_strain_neo.pdf
   figures/visco_elastic_law.pdf
   figures/isotropic_hardening_plasticity.pdf
   figures/stress_strain_visco.pdf
 
   figures/elements/hexahedron_8.pdf
   figures/elements/hexahedron_8.svg
   figures/elements/quadrangle_4.pdf
   figures/elements/quadrangle_4.svg
   figures/elements/quadrangle_8.pdf
   figures/elements/quadrangle_8.svg
   figures/elements/segment_2.pdf
   figures/elements/segment_2.svg
   figures/elements/segment_3.pdf
   figures/elements/segment_3.svg
   figures/elements/tetrahedron_10.pdf
   figures/elements/tetrahedron_10.svg
   figures/elements/tetrahedron_4.pdf
   figures/elements/tetrahedron_4.svg
   figures/elements/triangle_3.pdf
   figures/elements/triangle_3.svg
   figures/elements/triangle_6.pdf
   figures/elements/triangle_6.svg
   figures/elements/xtemp.pdf
   )
 
 find_program(READLINK_COMMAND readlink)
 find_program(ADDR2LINE_COMMAND addr2line)
 mark_as_advanced(READLINK_COMMAND)
 mark_as_advanced(ADDR2LINE_COMMAND)
 
 include(CheckFunctionExists)
 
 check_function_exists(clock_gettime _clock_gettime)
 
 if(NOT _clock_gettime)
   set(AKANTU_USE_OBSOLETE_GETTIMEOFDAY ON)
 else()
   set(AKANTU_USE_OBSOLETE_GETTIMEOFDAY OFF)
 endif()
 
 list(APPEND AKANTU_BOOST_COMPONENTS
     graph
     )
 
 set(AKANTU_CORE_DOCUMENTATION 
 "
 This package is the core engine of \\akantu. It depends on:
 \\begin{itemize}
 \\item A C++ compiler (\\href{http://gcc.gnu.org/}{GCC} >= 4, or \\href{https://software.intel.com/en-us/intel-compilers}{Intel}).
 \\item The cross-platform, open-source \\href{http://www.cmake.org/}{CMake} build system.
 \\item The \\href{http://www.boost.org/}{Boost} C++ portable libraries.
 \\item The \\href{http://www.zlib.net/}{zlib} compression library.
 \\end{itemize}
 
 Under Ubuntu (14.04 LTS) the installation can be performed using the commands:
 \\begin{command}
   > sudo apt-get install build-essential cmake-curses-gui libboost-dev zlib1g-dev
 \\end{command}
 
 Under Mac OS X the installation requires the following steps:
 \\begin{itemize}
 \\item Install Xcode
 \\item Install the command line tools.
 \\item Install the MacPorts project which allows to automatically 
 download and install opensource packages. 
 \\end{itemize}
 Then the following commands should be typed in a terminal:
 \\begin{command}
   > sudo port install cmake gcc48 boost
 \\end{command}
 ")
\ No newline at end of file
diff --git a/src/io/dumper/dumpable_inline_impl.hh b/src/io/dumper/dumpable.cc
similarity index 53%
copy from src/io/dumper/dumpable_inline_impl.hh
copy to src/io/dumper/dumpable.cc
index 189cb345e..fa535d74b 100644
--- a/src/io/dumper/dumpable_inline_impl.hh
+++ b/src/io/dumper/dumpable.cc
@@ -1,368 +1,254 @@
-/**
- * @file   dumpable_inline_impl.hh
- *
- * @author Nicolas Richart <nicolas.richart@epfl.ch>
- *
- * @date   Sat Jul 13 11:35:22 2013
- *
- * @brief  Implementation of the Dumpable class
- *
- * @section LICENSE
- *
- * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
- * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
- *
- * Akantu 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 3 of the License, or (at your option) any
- * later version.
- *
- * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
- *
- */
+#include "dumpable.hh"
 
-/* -------------------------------------------------------------------------- */
 #ifdef AKANTU_USE_IOHELPER
-#include "dumper_elemental_field.hh"
-#include "dumper_nodal_field.hh"
-/* -------------------------------------------------------------------------- */
 
 
 __BEGIN_AKANTU__
 
 /* -------------------------------------------------------------------------- */
-inline Dumpable::Dumpable() : default_dumper("") {
+Dumpable::Dumpable() : default_dumper("") {
 }
 
 /* -------------------------------------------------------------------------- */
-inline Dumpable::~Dumpable() {
+Dumpable::~Dumpable() {
 }
 
 /* -------------------------------------------------------------------------- */
-template<class T>
-inline void Dumpable::registerDumper(const std::string & dumper_name,
-                                     const std::string & file_name,
-                                     const bool is_default) {
-
-  AKANTU_DEBUG_ASSERT(this->dumpers.find(dumper_name) ==
-                      this->dumpers.end(),
-                      "Dumper " + dumper_name + "is already registered.");
-
-  std::string name = file_name;
-  if (name == "")
-    name = dumper_name;
-
-  this->dumpers[dumper_name] = new T(name);
-
-  if (is_default)
-    this->default_dumper = dumper_name;
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::registerExternalDumper(DumperIOHelper & dumper,
+void Dumpable::registerExternalDumper(DumperIOHelper & dumper,
                                              const std::string & dumper_name,
                                              const bool is_default) {
   this->dumpers[dumper_name] = &dumper;
   if (is_default)
     this->default_dumper = dumper_name;
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpMesh(const Mesh & mesh, UInt spatial_dimension,
+void Dumpable::addDumpMesh(const Mesh & mesh, UInt spatial_dimension,
                                   const GhostType & ghost_type,
                                   const ElementKind & element_kind) {
 
   this->addDumpMeshToDumper(this->default_dumper,
                             mesh,
                             spatial_dimension,
                             ghost_type,
                             element_kind);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpMeshToDumper(const std::string & dumper_name,
+void Dumpable::addDumpMeshToDumper(const std::string & dumper_name,
                                           const Mesh & mesh, UInt spatial_dimension,
                                           const GhostType & ghost_type,
                                           const ElementKind & element_kind) {
 
   DumperIOHelper & dumper = this->getDumper(dumper_name);
   dumper.registerMesh(mesh,
                       spatial_dimension,
                       ghost_type,
                       element_kind);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFilteredMesh(const Mesh & mesh,
+void Dumpable::addDumpFilteredMesh(const Mesh & mesh,
                                           const ElementTypeMapArray<UInt> & elements_filter,
                                           const Array<UInt> & nodes_filter,
                                           UInt spatial_dimension,
                                           const GhostType & ghost_type,
                                           const ElementKind & element_kind) {
   this->addDumpFilteredMeshToDumper(this->default_dumper,
                                     mesh,
                                     elements_filter,
                                     nodes_filter,
                                     spatial_dimension,
                                     ghost_type,
                                     element_kind);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFilteredMeshToDumper(const std::string & dumper_name,
+void Dumpable::addDumpFilteredMeshToDumper(const std::string & dumper_name,
                                                   const Mesh & mesh,
                                                   const ElementTypeMapArray<UInt> & elements_filter,
                                                   const Array<UInt> & nodes_filter,
                                                   UInt spatial_dimension,
                                                   const GhostType & ghost_type,
                                                   const ElementKind & element_kind) {
 
   DumperIOHelper & dumper = this->getDumper(dumper_name);
   dumper.registerFilteredMesh(mesh,
                               elements_filter,
                               nodes_filter,
                               spatial_dimension,
                               ghost_type,
                               element_kind);
 }
 
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpField(const std::string & field_id) {
+void Dumpable::addDumpField(const std::string & field_id) {
   this->addDumpFieldToDumper(this->default_dumper, field_id);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFieldToDumper(const std::string & dumper_name,
+void Dumpable::addDumpFieldToDumper(const std::string & dumper_name,
                                            const std::string & field_id) {
   AKANTU_DEBUG_TO_IMPLEMENT();
 };
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFieldExternal(const std::string & field_id,
+void Dumpable::addDumpFieldExternal(const std::string & field_id,
                                            dumper::Field * field) {
   this->addDumpFieldExternalToDumper(this->default_dumper, field_id, field);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFieldExternalToDumper(const std::string & dumper_name,
+void Dumpable::addDumpFieldExternalToDumper(const std::string & dumper_name,
                                                    const std::string & field_id,
                                                    dumper::Field * field) {
   DumperIOHelper & dumper = this->getDumper(dumper_name);
   dumper.registerField(field_id, field);
 }
 
 /* -------------------------------------------------------------------------- */
 
-template<typename T>
-inline void Dumpable::addDumpFieldExternal(const std::string & field_id,
-                                           const Array<T> & field) {
-  this->addDumpFieldExternalToDumper<T>(this->default_dumper,
-                                        field_id,
-                                        field);
-};
-
-/* -------------------------------------------------------------------------- */
-template<typename T>
-inline void Dumpable::addDumpFieldExternalToDumper(const std::string & dumper_name,
-                                                   const std::string & field_id,
-                                                   const Array<T> & field) {
-  dumper::Field * field_cont = new dumper::NodalField<T>(field);
-  DumperIOHelper & dumper = this->getDumper(dumper_name);
-  dumper.registerField(field_id, field_cont);
-}
-
-/* -------------------------------------------------------------------------- */
-template<typename T>
-inline void Dumpable::addDumpFieldExternal(const std::string & field_id,
-                                           const ElementTypeMapArray<T> & field,
-                                           UInt spatial_dimension,
-                                           const GhostType & ghost_type,
-                                           const ElementKind & element_kind) {
-  this->addDumpFieldExternalToDumper(this->default_dumper,
-                                     field_id,
-                                     field,
-                                     spatial_dimension,
-                                     ghost_type,
-                                     element_kind);
-}
-
-/* -------------------------------------------------------------------------- */
-template<typename T>
-inline void Dumpable::addDumpFieldExternalToDumper(const std::string & dumper_name,
-                                                   const std::string & field_id,
-                                                   const ElementTypeMapArray<T> & field,
-                                                   UInt spatial_dimension,
-                                                   const GhostType & ghost_type,
-                                                   const ElementKind & element_kind) {
-  dumper::Field * field_cont = new dumper::ElementalField<T>(field,
-							     spatial_dimension,
-							     ghost_type,
-							     element_kind);
-  DumperIOHelper & dumper = this->getDumper(dumper_name);
-  dumper.registerField(field_id, field_cont);
-}
-
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::removeDumpField(const std::string & field_id) {
+void Dumpable::removeDumpField(const std::string & field_id) {
   this->removeDumpFieldFromDumper(this->default_dumper, field_id);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::removeDumpFieldFromDumper(const std::string & dumper_name,
+void Dumpable::removeDumpFieldFromDumper(const std::string & dumper_name,
                                                 const std::string & field_id) {
   DumperIOHelper & dumper = this->getDumper(dumper_name);
   dumper.unRegisterField(field_id);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFieldVector(const std::string & field_id) {
+void Dumpable::addDumpFieldVector(const std::string & field_id) {
   this->addDumpFieldVectorToDumper(this->default_dumper, field_id);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFieldVectorToDumper(const std::string & dumper_name,
+void Dumpable::addDumpFieldVectorToDumper(const std::string & dumper_name,
                                                  const std::string & field_id) {
   AKANTU_DEBUG_TO_IMPLEMENT();
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFieldTensor(const std::string & field_id) {
+void Dumpable::addDumpFieldTensor(const std::string & field_id) {
   this->addDumpFieldTensorToDumper(this->default_dumper, field_id);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFieldTensorToDumper(const std::string & dumper_name,
+void Dumpable::addDumpFieldTensorToDumper(const std::string & dumper_name,
                                                  const std::string & field_id) {
   AKANTU_DEBUG_TO_IMPLEMENT();
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::setDirectory(const std::string & directory) {
+void Dumpable::setDirectory(const std::string & directory) {
   this->setDirectoryToDumper(this->default_dumper, directory);
 };
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::setDirectoryToDumper(const std::string & dumper_name,
-                                           const std::string & directory) {
+void Dumpable::setDirectoryToDumper(const std::string & dumper_name,
+				    const std::string & directory) {
   DumperIOHelper & dumper = this->getDumper(dumper_name);
   dumper.setDirectory(directory);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::setBaseName(const std::string & basename) {
+void Dumpable::setBaseName(const std::string & basename) {
   this->setBaseNameToDumper(this->default_dumper, basename);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::setBaseNameToDumper(const std::string & dumper_name,
+void Dumpable::setBaseNameToDumper(const std::string & dumper_name,
                                           const std::string & basename) {
   DumperIOHelper & dumper = this->getDumper(dumper_name);
   dumper.setBaseName(basename);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::setTimeStepToDumper(Real time_step) {
+void Dumpable::setTimeStepToDumper(Real time_step) {
   this->setTimeStepToDumper(this->default_dumper, time_step);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::setTimeStepToDumper(const std::string & dumper_name,
+void Dumpable::setTimeStepToDumper(const std::string & dumper_name,
                                           Real time_step) {
   DumperIOHelper & dumper = this->getDumper(dumper_name);
   dumper.setTimeStep(time_step);
 };
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::dump(const std::string & dumper_name) {
+void Dumpable::dump(const std::string & dumper_name) {
   DumperIOHelper & dumper = this->getDumper(dumper_name);
   dumper.dump();
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::dump() {
+void Dumpable::dump() {
   this->dump(this->default_dumper);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::dump(const std::string & dumper_name, UInt step) {
+void Dumpable::dump(const std::string & dumper_name, UInt step) {
   DumperIOHelper & dumper = this->getDumper(dumper_name);
   dumper.dump(step);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::dump(UInt step) {
+void Dumpable::dump(UInt step) {
   this->dump(this->default_dumper, step);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::dump(const std::string & dumper_name, Real time, UInt step) {
+void Dumpable::dump(const std::string & dumper_name, Real time, UInt step) {
   DumperIOHelper & dumper = this->getDumper(dumper_name);
   dumper.dump(time, step);
 }
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::dump(Real time, UInt step) {
+void Dumpable::dump(Real time, UInt step) {
   this->dump(this->default_dumper, time, step);
 }
 
 
 /* -------------------------------------------------------------------------- */
-inline void Dumpable::internalAddDumpFieldToDumper(const std::string & dumper_name,
+void Dumpable::internalAddDumpFieldToDumper(const std::string & dumper_name,
                                                    const std::string & field_id,
                                                    dumper::Field * field) {
   DumperIOHelper & dumper = this->getDumper(dumper_name);
   dumper.registerField(field_id, field);
 }
 
 
 /* -------------------------------------------------------------------------- */
-inline DumperIOHelper & Dumpable::getDumper() {
+DumperIOHelper & Dumpable::getDumper() {
   return this->getDumper(this->default_dumper);
 }
 
 
 /* -------------------------------------------------------------------------- */
-inline DumperIOHelper & Dumpable::getDumper(const std::string & dumper_name) {
+DumperIOHelper & Dumpable::getDumper(const std::string & dumper_name) {
 
   DumperMap::iterator it  = this->dumpers.find(dumper_name);
   DumperMap::iterator end = this->dumpers.end();
 
   if (it == end)
     AKANTU_EXCEPTION("Dumper " << dumper_name << "has not been registered, yet.");
 
   return *(it->second);
 }
 
 /* -------------------------------------------------------------------------- */
-template<class T>
-inline T & Dumpable::getDumper(const std::string & dumper_name) {
-  DumperIOHelper & dumper = this->getDumper(dumper_name);
-
-  try {
-    T & templated_dumper = dynamic_cast<T & >(dumper);
-    return templated_dumper;
-  }
-  catch (...) {
-    AKANTU_EXCEPTION("Dumper " << dumper_name << " is not of type: "
-                     << debug::demangle(typeid(T).name()));
-  }
-}
 
-/* -------------------------------------------------------------------------- */
-inline std::string Dumpable::getDefaultDumperName() const {
+std::string Dumpable::getDefaultDumperName() const {
   return this->default_dumper;
 }
 
 
 
+
+
 __END_AKANTU__
 
 #endif
diff --git a/src/io/dumper/dumpable.hh b/src/io/dumper/dumpable.hh
index c249d1c69..d24aed034 100644
--- a/src/io/dumper/dumpable.hh
+++ b/src/io/dumper/dumpable.hh
@@ -1,407 +1,409 @@
 /**
  * @file   dumpable.hh
  *
  * @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
  * @author Nicolas Richart <nicolas.richart@epfl.ch>
  * @author David Kammer <david.kammer@epfl.ch>
  *
  * @date   Fri Oct 26 21:52:40 2012
  *
  * @brief  Interface for object who wants to dump themselves
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 #include "aka_common.hh"
+#include "element_type_map.hh"
 #ifdef AKANTU_USE_IOHELPER
 #include "dumper_iohelper.hh"
 #endif //AKANTU_USE_IOHELPER
 
 #ifndef __AKANTU_DUMPABLE_HH__
 #define __AKANTU_DUMPABLE_HH__
 /* -------------------------------------------------------------------------- */
 
 #ifdef AKANTU_USE_IOHELPER
 
 #include "dumper_iohelper.hh"
+#include <set>
 
 __BEGIN_AKANTU__
 
 class Dumpable {
   /* ------------------------------------------------------------------------ */
   /* Constructors/Destructors                                                 */
   /* ------------------------------------------------------------------------ */
 public:
 
   Dumpable();
   virtual ~Dumpable();
 
   /* ------------------------------------------------------------------------ */
   /* Methods                                                                  */
   /* ------------------------------------------------------------------------ */
 public:
 
   /// create a new dumper (of templated type T) and register it under dumper_name. file_name is used for construction of T. is default states if this dumper is the default dumper. 
   template<class T>
-  void registerDumper(const std::string & dumper_name,
-                      const std::string & file_name = "",
-                      const bool is_default = false);
+  inline void registerDumper(const std::string & dumper_name,
+			     const std::string & file_name = "",
+			     const bool is_default = false);
 
   /// register an externally created dumper
   void registerExternalDumper(DumperIOHelper & dumper,
                               const std::string & dumper_name,
                               const bool is_default = false);
 
   /// register a mesh to the default dumper
   void addDumpMesh(const Mesh & mesh, UInt spatial_dimension = _all_dimensions,
                    const GhostType & ghost_type = _not_ghost,
                    const ElementKind & element_kind = _ek_not_defined);
 
   /// register a mesh to the default identified by its name
   void addDumpMeshToDumper(const std::string & dumper_name,
                            const Mesh & mesh, UInt spatial_dimension = _all_dimensions,
                            const GhostType & ghost_type = _not_ghost,
                            const ElementKind & element_kind = _ek_not_defined);
 
   /// register a filtered mesh as the default dumper
   void addDumpFilteredMesh(const Mesh & mesh,
                            const ElementTypeMapArray<UInt> & elements_filter,
                            const Array<UInt> & nodes_filter,
                            UInt spatial_dimension = _all_dimensions,
                            const GhostType & ghost_type = _not_ghost,
                            const ElementKind & element_kind = _ek_not_defined);
 
   /// register a filtered mesh and provides a name
   void addDumpFilteredMeshToDumper(const std::string & dumper_name,
                                    const Mesh & mesh,
                                    const ElementTypeMapArray<UInt> & elements_filter,
                                    const Array<UInt> & nodes_filter,
                                    UInt spatial_dimension = _all_dimensions,
                                    const GhostType & ghost_type = _not_ghost,
                                    const ElementKind & element_kind = _ek_not_defined);
 
   /// to implement
   virtual void addDumpField(const std::string & field_id);
   /// to implement
   virtual void addDumpFieldToDumper(const std::string & dumper_name,
                                     const std::string & field_id);
   
   /// add a field 
   virtual void addDumpFieldExternal(const std::string & field_id,
                                     dumper::Field * field);
   virtual void addDumpFieldExternalToDumper(const std::string & dumper_name,
                                             const std::string & field_id,
                                             dumper::Field * field);
 
   template<typename T>
   void addDumpFieldExternal(const std::string & field_id,
                             const Array<T> & field);
   template<typename T>
   void addDumpFieldExternalToDumper(const std::string & dumper_name,
                                     const std::string & field_id,
                                     const Array<T> & field);
   template<typename T>
   void addDumpFieldExternal(const std::string & field_id,
                             const ElementTypeMapArray<T> & field,
                             UInt spatial_dimension = _all_dimensions,
                             const GhostType & ghost_type = _not_ghost,
                             const ElementKind & element_kind = _ek_not_defined);
   template<typename T>
   void addDumpFieldExternalToDumper(const std::string & dumper_name,
                                     const std::string & field_id,
                                     const ElementTypeMapArray<T> & field,
                                     UInt spatial_dimension = _all_dimensions,
                                     const GhostType & ghost_type = _not_ghost,
                                     const ElementKind & element_kind = _ek_not_defined);
 
   void removeDumpField(const std::string & field_id);
   void removeDumpFieldFromDumper(const std::string & dumper_name,
                                  const std::string & field_id);
 
   virtual void addDumpFieldVector(const std::string & field_id);
   virtual void addDumpFieldVectorToDumper(const std::string & dumper_name,
                                           const std::string & field_id);
 
   virtual void addDumpFieldTensor(const std::string & field_id);
   virtual void addDumpFieldTensorToDumper(const std::string & dumper_name,
                                           const std::string & field_id);
 
   void setDirectory(const std::string & directory);
   void setDirectoryToDumper(const std::string & dumper_name,
                             const std::string & directory);
 
   void setBaseName(const std::string & basename);
 
   void setBaseNameToDumper(const std::string & dumper_name,
                            const std::string & basename);
   void setTimeStepToDumper(Real time_step);
   void setTimeStepToDumper(const std::string & dumper_name,
                            Real time_step);
 
   virtual void dump();
   virtual void dump(UInt step);
   virtual void dump(Real time, UInt step);
   virtual void dump(const std::string & dumper_name);
   virtual void dump(const std::string & dumper_name, UInt step);
   virtual void dump(const std::string & dumper_name, Real time, UInt step);
 
 
 public:
   void internalAddDumpFieldToDumper(const std::string & dumper_name,
                                     const std::string & field_id,
                                     dumper::Field * field);
 
   /* ------------------------------------------------------------------------ */
   /* Accessors                                                                */
   /* ------------------------------------------------------------------------ */
 public:
   DumperIOHelper & getDumper();
   DumperIOHelper & getDumper(const std::string & dumper_name);
 
   template<class T> T & getDumper(const std::string & dumper_name);
   std::string getDefaultDumperName() const;
 
   /* ------------------------------------------------------------------------ */
   /* Class Members                                                            */
   /* ------------------------------------------------------------------------ */
 private:
   typedef std::map<std::string, DumperIOHelper *> DumperMap;
   typedef std::set<std::string> DumperSet;
 
   DumperMap dumpers;
   std::string default_dumper;
 
   DumperSet external_dumpers;
 };
 
 __END_AKANTU__
 
 #else
 
 __BEGIN_AKANTU__
 
 /* -------------------------------------------------------------------------- */
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused"
 
 namespace dumper {
   class Field;
 }
 
 class DumperIOHelper;
 class Mesh;
 
 /* -------------------------------------------------------------------------- */
 class Dumpable {
   /* ------------------------------------------------------------------------ */
   /* Constructors/Destructors                                                 */
   /* ------------------------------------------------------------------------ */
 public:
 
   Dumpable() {};
   virtual ~Dumpable() { };
 
   /* ------------------------------------------------------------------------ */
   /* Methods                                                                  */
   /* ------------------------------------------------------------------------ */
 public:
   template<class T>
-  void registerDumper(const std::string & dumper_name,
+  inline void registerDumper(const std::string & dumper_name,
                       const std::string & file_name = "",
                       const bool is_default = false) { }
 
   void registerExternalDumper(DumperIOHelper * dumper,
                               const std::string & dumper_name,
                               const bool is_default = false) { }
 
   void addDumpMesh(const Mesh & mesh,
                    UInt spatial_dimension = _all_dimensions,
                    const GhostType & ghost_type = _not_ghost,
                    const ElementKind & element_kind = _ek_not_defined) {
   }
 
   void addDumpMeshToDumper(const std::string & dumper_name,
                            const Mesh & mesh,
                            UInt spatial_dimension = _all_dimensions,
                            const GhostType & ghost_type = _not_ghost,
                            const ElementKind & element_kind = _ek_not_defined) {
   }
 
   void addDumpFilteredMesh(const Mesh & mesh,
                            const ElementTypeMapArray<UInt> & elements_filter,
                            const Array<UInt> & nodes_filter,
                            UInt spatial_dimension = _all_dimensions,
                            const GhostType & ghost_type = _not_ghost,
                            const ElementKind & element_kind = _ek_not_defined) {
   }
 
   void addDumpFilteredMeshToDumper(const std::string & dumper_name,
                                    const Mesh & mesh,
                                    const ElementTypeMapArray<UInt> & elements_filter,
                                    const Array<UInt> & nodes_filter,
                                    UInt spatial_dimension = _all_dimensions,
                                    const GhostType & ghost_type = _not_ghost,
                                    const ElementKind & element_kind = _ek_not_defined) {
   }
 
   virtual void addDumpField(const std::string & field_id){
     AKANTU_DEBUG_TO_IMPLEMENT();
   }
   virtual void addDumpFieldToDumper(const std::string & dumper_name,
                                     const std::string & field_id){
     AKANTU_DEBUG_TO_IMPLEMENT();
   }
 
   virtual void addDumpFieldExternal(const std::string & field_id,
                                     dumper::Field * field) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
   virtual void addDumpFieldExternalToDumper(const std::string & dumper_name,
                                     const std::string & field_id,
                                     dumper::Field * field) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
 
   template<typename T>
   void addDumpFieldExternal(const std::string & field_id,
                             const Array<T> & field) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
   template<typename T>
   void addDumpFieldExternalToDumper(const std::string & dumper_name,
                                     const std::string & field_id,
                                     const Array<T> & field) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
 
   template<typename T>
   void addDumpFieldExternal(const std::string & field_id,
                             const ElementTypeMapArray<T> & field,
                             UInt spatial_dimension = _all_dimensions,
                             const GhostType & ghost_type = _not_ghost,
                             const ElementKind & element_kind = _ek_not_defined) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
   template<typename T>
   void addDumpFieldExternalToDumper(const std::string & dumper_name,
                                     const std::string & field_id,
                                     const ElementTypeMapArray<T> & field,
                                     UInt spatial_dimension = _all_dimensions,
                                     const GhostType & ghost_type = _not_ghost,
                                     const ElementKind & element_kind = _ek_not_defined) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
 
   void removeDumpField(const std::string & field_id) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
   void removeDumpFieldFromDumper(const std::string & dumper_name,
                                const std::string & field_id) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
 
   void setDirectory(const std::string & directory) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
   void setDirectoryToDumper(const std::string & dumper_name,
                             const std::string & directory) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
 
   void setBaseName(const std::string & basename) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
   void setBaseNameToDumper(const std::string & dumper_name,
                            const std::string & basename) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
 
   void dump() {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
   void dump(const std::string & dumper_name) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
 
   void dump(UInt step) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
   void dump(const std::string & dumper_name,
             UInt step) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
 
   void dump(Real current_time,
             UInt step) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
   void dump(const std::string & dumper_name,
             Real current_time,
             UInt step) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
 
 protected:
 
   void internalAddDumpFieldToDumper(const std::string & dumper_name,
                                     const std::string & field_id,
                                     dumper::Field * field) {
     AKANTU_DEBUG_WARNING("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
 
 protected:
   /* ------------------------------------------------------------------------ */
   /* Accessors                                                                */
   /* ------------------------------------------------------------------------ */
 public:
 
   DumperIOHelper & getDumper() {
     AKANTU_DEBUG_ERROR("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
 
   DumperIOHelper & getDumper(const std::string & dumper_name){
     AKANTU_DEBUG_ERROR("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
 
   template<class T>
   T & getDumper(const std::string & dumper_name) {
     AKANTU_DEBUG_ERROR("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
 
   std::string getDefaultDumperName() {
     AKANTU_DEBUG_ERROR("No dumper activated at compilation, turn on AKANTU_USE_IOHELPER in cmake.");
   }
 
   /* ------------------------------------------------------------------------ */
   /* Class Members                                                            */
   /* ------------------------------------------------------------------------ */
 private:
 };
 
 #pragma GCC diagnostic pop
 
 __END_AKANTU__
 
 #endif //AKANTU_USE_IOHELPER
 
-#include "dumpable_inline_impl.hh"
+//#include "dumpable_inline_impl.hh"
 
 #endif /* __AKANTU_DUMPABLE_HH__ */
diff --git a/src/io/dumper/dumpable_inline_impl.hh b/src/io/dumper/dumpable_inline_impl.hh
index 189cb345e..b72d45f53 100644
--- a/src/io/dumper/dumpable_inline_impl.hh
+++ b/src/io/dumper/dumpable_inline_impl.hh
@@ -1,368 +1,131 @@
 /**
  * @file   dumpable_inline_impl.hh
  *
  * @author Nicolas Richart <nicolas.richart@epfl.ch>
  *
  * @date   Sat Jul 13 11:35:22 2013
  *
  * @brief  Implementation of the Dumpable class
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 #ifdef AKANTU_USE_IOHELPER
 #include "dumper_elemental_field.hh"
 #include "dumper_nodal_field.hh"
 /* -------------------------------------------------------------------------- */
 
 
 __BEGIN_AKANTU__
 
-/* -------------------------------------------------------------------------- */
-inline Dumpable::Dumpable() : default_dumper("") {
-}
-
-/* -------------------------------------------------------------------------- */
-inline Dumpable::~Dumpable() {
-}
-
 /* -------------------------------------------------------------------------- */
 template<class T>
 inline void Dumpable::registerDumper(const std::string & dumper_name,
                                      const std::string & file_name,
                                      const bool is_default) {
 
   AKANTU_DEBUG_ASSERT(this->dumpers.find(dumper_name) ==
                       this->dumpers.end(),
                       "Dumper " + dumper_name + "is already registered.");
 
   std::string name = file_name;
   if (name == "")
     name = dumper_name;
 
   this->dumpers[dumper_name] = new T(name);
 
   if (is_default)
     this->default_dumper = dumper_name;
 }
 
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::registerExternalDumper(DumperIOHelper & dumper,
-                                             const std::string & dumper_name,
-                                             const bool is_default) {
-  this->dumpers[dumper_name] = &dumper;
-  if (is_default)
-    this->default_dumper = dumper_name;
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpMesh(const Mesh & mesh, UInt spatial_dimension,
-                                  const GhostType & ghost_type,
-                                  const ElementKind & element_kind) {
-
-  this->addDumpMeshToDumper(this->default_dumper,
-                            mesh,
-                            spatial_dimension,
-                            ghost_type,
-                            element_kind);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpMeshToDumper(const std::string & dumper_name,
-                                          const Mesh & mesh, UInt spatial_dimension,
-                                          const GhostType & ghost_type,
-                                          const ElementKind & element_kind) {
-
-  DumperIOHelper & dumper = this->getDumper(dumper_name);
-  dumper.registerMesh(mesh,
-                      spatial_dimension,
-                      ghost_type,
-                      element_kind);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFilteredMesh(const Mesh & mesh,
-                                          const ElementTypeMapArray<UInt> & elements_filter,
-                                          const Array<UInt> & nodes_filter,
-                                          UInt spatial_dimension,
-                                          const GhostType & ghost_type,
-                                          const ElementKind & element_kind) {
-  this->addDumpFilteredMeshToDumper(this->default_dumper,
-                                    mesh,
-                                    elements_filter,
-                                    nodes_filter,
-                                    spatial_dimension,
-                                    ghost_type,
-                                    element_kind);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFilteredMeshToDumper(const std::string & dumper_name,
-                                                  const Mesh & mesh,
-                                                  const ElementTypeMapArray<UInt> & elements_filter,
-                                                  const Array<UInt> & nodes_filter,
-                                                  UInt spatial_dimension,
-                                                  const GhostType & ghost_type,
-                                                  const ElementKind & element_kind) {
-
-  DumperIOHelper & dumper = this->getDumper(dumper_name);
-  dumper.registerFilteredMesh(mesh,
-                              elements_filter,
-                              nodes_filter,
-                              spatial_dimension,
-                              ghost_type,
-                              element_kind);
-}
-
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpField(const std::string & field_id) {
-  this->addDumpFieldToDumper(this->default_dumper, field_id);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFieldToDumper(const std::string & dumper_name,
-                                           const std::string & field_id) {
-  AKANTU_DEBUG_TO_IMPLEMENT();
-};
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFieldExternal(const std::string & field_id,
-                                           dumper::Field * field) {
-  this->addDumpFieldExternalToDumper(this->default_dumper, field_id, field);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFieldExternalToDumper(const std::string & dumper_name,
-                                                   const std::string & field_id,
-                                                   dumper::Field * field) {
-  DumperIOHelper & dumper = this->getDumper(dumper_name);
-  dumper.registerField(field_id, field);
-}
-
 /* -------------------------------------------------------------------------- */
 
 template<typename T>
 inline void Dumpable::addDumpFieldExternal(const std::string & field_id,
                                            const Array<T> & field) {
   this->addDumpFieldExternalToDumper<T>(this->default_dumper,
                                         field_id,
                                         field);
 };
 
 /* -------------------------------------------------------------------------- */
 template<typename T>
 inline void Dumpable::addDumpFieldExternalToDumper(const std::string & dumper_name,
                                                    const std::string & field_id,
                                                    const Array<T> & field) {
   dumper::Field * field_cont = new dumper::NodalField<T>(field);
   DumperIOHelper & dumper = this->getDumper(dumper_name);
   dumper.registerField(field_id, field_cont);
 }
 
 /* -------------------------------------------------------------------------- */
 template<typename T>
 inline void Dumpable::addDumpFieldExternal(const std::string & field_id,
                                            const ElementTypeMapArray<T> & field,
                                            UInt spatial_dimension,
                                            const GhostType & ghost_type,
                                            const ElementKind & element_kind) {
   this->addDumpFieldExternalToDumper(this->default_dumper,
                                      field_id,
                                      field,
                                      spatial_dimension,
                                      ghost_type,
                                      element_kind);
 }
 
 /* -------------------------------------------------------------------------- */
 template<typename T>
 inline void Dumpable::addDumpFieldExternalToDumper(const std::string & dumper_name,
                                                    const std::string & field_id,
                                                    const ElementTypeMapArray<T> & field,
                                                    UInt spatial_dimension,
                                                    const GhostType & ghost_type,
                                                    const ElementKind & element_kind) {
   dumper::Field * field_cont = new dumper::ElementalField<T>(field,
 							     spatial_dimension,
 							     ghost_type,
 							     element_kind);
   DumperIOHelper & dumper = this->getDumper(dumper_name);
   dumper.registerField(field_id, field_cont);
 }
 
 
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::removeDumpField(const std::string & field_id) {
-  this->removeDumpFieldFromDumper(this->default_dumper, field_id);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::removeDumpFieldFromDumper(const std::string & dumper_name,
-                                                const std::string & field_id) {
-  DumperIOHelper & dumper = this->getDumper(dumper_name);
-  dumper.unRegisterField(field_id);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFieldVector(const std::string & field_id) {
-  this->addDumpFieldVectorToDumper(this->default_dumper, field_id);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFieldVectorToDumper(const std::string & dumper_name,
-                                                 const std::string & field_id) {
-  AKANTU_DEBUG_TO_IMPLEMENT();
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFieldTensor(const std::string & field_id) {
-  this->addDumpFieldTensorToDumper(this->default_dumper, field_id);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::addDumpFieldTensorToDumper(const std::string & dumper_name,
-                                                 const std::string & field_id) {
-  AKANTU_DEBUG_TO_IMPLEMENT();
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::setDirectory(const std::string & directory) {
-  this->setDirectoryToDumper(this->default_dumper, directory);
-};
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::setDirectoryToDumper(const std::string & dumper_name,
-                                           const std::string & directory) {
-  DumperIOHelper & dumper = this->getDumper(dumper_name);
-  dumper.setDirectory(directory);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::setBaseName(const std::string & basename) {
-  this->setBaseNameToDumper(this->default_dumper, basename);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::setBaseNameToDumper(const std::string & dumper_name,
-                                          const std::string & basename) {
-  DumperIOHelper & dumper = this->getDumper(dumper_name);
-  dumper.setBaseName(basename);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::setTimeStepToDumper(Real time_step) {
-  this->setTimeStepToDumper(this->default_dumper, time_step);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::setTimeStepToDumper(const std::string & dumper_name,
-                                          Real time_step) {
-  DumperIOHelper & dumper = this->getDumper(dumper_name);
-  dumper.setTimeStep(time_step);
-};
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::dump(const std::string & dumper_name) {
-  DumperIOHelper & dumper = this->getDumper(dumper_name);
-  dumper.dump();
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::dump() {
-  this->dump(this->default_dumper);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::dump(const std::string & dumper_name, UInt step) {
-  DumperIOHelper & dumper = this->getDumper(dumper_name);
-  dumper.dump(step);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::dump(UInt step) {
-  this->dump(this->default_dumper, step);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::dump(const std::string & dumper_name, Real time, UInt step) {
-  DumperIOHelper & dumper = this->getDumper(dumper_name);
-  dumper.dump(time, step);
-}
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::dump(Real time, UInt step) {
-  this->dump(this->default_dumper, time, step);
-}
-
-
-/* -------------------------------------------------------------------------- */
-inline void Dumpable::internalAddDumpFieldToDumper(const std::string & dumper_name,
-                                                   const std::string & field_id,
-                                                   dumper::Field * field) {
-  DumperIOHelper & dumper = this->getDumper(dumper_name);
-  dumper.registerField(field_id, field);
-}
-
-
-/* -------------------------------------------------------------------------- */
-inline DumperIOHelper & Dumpable::getDumper() {
-  return this->getDumper(this->default_dumper);
-}
-
-
-/* -------------------------------------------------------------------------- */
-inline DumperIOHelper & Dumpable::getDumper(const std::string & dumper_name) {
-
-  DumperMap::iterator it  = this->dumpers.find(dumper_name);
-  DumperMap::iterator end = this->dumpers.end();
-
-  if (it == end)
-    AKANTU_EXCEPTION("Dumper " << dumper_name << "has not been registered, yet.");
-
-  return *(it->second);
-}
-
 /* -------------------------------------------------------------------------- */
 template<class T>
 inline T & Dumpable::getDumper(const std::string & dumper_name) {
   DumperIOHelper & dumper = this->getDumper(dumper_name);
 
   try {
     T & templated_dumper = dynamic_cast<T & >(dumper);
     return templated_dumper;
   }
   catch (...) {
     AKANTU_EXCEPTION("Dumper " << dumper_name << " is not of type: "
                      << debug::demangle(typeid(T).name()));
   }
 }
 
-/* -------------------------------------------------------------------------- */
-inline std::string Dumpable::getDefaultDumperName() const {
-  return this->default_dumper;
-}
 
 
 
 __END_AKANTU__
 
 #endif
diff --git a/src/io/dumper/dumper_compute.hh b/src/io/dumper/dumper_compute.hh
index 9bf426b6e..04a89227c 100644
--- a/src/io/dumper/dumper_compute.hh
+++ b/src/io/dumper/dumper_compute.hh
@@ -1,281 +1,282 @@
 #ifndef __AKANTU_DUMPER_COMPUTE_HH__
 #define __AKANTU_DUMPER_COMPUTE_HH__
 /* -------------------------------------------------------------------------- */
 #include "aka_common.hh"
 #include "dumper_iohelper.hh"
 #include "dumper_type_traits.hh"
 #include "dumper_field.hh"
+#include "io_helper.hh"
 /* -------------------------------------------------------------------------- */
 
 __BEGIN_AKANTU__
 __BEGIN_AKANTU_DUMPER__
 
 class ComputeFunctorInterface {
 
 public:
 
   virtual ~ComputeFunctorInterface(){};
 
   virtual UInt getDim() = 0;
   virtual UInt getNbComponent(UInt old_nb_comp) = 0;
 
 };
 
 /* -------------------------------------------------------------------------- */
 
 template <typename return_type>
 class ComputeFunctorOutput : public ComputeFunctorInterface {
 
 public:
 
   ComputeFunctorOutput(){};
   virtual ~ComputeFunctorOutput(){};
 
 };
 
 
 /* -------------------------------------------------------------------------- */
 
 template <typename input_type,typename return_type>
 class ComputeFunctor : public ComputeFunctorOutput<return_type> {
 
 public:
 
   ComputeFunctor(){};
   virtual ~ComputeFunctor(){};
 
   virtual return_type func(const input_type & d, Element global_index) = 0;
 };
 
 /* -------------------------------------------------------------------------- */
 
 
 template <typename SubFieldCompute, typename _return_type>
 class FieldCompute : public Field {
 
   /* ------------------------------------------------------------------------ */
   /* Typedefs                                                                 */
   /* ------------------------------------------------------------------------ */  
   
 public:
  
   typedef typename SubFieldCompute::iterator sub_iterator;
   typedef typename SubFieldCompute::types sub_types;
   typedef typename sub_types::return_type sub_return_type;
   typedef _return_type return_type;
   typedef typename sub_types::data_type data_type;
 
   typedef TypeTraits<data_type, return_type, ElementTypeMapArray<data_type> > types;
 
 
   class iterator {
   public:
     iterator(const sub_iterator & it, ComputeFunctor<sub_return_type,return_type> & func) 
       : it(it), func(func) {}
     
     bool operator!=(const iterator & it)const { return it.it != this->it; }
     iterator operator++() { ++this->it; return *this; }
     
 
     UInt currentGlobalIndex(){
       return this->it.currentGlobalIndex();
     }
 
     return_type operator*() {
       return func.func(*it,it.getCurrentElement());
     }
 
     Element getCurrentElement(){
       return this->it.getCurrentElement();
     }
 
     
   protected:
     sub_iterator it;
     ComputeFunctor<sub_return_type,return_type> & func;
   };
 
 
   /* ------------------------------------------------------------------------ */
   /* Constructors/Destructors                                                 */
   /* ------------------------------------------------------------------------ */
 
 public:
 
   FieldCompute(SubFieldCompute & cont, ComputeFunctorInterface & func)
     :sub_field(cont),func(dynamic_cast<ComputeFunctor<sub_return_type,return_type> &>(func)){
     this->checkHomogeneity();
   };
 
   virtual void registerToDumper(const std::string & id,
 				iohelper::Dumper & dumper) {
     dumper.addElemDataField(id, *this);
   }
 
 
   /* ------------------------------------------------------------------------ */
   /* Class Members                                                            */
   /* ------------------------------------------------------------------------ */
 
   iterator begin() { return iterator(sub_field.begin(), func); }
   iterator end  () { return iterator(sub_field.end(),   func); }
 
 
   UInt getDim() {
     return func.getDim();
   }
 
 
   UInt size() { 
     throw;
     // return Functor::size();
     return 0;
   }
 
   virtual void checkHomogeneity(){this->homogeneous = true;};
 
   iohelper::DataType getDataType() { return iohelper::getDataType<data_type>(); }
 
 
   /// get the number of components of the hosted field
   virtual ElementTypeMap<UInt> getNbComponents(UInt dim = _all_dimensions,
 					      GhostType ghost_type = _not_ghost,
 					      ElementKind kind = _ek_not_defined){
 
     ElementTypeMap<UInt> nb_components;
     const ElementTypeMap<UInt> & old_nb_components = 
       this->sub_field.getNbComponents(dim,ghost_type,kind);
     
 
     ElementTypeMap<UInt>::type_iterator tit = old_nb_components.firstType(dim,ghost_type,kind);
     ElementTypeMap<UInt>::type_iterator end = old_nb_components.lastType(dim,ghost_type,kind);
 
     while (tit != end){
       UInt nb_comp = old_nb_components(*tit,ghost_type);
       nb_components(*tit,ghost_type) = func.getNbComponent(nb_comp);
       ++tit;
     }
   return nb_components;
 };
 
   /// for connection to a FieldCompute
   inline virtual Field * connect(FieldComputeProxy & proxy);
 
   /// for connection to a FieldCompute
   virtual ComputeFunctorInterface * connect(HomogenizerProxy & proxy);
 
 
   /* ------------------------------------------------------------------------ */
   /* Class Members                                                            */
   /* ------------------------------------------------------------------------ */
 
 public:
 
   SubFieldCompute & sub_field;
   ComputeFunctor<sub_return_type,return_type> & func;
   
 };
 
 
 /* -------------------------------------------------------------------------- */
 
 class FieldComputeProxy {
 
   /* ------------------------------------------------------------------------ */
   /* Constructors/Destructors                                                 */
   /* ------------------------------------------------------------------------ */
 
 public:
 
   FieldComputeProxy(ComputeFunctorInterface & func):func(func){};
 
 public:
 
   inline static Field * createFieldCompute(Field * field, 
 					   ComputeFunctorInterface & func){
     
     FieldComputeProxy compute_proxy(func);
     return field->connect(compute_proxy);
   }
 
   template <typename T>
   Field * connectToField(T * ptr){
     if (dynamic_cast<ComputeFunctorOutput<Vector<Real> > *>(&func)){
       return this->connectToFunctor<Vector<Real> >(ptr);
     }
     else if (dynamic_cast<ComputeFunctorOutput<Vector<UInt> > *>(&func)){
       return this->connectToFunctor<Vector<UInt> >(ptr);
     }
 
     else if (dynamic_cast<ComputeFunctorOutput<Matrix<UInt> > *>(&func)){
       return this->connectToFunctor<Matrix<UInt> >(ptr);
     }
 
     else if (dynamic_cast<ComputeFunctorOutput<Matrix<Real> > *>(&func)){
       return this->connectToFunctor<Matrix<Real> >(ptr);
     }
 
 
     else throw;
   }
 
   template <typename output, typename T>
   Field * connectToFunctor(T * ptr){
     return new FieldCompute<T,output>(*ptr,func);
   }
 
   template <typename output, typename SubFieldCompute, 
 	    typename return_type1, typename return_type2>
   Field * connectToFunctor(FieldCompute<FieldCompute<SubFieldCompute,return_type1>,
 			   return_type2> * ptr){
     throw;    //    return new FieldCompute<T,output>(*ptr,func);
     return NULL;
   }
 
 
   template <typename output, typename SubFieldCompute, 
    	    typename return_type1,typename return_type2,
    	    typename return_type3,typename return_type4>
   Field * connectToFunctor(FieldCompute<
     			     FieldCompute<
    			       FieldCompute<
    			         FieldCompute<SubFieldCompute,return_type1>,
    			           return_type2>,
    			         return_type3>,
    			       return_type4> * ptr){
      throw;    //    return new FieldCompute<T,output>(*ptr,func);
      return NULL;
    }
             
 
   /* ------------------------------------------------------------------------ */
   /* Class Members                                                            */
   /* ------------------------------------------------------------------------ */
 
   ComputeFunctorInterface & func;
  
 };
 
 
 /* -------------------------------------------------------------------------- */
 
 /// for connection to a FieldCompute
 template <typename SubFieldCompute, typename return_type>
 inline Field * FieldCompute<SubFieldCompute,return_type>
 ::connect(FieldComputeProxy & proxy){
 
   return proxy.connectToField(this);
 }
 
 /* -------------------------------------------------------------------------- */
 
 
 
 
 
 
 __END_AKANTU_DUMPER__
 __END_AKANTU__
 
 
 #endif /* __AKANTU_DUMPER_COMPUTE_HH__ */
diff --git a/src/io/dumper/dumper_text.cc b/src/io/dumper/dumper_text.cc
index 0fbb10e78..c8cee5398 100644
--- a/src/io/dumper/dumper_text.cc
+++ b/src/io/dumper/dumper_text.cc
@@ -1,114 +1,115 @@
 /**
  * @file   dumper_text.cc
  * @author David Kammer <david.kammer@epfl.ch>
  * @date   Tue May 14 15:27:03 2013
  *
  * @brief  implementation of text dumper
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 #include <io_helper.hh>
 #include "dumper_text.hh"
 #include "dumper_nodal_field.hh"
 #include "mesh.hh"
+#include "static_communicator.hh"
 
 __BEGIN_AKANTU__
 
 /* -------------------------------------------------------------------------- */
 DumperText::DumperText(const std::string & basename,
 		       iohelper::TextDumpMode mode,
 		       bool parallel) : DumperIOHelper() {
   AKANTU_DEBUG_IN();
 
   iohelper::DumperText * dumper_text = new iohelper::DumperText(mode);
   this->dumper = dumper_text;
   this->setBaseName(basename);
 
   this->setParallelContext(parallel);
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void DumperText::registerMesh(const Mesh & mesh,
 			      UInt spatial_dimension,
 			      const GhostType & ghost_type,
 			      const ElementKind & element_kind) {
 
   registerField("position",
 		new dumper::NodalField<Real>(mesh.getNodes()));
 
   // in parallel we need node type
   UInt nb_proc = StaticCommunicator::getStaticCommunicator().getNbProc();
   if (nb_proc > 1) {
     registerField("nodes_type",
 		  new dumper::NodalField<Int>(mesh.getNodesType()));
   }
 }
 
 /* -------------------------------------------------------------------------- */
 void DumperText::registerFilteredMesh(const Mesh & mesh,
 				      const ElementTypeMapArray<UInt> & elements_filter,
 				      const Array<UInt> & nodes_filter,
 				      UInt spatial_dimension,
 				      const GhostType & ghost_type,
 				      const ElementKind & element_kind) {
 
   registerField("position",
 		new dumper::NodalField<Real,
 		true>(mesh.getNodes(),
 		      0,
 		      0,
 		      &nodes_filter));
 
   // in parallel we need node type
   UInt nb_proc = StaticCommunicator::getStaticCommunicator().getNbProc();
   if (nb_proc > 1) {
     registerField("nodes_type",
 		  new dumper::NodalField<Int,
 		  true>(mesh.getNodesType(),
 			0,
 			0,
 			&nodes_filter));
   }
 }
 
 /* -------------------------------------------------------------------------- */
 void DumperText::setBaseName(const std::string & basename) {
   AKANTU_DEBUG_IN();
 
   DumperIOHelper::setBaseName(basename);
   static_cast<iohelper::DumperText*>(this->dumper)->setDataSubDirectory(this->filename
 									+ "-DataFiles");
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void DumperText::setPrecision(UInt prec) {
   AKANTU_DEBUG_IN();
 
   static_cast<iohelper::DumperText*>(this->dumper)->setPrecision(prec);
 
   AKANTU_DEBUG_OUT();
 }
 
 __END_AKANTU__
diff --git a/src/io/dumper/dumper_text.hh b/src/io/dumper/dumper_text.hh
index 9ff0fb560..e11828ff0 100644
--- a/src/io/dumper/dumper_text.hh
+++ b/src/io/dumper/dumper_text.hh
@@ -1,81 +1,84 @@
 /**
  * @file   dumper_text.hh
  * @author David Kammer <david.kammer@epfl.ch>
  * @date   Tue May 14 15:24:25 2013
  *
  * @brief  to dump into a text file
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 #include "dumper_iohelper.hh"
 /* -------------------------------------------------------------------------- */
 #ifndef __AKANTU_DUMPER_TEXT_HH__
 #define __AKANTU_DUMPER_TEXT_HH__
+/* -------------------------------------------------------------------------- */
+#include <io_helper.hh>
+/* -------------------------------------------------------------------------- */
 
 __BEGIN_AKANTU__
 
 class DumperText : public DumperIOHelper {
   /* ------------------------------------------------------------------------ */
   /* Constructors/Destructors                                                 */
   /* ------------------------------------------------------------------------ */
 public:
 
   DumperText(const std::string & basename = "dumper_text",
 	     iohelper::TextDumpMode mode = iohelper::_tdm_space,
 	     bool parallel = true);
   virtual ~DumperText() {};
 
   /* ------------------------------------------------------------------------ */
   /* Methods                                                                  */
   /* ------------------------------------------------------------------------ */
 public:
   virtual void registerMesh(const Mesh & mesh, UInt spatial_dimension = _all_dimensions,
 			    const GhostType & ghost_type = _not_ghost,
 			    const ElementKind & element_kind = _ek_not_defined);
 
   virtual void registerFilteredMesh(const Mesh & mesh,
 				    const ElementTypeMapArray<UInt> & elements_filter,
 				    const Array<UInt> & nodes_filter,
 				    UInt spatial_dimension = _all_dimensions,
 				    const GhostType & ghost_type = _not_ghost,
 				    const ElementKind & element_kind = _ek_not_defined);
 
   virtual void setBaseName(const std::string & basename);
 
 private:
   void registerNodeTypeField();
 
   /* ------------------------------------------------------------------------ */
   /* Accessors                                                                */
   /* ------------------------------------------------------------------------ */
 public:
   void setPrecision(UInt prec);
 
   /* ------------------------------------------------------------------------ */
   /* Class Members                                                            */
   /* ------------------------------------------------------------------------ */
 private:
 };
 
 __END_AKANTU__
 
 #endif /* __AKANTU_DUMPER_TEXT_HH__ */
diff --git a/src/mesh/element_group.hh b/src/mesh/element_group.hh
index 4da0aefb1..c78e90994 100644
--- a/src/mesh/element_group.hh
+++ b/src/mesh/element_group.hh
@@ -1,174 +1,173 @@
 /**
  * @file   element_group.hh
  *
  * @author Dana Christen <dana.christen@gmail.com>
  *
  * @date   Wed Mar 06 09:30:00 2013
  *
  * @brief  Stores information relevent to the notion of domain boundary and surfaces.
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 
 #ifndef __AKANTU_ELEMENT_GROUP_HH__
 #define __AKANTU_ELEMENT_GROUP_HH__
 
 #include <set>
 #include "aka_common.hh"
 #include "aka_memory.hh"
 #include "element_type_map.hh"
 #include "node_group.hh"
 #include "dumpable.hh"
 __BEGIN_AKANTU__
 
 class Mesh;
 class Element;
 
 /* -------------------------------------------------------------------------- */
 class ElementGroup : private Memory, public Dumpable {
 
    /* ------------------------------------------------------------------------ */
    /* Constructors/Destructors                                                 */
    /* ------------------------------------------------------------------------ */
  public:
   ElementGroup(const std::string & name,
 	       const Mesh & mesh,
 	       NodeGroup & node_group,
                UInt dimension = _all_dimensions,
 	       const std::string & id = "element_group",
 	       const MemoryID & memory_id = 0);
 
   /* ------------------------------------------------------------------------ */
   /* Type definitions                                                         */
   /* ------------------------------------------------------------------------ */
 public:
   typedef ElementTypeMapArray<UInt> ElementList;
   typedef Array<UInt> NodeList;
 
   /* ------------------------------------------------------------------------ */
   /* Node iterator                                                            */
   /* ------------------------------------------------------------------------ */
   typedef NodeGroup::const_node_iterator const_node_iterator;
   inline const_node_iterator node_begin() const;
   inline const_node_iterator node_end() const;
 
   /* ------------------------------------------------------------------------ */
   /* Element iterator                                                         */
   /* ------------------------------------------------------------------------ */
   typedef ElementList::type_iterator type_iterator;
   inline type_iterator firstType(UInt dim = _all_dimensions,
 				 const GhostType & ghost_type = _not_ghost,
 				 const ElementKind & kind = _ek_regular) const;
 
   inline type_iterator lastType(UInt dim = _all_dimensions,
 				const GhostType & ghost_type = _not_ghost,
 				const ElementKind & kind = _ek_regular) const;
 
   typedef Array<UInt>::const_iterator<UInt> const_element_iterator;
   inline const_element_iterator element_begin(const ElementType & type,
 					      const GhostType & ghost_type = _not_ghost) const;
   inline const_element_iterator element_end(const ElementType & type,
 					    const GhostType & ghost_type = _not_ghost) const;
 
   /* ------------------------------------------------------------------------ */
   /* Methods                                                                  */
   /* ------------------------------------------------------------------------ */
 public:
   /// empty the element group
   void empty();
 
   /// append another group to this group
   /// BE CAREFUL: it doesn't conserve the element order
   void append(const ElementGroup & other_group);
 
   /// add an element to the group. By default the it does not add the nodes to the group
   inline void add(const Element & el, bool add_nodes = false, bool check_for_duplicate = true);
 
   /// \todo fix the default for add_nodes : make it coherent with the other method
   inline void add(const ElementType & type, UInt element, 
 		  const GhostType & ghost_type = _not_ghost,
 		  bool add_nodes = true, bool check_for_duplicate = true);
 
   inline void addNode(UInt node_id, bool check_for_duplicate = true);
 
   /// function to print the contain of the class
   virtual void printself(std::ostream & stream, int indent = 0) const;
 
   // sort and remove duplicated values
   void optimize();
 private:
   inline void addElement(const ElementType & elem_type,
 			 UInt elem_id,
 			 const GhostType & ghost_type);
 
 
   friend class GroupManager;
 
   /* ------------------------------------------------------------------------ */
   /* Accessors                                                                */
   /* ------------------------------------------------------------------------ */
 public:
   AKANTU_GET_MACRO_BY_ELEMENT_TYPE_CONST(Elements, elements, UInt);
   AKANTU_GET_MACRO(Elements, elements, const ElementTypeMapArray<UInt> &);
   AKANTU_GET_MACRO(Nodes, node_group.getNodes(), const Array<UInt> &);
   AKANTU_GET_MACRO(NodeGroup, node_group, const NodeGroup &);
   AKANTU_GET_MACRO_NOT_CONST(NodeGroup, node_group, NodeGroup &);
   AKANTU_GET_MACRO(Dimension, dimension, UInt);
   AKANTU_GET_MACRO(Name, name, std::string);
   inline UInt getNbNodes() const;
 
   /* ------------------------------------------------------------------------ */
   /* Class Members                                                            */
   /* ------------------------------------------------------------------------ */
 private:
   /// Mesh to which this group belongs
   const Mesh & mesh;
 
   /// name of the group
   std::string name;
 
   /// list of elements composing the group
   ElementList elements;
 
   /// sub list of nodes which are composing the elements
   NodeGroup & node_group;
 
   /// group dimension
   UInt dimension;
 
   /// empty arry for the iterator to work when an element type not present
   Array<UInt> empty_elements;
 };
 
-__END_AKANTU__
-#include "element.hh"
-__BEGIN_AKANTU__
-
 /// standard output stream operator
 inline std::ostream & operator << (std::ostream & stream, const ElementGroup &_this) {
   _this.printself(stream);
   return stream;
 }
 
 __END_AKANTU__
 
+#include "element.hh"
+#include "element_group_inline_impl.cc"
+
 #endif /* __AKANTU_ELEMENT_GROUP_HH__ */
diff --git a/src/mesh/group_manager.hh b/src/mesh/group_manager.hh
index 177c6c702..43d74d7a5 100644
--- a/src/mesh/group_manager.hh
+++ b/src/mesh/group_manager.hh
@@ -1,295 +1,299 @@
 /**
  * @file   group_manager.hh
  *
  * @author Dana Christen <dana.christen@gmail.com>
  * @author Nicolas Richart <nicolas.richart@epfl.ch>
  * @author David Kammer <david.kammer@epfl.ch>
  *
  * @date   Wed Mar 06 09:30:00 2013
  *
  * @brief  Stores information relevent to the notion of element and nodes groups.
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 
 #ifndef __AKANTU_GROUP_MANAGER_HH__
 #define __AKANTU_GROUP_MANAGER_HH__
 
 #include <set>
 #include "aka_common.hh"
 #include "element_type_map.hh"
-#include "dumpable.hh"
+//#include "dumpable.hh"
 
 __BEGIN_AKANTU__
 
 /* -------------------------------------------------------------------------- */
 class FEM;
 class ElementGroup;
 class NodeGroup;
 class Mesh;
 class Element;
 class DistributedSynchronizer;
 template<bool> class CommunicationBufferTemplated;
+
+namespace dumper {
+  class Field;
+}
 /* -------------------------------------------------------------------------- */
 
 
 
 class GroupManager {
   /* ------------------------------------------------------------------------ */
   /* Typedefs                                                                 */
   /* ------------------------------------------------------------------------ */
 private:
   typedef std::map<std::string, ElementGroup *> ElementGroups;
   typedef std::map<std::string, NodeGroup *> NodeGroups;
 
 public:
   typedef std::set<ElementType> GroupManagerTypeSet;
 
   /* ------------------------------------------------------------------------ */
   /* Constructors/Destructors                                                 */
   /* ------------------------------------------------------------------------ */
 public:
   GroupManager(const Mesh & mesh,
 	       const ID & id = "group_manager",
 	       const MemoryID & memory_id = 0);
   virtual ~GroupManager();
 
   /* ------------------------------------------------------------------------ */
   /* Groups iterators                                                         */
   /* ------------------------------------------------------------------------ */
 public:
   typedef NodeGroups::iterator node_group_iterator;
   typedef ElementGroups::iterator element_group_iterator;
 
   typedef NodeGroups::const_iterator const_node_group_iterator;
   typedef ElementGroups::const_iterator const_element_group_iterator;
 
 #define AKANTU_GROUP_MANAGER_DEFINE_ITERATOR_FUNCTION(group_type,       \
 						      function,         \
 						      param_in,         \
 						      param_out)        \
   inline BOOST_PP_CAT(BOOST_PP_CAT(const_, group_type), _iterator)      \
     BOOST_PP_CAT(BOOST_PP_CAT(group_type, _), function)(param_in) const { \
     return BOOST_PP_CAT(group_type, s).function(param_out);             \
   };                                                                    \
 									\
   inline BOOST_PP_CAT(group_type, _iterator)                            \
     BOOST_PP_CAT(BOOST_PP_CAT(group_type, _), function)(param_in) {     \
     return BOOST_PP_CAT(group_type, s).function(param_out);             \
   }
 
 #define AKANTU_GROUP_MANAGER_DEFINE_ITERATOR_FUNCTION_NP(group_type, function) \
   AKANTU_GROUP_MANAGER_DEFINE_ITERATOR_FUNCTION(group_type, function, BOOST_PP_EMPTY(), BOOST_PP_EMPTY())
 
   AKANTU_GROUP_MANAGER_DEFINE_ITERATOR_FUNCTION_NP(node_group, begin);
   AKANTU_GROUP_MANAGER_DEFINE_ITERATOR_FUNCTION_NP(node_group, end  );
   AKANTU_GROUP_MANAGER_DEFINE_ITERATOR_FUNCTION_NP(element_group, begin);
   AKANTU_GROUP_MANAGER_DEFINE_ITERATOR_FUNCTION_NP(element_group, end  );
   AKANTU_GROUP_MANAGER_DEFINE_ITERATOR_FUNCTION(element_group, find, const std::string & name, name);
   AKANTU_GROUP_MANAGER_DEFINE_ITERATOR_FUNCTION(node_group, find, const std::string & name, name);
 
   /* ------------------------------------------------------------------------ */
   /* Clustering filter                                                        */
   /* ------------------------------------------------------------------------ */
 public:
 
   class ClusteringFilter {
   public:
     virtual bool operator() (const Element &) const {
       return true;
     }
   };
 
   /* ------------------------------------------------------------------------ */
   /* Methods                                                                  */
   /* ------------------------------------------------------------------------ */
 public:
   /// create an empty node group
   NodeGroup & createNodeGroup(const std::string & group_name,
 			      bool replace_group = false);
 
   /// create a node group from another node group but filtered
   template <typename T>
   NodeGroup & createFilteredNodeGroup(const std::string & group_name,
 				      const NodeGroup & node_group,
 				      T & filter);
 
   /// destroy a node group
   void destroyNodeGroup(const std::string & group_name);
 
 
   /// create an element group and the associated node group
   ElementGroup & createElementGroup(const std::string & group_name,
 				    UInt dimension = _all_dimensions,
 				    bool replace_group = false);
 
   /// create an element group from another element group but filtered
   template <typename T>
   ElementGroup & createFilteredElementGroup(const std::string & group_name,
 					    UInt dimension,
 					    const NodeGroup & node_group,
 					    T & filter);
 
   /// destroy an element group and the associated node group
   void destroyElementGroup(const std::string & group_name,
 			   bool destroy_node_group = false);
 
   /// destroy all element groups and the associated node groups
   void destroyAllElementGroups(bool destroy_node_groups = false);
 
   /// create a element group using an existing node group
   ElementGroup & createElementGroup(const std::string & group_name,
 				    UInt dimension,
 				    NodeGroup & node_group);
 
   /// create groups based on values stored in a given mesh data
   template <typename T>
   void createGroupsFromMeshData(const std::string & dataset_name);
 
   /// create boundaries group by a clustering algorithm \todo extend to parallel
   UInt createBoundaryGroupFromGeometry();
 
   /// create element clusters for a given dimension
   UInt createClusters(UInt element_dimension,
 		      std::string cluster_name_prefix = "cluster",
 		      const ClusteringFilter & filter = ClusteringFilter(),
 		      DistributedSynchronizer * distributed_synchronizer = NULL,
 		      Mesh * mesh_facets = NULL);
 
   /// Create an ElementGroup based on a NodeGroup
   void createElementGroupFromNodeGroup(const std::string & name,
 				       const std::string & node_group,
 				       UInt dimension = _all_dimensions);
 
   virtual void printself(std::ostream & stream, int indent = 0) const;
 
   /// this function insure that the group names are present on all processors
   /// /!\ it is a SMP call
   void synchronizeGroupNames();
 
   /// register an elemental field to the given group name (overloading for ElementalPartionField)
   template <typename T, template <bool> class dump_type>
-  dumper::Field * createElementalField(const ElementTypeMapArray<T> & field, 
-				       const std::string & group_name,
-				       UInt spatial_dimension,
-				       const ElementKind & kind,
-				       ElementTypeMap<UInt> nb_data_per_elem = ElementTypeMap<UInt>());
+  inline dumper::Field * createElementalField(const ElementTypeMapArray<T> & field, 
+					      const std::string & group_name,
+					      UInt spatial_dimension,
+					      const ElementKind & kind,
+					      ElementTypeMap<UInt> nb_data_per_elem = ElementTypeMap<UInt>());
 
   /// register an elemental field to the given group name (overloading for ElementalField)
   template <typename T, template <class> class ret_type, template <class,template <class> class,bool> class dump_type>
-  dumper::Field * createElementalField(const ElementTypeMapArray<T> & field, 
-				       const std::string & group_name,
-				       UInt spatial_dimension,
-				       const ElementKind & kind,
-				       ElementTypeMap<UInt> nb_data_per_elem = ElementTypeMap<UInt>());
+  inline dumper::Field * createElementalField(const ElementTypeMapArray<T> & field, 
+					      const std::string & group_name,
+					      UInt spatial_dimension,
+					      const ElementKind & kind,
+					      ElementTypeMap<UInt> nb_data_per_elem = ElementTypeMap<UInt>());
 
   /// register an elemental field to the given group name (overloading for MaterialInternalField)
   template <typename T, 
 	    /// type of InternalMaterialField
 	    template<typename T, bool filtered> class dump_type>
-  dumper::Field * createElementalField(const ElementTypeMapArray<T> & field, 
-				       const std::string & group_name,
-				       UInt spatial_dimension,
-				       const ElementKind & kind,
-				       ElementTypeMap<UInt> nb_data_per_elem);
-
-  template <typename type, bool flag, template<class,bool> class ftype>
-  dumper::Field * createNodalField(const ftype<type,flag> * field,
-				   const std::string & group_name,
-				   UInt padding_size = 0);
-
+  inline dumper::Field * createElementalField(const ElementTypeMapArray<T> & field, 
+					      const std::string & group_name,
+					      UInt spatial_dimension,
+					      const ElementKind & kind,
+					      ElementTypeMap<UInt> nb_data_per_elem);
+  
   template <typename type, bool flag, template<class,bool> class ftype>
-  dumper::Field * createStridedNodalField(const ftype<type,flag> * field,
+  inline dumper::Field * createNodalField(const ftype<type,flag> * field,
 					  const std::string & group_name,
-					  UInt size, UInt stride,
-					  UInt padding_size);
+					  UInt padding_size = 0);
+  
+  template <typename type, bool flag, template<class,bool> class ftype>
+  inline dumper::Field * createStridedNodalField(const ftype<type,flag> * field,
+						 const std::string & group_name,
+						 UInt size, UInt stride,
+						 UInt padding_size);
 
 protected:
   /// fill a buffer with all the group names
   void fillBufferWithGroupNames(CommunicationBufferTemplated<false> & comm_buffer) const;
 
   /// take a buffer and create the missing groups localy
   void checkAndAddGroups(CommunicationBufferTemplated<true> & buffer);
   
 
 
   /// register an elemental field to the given group name
   template <class dump_type,typename field_type>
-  dumper::Field * createElementalField(const field_type & field, 
+  inline dumper::Field * createElementalField(const field_type & field, 
 				       const std::string & group_name,
 				       UInt spatial_dimension,
 				       const ElementKind & kind,
 				       ElementTypeMap<UInt> nb_data_per_elem);
 
 
   /// register an elemental field to the given group name
   template <class dump_type,typename field_type>
-  dumper::Field * createElementalFilteredField(const field_type & field, 
+  inline dumper::Field * createElementalFilteredField(const field_type & field, 
 					       const std::string & group_name,
 					       UInt spatial_dimension,
 					       const ElementKind & kind,
 					       ElementTypeMap<UInt> nb_data_per_elem);
 
 
 
   /* ------------------------------------------------------------------------ */
   /* Accessor                                                                 */
   /* ------------------------------------------------------------------------ */
 public:
   const ElementGroup & getElementGroup(const std::string & name) const;
   const NodeGroup    & getNodeGroup(const std::string & name) const;
 
   ElementGroup & getElementGroup(const std::string & name);
   NodeGroup    & getNodeGroup(const std::string & name);
 
 
   UInt getNbElementGroups(UInt dimension = _all_dimensions) const;
 
   /* ------------------------------------------------------------------------ */
   /* Class Members                                                            */
   /* ------------------------------------------------------------------------ */
 protected:
   /// id to create element and node groups
   ID id;
   /// memory_id to create element and node groups
   MemoryID memory_id;
 
   /// list of the node groups managed
   NodeGroups node_groups;
 
   /// list of the element groups managed
   ElementGroups element_groups;
 
   /// Mesh to which the element belongs
   const Mesh & mesh;
 };
 
 /// standard output stream operator
 inline std::ostream & operator <<(std::ostream & stream, const GroupManager & _this)
 {
   _this.printself(stream);
   return stream;
 }
 
 __END_AKANTU__
 
 #endif /* __AKANTU_GROUP_MANAGER_HH__ */
diff --git a/src/mesh/mesh.cc b/src/mesh/mesh.cc
index b8e35440b..b1c28ef22 100644
--- a/src/mesh/mesh.cc
+++ b/src/mesh/mesh.cc
@@ -1,478 +1,474 @@
 /**
  * @file   mesh.cc
  *
  * @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
  * @author Marco Vocialta <marco.vocialta@epfl.ch>
  * @author Nicolas Richart <nicolas.richart@epfl.ch>
  *
  * @date   Fri Jun 18 11:47:19 2010
  *
  * @brief  class handling meshes
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 #include <sstream>
 
 #include "aka_config.hh"
 
 /* -------------------------------------------------------------------------- */
 #include "mesh.hh"
+#include "group_manager_inline_impl.cc"
 #include "mesh_io.hh"
 #include "element_class.hh"
 #include "static_communicator.hh"
+#include "element_group.hh"
 /* -------------------------------------------------------------------------- */
 #ifdef AKANTU_USE_IOHELPER
 #  include "dumper_field.hh"
-//#  include "dumper_paraview.hh"
-//#  include "dumper_homogenizing_field.hh"
 #  include "dumper_material_internal_field.hh"
-//#  include "dumper_elemental_field.hh"
-//#  include "dumper_material_padders.hh"
-//#  include "dumper_element_partition.hh"
-//#  include "dumper_iohelper.hh"
 #endif
 /* -------------------------------------------------------------------------- */
 
 
 __BEGIN_AKANTU__
 
 const Element ElementNull(_not_defined, 0);
 
 /* -------------------------------------------------------------------------- */
 void Element::printself(std::ostream & stream, int indent) const {
   std::string space;
   for(Int i = 0; i < indent; i++, space += AKANTU_INDENT);
   stream << space << "Element [" << type << ", " << element << ", " << ghost_type << "]";
 }
 
 
 /* -------------------------------------------------------------------------- */
 Mesh::Mesh(UInt spatial_dimension,
 	   const ID & id,
 	   const MemoryID & memory_id) :
   Memory(id, memory_id),
   GroupManager(*this, id + ":group_manager", memory_id),
   nodes_global_ids(NULL), nodes_type(0, 1, id + ":nodes_type"),
   created_nodes(true),
   connectivities("connectivities", id),
   normals("normals", id),
   spatial_dimension(spatial_dimension),
   types_offsets(Array<UInt>((UInt) _max_element_type + 1, 1)),
   ghost_types_offsets(Array<UInt>((UInt) _max_element_type + 1, 1)),
   lower_bounds(spatial_dimension,0.),
   upper_bounds(spatial_dimension,0.),
   size(spatial_dimension, 0.),
   local_lower_bounds(spatial_dimension,0.),
   local_upper_bounds(spatial_dimension,0.),
   mesh_data("mesh_data", id, memory_id),
   mesh_facets(NULL) {
   AKANTU_DEBUG_IN();
 
   this->nodes = &(alloc<Real>(id + ":coordinates", 0, this->spatial_dimension));
 
   nb_global_nodes = 0;
 
   init();
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 Mesh::Mesh(UInt spatial_dimension,
            const ID & nodes_id,
            const ID & id,
            const MemoryID & memory_id) :
   Memory(id, memory_id),
   GroupManager(*this, id + ":group_manager", memory_id),
   nodes_global_ids(NULL), nodes_type(0, 1, id + ":nodes_type"),
   created_nodes(false),
   connectivities("connectivities", id),
   normals("normals", id),
   spatial_dimension(spatial_dimension),
   types_offsets(Array<UInt>((UInt) _max_element_type + 1, 1)),
   ghost_types_offsets(Array<UInt>((UInt) _max_element_type + 1, 1)),
   lower_bounds(spatial_dimension,0.),
   upper_bounds(spatial_dimension,0.),
   size(spatial_dimension, 0.),
   local_lower_bounds(spatial_dimension,0.),
   local_upper_bounds(spatial_dimension,0.),
   mesh_data("mesh_data", id, memory_id),
   mesh_facets(NULL) {
   AKANTU_DEBUG_IN();
 
   this->nodes = &(getArray<Real>(nodes_id));
   nb_global_nodes = nodes->getSize();
 
   init();
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 Mesh::Mesh(UInt spatial_dimension,
            Array<Real> & nodes,
            const ID & id,
            const MemoryID & memory_id) :
   Memory(id, memory_id),
   GroupManager(*this, id + ":group_manager", memory_id),
   nodes_global_ids(NULL), nodes_type(0, 1, id + ":nodes_type"),
   created_nodes(false),
   connectivities("connectivities", id),
   normals("normals", id),
   spatial_dimension(spatial_dimension),
   types_offsets(Array<UInt>(_max_element_type + 1, 1)),
   ghost_types_offsets(Array<UInt>(_max_element_type + 1, 1)),
   lower_bounds(spatial_dimension,0.),
   upper_bounds(spatial_dimension,0.),
   size(spatial_dimension, 0.),
   local_lower_bounds(spatial_dimension,0.),
   local_upper_bounds(spatial_dimension,0.),
   mesh_data("mesh_data", id, memory_id),
   mesh_facets(NULL) {
   AKANTU_DEBUG_IN();
 
   this->nodes = &(nodes);
   nb_global_nodes = nodes.getSize();
 
   init();
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 Mesh & Mesh::initMeshFacets(const ID & id) {
   AKANTU_DEBUG_IN();
 
   if (!mesh_facets) {
     mesh_facets = new Mesh(spatial_dimension,
                            *(this->nodes),
 			   getID()+":"+id,
                            getMemoryID());
 
     mesh_facets->mesh_parent = this;
     mesh_facets->is_mesh_facets = true;
   }
 
   AKANTU_DEBUG_OUT();
   return *mesh_facets;
 }
 
 /* -------------------------------------------------------------------------- */
 void Mesh::defineMeshParent(const Mesh & mesh) {
   AKANTU_DEBUG_IN();
 
   this->mesh_parent = &mesh;
   this->is_mesh_facets = true;
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void Mesh::init() {
   this->is_mesh_facets = false;
   this->mesh_parent = NULL;
   this->is_distributed = false;
   //  computeBoundingBox();
 }
 
 /* -------------------------------------------------------------------------- */
 Mesh::~Mesh() {
   AKANTU_DEBUG_IN();
 
   delete mesh_facets;
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void Mesh::read (const std::string & filename, const MeshIOType & mesh_io_type) {
   MeshIO mesh_io;
   mesh_io.read(filename, *this, mesh_io_type);
 
   type_iterator it   = this->firstType(spatial_dimension, _not_ghost, _ek_not_defined);
   type_iterator last = this->lastType(spatial_dimension, _not_ghost, _ek_not_defined);
   if(it == last) AKANTU_EXCEPTION("The mesh contained in the file " << filename
 				  << " does not seam to be of the good dimension."
 				  << " No element of dimension " << spatial_dimension
 				  << " where read.");
 }
 
 /* -------------------------------------------------------------------------- */
 void Mesh::write(const std::string & filename, const MeshIOType & mesh_io_type) {
   MeshIO mesh_io;
   mesh_io.write(filename, *this, mesh_io_type);
 }
 
 /* -------------------------------------------------------------------------- */
 void Mesh::printself(std::ostream & stream, int indent) const {
   std::string space;
   for(Int i = 0; i < indent; i++, space += AKANTU_INDENT);
 
   stream << space << "Mesh [" << std::endl;
   stream << space << " + id                : " << getID() << std::endl;
   stream << space << " + spatial dimension : " << this->spatial_dimension << std::endl;
   stream << space << " + nodes [" << std::endl;
   nodes->printself(stream, indent+2);
   stream << space << " + connectivities [" << std::endl;
   connectivities.printself(stream, indent+2);
   stream << space << " ]" << std::endl;
 
   GroupManager::printself(stream, indent + 1);
   stream << space << "]" << std::endl;
 }
 
 /* -------------------------------------------------------------------------- */
 void Mesh::computeBoundingBox(){
   AKANTU_DEBUG_IN();
   for (UInt k = 0; k < spatial_dimension; ++k) {
     local_lower_bounds(k) =   std::numeric_limits<double>::max();
     local_upper_bounds(k) = - std::numeric_limits<double>::max();
   }
 
   for (UInt i = 0; i < nodes->getSize(); ++i) {
     //    if(!isPureGhostNode(i))
     for (UInt k = 0; k < spatial_dimension; ++k) {
       local_lower_bounds(k) = std::min(local_lower_bounds[k], (*nodes)(i, k));
       local_upper_bounds(k) = std::max(local_upper_bounds[k], (*nodes)(i, k));
     }
   }
 
   if (this->is_distributed) {
     StaticCommunicator & comm = StaticCommunicator::getStaticCommunicator();
 
     Real reduce_bounds[2 * spatial_dimension];
     for (UInt k = 0; k < spatial_dimension; ++k) {
       reduce_bounds[2*k    ] =   local_lower_bounds(k);
       reduce_bounds[2*k + 1] = - local_upper_bounds(k);
     }
     
     comm.allReduce(reduce_bounds, 2 * spatial_dimension, _so_min);
 
     for (UInt k = 0; k < spatial_dimension; ++k) {
       lower_bounds(k) =   reduce_bounds[2*k];
       upper_bounds(k) = - reduce_bounds[2*k + 1];
     }
   }
   else {
     this->lower_bounds = this->local_lower_bounds;
     this->upper_bounds = this->local_upper_bounds;
   }
 
   size = upper_bounds - lower_bounds;
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 template<typename T>
 void Mesh::initElementTypeMapArray(ElementTypeMapArray<T> & vect,
                                   UInt nb_component,
                                   UInt dim,
                                   const bool & flag_nb_node_per_elem_multiply,
                                   ElementKind element_kind,
                                   bool size_to_nb_element) const {
   AKANTU_DEBUG_IN();
 
   for(UInt g = _not_ghost; g <= _ghost; ++g) {
     GhostType gt = (GhostType) g;
     this->initElementTypeMapArray(vect, nb_component, dim, gt,
                                  flag_nb_node_per_elem_multiply,
                                  element_kind, size_to_nb_element);
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 template<typename T>
 void Mesh::initElementTypeMapArray(ElementTypeMapArray<T> & vect,
                                   UInt nb_component,
                                   UInt dim,
                                   GhostType gt,
                                   const bool & flag_nb_node_per_elem_multiply,
                                   ElementKind element_kind,
                                   bool size_to_nb_element) const {
   AKANTU_DEBUG_IN();
 
   Mesh::type_iterator it  = firstType(dim, gt, element_kind);
   Mesh::type_iterator end = lastType(dim, gt, element_kind);
   for(; it != end; ++it) {
     ElementType type = *it;
     if (flag_nb_node_per_elem_multiply) nb_component *= Mesh::getNbNodesPerElement(*it);
     UInt size = 0;
     if (size_to_nb_element) size = this->getNbElement(type, gt);
     vect.alloc(size, nb_component, type, gt);
   }
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void Mesh::initNormals() {
   initElementTypeMapArray(normals, spatial_dimension, spatial_dimension, false, _ek_not_defined);
 }
 
 /* -------------------------------------------------------------------------- */
 void Mesh::getGlobalConnectivity(ElementTypeMapArray<UInt> & global_connectivity,
 				 UInt dimension,
 				 GhostType ghost_type) {
   AKANTU_DEBUG_IN();
 
   Mesh::type_iterator it  = firstType(dimension, ghost_type);
   Mesh::type_iterator end = lastType(dimension, ghost_type);
 
   for(; it != end; ++it) {
     ElementType type = *it;
 
     Array<UInt> & local_conn = connectivities(type, ghost_type);
     Array<UInt> & g_connectivity = global_connectivity(type, ghost_type);
 
     if (!nodes_global_ids)
       nodes_global_ids = mesh_parent->nodes_global_ids;
 
     UInt * local_c = local_conn.storage();
     UInt * global_c = g_connectivity.storage();
 
     UInt nb_terms = local_conn.getSize() * local_conn.getNbComponent();
 
     for (UInt i = 0; i < nb_terms; ++i, ++local_c, ++global_c)
       *global_c = (*nodes_global_ids)(*local_c);
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 
 DumperIOHelper & Mesh::getGroupDumper(const std::string & dumper_name, 
 				      const std::string & group_name){
   
   if (group_name == "all") return this->getDumper(dumper_name);
   else return element_groups[group_name]->getDumper(dumper_name);
 
 }
 
 
 
 /* -------------------------------------------------------------------------- */
 #define AKANTU_INSTANTIATE_INIT(type)					\
 template void Mesh::initElementTypeMapArray<type>(ElementTypeMapArray<type> & vect, \
                                                  UInt nb_component,	\
                                                  UInt dim,		\
                                                  const bool & flag_nb_elem_multiply, \
                                                  ElementKind element_kind, \
                                                  bool size_to_nb_element) const; \
 template void Mesh::initElementTypeMapArray<type>(ElementTypeMapArray<type> & vect, \
                                                  UInt nb_component,	\
                                                  UInt dim,		\
 						 GhostType gt,		\
                                                  const bool & flag_nb_elem_multiply, \
                                                  ElementKind element_kind, \
                                                  bool size_to_nb_element) const
 
 AKANTU_INSTANTIATE_INIT(Real);
 AKANTU_INSTANTIATE_INIT(UInt);
 AKANTU_INSTANTIATE_INIT(Int);
 AKANTU_INSTANTIATE_INIT(bool);
 
 /* -------------------------------------------------------------------------- */
 template <typename T>
 ElementTypeMap<UInt> Mesh::getNbDataPerElem(ElementTypeMapArray<T> & array,
 					    const ElementKind & element_kind){
 
   ElementTypeMap<UInt> nb_data_per_elem;
   
   typename ElementTypeMapArray<T>::type_iterator it = 
     array.firstType(spatial_dimension, _not_ghost,element_kind);
   typename ElementTypeMapArray<T>::type_iterator last_type = 
     array.lastType(spatial_dimension, _not_ghost,element_kind);
   
   for(; it != last_type; ++it) {
     UInt nb_elements = this->getNbElement(*it);
     nb_data_per_elem(*it) = 
       array(*it).getNbComponent() * 
       array(*it).getSize();
 
     nb_data_per_elem(*it) /= nb_elements;
   }
   return nb_data_per_elem;
 }
 
 /* -------------------------------------------------------------------------- */
 
 template 
 ElementTypeMap<UInt> Mesh::getNbDataPerElem(ElementTypeMapArray<Real> & array,
 					    const ElementKind & element_kind);
 
 template 
 ElementTypeMap<UInt> Mesh::getNbDataPerElem(ElementTypeMapArray<UInt> & array,
 					    const ElementKind & element_kind);
 
 
 /* -------------------------------------------------------------------------- */
 
 #ifdef AKANTU_USE_IOHELPER
 
 template <typename T>
 dumper::Field * Mesh::createFieldFromAttachedData(const std::string & field_id,
 						  const std::string & group_name,
 						  const ElementKind & element_kind){
 
 
   dumper::Field * field = NULL;
   ElementTypeMapArray<T> * internal = NULL;
   try {
     internal = &(this->getData<T>(field_id));
   }
   catch (...){
     return NULL;
   }
 
   ElementTypeMap<UInt> nb_data_per_elem = 
     this->getNbDataPerElem(*internal,element_kind);
 
   field = 
     this->createElementalField<T, dumper::InternalMaterialField>(*internal,
 								group_name,
 								this->spatial_dimension,
 								element_kind,
 								nb_data_per_elem);
 
   return field;
 }
 
 template dumper::Field * 
 Mesh::createFieldFromAttachedData<Real>(const std::string & field_id,
 					const std::string & group_name,
 					const ElementKind & element_kind);
 
 template dumper::Field * 
 Mesh::createFieldFromAttachedData<UInt>(const std::string & field_id,
 					const std::string & group_name,
 					const ElementKind & element_kind);
 
 
 /* -------------------------------------------------------------------------- */
 
 #endif
 
 
 __END_AKANTU__
diff --git a/src/mesh/mesh.hh b/src/mesh/mesh.hh
index 2b68051fc..7df9fe3fb 100644
--- a/src/mesh/mesh.hh
+++ b/src/mesh/mesh.hh
@@ -1,618 +1,619 @@
 /**
  * @file   mesh.hh
  *
  * @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
  * @author Marco Vocialta <marco.vocialta@epfl.ch>
  * @author Nicolas Richart <nicolas.richart@epfl.ch>
  * @author Dana Christen <dana.christen@epfl.ch>
  * @author David Kammer <david.kammer@epfl.ch>
  *
  * @date   Fri Jun 18 11:47:19 2010
  *
  * @brief  the class representing the meshes
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 #ifndef __AKANTU_MESH_HH__
 #define __AKANTU_MESH_HH__
 
 /* -------------------------------------------------------------------------- */
 
 #include "aka_config.hh"
 #include "aka_common.hh"
 #include "aka_memory.hh"
 #include "aka_array.hh"
 #include "element_class.hh"
 #include "element_type_map.hh"
 #include "aka_event_handler_manager.hh"
 #include "group_manager.hh"
 #include "element.hh"
 /* -------------------------------------------------------------------------- */
 #include <set>
 /* -------------------------------------------------------------------------- */
 #include "mesh_data.hh"
+#include "dumpable.hh"
 
 __BEGIN_AKANTU__
 
 /* -------------------------------------------------------------------------- */
 /* Mesh modifications events                                                  */
 /* -------------------------------------------------------------------------- */
 template<class Entity>
 class MeshEvent {
 public:
   virtual ~MeshEvent() {}
   const Array<Entity> & getList() const { return list; }
   Array<Entity> & getList() { return list; }
 protected:
   Array<Entity> list;
 };
 
 class Mesh;
 
 class NewNodesEvent : public MeshEvent<UInt> {
 public:
   virtual ~NewNodesEvent() {};
 };
 class RemovedNodesEvent : public MeshEvent<UInt> {
 public:
   virtual ~RemovedNodesEvent() {};
   inline RemovedNodesEvent(const Mesh & mesh);
   AKANTU_GET_MACRO_NOT_CONST(NewNumbering, new_numbering, Array<UInt> &);
   AKANTU_GET_MACRO(NewNumbering, new_numbering, const Array<UInt> &);
 private:
   Array<UInt> new_numbering;
 };
 
 class NewElementsEvent : public MeshEvent<Element> {
 public:
   virtual ~NewElementsEvent() {};
 };
 class RemovedElementsEvent : public MeshEvent<Element> {
 public:
   virtual ~RemovedElementsEvent() {};
   inline RemovedElementsEvent(const Mesh & mesh);
   AKANTU_GET_MACRO(NewNumbering, new_numbering, const ElementTypeMapArray<UInt> &);
   AKANTU_GET_MACRO_NOT_CONST(NewNumbering, new_numbering, ElementTypeMapArray<UInt> &);
   AKANTU_GET_MACRO_BY_ELEMENT_TYPE(NewNumbering, new_numbering, UInt);
   AKANTU_GET_MACRO_BY_ELEMENT_TYPE_CONST(NewNumbering, new_numbering, UInt);
 protected:
   ElementTypeMapArray<UInt> new_numbering;
 };
 
 /* -------------------------------------------------------------------------- */
 
 class MeshEventHandler {
 public:
   virtual ~MeshEventHandler() {};
   /* ------------------------------------------------------------------------ */
   /* Internal code                                                            */
   /* ------------------------------------------------------------------------ */
 private:
   inline void sendEvent(const NewNodesEvent & event)     { onNodesAdded  (event.getList(),
                                                                           event); }
   inline void sendEvent(const RemovedNodesEvent & event) { onNodesRemoved(event.getList(),
                                                                           event.getNewNumbering(),
                                                                           event); }
 
   inline void sendEvent(const NewElementsEvent & event)     { onElementsAdded  (event.getList(),
                                                                                 event); }
   inline void sendEvent(const RemovedElementsEvent & event) { onElementsRemoved(event.getList(),
                                                                                 event.getNewNumbering(),
                                                                                 event); }
 
   template<class EventHandler>
   friend class EventHandlerManager;
 
   /* ------------------------------------------------------------------------ */
   /* Interface                                                                */
   /* ------------------------------------------------------------------------ */
 public:
   virtual void onNodesAdded  (__attribute__((unused)) const Array<UInt> & nodes_list,
                               __attribute__((unused)) const NewNodesEvent & event) {  }
   virtual void onNodesRemoved(__attribute__((unused)) const Array<UInt> & nodes_list,
                               __attribute__((unused)) const Array<UInt> & new_numbering,
                               __attribute__((unused)) const RemovedNodesEvent & event) {  }
 
   virtual void onElementsAdded  (__attribute__((unused)) const Array<Element> & elements_list,
                                  __attribute__((unused)) const NewElementsEvent & event) { }
   virtual void onElementsRemoved(__attribute__((unused)) const Array<Element> & elements_list,
                                  __attribute__((unused)) const ElementTypeMapArray<UInt> & new_numbering,
                                  __attribute__((unused)) const RemovedElementsEvent & event) { }
 };
 
 /* -------------------------------------------------------------------------- */
 /* Mesh                                                                       */
 /* -------------------------------------------------------------------------- */
 
 /**
  * @class  Mesh this  contain the  coordinates of  the nodes  in  the Mesh.nodes
  * Array,  and the  connectivity. The  connectivity  are stored  in by  element
  * types.
  *
  * To  know  all  the  element  types   present  in  a  mesh  you  can  get  the
  * Mesh::ConnectivityTypeList
  *
  * In order to loop on all element you have to loop on all types like this :
  * @code{.cpp}
  Mesh::type_iterator it = mesh.firstType(dim, ghost_type);
  Mesh::type_iterator end = mesh.lastType(dim, ghost_type);
  for(; it != end; ++it) {
    UInt nb_element  = mesh.getNbElement(*it);
    const Array<UInt> & conn = mesh.getConnectivity(*it);
    for(UInt e = 0; e < nb_element; ++e) {
      ...
    }
  }
  @endcode
 */
 class Mesh : protected Memory,
              public EventHandlerManager<MeshEventHandler>,
              public GroupManager,
 	     public Dumpable {
   /* ------------------------------------------------------------------------ */
   /* Constructors/Destructors                                                 */
   /* ------------------------------------------------------------------------ */
 public:
 
   /// constructor that create nodes coordinates array
   Mesh(UInt spatial_dimension,
        const ID & id = "mesh",
        const MemoryID & memory_id = 0);
 
   /// constructor that use an existing nodes coordinates array, by knowing its ID
   Mesh(UInt spatial_dimension,
        const ID & nodes_id,
        const ID & id,
        const MemoryID & memory_id = 0);
 
   /**
    * constructor that use an existing nodes coordinates
    * array, by getting the vector of coordinates
    */
   Mesh(UInt spatial_dimension,
        Array<Real> & nodes,
        const ID & id = "mesh",
        const MemoryID & memory_id = 0);
 
 
   virtual ~Mesh();
 
   /// @typedef ConnectivityTypeList list of the types present in a Mesh
   typedef std::set<ElementType> ConnectivityTypeList;
 
   /// read the mesh from a file
   void read (const std::string & filename, const MeshIOType & mesh_io_type = _miot_auto);
   /// write the mesh to a file
   void write(const std::string & filename, const MeshIOType & mesh_io_type = _miot_auto);
 
 private:
   /// initialize the connectivity to NULL and other stuff
   void init();
 
   /* ------------------------------------------------------------------------ */
   /* Methods                                                                  */
   /* ------------------------------------------------------------------------ */
 public:
 
   /// function to print the containt of the class
   virtual void printself(std::ostream & stream, int indent = 0) const;
 
   /// function that computes the bounding box (fills xmin, xmax)
   void computeBoundingBox();
 
 #ifdef AKANTU_CORE_CXX11
   /// translate the mesh by the given amount in x[, y[, z]] directions
   template <typename... Args> void translate(Args... params);
 #endif
 
   /// init a by-element-type real vector with provided ids
   template<typename T>
   void initElementTypeMapArray(ElementTypeMapArray<T> & v,
                               UInt nb_component,
                               UInt spatial_dimension,
                               const bool & flag_nb_node_per_elem_multiply = false,
                               ElementKind element_kind = _ek_regular,
                               bool size_to_nb_element = false) const; /// @todo: think about nicer way to do it
   template<typename T>
   void initElementTypeMapArray(ElementTypeMapArray<T> & v,
                               UInt nb_component,
                               UInt spatial_dimension,
                               GhostType ghost_type,
                               const bool & flag_nb_node_per_elem_multiply = false,
                               ElementKind element_kind = _ek_regular,
                               bool size_to_nb_element = false) const; /// @todo: think about nicer way to do it
 
   /// extract coordinates of nodes from an element
   template<typename T>
   inline void extractNodalValuesFromElement(const Array<T> & nodal_values,
                                             T * elemental_values,
                                             UInt * connectivity,
                                             UInt n_nodes,
                                             UInt nb_degree_of_freedom) const;
 
   /// extract coordinates of nodes from a reversed element
   inline void extractNodalCoordinatesFromPBCElement(Real * local_coords,
                                                     UInt * connectivity,
                                                     UInt n_nodes);
 
   /// convert a element to a linearized element
   inline UInt elementToLinearized(const Element & elem) const;
 
   /// convert a linearized element to an element
   inline Element linearizedToElement (UInt linearized_element) const;
 
   /// update the types offsets array for the conversions
   inline void updateTypesOffsets(const GhostType & ghost_type);
 
   /// add a Array of connectivity for the type <type>.
   inline void addConnectivityType(const ElementType & type,
                                   const GhostType & ghost_type = _not_ghost);
 
   /* ------------------------------------------------------------------------ */
   template <class Event>
   inline void sendEvent(Event & event) {
     //    if(event.getList().getSize() != 0)
     EventHandlerManager<MeshEventHandler>::sendEvent<Event>(event);
   }
 
   /* ------------------------------------------------------------------------ */
   template<typename T>
   inline void removeNodesFromArray(Array<T> & vect, const Array<UInt> & new_numbering);
 
   /// initialize normals
   void initNormals();
 
   /// init facets' mesh
   Mesh & initMeshFacets(const ID & id = "mesh_facets");
 
   /// define parent mesh
   void defineMeshParent(const Mesh & mesh);
 
   /// get global connectivity array
   void getGlobalConnectivity(ElementTypeMapArray<UInt> & global_connectivity,
 			     UInt dimension,
 			     GhostType ghost_type);
 
   /* ------------------------------------------------------------------------ */
   /* Accessors                                                                */
   /* ------------------------------------------------------------------------ */
 public:
   /// get the id of the mesh
   AKANTU_GET_MACRO(ID, Memory::id, const ID &);
 
   /// get the spatial dimension of the mesh = number of component of the coordinates
   AKANTU_GET_MACRO(SpatialDimension, spatial_dimension, UInt);
 
   /// get the nodes Array aka coordinates
   AKANTU_GET_MACRO(Nodes, *nodes, const Array<Real> &);
   AKANTU_GET_MACRO_NOT_CONST(Nodes, *nodes, Array<Real> &);
 
   /// get the normals for the elements
   AKANTU_GET_MACRO_BY_ELEMENT_TYPE(Normals, normals, Real);
 
   /// get the number of nodes
   AKANTU_GET_MACRO(NbNodes, nodes->getSize(), UInt);
 
   /// get the Array of global ids of the nodes (only used in parallel)
   AKANTU_GET_MACRO(GlobalNodesIds, *nodes_global_ids, const Array<UInt> &);
 
   /// get the global id of a node
   inline UInt getNodeGlobalId(UInt local_id) const;
 
   /// get the global number of nodes
   inline UInt getNbGlobalNodes() const;
 
   /// get the nodes type Array
   AKANTU_GET_MACRO(NodesType, nodes_type, const Array<Int> &);
 
 protected:
   AKANTU_GET_MACRO_NOT_CONST(NodesType, nodes_type, Array<Int> &);
 public:
   inline Int getNodeType(UInt local_id) const;
 
   /// say if a node is a pure ghost node
   inline bool isPureGhostNode(UInt n) const;
 
   /// say if a node is pur local or master node
   inline bool isLocalOrMasterNode(UInt n) const;
 
   inline bool isLocalNode(UInt n) const;
   inline bool isMasterNode(UInt n) const;
   inline bool isSlaveNode(UInt n) const;
 
   AKANTU_GET_MACRO(LowerBounds, lower_bounds, const Vector<Real> &);
   AKANTU_GET_MACRO(UpperBounds, upper_bounds, const Vector<Real> &);
   AKANTU_GET_MACRO(LocalLowerBounds, local_lower_bounds, const Vector<Real> &);
   AKANTU_GET_MACRO(LocalUpperBounds, local_upper_bounds, const Vector<Real> &);
 
   /// get the connectivity Array for a given type
   AKANTU_GET_MACRO_BY_ELEMENT_TYPE_CONST(Connectivity, connectivities, UInt);
   AKANTU_GET_MACRO_BY_ELEMENT_TYPE(Connectivity, connectivities, UInt);
   AKANTU_GET_MACRO(Connectivities, connectivities, const ElementTypeMapArray<UInt> &);
 
   /// get the number of element of a type in the mesh
   inline UInt getNbElement(const ElementType & type, const GhostType & ghost_type = _not_ghost) const;
 
   /// get the number of element for a given ghost_type and a given dimension
   inline UInt getNbElement(const UInt spatial_dimension = _all_dimensions,
 			   const GhostType & ghost_type = _not_ghost,
 			   const ElementKind & kind = _ek_not_defined) const;
 
   /// get the connectivity list either for the elements or the ghost elements
   inline const ConnectivityTypeList & getConnectivityTypeList(const GhostType & ghost_type = _not_ghost) const;
 
   /// compute the barycenter of a given element
   inline void getBarycenter(UInt element, const ElementType & type, Real * barycenter,
                             GhostType ghost_type = _not_ghost) const;
   inline void getBarycenter(const Element & element, Vector<Real> & barycenter) const;
 
   /// get the element connected to a subelement
   const Array< std::vector<Element> > & getElementToSubelement(const ElementType & el_type,
                                                                const GhostType & ghost_type = _not_ghost) const;
   /// get the element connected to a subelement
   Array< std::vector<Element> > & getElementToSubelement(const ElementType & el_type,
                                                          const GhostType & ghost_type = _not_ghost);
 
   /// get the subelement connected to an element
   const Array<Element> & getSubelementToElement(const ElementType & el_type,
                                                 const GhostType & ghost_type = _not_ghost) const;
   /// get the subelement connected to an element
   Array<Element> & getSubelementToElement(const ElementType & el_type,
                                           const GhostType & ghost_type = _not_ghost);
 
   /// get a name field associated to the mesh
   template<typename T>
   inline const Array<T> & getData(const std::string & data_name,
 				  const ElementType & el_type,
                                   const GhostType & ghost_type = _not_ghost) const;
 
   /// get a name field associated to the mesh
   template<typename T>
   inline Array<T> & getData(const std::string & data_name,
 			    const ElementType & el_type,
                             const GhostType & ghost_type = _not_ghost);
 
   /// get a name field associated to the mesh
   template<typename T>
   inline const ElementTypeMapArray<T> & getData(const std::string & data_name) const;
 
   /// get a name field associated to the mesh
   template<typename T>
   inline ElementTypeMapArray<T> & getData(const std::string & data_name);
 
 
   template <typename T>
   ElementTypeMap<UInt> getNbDataPerElem(ElementTypeMapArray<T> & array,
 					const ElementKind & element_kind);
 
   template <typename T>
   dumper::Field * createFieldFromAttachedData(const std::string & field_id,
 					      const std::string & group_name,
 					      const ElementKind & element_kind);
 
   /// templated getter returning the pointer to data in MeshData (modifiable)
   template<typename T>
   inline Array<T> * getDataPointer(const std::string & data_name,
 				   const ElementType & el_type,
                                    const GhostType & ghost_type = _not_ghost,
                                    UInt nb_component = 1,
 				   bool size_to_nb_element = true,
 				   bool resize_with_parent = false);
 
   /// Facets mesh accessor
   AKANTU_GET_MACRO(MeshFacets, *mesh_facets, const Mesh &);
   AKANTU_GET_MACRO_NOT_CONST(MeshFacets, *mesh_facets, Mesh &);
 
   /// Parent mesh accessor
   AKANTU_GET_MACRO(MeshParent, *mesh_parent, const Mesh &);
 
   inline bool isMeshFacets() const { return this->is_mesh_facets; }
 
   /// defines is the mesh is distributed or not
   inline bool isDistributed() const { return this->is_distributed; }
 
   /// return the dumper from a group and and a dumper name
   DumperIOHelper & getGroupDumper(const std::string & dumper_name, 
 				  const std::string & group_name);
 
   /* ------------------------------------------------------------------------ */
   /* Wrappers on ElementClass functions                                       */
   /* ------------------------------------------------------------------------ */
 public:
   /// get the number of nodes per element for a given element type
   static inline UInt getNbNodesPerElement(const ElementType & type);
 
   /// get the number of nodes per element for a given element type considered as
   /// a first order element
   static inline ElementType getP1ElementType(const ElementType & type);
 
   /// get the kind of the element type
   static inline ElementKind getKind(const ElementType & type);
 
   /// get spatial dimension of a type of element
   static inline UInt getSpatialDimension(const ElementType & type);
 
   /// get number of facets of a given element type
   static inline UInt getNbFacetsPerElement(const ElementType & type);
 
   /// get local connectivity of a facet for a given facet type
   static inline MatrixProxy<UInt> getFacetLocalConnectivity(const ElementType & type);
 
   /// get connectivity of facets for a given element
   inline Matrix<UInt> getFacetConnectivity(UInt element, const ElementType & type, const GhostType & ghost_type) const;
 
   /// get the type of the surface element associated to a given element
   static inline ElementType getFacetType(const ElementType & type);
 
   /* ------------------------------------------------------------------------ */
   /* Element type Iterator                                                    */
   /* ------------------------------------------------------------------------ */
   typedef ElementTypeMapArray<UInt, ElementType>::type_iterator type_iterator;
 
   inline type_iterator firstType(UInt dim = _all_dimensions,
                                  GhostType ghost_type = _not_ghost,
                                  ElementKind kind = _ek_regular) const {
     return connectivities.firstType(dim, ghost_type, kind);
   }
 
   inline type_iterator lastType(UInt dim = _all_dimensions,
                                 GhostType ghost_type = _not_ghost,
                                 ElementKind kind = _ek_regular) const {
     return connectivities.lastType(dim, ghost_type, kind);
   }
 
   /* ------------------------------------------------------------------------ */
   /* Private methods for friends                                              */
   /* ------------------------------------------------------------------------ */
 private:
   friend class MeshIOMSH;
   friend class MeshIOMSHStruct;
   friend class MeshIODiana;
   friend class MeshUtils;
   friend class DistributedSynchronizer;
   template<class T> friend class SpatialGrid;
 
 #if defined(AKANTU_COHESIVE_ELEMENT)
   friend class CohesiveElementInserter;
 #endif
 
   AKANTU_GET_MACRO(NodesPointer, nodes, Array<Real> *);
 
   /// get a pointer to the nodes_global_ids Array<UInt> and create it if necessary
   inline Array<UInt> * getNodesGlobalIdsPointer();
 
   /// get a pointer to the nodes_type Array<Int> and create it if necessary
   inline Array<Int> * getNodesTypePointer();
 
   /// get a pointer to the connectivity Array for the given type and create it if necessary
   inline Array<UInt> * getConnectivityPointer(const ElementType & type,
                                               const GhostType & ghost_type = _not_ghost);
 
 
 
   /// get a pointer to the element_to_subelement Array for the given type and create it if necessary
   inline Array< std::vector<Element> > * getElementToSubelementPointer(const ElementType & type,
                                                                        const GhostType & ghost_type = _not_ghost);
 
   /// get a pointer to the subelement_to_element Array for the given type and create it if necessary
   inline Array<Element > * getSubelementToElementPointer(const ElementType & type,
                                                          const GhostType & ghost_type = _not_ghost);
 
   AKANTU_GET_MACRO_NOT_CONST(MeshData, mesh_data, MeshData &);
 
   /* ------------------------------------------------------------------------ */
   /* Class Members                                                            */
   /* ------------------------------------------------------------------------ */
 private:
   /// array of the nodes coordinates
   Array<Real> * nodes;
 
   /// global node ids
   Array<UInt> * nodes_global_ids;
 
   /// node type,  -3 pure ghost, -2  master for the  node, -1 normal node,  i in
   /// [0-N] slave node and master is proc i
   Array<Int> nodes_type;
 
   /// global number of nodes;
   UInt nb_global_nodes;
 
   /// boolean to know if the nodes have to be deleted with the mesh or not
   bool created_nodes;
 
   /// all class of elements present in this mesh (for heterogenous meshes)
   ElementTypeMapArray<UInt> connectivities;
 
   /// map to normals for all class of elements present in this mesh
   ElementTypeMapArray<Real> normals;
 
   /// list of all existing types in the mesh
   ConnectivityTypeList type_set;
 
   /// the spatial dimension of this mesh
   UInt spatial_dimension;
 
   /// types offsets
   Array<UInt> types_offsets;
 
   /// list of all existing types in the mesh
   ConnectivityTypeList ghost_type_set;
   /// ghost types offsets
   Array<UInt> ghost_types_offsets;
 
   /// min of coordinates
   Vector<Real> lower_bounds;
   /// max of coordinates
   Vector<Real> upper_bounds;
   /// size covered by the mesh on each direction
   Vector<Real> size;
 
   /// local min of coordinates
   Vector<Real> local_lower_bounds;
   /// local max of coordinates
   Vector<Real> local_upper_bounds;
 
   /// Extra data loaded from the mesh file
   MeshData mesh_data;
 
   /// facets' mesh
   Mesh * mesh_facets;
 
   /// parent mesh (this is set for mesh_facets meshes)
   const Mesh * mesh_parent;
 
   /// defines if current mesh is mesh_facets or not
   bool is_mesh_facets;
 
   /// defines if the mesh is centralized or distributed
   bool is_distributed;
 };
 
 
 /// standard output stream operator
 inline std::ostream & operator <<(std::ostream & stream, const Element & _this)
 {
   _this.printself(stream);
   return stream;
 }
 
 
 /// standard output stream operator
 inline std::ostream & operator <<(std::ostream & stream, const Mesh & _this)
 {
   _this.printself(stream);
   return stream;
 }
 
 __END_AKANTU__
 
 
 /* -------------------------------------------------------------------------- */
 /* Inline functions                                                           */
 /* -------------------------------------------------------------------------- */
 
 #include "mesh_inline_impl.cc"
 #include "element_type_map_tmpl.hh"
-#include "group_manager_inline_impl.cc"
-#include "element_group_inline_impl.cc"
+//#include "group_manager_inline_impl.cc"
+//#include "element_group_inline_impl.cc"
 
 #endif /* __AKANTU_MESH_HH__ */
diff --git a/src/model/heat_transfer/heat_transfer_model.cc b/src/model/heat_transfer/heat_transfer_model.cc
index cd742e612..93c8945b8 100644
--- a/src/model/heat_transfer/heat_transfer_model.cc
+++ b/src/model/heat_transfer/heat_transfer_model.cc
@@ -1,950 +1,952 @@
 /**
  * @file   heat_transfer_model.cc
  *
  * @author Rui Wang <rui.wang@epfl.ch>
  * @author Srinivasa Babu Ramisetti <srinivasa.ramisetti@epfl.ch>
  * @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
  * @author Nicolas Richart <nicolas.richart@epfl.ch>
  * @author David Simon Kammer <david.kammer@epfl.ch>
  * @author Lucas Frerot <lucas.frerot@epfl.ch>
  *
  * @date   Sun May 01 19:14:43 2011
  *
  * @brief  Implementation of HeatTransferModel class
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 #include "aka_common.hh"
 #include "heat_transfer_model.hh"
+#include "group_manager_inline_impl.cc"
+#include "dumpable_inline_impl.hh"
 #include "aka_math.hh"
 #include "aka_common.hh"
 #include "fe_engine_template.hh"
 #include "mesh.hh"
 #include "static_communicator.hh"
 #include "parser.hh"
 #include "generalized_trapezoidal.hh"
 
 #ifdef AKANTU_USE_MUMPS
 #include "solver_mumps.hh"
 #endif
 
 #ifdef AKANTU_USE_IOHELPER
 #  include "dumper_paraview.hh"
 #  include "dumper_elemental_field.hh"
 #  include "dumper_element_partition.hh"
 #  include "dumper_material_internal_field.hh"
 #endif
 
 /* -------------------------------------------------------------------------- */
 __BEGIN_AKANTU__
 
 const HeatTransferModelOptions default_heat_transfer_model_options(_explicit_lumped_capacity);
 
 /* -------------------------------------------------------------------------- */
 HeatTransferModel::HeatTransferModel(Mesh & mesh,
 				     UInt dim,
 				     const ID & id,
 				     const MemoryID & memory_id) :
   Model(mesh, dim, id, memory_id), Parsable(_st_heat, id),
   integrator(new ForwardEuler()),
   stiffness_matrix(NULL),
   jacobian_matrix(NULL),
   temperature_gradient    ("temperature_gradient", id),
   temperature_on_qpoints  ("temperature_on_qpoints", id),
   conductivity_on_qpoints ("conductivity_on_qpoints", id),
   k_gradt_on_qpoints      ("k_gradt_on_qpoints", id),
   int_bt_k_gT             ("int_bt_k_gT", id),
   bt_k_gT                 ("bt_k_gT", id),
   conductivity(spatial_dimension, spatial_dimension),
   thermal_energy          ("thermal_energy", id) {
   AKANTU_DEBUG_IN();
 
   createSynchronizerRegistry(this);
 
   std::stringstream sstr; sstr << id << ":fem";
   registerFEEngineObject<MyFEEngineType>(sstr.str(), mesh,spatial_dimension);
 
   this->temperature= NULL;
   this->residual = NULL;
   this->blocked_dofs = NULL;
 
 #ifdef AKANTU_USE_IOHELPER
   this->mesh.registerDumper<DumperParaview>("paraview_all", id, true);
   this->mesh.addDumpMesh(mesh, spatial_dimension, _not_ghost, _ek_regular);
 #endif
 
   this->registerParam("conductivity"          , conductivity              , _pat_parsmod);
   this->registerParam("conductivity_variation", conductivity_variation, 0., _pat_parsmod);
   this->registerParam("temperature_reference" , T_ref                 , 0., _pat_parsmod);
   this->registerParam("capacity"              , capacity                  , _pat_parsmod);
   this->registerParam("density"               , density                   , _pat_parsmod);
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::initModel() {
   getFEEngine().initShapeFunctions(_not_ghost);
   getFEEngine().initShapeFunctions(_ghost);
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::initParallel(MeshPartition * partition,
 				     DataAccessor * data_accessor) {
   AKANTU_DEBUG_IN();
 
   if (data_accessor == NULL) data_accessor = this;
   Synchronizer & synch_parallel = createParallelSynch(partition,data_accessor);
 
   synch_registry->registerSynchronizer(synch_parallel, _gst_htm_capacity);
   synch_registry->registerSynchronizer(synch_parallel, _gst_htm_temperature);
   synch_registry->registerSynchronizer(synch_parallel, _gst_htm_gradient_temperature);
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::initPBC() {
   AKANTU_DEBUG_IN();
 
   Model::initPBC();
   PBCSynchronizer * synch = new PBCSynchronizer(pbc_pair);
 
   synch_registry->registerSynchronizer(*synch, _gst_htm_capacity);
   synch_registry->registerSynchronizer(*synch, _gst_htm_temperature);
   changeLocalEquationNumberForPBC(pbc_pair,1);
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::initArrays() {
   AKANTU_DEBUG_IN();
 
   UInt nb_nodes = getFEEngine().getMesh().getNbNodes();
 
   std::stringstream sstr_temp;      sstr_temp      << Model::id << ":temperature";
   std::stringstream sstr_temp_rate; sstr_temp_rate << Model::id << ":temperature_rate";
   std::stringstream sstr_inc;       sstr_inc       << Model::id << ":increment";
   std::stringstream sstr_ext_flx;   sstr_ext_flx   << Model::id << ":external_flux";
   std::stringstream sstr_residual;  sstr_residual  << Model::id << ":residual";
   std::stringstream sstr_lump;      sstr_lump      << Model::id << ":lumped";
   std::stringstream sstr_boun;      sstr_boun      << Model::id << ":blocked_dofs";
 
   temperature        = &(alloc<Real>(sstr_temp.str(),      nb_nodes, 1, REAL_INIT_VALUE));
   temperature_rate   = &(alloc<Real>(sstr_temp_rate.str(), nb_nodes, 1, REAL_INIT_VALUE));
   increment          = &(alloc<Real>(sstr_inc.str(),       nb_nodes, 1, REAL_INIT_VALUE));
   external_heat_rate = &(alloc<Real>(sstr_ext_flx.str(),   nb_nodes, 1, REAL_INIT_VALUE));
   residual           = &(alloc<Real>(sstr_residual.str(),  nb_nodes, 1, REAL_INIT_VALUE));
   capacity_lumped    = &(alloc<Real>(sstr_lump.str(),      nb_nodes, 1, REAL_INIT_VALUE));
   blocked_dofs           = &(alloc<bool>(sstr_boun.str(),      nb_nodes, 1, false));
 
   Mesh::ConnectivityTypeList::const_iterator it;
 
   /* -------------------------------------------------------------------------- */
   // byelementtype vectors
   getFEEngine().getMesh().initElementTypeMapArray(temperature_on_qpoints,
 					     1,
 					     spatial_dimension);
 
   getFEEngine().getMesh().initElementTypeMapArray(temperature_gradient,
 					     spatial_dimension,
 					     spatial_dimension);
 
   getFEEngine().getMesh().initElementTypeMapArray(conductivity_on_qpoints,
 					     spatial_dimension*spatial_dimension,
 					     spatial_dimension);
 
   getFEEngine().getMesh().initElementTypeMapArray(k_gradt_on_qpoints,
 					     spatial_dimension,
 					     spatial_dimension);
 
   getFEEngine().getMesh().initElementTypeMapArray(bt_k_gT,
 					     1,
 					     spatial_dimension,true);
 
   getFEEngine().getMesh().initElementTypeMapArray(int_bt_k_gT,
 					     1,
 					     spatial_dimension,true);
 
   getFEEngine().getMesh().initElementTypeMapArray(thermal_energy,
 					     1,
 					     spatial_dimension);
 
 
   for(UInt g = _not_ghost; g <= _ghost; ++g) {
     GhostType gt = (GhostType) g;
 
     const Mesh::ConnectivityTypeList & type_list =
       getFEEngine().getMesh().getConnectivityTypeList(gt);
 
     for(it = type_list.begin(); it != type_list.end(); ++it) {
       if(Mesh::getSpatialDimension(*it) != spatial_dimension) continue;
       UInt nb_element = getFEEngine().getMesh().getNbElement(*it, gt);
       UInt nb_quad_points = this->getFEEngine().getNbQuadraturePoints(*it, gt) * nb_element;
 
       temperature_on_qpoints(*it, gt).resize(nb_quad_points);
       temperature_on_qpoints(*it, gt).clear();
 
       temperature_gradient(*it, gt).resize(nb_quad_points);
       temperature_gradient(*it, gt).clear();
 
       conductivity_on_qpoints(*it, gt).resize(nb_quad_points);
       conductivity_on_qpoints(*it, gt).clear();
 
       k_gradt_on_qpoints(*it, gt).resize(nb_quad_points);
       k_gradt_on_qpoints(*it, gt).clear();
 
       bt_k_gT(*it, gt).resize(nb_quad_points);
       bt_k_gT(*it, gt).clear();
 
       int_bt_k_gT(*it, gt).resize(nb_element);
       int_bt_k_gT(*it, gt).clear();
 
       thermal_energy(*it, gt).resize(nb_element);
       thermal_energy(*it, gt).clear();
     }
   }
 
   /* -------------------------------------------------------------------------- */
   dof_synchronizer = new DOFSynchronizer(getFEEngine().getMesh(),1);
   dof_synchronizer->initLocalDOFEquationNumbers();
   dof_synchronizer->initGlobalDOFEquationNumbers();
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::initSolver(__attribute__((unused)) SolverOptions & options) {
 #if !defined(AKANTU_USE_MUMPS) // or other solver in the future \todo add AKANTU_HAS_SOLVER in CMake
   AKANTU_DEBUG_ERROR("You should at least activate one solver.");
 #else
   UInt nb_global_nodes = mesh.getNbGlobalNodes();
 
   delete jacobian_matrix;
   std::stringstream sstr; sstr << Memory::id << ":jacobian_matrix";
   jacobian_matrix = new SparseMatrix(nb_global_nodes, _symmetric,
                                      1, sstr.str(), memory_id);
 
   jacobian_matrix->buildProfile(mesh, *dof_synchronizer);
 
   delete stiffness_matrix;
   std::stringstream sstr_sti; sstr_sti << Memory::id << ":stiffness_matrix";
   stiffness_matrix = new SparseMatrix(*jacobian_matrix, sstr_sti.str(), memory_id);
 
 #ifdef AKANTU_USE_MUMPS
   std::stringstream sstr_solv; sstr_solv << Memory::id << ":solver";
   solver = new SolverMumps(*jacobian_matrix, sstr_solv.str());
 
   dof_synchronizer->initScatterGatherCommunicationScheme();
 #else
   AKANTU_DEBUG_ERROR("You should at least activate one solver.");
 #endif //AKANTU_USE_MUMPS
 
   if(solver)
     solver->initialize(options);
 #endif //AKANTU_HAS_SOLVER
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::initImplicit(SolverOptions & solver_options) {
   method = _static;
   initSolver(solver_options);
 }
 
 /* -------------------------------------------------------------------------- */
 
 HeatTransferModel::~HeatTransferModel()
 {
   AKANTU_DEBUG_IN();
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::assembleCapacityLumped(const GhostType & ghost_type) {
   AKANTU_DEBUG_IN();
 
   FEEngine & fem = getFEEngine();
 
   const Mesh::ConnectivityTypeList & type_list
     = fem.getMesh().getConnectivityTypeList(ghost_type);
 
   Mesh::ConnectivityTypeList::const_iterator it;
   for(it = type_list.begin(); it != type_list.end(); ++it)
   {
     if(Mesh::getSpatialDimension(*it) != spatial_dimension) continue;
 
     UInt nb_element = getFEEngine().getMesh().getNbElement(*it,ghost_type);
     UInt nb_quadrature_points = getFEEngine().getNbQuadraturePoints(*it, ghost_type);
 
     Array<Real> rho_1 (nb_element * nb_quadrature_points,1, capacity * density);
     fem.assembleFieldLumped(rho_1,1,*capacity_lumped,
 			    dof_synchronizer->getLocalDOFEquationNumbers(),
 			    *it, ghost_type);
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::assembleCapacityLumped() {
   AKANTU_DEBUG_IN();
 
   capacity_lumped->clear();
 
   assembleCapacityLumped(_not_ghost);
   assembleCapacityLumped(_ghost);
 
   getSynchronizerRegistry().synchronize(_gst_htm_capacity);
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::updateResidual() {
   AKANTU_DEBUG_IN();
   /// @f$ r = q_{ext} - q_{int} - C \dot T @f$
 
   // start synchronization
   synch_registry->asynchronousSynchronize(_gst_htm_temperature);
   // finalize communications
   synch_registry->waitEndSynchronize(_gst_htm_temperature);
 
   //clear the array
   /// first @f$ r = q_{ext} @f$
   //  residual->clear();
   residual->copy(*external_heat_rate);
 
   /// then @f$ r -= q_{int} @f$
   // update the not ghost ones
 
   updateResidual(_not_ghost);
   // update for the received ghosts
   updateResidual(_ghost);
 
 /*  if (method == _explicit_lumped_capacity) {
     this->solveExplicitLumped();
   }*/
 
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::assembleStiffnessMatrix() {
   AKANTU_DEBUG_IN();
 
   AKANTU_DEBUG_INFO("Assemble the new stiffness matrix.");
 
   stiffness_matrix->clear();
 
   switch(mesh.getSpatialDimension()) {
     case 1: this->assembleStiffnessMatrix<1>(_not_ghost); break;
     case 2: this->assembleStiffnessMatrix<2>(_not_ghost); break;
     case 3: this->assembleStiffnessMatrix<3>(_not_ghost); break;
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 template <UInt dim>
 void HeatTransferModel::assembleStiffnessMatrix(const GhostType & ghost_type) {
   AKANTU_DEBUG_IN();
 
   Mesh & mesh = this->getFEEngine().getMesh();
   Mesh::type_iterator it = mesh.firstType(spatial_dimension, ghost_type);
   Mesh::type_iterator last_type = mesh.lastType(spatial_dimension, ghost_type);
   for(; it != last_type; ++it) {
     this->assembleStiffnessMatrix<dim>(*it, ghost_type);
   }
 
   AKANTU_DEBUG_OUT();
 }
   
 /* -------------------------------------------------------------------------- */
 template <UInt dim>
 void HeatTransferModel::assembleStiffnessMatrix(const ElementType & type, const GhostType & ghost_type) {
   AKANTU_DEBUG_IN();
 
   SparseMatrix & K = *stiffness_matrix;
   const Array<Real> & shapes_derivatives = this->getFEEngine().getShapesDerivatives(type, ghost_type);
 
   UInt nb_element                 = mesh.getNbElement(type, ghost_type);
   UInt nb_nodes_per_element       = Mesh::getNbNodesPerElement(type);
   UInt nb_quadrature_points       = getFEEngine().getNbQuadraturePoints(type, ghost_type);
 
   /// compute @f$\mathbf{B}^t * \mathbf{D} * \mathbf{B}@f$
   UInt bt_d_b_size = nb_nodes_per_element;
 
   Array<Real> * bt_d_b = new Array<Real>(nb_element * nb_quadrature_points,
 					                               bt_d_b_size * bt_d_b_size,
 					                               "B^t*D*B");
 
   Matrix<Real> Bt_D(nb_nodes_per_element, dim);
 
   Array<Real>::const_iterator< Matrix<Real> > shapes_derivatives_it = shapes_derivatives.begin(dim, nb_nodes_per_element);
 
   Array<Real>::iterator< Matrix<Real> > Bt_D_B_it = bt_d_b->begin(bt_d_b_size, bt_d_b_size);
 
   this->computeConductivityOnQuadPoints(ghost_type);
   Array<Real>::iterator< Matrix<Real> > D_it = conductivity_on_qpoints(type, ghost_type).begin(dim, dim);
   Array<Real>::iterator< Matrix<Real> > D_end = conductivity_on_qpoints(type, ghost_type).end(dim, dim);
 
   for (; D_it != D_end; ++D_it, ++Bt_D_B_it, ++shapes_derivatives_it) {
     Matrix<Real> & D = *D_it;
     const Matrix<Real> & B = *shapes_derivatives_it;
     Matrix<Real> & Bt_D_B = *Bt_D_B_it;
 
     Bt_D.mul<true, false>(B, D);
     Bt_D_B.mul<false, false>(Bt_D, B);
   }
 
   /// compute @f$ k_e = \int_e \mathbf{B}^t * \mathbf{D} * \mathbf{B}@f$
   Array<Real> * K_e = new Array<Real>(nb_element,
 				      bt_d_b_size * bt_d_b_size,
 				      "K_e");
 
   this->getFEEngine().integrate(*bt_d_b, *K_e,
                             bt_d_b_size * bt_d_b_size,
                             type, ghost_type);
 
   delete bt_d_b;
 
   this->getFEEngine().assembleMatrix(*K_e, K, 1, type, ghost_type);
   delete K_e;
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::solveStatic() {
   AKANTU_DEBUG_IN();
 
   AKANTU_DEBUG_INFO("Solving Ku = f");
   AKANTU_DEBUG_ASSERT(stiffness_matrix != NULL,
                       "You should first initialize the implicit solver and assemble the stiffness matrix");
 
   UInt nb_nodes = temperature->getSize();
   UInt nb_degree_of_freedom = temperature->getNbComponent() * nb_nodes;
 
   jacobian_matrix->copyContent(*stiffness_matrix);
   jacobian_matrix->applyBoundary(*blocked_dofs);
 
   increment->clear();
 
   solver->setRHS(*residual);
   solver->factorize();
   solver->solve(*increment);
 
   Real * increment_val = increment->storage();
   Real * temperature_val = temperature->storage();
   bool * blocked_dofs_val = blocked_dofs->storage();
 
   for (UInt j = 0; j < nb_degree_of_freedom;
        ++j, ++temperature_val, ++increment_val, ++blocked_dofs_val) {
     if (!(*blocked_dofs_val)) {
       *temperature_val += *increment_val;
     }
     else {
       *increment_val = 0.0;
     }
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::computeConductivityOnQuadPoints(const GhostType & ghost_type) {
   const Mesh::ConnectivityTypeList & type_list =
     this->getFEEngine().getMesh().getConnectivityTypeList(ghost_type);
   Mesh::ConnectivityTypeList::const_iterator it;
 
   for(it = type_list.begin(); it != type_list.end(); ++it) {
     if(Mesh::getSpatialDimension(*it) != spatial_dimension) continue;
 
     Array<Real> & temperature_interpolated = temperature_on_qpoints(*it, ghost_type);
 
     //compute the temperature on quadrature points
     this->getFEEngine().interpolateOnQuadraturePoints(*temperature,
 						 temperature_interpolated,
 						 1 ,*it,ghost_type);
 
     Array<Real>::matrix_iterator C_it =
       conductivity_on_qpoints(*it, ghost_type).begin(spatial_dimension, spatial_dimension);
     Array<Real>::matrix_iterator C_end =
       conductivity_on_qpoints(*it, ghost_type).end(spatial_dimension, spatial_dimension);
 
     Array<Real>::iterator<Real>  T_it = temperature_interpolated.begin();
 
     for (;C_it != C_end; ++C_it, ++T_it) {
       Matrix<Real> & C = *C_it;
       Real & T = *T_it;
       C = conductivity;
 
       Matrix<Real> variation(spatial_dimension, spatial_dimension, conductivity_variation * (T - T_ref));
       C += conductivity_variation;
     }
   }
   AKANTU_DEBUG_OUT();
 }
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::computeKgradT(const GhostType & ghost_type) {
 
   computeConductivityOnQuadPoints(ghost_type);
 
   const Mesh::ConnectivityTypeList & type_list =
     this->getFEEngine().getMesh().getConnectivityTypeList(ghost_type);
   Mesh::ConnectivityTypeList::const_iterator it;
 
   for(it = type_list.begin(); it != type_list.end(); ++it) {
     const ElementType & type = *it;
     if(Mesh::getSpatialDimension(*it) != spatial_dimension) continue;
 
     Array<Real> & gradient = temperature_gradient(*it, ghost_type);
     this->getFEEngine().gradientOnQuadraturePoints(*temperature,
 					      gradient,
 					      1 ,*it, ghost_type);
 
     Array<Real>::matrix_iterator C_it =
       conductivity_on_qpoints(*it, ghost_type).begin(spatial_dimension, spatial_dimension);
 
     Array<Real>::vector_iterator BT_it = gradient.begin(spatial_dimension);
 
     Array<Real>::vector_iterator k_BT_it =
       k_gradt_on_qpoints(type, ghost_type).begin(spatial_dimension);
     Array<Real>::vector_iterator k_BT_end =
       k_gradt_on_qpoints(type, ghost_type).end(spatial_dimension);
 
     for (;k_BT_it != k_BT_end; ++k_BT_it, ++BT_it, ++C_it) {
       Vector<Real> & k_BT = *k_BT_it;
       Vector<Real> & BT = *BT_it;
       Matrix<Real> & C = *C_it;
 
       k_BT.mul<false>(C, BT);
     }
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::updateResidual(const GhostType & ghost_type) {
   AKANTU_DEBUG_IN();
 
   const Mesh::ConnectivityTypeList & type_list =
     this->getFEEngine().getMesh().getConnectivityTypeList(ghost_type);
   Mesh::ConnectivityTypeList::const_iterator it;
 
   for(it = type_list.begin(); it != type_list.end(); ++it) {
     if(Mesh::getSpatialDimension(*it) != spatial_dimension) continue;
 
     Array<Real> & shapes_derivatives =
       const_cast<Array<Real> &>(getFEEngine().getShapesDerivatives(*it,ghost_type));
 
     UInt nb_nodes_per_element = Mesh::getNbNodesPerElement(*it);
 
     // compute k \grad T
     computeKgradT(ghost_type);
 
     Array<Real>::vector_iterator k_BT_it =
       k_gradt_on_qpoints(*it,ghost_type).begin(spatial_dimension);
 
     Array<Real>::matrix_iterator B_it =
       shapes_derivatives.begin(spatial_dimension, nb_nodes_per_element);
 
     Array<Real>::vector_iterator Bt_k_BT_it =
       bt_k_gT(*it,ghost_type).begin(nb_nodes_per_element);
 
     Array<Real>::vector_iterator Bt_k_BT_end =
       bt_k_gT(*it,ghost_type).end(nb_nodes_per_element);
 
 
     for (;Bt_k_BT_it != Bt_k_BT_end; ++Bt_k_BT_it, ++B_it, ++k_BT_it) {
       Vector<Real> & k_BT = *k_BT_it;
       Vector<Real> & Bt_k_BT = *Bt_k_BT_it;
       Matrix<Real> & B = *B_it;
 
       Bt_k_BT.mul<true>(B, k_BT);
     }
 
     this->getFEEngine().integrate(bt_k_gT(*it,ghost_type),
 			     int_bt_k_gT(*it,ghost_type),
 			     nb_nodes_per_element, *it,ghost_type);
 
     this->getFEEngine().assembleArray(int_bt_k_gT(*it,ghost_type), *residual,
 				  dof_synchronizer->getLocalDOFEquationNumbers(),
 				 1, *it,ghost_type, empty_filter, -1);
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::solveExplicitLumped() {
   AKANTU_DEBUG_IN();
   
   /// finally @f$ r -= C \dot T @f$
   // lumped C
   UInt nb_nodes            = temperature_rate->getSize();
   UInt nb_degree_of_freedom = temperature_rate->getNbComponent();
 
   Real * capacity_val  = capacity_lumped->storage();
   Real * temp_rate_val = temperature_rate->storage();
   Real * res_val       = residual->storage();
   bool * blocked_dofs_val  = blocked_dofs->storage();
 
   for (UInt n = 0; n < nb_nodes * nb_degree_of_freedom; ++n) {
     if(!(*blocked_dofs_val)) {
       *res_val -= *capacity_val * *temp_rate_val;
     }
     blocked_dofs_val++;
     res_val++;
     capacity_val++;
     temp_rate_val++;
   }
 
 #ifndef AKANTU_NDEBUG
   getSynchronizerRegistry().synchronize(akantu::_gst_htm_gradient_temperature);
 #endif
 
   capacity_val      = capacity_lumped->storage();
   res_val           = residual->storage();
   blocked_dofs_val      = blocked_dofs->storage();
   Real * inc           = increment->storage();
 
   for (UInt n = 0; n < nb_nodes * nb_degree_of_freedom; ++n) {
     if(!(*blocked_dofs_val)) {
       *inc = (*res_val / *capacity_val);
     }
     res_val++;
     blocked_dofs_val++;
     inc++;
     capacity_val++;
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::explicitPred() {
   AKANTU_DEBUG_IN();
 
   integrator->integrationSchemePred(time_step,
 				    *temperature,
 				    *temperature_rate,
 				    *blocked_dofs);
 
   UInt nb_nodes = temperature->getSize();
   UInt nb_degree_of_freedom = temperature->getNbComponent();
 
   Real * temp = temperature->storage();
   for (UInt n = 0; n < nb_nodes * nb_degree_of_freedom; ++n, ++temp)
     if(*temp < 0.) *temp = 0.;
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::explicitCorr() {
   AKANTU_DEBUG_IN();
 
   integrator->integrationSchemeCorrTempRate(time_step,
 					    *temperature,
 					    *temperature_rate,
 					    *blocked_dofs,
 					    *increment);
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 Real HeatTransferModel::getStableTimeStep()
 {
   AKANTU_DEBUG_IN();
 
   Real el_size;
   Real min_el_size = std::numeric_limits<Real>::max();
   Real conductivitymax = conductivity(0, 0);
 
   //get the biggest parameter from k11 until k33//
   for(UInt i = 0; i < spatial_dimension; i++)
     for(UInt j = 0; j < spatial_dimension; j++)
       conductivitymax = std::max(conductivity(i, j), conductivitymax);
 
 
   const Mesh::ConnectivityTypeList & type_list =
     getFEEngine().getMesh().getConnectivityTypeList();
   Mesh::ConnectivityTypeList::const_iterator it;
   for(it = type_list.begin(); it != type_list.end(); ++it) {
     if(getFEEngine().getMesh().getSpatialDimension(*it) != spatial_dimension)
       continue;
 
     UInt nb_nodes_per_element = getFEEngine().getMesh().getNbNodesPerElement(*it);
 
     Array<Real> coord(0, nb_nodes_per_element*spatial_dimension);
     FEEngine::extractNodalToElementField(getFEEngine().getMesh(), getFEEngine().getMesh().getNodes(),
 				    coord, *it, _not_ghost);
 
     Array<Real>::matrix_iterator el_coord = coord.begin(spatial_dimension, nb_nodes_per_element);
     UInt nb_element           = getFEEngine().getMesh().getNbElement(*it);
 
     for (UInt el = 0; el < nb_element; ++el, ++el_coord) {
 	el_size    = getFEEngine().getElementInradius(*el_coord, *it);
 	min_el_size = std::min(min_el_size, el_size);
     }
 
     AKANTU_DEBUG_INFO("The minimum element size : " << min_el_size
 		      << " and the max conductivity is : "
 		      << conductivitymax);
   }
 
   Real min_dt = 2 * min_el_size * min_el_size * density
     * capacity / conductivitymax;
 
   StaticCommunicator::getStaticCommunicator().allReduce(&min_dt, 1, _so_min);
 
   AKANTU_DEBUG_OUT();
 
   return min_dt;
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::readMaterials() {
   std::pair<Parser::const_section_iterator, Parser::const_section_iterator>
     sub_sect = this->parser->getSubSections(_st_heat);
 
   Parser::const_section_iterator it = sub_sect.first;
   const ParserSection & section = *it;
 
   this->parseSection(section);
 }
 
 /* -------------------------------------------------------------------------- */
 
 void HeatTransferModel::initFull(const ModelOptions & options){
   Model::initFull(options);
 
   readMaterials();
 
   const HeatTransferModelOptions & my_options = dynamic_cast<const HeatTransferModelOptions &>(options);
 
   //initialize the vectors
   initArrays();
   temperature->clear();
   temperature_rate->clear();
   external_heat_rate->clear();
 
   method = my_options.analysis_method;
 
   if (method == _static) {
     initImplicit();
   }
 }
 
 /* -------------------------------------------------------------------------- */
 void HeatTransferModel::initFEEngineBoundary(bool create_surface) {
 
   if(create_surface)
     MeshUtils::buildFacets(getFEEngine().getMesh());
 
   FEEngine & fem_boundary = getFEEngineBoundary();
   fem_boundary.initShapeFunctions();
   fem_boundary.computeNormalsOnControlPoints();
 }
 
 /* -------------------------------------------------------------------------- */
 Real HeatTransferModel::computeThermalEnergyByNode() {
   AKANTU_DEBUG_IN();
 
   Real ethermal = 0.;
 
   Array<Real>::vector_iterator heat_rate_it =
     residual->begin(residual->getNbComponent());
 
   Array<Real>::vector_iterator heat_rate_end =
     residual->end(residual->getNbComponent());
 
 
   UInt n = 0;
   for(;heat_rate_it != heat_rate_end; ++heat_rate_it, ++n) {
     Real heat = 0;
     bool is_local_node = mesh.isLocalOrMasterNode(n);
     bool is_not_pbc_slave_node = !isPBCSlaveNode(n);
     bool count_node = is_local_node && is_not_pbc_slave_node;
 
     Vector<Real> & heat_rate = *heat_rate_it;
     for (UInt i = 0; i < heat_rate.size(); ++i) {
       if (count_node)
 	heat += heat_rate[i] * time_step;
     }
     ethermal += heat;
   }
 
   StaticCommunicator::getStaticCommunicator().allReduce(&ethermal, 1, _so_sum);
 
   AKANTU_DEBUG_OUT();
   return ethermal;
 }
 
 /* -------------------------------------------------------------------------- */
 template<class iterator>
 void HeatTransferModel::getThermalEnergy(iterator Eth,
 					 Array<Real>::const_iterator<Real> T_it,
 					 Array<Real>::const_iterator<Real> T_end) const {
   for(;T_it != T_end; ++T_it, ++Eth) {
     *Eth = capacity * density * *T_it;
   }
 }
 
 /* -------------------------------------------------------------------------- */
 Real HeatTransferModel::getThermalEnergy(const ElementType & type, UInt index) {
   AKANTU_DEBUG_IN();
 
   UInt nb_quadrature_points = getFEEngine().getNbQuadraturePoints(type);
   Vector<Real> Eth_on_quarature_points(nb_quadrature_points);
 
   Array<Real>::iterator<Real> T_it  = this->temperature_on_qpoints(type).begin();
   T_it  += index * nb_quadrature_points;
 
   Array<Real>::iterator<Real> T_end = T_it + nb_quadrature_points;
 
   getThermalEnergy(Eth_on_quarature_points.storage(), T_it, T_end);
 
   return getFEEngine().integrate(Eth_on_quarature_points, type, index);
 }
 
 /* -------------------------------------------------------------------------- */
 Real HeatTransferModel::getThermalEnergy() {
   Real Eth = 0;
 
   Mesh & mesh = getFEEngine().getMesh();
   Mesh::type_iterator it = mesh.firstType(spatial_dimension);
   Mesh::type_iterator last_type = mesh.lastType(spatial_dimension);
   for(; it != last_type; ++it) {
     UInt nb_element = getFEEngine().getMesh().getNbElement(*it, _not_ghost);
     UInt nb_quadrature_points = getFEEngine().getNbQuadraturePoints(*it, _not_ghost);
     Array<Real> Eth_per_quad(nb_element * nb_quadrature_points, 1);
 
     Array<Real>::iterator<Real> T_it  = this->temperature_on_qpoints(*it).begin();
     Array<Real>::iterator<Real> T_end = this->temperature_on_qpoints(*it).end();
     getThermalEnergy(Eth_per_quad.begin(), T_it, T_end);
 
     Eth += getFEEngine().integrate(Eth_per_quad, *it);
   }
 
   return Eth;
 }
 
 /* -------------------------------------------------------------------------- */
 Real HeatTransferModel::getEnergy(const std::string & id) {
   AKANTU_DEBUG_IN();
   Real energy = 0;
 
   if("thermal") energy = getThermalEnergy();
 
   // reduction sum over all processors
   StaticCommunicator::getStaticCommunicator().allReduce(&energy, 1, _so_sum);
 
   AKANTU_DEBUG_OUT();
   return energy;
 }
 
 /* -------------------------------------------------------------------------- */
 Real HeatTransferModel::getEnergy(const std::string & energy_id, const ElementType & type, UInt index) {
   AKANTU_DEBUG_IN();
 
   Real energy = 0.;
 
   if("thermal") energy = getThermalEnergy(type, index);
 
   AKANTU_DEBUG_OUT();
   return energy;
 }
 
 /* -------------------------------------------------------------------------- */
 
 dumper::Field * HeatTransferModel::createNodalFieldBool(const std::string & field_name,
 							const std::string & group_name,
 							bool padding_flag) {
   
   std::map<std::string,Array<bool>* > uint_nodal_fields;
   uint_nodal_fields["blocked_dofs"             ] = blocked_dofs;
 
   dumper::Field * field = NULL;
   field = mesh.createNodalField(uint_nodal_fields[field_name],group_name);
   return field;
 
 }
 /* -------------------------------------------------------------------------- */
 
 dumper::Field * HeatTransferModel::createNodalFieldReal(const std::string & field_name,
 							const std::string & group_name,
 							bool padding_flag) {
   
   std::map<std::string,Array<Real>* > real_nodal_fields;
   real_nodal_fields["temperature"              ] = temperature;
   real_nodal_fields["temperature_rate"         ] = temperature_rate;
   real_nodal_fields["external_heat_rate"       ] = external_heat_rate;
   real_nodal_fields["residual"                 ] = residual;
   real_nodal_fields["capacity_lumped"          ] = capacity_lumped;
 
   dumper::Field * field = 
     mesh.createNodalField(real_nodal_fields[field_name],group_name);
   
   return field;
 }
 /* -------------------------------------------------------------------------- */
 
 dumper::Field * HeatTransferModel
 ::createElementalField(const std::string & field_name, 
 		       const std::string & group_name,
 		       bool padding_flag,
 		       const ElementKind & element_kind){
 
 
   dumper::Field * field = NULL;
 
   if(field_name == "partitions") 
     field = mesh.createElementalField<UInt, dumper::ElementPartitionField>(mesh.getConnectivities(),group_name,this->spatial_dimension,element_kind);
   else if(field_name == "temperature_gradient"){
     ElementTypeMap<UInt> nb_data_per_elem = this->mesh.getNbDataPerElem(temperature_gradient,element_kind);
 
     field = 
       mesh.createElementalField<Real, 
 				dumper::InternalMaterialField>(temperature_gradient,
 							       group_name,
 							       this->spatial_dimension,
 							       element_kind,
 							       nb_data_per_elem);
   }
 
   return field;
 }
 
 /* -------------------------------------------------------------------------- */
  
  
 
 
 __END_AKANTU__
diff --git a/src/model/model.cc b/src/model/model.cc
index 2d80de18a..0f3a01065 100644
--- a/src/model/model.cc
+++ b/src/model/model.cc
@@ -1,360 +1,372 @@
 /**
  * @file   model.cc
  *
  * @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
  * @author David Simon Kammer <david.kammer@epfl.ch>
  * @author Nicolas Richart <nicolas.richart@epfl.ch>
  *
  * @date   Mon Oct 03 12:24:07 2011
  *
  * @brief  implementation of model common parts
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 #include "model.hh"
 #include "element_group.hh"
 
 __BEGIN_AKANTU__
 
 /* -------------------------------------------------------------------------- */
 Model::Model(Mesh& m, UInt dim, const ID & id,
 	     const MemoryID & memory_id) :
   Memory(id, memory_id), mesh(m), 
   spatial_dimension(dim == _all_dimensions ? m.getSpatialDimension() : dim),
   synch_registry(NULL),is_pbc_slave_node(0,1,"is_pbc_slave_node") ,
   parser(&getStaticParser()) {
   AKANTU_DEBUG_IN();
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 Model::~Model() {
   AKANTU_DEBUG_IN();
 
   FEEngineMap::iterator it;
   for (it = fems.begin(); it != fems.end(); ++it) {
     if(it->second) delete it->second;
   }
 
   for (it = fems_boundary.begin(); it != fems_boundary.end(); ++it) {
     if(it->second) delete it->second;
   }
 
   delete synch_registry;
 
   delete dof_synchronizer;
   dof_synchronizer = NULL;
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::setParser(Parser & parser){
   this->parser = &parser;
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::initFull(const ModelOptions & options) {
   AKANTU_DEBUG_IN();
 
   initModel();
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::createSynchronizerRegistry(DataAccessor * data_accessor){
   synch_registry = new SynchronizerRegistry(*data_accessor);
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::setPBC(UInt x, UInt y, UInt z){
   mesh.computeBoundingBox();
   if (x) MeshUtils::computePBCMap(this->mesh, 0, this->pbc_pair);
   if (y) MeshUtils::computePBCMap(this->mesh, 1, this->pbc_pair);
   if (z) MeshUtils::computePBCMap(this->mesh, 2, this->pbc_pair);
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::setPBC(SurfacePairList & surface_pairs){
   SurfacePairList::iterator s_it;
   for(s_it = surface_pairs.begin(); s_it != surface_pairs.end(); ++s_it) {
     MeshUtils::computePBCMap(this->mesh, *s_it, this->pbc_pair);
   }
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::initPBC() {
   std::map<UInt,UInt>::iterator it  = pbc_pair.begin();
   std::map<UInt,UInt>::iterator end = pbc_pair.end();
 
   is_pbc_slave_node.resize(mesh.getNbNodes());
 #ifndef AKANTU_NDEBUG
   Real * coords = mesh.getNodes().storage();
   UInt dim = mesh.getSpatialDimension();
 #endif
   while(it != end){
     UInt i1 = (*it).first;
 
     is_pbc_slave_node(i1) = true;
 
 #ifndef AKANTU_NDEBUG
     UInt i2 = (*it).second;
     AKANTU_DEBUG_INFO("pairing " << i1 << " ("
 		      << coords[dim*i1] << "," << coords[dim*i1+1] << ","
 		      << coords[dim*i1+2]
 		      << ") with "
 		      << i2 << " ("
 		      << coords[dim*i2] << "," << coords[dim*i2+1] << ","
 		      << coords[dim*i2+2]
 		      << ")");
 #endif
     ++it;
   }
 }
 
 /* -------------------------------------------------------------------------- */
 DistributedSynchronizer & Model::createParallelSynch(MeshPartition * partition,
 						     __attribute__((unused)) DataAccessor * data_accessor){
   AKANTU_DEBUG_IN();
   /* ------------------------------------------------------------------------ */
   /* Parallel initialization                                                  */
   /* ------------------------------------------------------------------------ */
   StaticCommunicator & comm =
     StaticCommunicator::getStaticCommunicator();
   Int prank = comm.whoAmI();
 
   DistributedSynchronizer * synch = NULL;
   if(prank == 0)
     synch =
       DistributedSynchronizer::createDistributedSynchronizerMesh(getFEEngine().getMesh(),
 								 partition);
   else
     synch =
       DistributedSynchronizer::createDistributedSynchronizerMesh(getFEEngine().getMesh(),
 								 NULL);
 
   AKANTU_DEBUG_OUT();
   return *synch;
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::dumpGroup(const std::string & group_name) {
   ElementGroup & group = mesh.getElementGroup(group_name);
   group.dump();
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::dumpGroup(const std::string & group_name,
 		      const std::string & dumper_name) {
   ElementGroup & group =  mesh.getElementGroup(group_name);
   group.dump(dumper_name);
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::dumpGroup() {
   GroupManager::element_group_iterator bit  = mesh.element_group_begin();
   GroupManager::element_group_iterator bend = mesh.element_group_end();
   for(; bit != bend; ++bit) {
     bit->second->dump();
   }
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::setGroupDirectory(const std::string & directory) {
   GroupManager::element_group_iterator bit  = mesh.element_group_begin();
   GroupManager::element_group_iterator bend = mesh.element_group_end();
   for (; bit != bend; ++bit) {
     bit->second->setDirectory(directory);
   }
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::setGroupDirectory(const std::string & directory,
 				 const std::string & group_name) {
   ElementGroup & group =  mesh.getElementGroup(group_name);
   group.setDirectory(directory);
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::setGroupBaseName(const std::string & basename,
 				const std::string & group_name) {
   ElementGroup & group =  mesh.getElementGroup(group_name);
   group.setBaseName(basename);
 }
 
 /* -------------------------------------------------------------------------- */
 DumperIOHelper &  Model::getGroupDumper(const std::string & group_name) {
   ElementGroup & group =  mesh.getElementGroup(group_name);
   return group.getDumper();
 }
 
 /* -------------------------------------------------------------------------- */
 // DUMPER stuff
 /* -------------------------------------------------------------------------- */
 void Model::addDumpGroupFieldToDumper(const std::string & field_id,
 				      dumper::Field * field,
 				      DumperIOHelper & dumper) {
 #ifdef AKANTU_USE_IOHELPER
   dumper.registerField(field_id,field);
 #endif
 }
 
 
 
 /* -------------------------------------------------------------------------- */
 void Model::addDumpField(const std::string & field_id) {
 
   this->addDumpFieldToDumper(mesh.getDefaultDumperName(),field_id);
 }
 /* -------------------------------------------------------------------------- */
 
 void Model::addDumpFieldVector(const std::string & field_id) {
 
   this->addDumpFieldVectorToDumper(mesh.getDefaultDumperName(),field_id);
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::addDumpFieldTensor(const std::string & field_id) {
 
   this->addDumpFieldTensorToDumper(mesh.getDefaultDumperName(),field_id);
 }
 
 /* -------------------------------------------------------------------------- */
 
 void Model::setBaseName(const std::string & field_id) {
 
   mesh.setBaseName(field_id);
 }
 /* -------------------------------------------------------------------------- */
 
 void Model::setBaseNameToDumper(const std::string & dumper_name,
 					 const std::string & basename) {
   mesh.setBaseNameToDumper(dumper_name,basename);
 }
 /* -------------------------------------------------------------------------- */
 
 void Model::addDumpFieldToDumper(const std::string & dumper_name,
                                                const std::string & field_id) {
 
   this->addDumpGroupFieldToDumper(dumper_name,field_id,"all",_ek_regular,false);
 
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::addDumpGroupField(const std::string & field_id,
                                             const std::string & group_name) {
 
   ElementGroup & group = mesh.getElementGroup(group_name);
   this->addDumpGroupFieldToDumper(group.getDefaultDumperName(),
                                   field_id,
                                   group_name,_ek_regular,false);
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::removeDumpGroupField(const std::string & field_id,
                                                const std::string & group_name) {
   ElementGroup & group = mesh.getElementGroup(group_name);
   this->removeDumpGroupFieldFromDumper(group.getDefaultDumperName(),
                                        field_id,
                                        group_name);
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::removeDumpGroupFieldFromDumper(const std::string & dumper_name,
                                                          const std::string & field_id,
                                                          const std::string & group_name) {
   ElementGroup & group = mesh.getElementGroup(group_name);
   group.removeDumpFieldFromDumper(dumper_name, field_id);
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::addDumpFieldVectorToDumper(const std::string & dumper_name,
                                                      const std::string & field_id) {
   this->addDumpGroupFieldToDumper(dumper_name,field_id,"all",_ek_regular,3);
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::addDumpGroupFieldVector(const std::string & field_id,
                                                   const std::string & group_name) {
 
   ElementGroup & group = mesh.getElementGroup(group_name);
   this->addDumpGroupFieldVectorToDumper(group.getDefaultDumperName(),
                                         field_id,
                                         group_name);
 }
 
 /* -------------------------------------------------------------------------- */
 void Model::addDumpGroupFieldVectorToDumper(const std::string & dumper_name,
                                                           const std::string & field_id,
                                                           const std::string & group_name) {
   this->addDumpGroupFieldToDumper(dumper_name,field_id,group_name,_ek_regular,true);
 }
 /* -------------------------------------------------------------------------- */
 
 void Model::addDumpFieldTensorToDumper(const std::string & dumper_name,
                                                      const std::string & field_id) {
   this->addDumpGroupFieldToDumper(dumper_name,field_id,"all",_ek_regular,true);
 }
 
 /* -------------------------------------------------------------------------- */
 
 void Model::addDumpGroupFieldToDumper(const std::string & dumper_name,
                                                     const std::string & field_id,
                                                     const std::string & group_name,
 						    const ElementKind & element_kind,
 						    bool padding_flag) {
 
 #ifdef AKANTU_USE_IOHELPER
   dumper::Field * field = NULL;
 
   if (!field) field = this->createNodalFieldReal(field_id,group_name,padding_flag);
   if (!field) field = this->createNodalFieldUInt(field_id,group_name,padding_flag);
   if (!field) field = this->createNodalFieldBool(field_id,group_name,padding_flag);
   if (!field) field = this->createElementalField(field_id,group_name,padding_flag,element_kind);
   if (!field) field = 
 		this->mesh.createFieldFromAttachedData<UInt>(field_id,group_name,
 							     element_kind);
   if (!field) field = 
 		this->mesh.createFieldFromAttachedData<Real>(field_id,group_name,
 							     element_kind);
 
   if (!field) AKANTU_DEBUG_WARNING("No field could be found based on name: " << field_id);
   if (field) {
     DumperIOHelper & dumper = mesh.getGroupDumper(dumper_name,group_name);
     this->addDumpGroupFieldToDumper(field_id,field,dumper);
   }
 
 #endif
 }
 
 /* -------------------------------------------------------------------------- */
 
 void Model::dump() {
   mesh.dump();
 }
 
 /* -------------------------------------------------------------------------- */
 
+void Model::setDirectory(const std::string & directory) {
+  mesh.setDirectory(directory);
+}
+
+/* -------------------------------------------------------------------------- */
+
+void Model::setDirectoryToDumper(const std::string & dumper_name,
+				 const std::string & directory) {
+  mesh.setDirectoryToDumper(dumper_name,directory);
+}
+
+
 
 
 __END_AKANTU__
diff --git a/src/model/model.hh b/src/model/model.hh
index f905ff6b0..ee317bc58 100644
--- a/src/model/model.hh
+++ b/src/model/model.hh
@@ -1,310 +1,315 @@
 /**
  * @file   model.hh
  *
  * @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
  * @author David Simon Kammer <david.kammer@epfl.ch>
  * @author Nicolas Richart <nicolas.richart@epfl.ch>
  *
  * @date   Tue Jul 27 18:15:37 2010
  *
  * @brief  Interface of a model
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 
 #ifndef __AKANTU_MODEL_HH__
 #define __AKANTU_MODEL_HH__
 
 /* -------------------------------------------------------------------------- */
 #include "aka_common.hh"
 #include "aka_memory.hh"
 #include "mesh.hh"
 #include "fe_engine.hh"
 #include "mesh_utils.hh"
 #include "synchronizer_registry.hh"
 #include "distributed_synchronizer.hh"
 #include "static_communicator.hh"
 #include "mesh_partition.hh"
 #include "dof_synchronizer.hh"
 #include "pbc_synchronizer.hh"
 #include "parser.hh"
 /* -------------------------------------------------------------------------- */
 
 __BEGIN_AKANTU__
 
 struct ModelOptions {
 
   virtual ~ModelOptions() {}
 };
 
 class DumperIOHelper;
 
 class Model : public Memory {
   /* ------------------------------------------------------------------------ */
   /* Constructors/Destructors                                                 */
   /* ------------------------------------------------------------------------ */
 public:
 
   typedef Mesh mesh_type;
 
 
   Model(Mesh& mesh, UInt spatial_dimension = _all_dimensions,
         const ID & id = "model",
         const MemoryID & memory_id = 0);
 
   virtual ~Model();
 
   typedef std::map<std::string, FEEngine *> FEEngineMap;
 
   /* ------------------------------------------------------------------------ */
   /* Methods                                                                  */
   /* ------------------------------------------------------------------------ */
 public:
   virtual void initFull(const ModelOptions & options);
 
   virtual void initModel() = 0;
 
   /// create the synchronizer registry object
   void createSynchronizerRegistry(DataAccessor * data_accessor);
 
   /// create a parallel synchronizer and distribute the mesh
   DistributedSynchronizer & createParallelSynch(MeshPartition * partition,
 						DataAccessor * data_accessor);
 
   /// change local equation number so that PBC is assembled properly
   void changeLocalEquationNumberForPBC(std::map<UInt,UInt> & pbc_pair,UInt dimension);
   /// function to print the containt of the class
   virtual void printself(std::ostream & stream, int indent = 0) const = 0;
 
   /// initialize the model for PBC
   void setPBC(UInt x, UInt y, UInt z);
   void setPBC(SurfacePairList & surface_pairs);
 
   virtual void initPBC();
 
   /// set the parser to use
   void setParser(Parser & parser);
 
   /* ------------------------------------------------------------------------ */
   /* Access to the dumpable interface of the boundaries                       */
   /* ------------------------------------------------------------------------ */
   /// Dump the data for a given group
   void dumpGroup(const std::string & group_name);
   void dumpGroup(const std::string & group_name,
                  const std::string & dumper_name);
   /// Dump the data for all boundaries
   void dumpGroup();
   /// Set the directory for a given group
   void setGroupDirectory(const std::string & directory,
                          const std::string & group_name);
   /// Set the directory for all boundaries
   void setGroupDirectory(const std::string & directory);
   /// Set the base name for a given group
   void setGroupBaseName(const std::string & basename,
                         const std::string & group_name);
   /// Get the internal dumper of a given group
   DumperIOHelper & getGroupDumper(const std::string & group_name);
 
   /* ------------------------------------------------------------------------ */
   /* Accessors                                                                 */
   /* ------------------------------------------------------------------------ */
 public:
   /// get id of model
   AKANTU_GET_MACRO(ID, id, const ID)
 
   /// get the number of surfaces
   AKANTU_GET_MACRO(Mesh, mesh, Mesh&);
 
   /// return the object handling equation numbers
   AKANTU_GET_MACRO(DOFSynchronizer, *dof_synchronizer, const DOFSynchronizer &)
 
   /// return the object handling synchronizers
   AKANTU_GET_MACRO(SynchronizerRegistry, *synch_registry, SynchronizerRegistry &)
   
   /// synchronize the boundary in case of parallel run
   virtual void synchronizeBoundaries() {};
 
   /// return the fem object associated with a provided name
   inline FEEngine & getFEEngine(const ID & name = "") const;
 
   /// return the fem boundary object associated with a provided name
   virtual FEEngine & getFEEngineBoundary(const ID & name = "");
 
   /// register a fem object associated with name
   template <typename FEEngineClass> inline void registerFEEngineObject(const std::string & name,
                                                              Mesh & mesh,
                                                              UInt spatial_dimension);
   /// unregister a fem object associated with name
   inline void unRegisterFEEngineObject(const std::string & name);
 
   /// return the synchronizer registry
   SynchronizerRegistry & getSynchronizerRegistry();
 
   /// return the fem object associated with a provided name
   template <typename FEEngineClass>
   inline FEEngineClass & getFEEngineClass(std::string name = "") const;
 
   /// return the fem boundary object associated with a provided name
   template <typename FEEngineClass>
   inline FEEngineClass & getFEEngineClassBoundary(std::string name = "");
 
   /// get the pbc pairs
   std::map<UInt,UInt> & getPBCPairs(){return pbc_pair;};
 
   /// returns if node is slave in pbc
   inline bool isPBCSlaveNode(const UInt node) const;
 
   /// returns the array of pbc slave nodes (boolean information)
   AKANTU_GET_MACRO(IsPBCSlaveNode, is_pbc_slave_node, const Array<bool> &)
 
   /* ------------------------------------------------------------------------ */
   /* Pack and unpack helper functions                                         */
   /* ------------------------------------------------------------------------ */
 public:
   inline UInt getNbQuadraturePoints(const Array<Element> & elements,
 				    const ID & fem_id = ID()) const;
 
   /* ------------------------------------------------------------------------ */
   /* Dumpable interface (kept for convenience) and dumper relative functions  */
   /* ------------------------------------------------------------------------ */
 
   virtual void addDumpGroupFieldToDumper(const std::string & field_id,
 					 dumper::Field * field,
 					 DumperIOHelper & dumper);
 
   virtual void addDumpField(const std::string & field_id);
 
   virtual void addDumpFieldVector(const std::string & field_id);
 
   virtual void addDumpFieldToDumper(const std::string & dumper_name,
 				    const std::string & field_id);
 
   virtual void addDumpFieldVectorToDumper(const std::string & dumper_name,
 					  const std::string & field_id);
 
   virtual void addDumpFieldTensorToDumper(const std::string & dumper_name,
 					  const std::string & field_id);
 
   virtual void addDumpFieldTensor(const std::string & field_id);
 
   virtual void setBaseName(const std::string & basename);  
   
   virtual void  setBaseNameToDumper(const std::string & dumper_name,
 				    const std::string & basename);
 
 
   virtual void addDumpGroupField(const std::string & field_id,
 				 const std::string & group_name);
 
   virtual void addDumpGroupFieldToDumper(const std::string & dumper_name,
 					 const std::string & field_id,
 					 const std::string & group_name,
 					 const ElementKind & element_kind,
 					 bool padding_flag);
 
   virtual void removeDumpGroupField(const std::string & field_id,
 				    const std::string & group_name);
   virtual void removeDumpGroupFieldFromDumper(const std::string & dumper_name,
 					      const std::string & field_id,
 					      const std::string & group_name);
 
   virtual void addDumpGroupFieldVector(const std::string & field_id,
 				       const std::string & group_name);
 
   virtual void addDumpGroupFieldVectorToDumper(const std::string & dumper_name,
 					       const std::string & field_id,
 					       const std::string & group_name);
 
   virtual dumper::Field * createNodalFieldReal(const std::string & field_name,
 					       const std::string & group_name,
 					       bool padding_flag){return NULL;}
 
   virtual dumper::Field * createNodalFieldUInt(const std::string & field_name,
 					       const std::string & group_name,
 					       bool padding_flag){return NULL;}
 
   virtual dumper::Field * createNodalFieldBool(const std::string & field_name,
 					       const std::string & group_name,
 					       bool padding_flag){return NULL;}
 
 
   virtual dumper::Field * createElementalField(const std::string & field_name, 
 					       const std::string & group_name,
 					       bool padding_flag,
 					       const ElementKind & kind){return NULL;}
 
+
+  void setDirectory(const std::string & directory);
+  void setDirectoryToDumper(const std::string & dumper_name,
+			    const std::string & directory);
+
   virtual void dump();
 
   /* ------------------------------------------------------------------------ */
   /* Class Members                                                            */
   /* ------------------------------------------------------------------------ */
 protected:
   /// Mesh
   Mesh & mesh;
 
   /// Spatial dimension of the problem
   UInt spatial_dimension;
 
   /// the main fem object present in all  models
   FEEngineMap fems;
 
   /// the fem object present in all  models for boundaries
   FEEngineMap fems_boundary;
 
   /// default fem object
   std::string default_fem;
 
   /// synchronizer registry
   SynchronizerRegistry * synch_registry;
 
   /// handle the equation number things
   DOFSynchronizer * dof_synchronizer;
 
   /// pbc pairs
   std::map<UInt,UInt> pbc_pair;
 
   /// flag per node to know is pbc slave
   Array<bool> is_pbc_slave_node;
 
   /// parser to the pointer to use
   Parser * parser;
 };
 
 
 /* -------------------------------------------------------------------------- */
 /* inline functions                                                           */
 /* -------------------------------------------------------------------------- */
 
 #if defined (AKANTU_INCLUDE_INLINE_IMPL)
 #  include "model_inline_impl.cc"
 #endif
 
 /// standard output stream operator
 inline std::ostream & operator <<(std::ostream & stream, const Model & _this)
 {
   _this.printself(stream);
   return stream;
 }
 
 __END_AKANTU__
 
 #endif /* __AKANTU_MODEL_HH__ */
diff --git a/src/model/solid_mechanics/solid_mechanics_model.cc b/src/model/solid_mechanics/solid_mechanics_model.cc
index 099c07684..1c1ece763 100644
--- a/src/model/solid_mechanics/solid_mechanics_model.cc
+++ b/src/model/solid_mechanics/solid_mechanics_model.cc
@@ -1,1928 +1,1930 @@
 /**
  * @file   solid_mechanics_model.cc
  *
  * @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
  * @author Nicolas Richart <nicolas.richart@epfl.ch>
  *
  * @date   Tue Jul 27 18:15:37 2010
  *
  * @brief  Implementation of the SolidMechanicsModel class
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 #include "aka_math.hh"
 #include "aka_common.hh"
 #include "solid_mechanics_model.hh"
+#include "group_manager_inline_impl.cc"
+#include "dumpable_inline_impl.hh"
 #include "integration_scheme_2nd_order.hh"
 #include "element_group.hh"
 
 #include "static_communicator.hh"
 
 #include "dof_synchronizer.hh"
 #include "element_group.hh"
 
 #include <cmath>
 
 #ifdef AKANTU_USE_MUMPS
 #include "solver_mumps.hh"
 #endif
 
 #ifdef AKANTU_USE_IOHELPER
 #  include "dumper_field.hh"
 #  include "dumper_paraview.hh"
 #  include "dumper_homogenizing_field.hh"
 #  include "dumper_material_internal_field.hh"
 #  include "dumper_elemental_field.hh"
 #  include "dumper_material_padders.hh"
 #  include "dumper_element_partition.hh"
 #  include "dumper_iohelper.hh"
 #endif
 
 /* -------------------------------------------------------------------------- */
 __BEGIN_AKANTU__
 
 using std::cout;
 using std::endl;
 
 const SolidMechanicsModelOptions default_solid_mechanics_model_options(_explicit_lumped_mass, false);
 
 /* -------------------------------------------------------------------------- */
 /**
  * A solid mechanics model need a mesh  and a dimension to be created. the model
  * by it  self can not  do a lot,  the good init  functions should be  called in
  * order to configure the model depending on what we want to do.
  *
  * @param  mesh mesh  representing  the model  we  want to  simulate
  * @param dim spatial  dimension of the problem, if dim =  0 (default value) the
  * dimension of the problem is assumed to be the on of the mesh
  * @param id an id to identify the model
  */
 SolidMechanicsModel::SolidMechanicsModel(Mesh & mesh,
                                          UInt dim,
                                          const ID & id,
                                          const MemoryID & memory_id) :
   Model(mesh, dim, id, memory_id), 
   BoundaryCondition<SolidMechanicsModel>(),
   time_step(NAN), f_m2a(1.0),
   mass_matrix(NULL),
   velocity_damping_matrix(NULL),
   stiffness_matrix(NULL),
   jacobian_matrix(NULL),
   element_index_by_material("element index by material", id),
   material_selector(new DefaultMaterialSelector(element_index_by_material)),
   is_default_material_selector(true),
   integrator(NULL),
   increment_flag(false), solver(NULL),
   synch_parallel(NULL),
   are_materials_instantiated(false) {
 
   AKANTU_DEBUG_IN();
 
   createSynchronizerRegistry(this);
 
   registerFEEngineObject<MyFEEngineType>("SolidMechanicsFEEngine", mesh, spatial_dimension);
 
   this->displacement = NULL;
   this->mass         = NULL;
   this->velocity     = NULL;
   this->acceleration = NULL;
   this->force        = NULL;
   this->residual     = NULL;
   this->blocked_dofs = NULL;
 
   this->increment    = NULL;
   this->increment_acceleration = NULL;
 
   this->dof_synchronizer = NULL;
 
   this->previous_displacement = NULL;
 
   materials.clear();
 
   mesh.registerEventHandler(*this);
 
 #if defined(AKANTU_USE_IOHELPER)
   this->mesh.registerDumper<DumperParaview>("paraview_all", id, true);
   this->mesh.addDumpMesh(mesh, spatial_dimension, _not_ghost, _ek_regular);
 #endif
   AKANTU_DEBUG_OUT();
 }
 
 
 
 /* -------------------------------------------------------------------------- */
 SolidMechanicsModel::~SolidMechanicsModel() {
   AKANTU_DEBUG_IN();
 
   std::vector<Material *>::iterator mat_it;
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     delete *mat_it;
   }
 
   materials.clear();
 
   delete integrator;
 
   delete solver;
   delete mass_matrix;
   delete velocity_damping_matrix;
 
   if(stiffness_matrix && stiffness_matrix != jacobian_matrix)
     delete stiffness_matrix;
 
   delete jacobian_matrix;
 
   delete synch_parallel;
 
   if(is_default_material_selector) {
     delete material_selector;
     material_selector = NULL;
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 void SolidMechanicsModel::setTimeStep(Real time_step) {
   this->time_step = time_step;
 
 #if defined(AKANTU_USE_IOHELPER)
   this->mesh.getDumper().setTimeStep(time_step);
 #endif
 }
 
 /* -------------------------------------------------------------------------- */
 /* Initialisation                                                             */
 /* -------------------------------------------------------------------------- */
 /**
  * This function groups  many of the initialization in on  function. For most of
  * basics  case the  function should  be  enough. The  functions initialize  the
  * model, the internal  vectors, set them to 0, and  depending on the parameters
  * it also initialize the explicit or implicit solver.
  *
  * @param material_file the  file containing the materials to  use
  * @param method the analysis method wanted.  See the akantu::AnalysisMethod for
  * the different possibilities
  */
 void SolidMechanicsModel::initFull(const ModelOptions & options) {
   Model::initFull(options);
 
   const SolidMechanicsModelOptions & smm_options =
     dynamic_cast<const SolidMechanicsModelOptions &>(options);
 
   method = smm_options.analysis_method;
 
   // initialize the vectors
   initArrays();
 
   // set the initial condition to 0
   force->clear();
   velocity->clear();
   acceleration->clear();
   displacement->clear();
 
   // initialize pcb
   if(pbc_pair.size()!=0)
     initPBC();
 
   // initialize the time integration schemes
   switch(method) {
   case _explicit_lumped_mass:
     initExplicit();
     break;
   case _explicit_consistent_mass:
     initSolver();
     initExplicit();
     break;
   case _implicit_dynamic:
     initImplicit(true);
     break;
   case _static:
     initImplicit(false);
     break;
   default:
     AKANTU_EXCEPTION("analysis method not recognised by SolidMechanicsModel");
     break;
   }
 
   // initialize the materials
   if(this->parser->getLastParsedFile() != "") {
     instantiateMaterials();
   }
 
   if(!smm_options.no_init_materials) {
     initMaterials();
   }
 
   if(increment_flag)
     initBC(*this, *displacement, *increment, *force);
   else
     initBC(*this, *displacement, *force);
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::initParallel(MeshPartition * partition,
                                        DataAccessor * data_accessor) {
   AKANTU_DEBUG_IN();
 
   if (data_accessor == NULL) data_accessor = this;
   synch_parallel = &createParallelSynch(partition,data_accessor);
 
   synch_registry->registerSynchronizer(*synch_parallel, _gst_material_id);
   synch_registry->registerSynchronizer(*synch_parallel, _gst_smm_mass);
   synch_registry->registerSynchronizer(*synch_parallel, _gst_smm_stress);
   synch_registry->registerSynchronizer(*synch_parallel, _gst_smm_boundary);
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::initFEEngineBoundary() {
   FEEngine & fem_boundary = getFEEngineBoundary();
   fem_boundary.initShapeFunctions(_not_ghost);
   fem_boundary.initShapeFunctions(_ghost);
 
   fem_boundary.computeNormalsOnControlPoints(_not_ghost);
   fem_boundary.computeNormalsOnControlPoints(_ghost);
 }
 
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::initExplicit(AnalysisMethod analysis_method) {
   AKANTU_DEBUG_IN();
 
   //in case of switch from implicit to explicit
   if(!this->isExplicit())
     method = analysis_method;
 
   if (integrator) delete integrator;
   integrator = new CentralDifference();
 
   UInt nb_nodes = acceleration->getSize();
   UInt nb_degree_of_freedom = acceleration->getNbComponent();
 
   std::stringstream sstr; sstr << id << ":increment_acceleration";
   increment_acceleration = &(alloc<Real>(sstr.str(), nb_nodes, nb_degree_of_freedom, Real()));
 
   AKANTU_DEBUG_OUT();
 }
 
 void SolidMechanicsModel::initArraysPreviousDisplacment() {
   AKANTU_DEBUG_IN();
 
   SolidMechanicsModel::setIncrementFlagOn();
   UInt nb_nodes = mesh.getNbNodes();
   std::stringstream sstr_disp_t;
   sstr_disp_t << id << ":previous_displacement";
   previous_displacement = &(alloc<Real > (sstr_disp_t.str(), nb_nodes, spatial_dimension, 0.));
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 /**
  * Allocate all the needed vectors. By  default their are not necessarily set to
  * 0
  *
  */
 void SolidMechanicsModel::initArrays() {
   AKANTU_DEBUG_IN();
 
   UInt nb_nodes = mesh.getNbNodes();
   std::stringstream sstr_disp; sstr_disp << id << ":displacement";
   //  std::stringstream sstr_mass; sstr_mass << id << ":mass";
   std::stringstream sstr_velo; sstr_velo << id << ":velocity";
   std::stringstream sstr_acce; sstr_acce << id << ":acceleration";
   std::stringstream sstr_forc; sstr_forc << id << ":force";
   std::stringstream sstr_resi; sstr_resi << id << ":residual";
   std::stringstream sstr_boun; sstr_boun << id << ":blocked_dofs";
 
   displacement = &(alloc<Real>(sstr_disp.str(), nb_nodes, spatial_dimension, REAL_INIT_VALUE));
   //  mass         = &(alloc<Real>(sstr_mass.str(), nb_nodes, spatial_dimension, 0));
   velocity     = &(alloc<Real>(sstr_velo.str(), nb_nodes, spatial_dimension, REAL_INIT_VALUE));
   acceleration = &(alloc<Real>(sstr_acce.str(), nb_nodes, spatial_dimension, REAL_INIT_VALUE));
   force        = &(alloc<Real>(sstr_forc.str(), nb_nodes, spatial_dimension, REAL_INIT_VALUE));
   residual     = &(alloc<Real>(sstr_resi.str(), nb_nodes, spatial_dimension, REAL_INIT_VALUE));
   blocked_dofs = &(alloc<bool>(sstr_boun.str(), nb_nodes, spatial_dimension, false));
 
   std::stringstream sstr_curp; sstr_curp << id << ":current_position";
   current_position = &(alloc<Real>(sstr_curp.str(), 0, spatial_dimension, REAL_INIT_VALUE));
 
   for(UInt g = _not_ghost; g <= _ghost; ++g) {
     GhostType gt = (GhostType) g;
     Mesh::type_iterator it  = mesh.firstType(spatial_dimension, gt, _ek_not_defined);
     Mesh::type_iterator end = mesh.lastType(spatial_dimension, gt, _ek_not_defined);
     for(; it != end; ++it) {
       UInt nb_element = mesh.getNbElement(*it, gt);
       element_index_by_material.alloc(nb_element, 2, *it, gt);
     }
   }
 
   dof_synchronizer = new DOFSynchronizer(mesh, spatial_dimension);
   dof_synchronizer->initLocalDOFEquationNumbers();
   dof_synchronizer->initGlobalDOFEquationNumbers();
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 /**
  * Initialize the model,basically it  pre-compute the shapes, shapes derivatives
  * and jacobian
  *
  */
 void SolidMechanicsModel::initModel() {
   /// \todo add  the current position  as a parameter to  initShapeFunctions for
   /// large deformation
   getFEEngine().initShapeFunctions(_not_ghost);
   getFEEngine().initShapeFunctions(_ghost);
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::initPBC() {
   Model::initPBC();
   registerPBCSynchronizer();
 
   // as long as there are ones on the diagonal of the matrix, we can put boudandary true for slaves
   std::map<UInt, UInt>::iterator it = pbc_pair.begin();
   std::map<UInt, UInt>::iterator end = pbc_pair.end();
   UInt dim = mesh.getSpatialDimension();
   while(it != end) {
     for (UInt i=0; i<dim; ++i)
       (*blocked_dofs)((*it).first,i) = true;
     ++it;
   }
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::registerPBCSynchronizer(){
   PBCSynchronizer * synch = new PBCSynchronizer(pbc_pair);
   synch_registry->registerSynchronizer(*synch, _gst_smm_uv);
   synch_registry->registerSynchronizer(*synch, _gst_smm_mass);
   synch_registry->registerSynchronizer(*synch, _gst_smm_res);
   synch_registry->registerSynchronizer(*synch, _gst_for_dump);
   changeLocalEquationNumberForPBC(pbc_pair, mesh.getSpatialDimension());
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::updateCurrentPosition() {
   AKANTU_DEBUG_IN();
   UInt nb_nodes = mesh.getNbNodes();
 
   current_position->resize(nb_nodes);
   Real * current_position_val = current_position->storage();
   Real * position_val         = mesh.getNodes().storage();
   Real * displacement_val     = displacement->storage();
 
   /// compute current_position = initial_position + displacement
   memcpy(current_position_val, position_val, nb_nodes*spatial_dimension*sizeof(Real));
   for (UInt n = 0; n < nb_nodes*spatial_dimension; ++n) {
     *current_position_val++ += *displacement_val++;
   }
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::initializeUpdateResidualData() {
   AKANTU_DEBUG_IN();
   UInt nb_nodes = mesh.getNbNodes();
   residual->resize(nb_nodes);
 
   /// copy the forces in residual for boundary conditions
   memcpy(residual->storage(), force->storage(), nb_nodes*spatial_dimension*sizeof(Real));
 
   // start synchronization
   synch_registry->asynchronousSynchronize(_gst_smm_uv);
   synch_registry->waitEndSynchronize(_gst_smm_uv);
 
   updateCurrentPosition();
 
   AKANTU_DEBUG_OUT();
 }
 
 
 /* -------------------------------------------------------------------------- */
 /* Explicit scheme                                                            */
 /* -------------------------------------------------------------------------- */
 
 /* -------------------------------------------------------------------------- */
 /**
  * This function compute  the second member of the motion  equation.  That is to
  * say the sum of forces @f$ r = F_{ext} - F_{int} @f$. @f$ F_{ext} @f$ is given
  * by the  user in  the force  vector, and @f$  F_{int} @f$  is computed  as @f$
  * F_{int} = \int_{\Omega} N \sigma d\Omega@f$
  *
  */
 void SolidMechanicsModel::updateResidual(bool need_initialize) {
   AKANTU_DEBUG_IN();
 
   AKANTU_DEBUG_INFO("Assemble the internal forces");
   // f = f_ext - f_int
 
   // f = f_ext
   if(need_initialize) initializeUpdateResidualData();
 
   AKANTU_DEBUG_INFO("Compute local stresses");
 
   std::vector<Material *>::iterator mat_it;
   for (mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     Material & mat = **mat_it;
     mat.computeAllStresses(_not_ghost);
   }
 
 #ifdef AKANTU_DAMAGE_NON_LOCAL
   /* ------------------------------------------------------------------------ */
   /* Computation of the non local part */
   synch_registry->asynchronousSynchronize(_gst_mnl_for_average);
   AKANTU_DEBUG_INFO("Compute non local stresses for local elements");
 
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     Material & mat = **mat_it;
     mat.computeAllNonLocalStresses(_not_ghost);
   }
 
 
   AKANTU_DEBUG_INFO("Wait distant non local stresses");
   synch_registry->waitEndSynchronize(_gst_mnl_for_average);
 
   AKANTU_DEBUG_INFO("Compute non local stresses for ghosts elements");
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     Material & mat = **mat_it;
     mat.computeAllNonLocalStresses(_ghost);
   }
 #endif
 
   /* ------------------------------------------------------------------------ */
   /* assembling the forces internal */
   // communicate the stress
   AKANTU_DEBUG_INFO("Send data for residual assembly");
   synch_registry->asynchronousSynchronize(_gst_smm_stress);
 
   AKANTU_DEBUG_INFO("Assemble residual for local elements");
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     Material & mat = **mat_it;
     mat.assembleResidual(_not_ghost);
   }
 
 
   AKANTU_DEBUG_INFO("Wait distant stresses");
   // finalize communications
   synch_registry->waitEndSynchronize(_gst_smm_stress);
 
   AKANTU_DEBUG_INFO("Assemble residual for ghost elements");
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     Material & mat = **mat_it;
     mat.assembleResidual(_ghost);
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::computeStresses() {
   if (isExplicit()) {
     // start synchronization
     synch_registry->asynchronousSynchronize(_gst_smm_uv);
     synch_registry->waitEndSynchronize(_gst_smm_uv);
 
     // compute stresses on all local elements for each materials
     std::vector<Material *>::iterator mat_it;
     for (mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
       Material & mat = **mat_it;
       mat.computeAllStresses(_not_ghost);
     }
 
     /* ------------------------------------------------------------------------ */
 #ifdef AKANTU_DAMAGE_NON_LOCAL
     /* Computation of the non local part */
     synch_registry->asynchronousSynchronize(_gst_mnl_for_average);
 
     for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
       Material & mat = **mat_it;
       mat.computeAllNonLocalStresses(_not_ghost);
     }
 
     synch_registry->waitEndSynchronize(_gst_mnl_for_average);
 
     for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
       Material & mat = **mat_it;
       mat.computeAllNonLocalStresses(_ghost);
     }
 #endif
   } else {
     std::vector<Material *>::iterator mat_it;
     for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
       Material & mat = **mat_it;
       mat.computeAllStressesFromTangentModuli(_not_ghost);
     }
   }
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::updateResidualInternal() {
   AKANTU_DEBUG_IN();
 
   AKANTU_DEBUG_INFO("Update the residual");
   // f = f_ext - f_int - Ma - Cv = r - Ma - Cv;
 
   if(method != _static) {
     // f -= Ma
     if(mass_matrix) {
       // if full mass_matrix
       Array<Real> * Ma = new Array<Real>(*acceleration, true, "Ma");
       *Ma *= *mass_matrix;
       /// \todo check unit conversion for implicit dynamics
       //      *Ma /= f_m2a
       *residual -= *Ma;
       delete Ma;
     } else if (mass) {
 
       // else lumped mass
       UInt nb_nodes = acceleration->getSize();
       UInt nb_degree_of_freedom = acceleration->getNbComponent();
 
       Real * mass_val     = mass->storage();
       Real * accel_val    = acceleration->storage();
       Real * res_val      = residual->storage();
       bool * blocked_dofs_val = blocked_dofs->storage();
 
       for (UInt n = 0; n < nb_nodes * nb_degree_of_freedom; ++n) {
         if(!(*blocked_dofs_val)) {
           *res_val -= *accel_val * *mass_val /f_m2a;
         }
         blocked_dofs_val++;
         res_val++;
         mass_val++;
         accel_val++;
       }
     } else {
       AKANTU_DEBUG_ERROR("No function called to assemble the mass matrix.");
     }
 
     // f -= Cv
     if(velocity_damping_matrix) {
       Array<Real> * Cv = new Array<Real>(*velocity);
       *Cv *= *velocity_damping_matrix;
       *residual -= *Cv;
       delete Cv;
     }
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::updateAcceleration() {
   AKANTU_DEBUG_IN();
 
   updateResidualInternal();
 
   if(method == _explicit_lumped_mass) {
     /* residual = residual_{n+1} - M * acceleration_n therefore
        solution = increment acceleration not acceleration */
     solveLumped(*increment_acceleration,
                 *mass,
                 *residual,
                 *blocked_dofs,
                 f_m2a);
   } else if (method == _explicit_consistent_mass) {
     solve<NewmarkBeta::_acceleration_corrector>(*increment_acceleration);
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::solveLumped(Array<Real> & x,
                                       const Array<Real> & A,
                                       const Array<Real> & b,
                                       const Array<bool> & blocked_dofs,
                                       Real alpha) {
 
   Real * A_val = A.storage();
   Real * b_val = b.storage();
   Real * x_val = x.storage();
   bool * blocked_dofs_val = blocked_dofs.storage();
 
   UInt nb_degrees_of_freedom = x.getSize() * x.getNbComponent();
 
   for (UInt n = 0; n < nb_degrees_of_freedom; ++n) {
     if(!(*blocked_dofs_val)) {
       *x_val = alpha * (*b_val / *A_val);
     }
     x_val++;
     A_val++;
     b_val++;
     blocked_dofs_val++;
   }
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::explicitPred() {
   AKANTU_DEBUG_IN();
 
   if(increment_flag) {
     if(previous_displacement) increment->copy(*previous_displacement);
     else increment->copy(*displacement);
   }
 
   AKANTU_DEBUG_ASSERT(integrator,"itegrator should have been allocated: "
                       << "have called initExplicit ? "
                       << "or initImplicit ?");
 
   integrator->integrationSchemePred(time_step,
                                     *displacement,
                                     *velocity,
                                     *acceleration,
                                     *blocked_dofs);
 
   if(increment_flag) {
     Real * inc_val = increment->storage();
     Real * dis_val = displacement->storage();
     UInt nb_degree_of_freedom = displacement->getSize() * displacement->getNbComponent();
 
     for (UInt n = 0; n < nb_degree_of_freedom; ++n) {
       *inc_val = *dis_val - *inc_val;
       inc_val++;
       dis_val++;
     }
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::explicitCorr() {
   AKANTU_DEBUG_IN();
 
   integrator->integrationSchemeCorrAccel(time_step,
                                          *displacement,
                                          *velocity,
                                          *acceleration,
                                          *blocked_dofs,
                                          *increment_acceleration);
 
   if(previous_displacement) previous_displacement->copy(*displacement);
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::solveStep() {
   AKANTU_DEBUG_IN();
 
   EventManager::sendEvent(SolidMechanicsModelEvent::BeforeSolveStepEvent(method));
 
   this->explicitPred();
   this->updateResidual();
   this->updateAcceleration();
   this->explicitCorr();
 
   EventManager::sendEvent(SolidMechanicsModelEvent::AfterSolveStepEvent(method));
 
   AKANTU_DEBUG_OUT();
 }
 
 
 /* -------------------------------------------------------------------------- */
 /* Implicit scheme                                                            */
 /* -------------------------------------------------------------------------- */
 
 /* -------------------------------------------------------------------------- */
 /**
  * Initialize the solver and create the sparse matrices needed.
  *
  */
 void SolidMechanicsModel::initSolver(__attribute__((unused)) SolverOptions & options) {
 #if !defined(AKANTU_USE_MUMPS) // or other solver in the future \todo add AKANTU_HAS_SOLVER in CMake
   AKANTU_DEBUG_ERROR("You should at least activate one solver.");
 #else
   UInt nb_global_nodes = mesh.getNbGlobalNodes();
 
   delete jacobian_matrix;
   std::stringstream sstr; sstr << id << ":jacobian_matrix";
   jacobian_matrix = new SparseMatrix(nb_global_nodes * spatial_dimension, _symmetric,
                                      spatial_dimension, sstr.str(), memory_id);
 
   jacobian_matrix->buildProfile(mesh, *dof_synchronizer);
 
   if (!isExplicit()) {
     delete stiffness_matrix;
     std::stringstream sstr_sti; sstr_sti << id << ":stiffness_matrix";
     stiffness_matrix = new SparseMatrix(*jacobian_matrix, sstr_sti.str(), memory_id);
   }
 
 #ifdef AKANTU_USE_MUMPS
   std::stringstream sstr_solv; sstr_solv << id << ":solver";
   solver = new SolverMumps(*jacobian_matrix, sstr_solv.str());
 
   dof_synchronizer->initScatterGatherCommunicationScheme();
 #else
   AKANTU_DEBUG_ERROR("You should at least activate one solver.");
 #endif //AKANTU_USE_MUMPS
 
   if(solver)
     solver->initialize(options);
 #endif //AKANTU_HAS_SOLVER
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::initJacobianMatrix() {
 #ifdef AKANTU_USE_MUMPS
   // @todo make it more flexible: this is an ugly patch to treat the case of non
   // fix profile of the K matrix
   delete jacobian_matrix;
   std::stringstream sstr_sti; sstr_sti << id << ":jacobian_matrix";
   jacobian_matrix = new SparseMatrix(*stiffness_matrix, sstr_sti.str(), memory_id);
 
   std::stringstream sstr_solv; sstr_solv << id << ":solver";
   delete solver;
   solver = new SolverMumps(*jacobian_matrix, sstr_solv.str());
   if(solver)
     solver->initialize(_solver_no_options);
 #else
   AKANTU_DEBUG_ERROR("You should at least activate one solver.");
 #endif
 }
 
 /* -------------------------------------------------------------------------- */
 /**
  * Initialize the implicit solver, either for dynamic or static cases,
  *
  * @param dynamic
  */
 void SolidMechanicsModel::initImplicit(bool dynamic, SolverOptions & solver_options) {
   AKANTU_DEBUG_IN();
 
   method = dynamic ? _implicit_dynamic : _static;
 
   if (!increment) setIncrementFlagOn();
 
   initSolver(solver_options);
 
   if(method == _implicit_dynamic) {
     if(integrator) delete integrator;
     integrator = new TrapezoidalRule2();
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::initialAcceleration() {
   AKANTU_DEBUG_IN();
 
   AKANTU_DEBUG_INFO("Solving Ma = f");
 
   Solver * acc_solver = NULL;
 
   std::stringstream sstr; sstr << id << ":tmp_mass_matrix";
   SparseMatrix * tmp_mass = new SparseMatrix(*mass_matrix, sstr.str(), memory_id);
 
 #ifdef AKANTU_USE_MUMPS
   std::stringstream sstr_solver; sstr << id << ":solver_mass_matrix";
   acc_solver = new SolverMumps(*mass_matrix, sstr_solver.str());
 
   dof_synchronizer->initScatterGatherCommunicationScheme();
 #else
   AKANTU_DEBUG_ERROR("You should at least activate one solver.");
 #endif //AKANTU_USE_MUMPS
 
   acc_solver->initialize();
 
   tmp_mass->applyBoundary(*blocked_dofs);
 
   acc_solver->setRHS(*residual);
   acc_solver->solve(*acceleration);
 
   delete acc_solver;
   delete tmp_mass;
 
   AKANTU_DEBUG_OUT();
 }
 
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::assembleStiffnessMatrix() {
   AKANTU_DEBUG_IN();
 
   AKANTU_DEBUG_INFO("Assemble the new stiffness matrix.");
 
   stiffness_matrix->clear();
 
   // call compute stiffness matrix on each local elements
   std::vector<Material *>::iterator mat_it;
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     (*mat_it)->assembleStiffnessMatrix(_not_ghost);
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 // /* -------------------------------------------------------------------------- */
 // void SolidMechanicsModel::solveStatic(Array<bool> & boundary_normal, Array<Real> & EulerAngles) {
 //   AKANTU_DEBUG_IN();
 
 //   AKANTU_DEBUG_INFO("Solving Ku = f");
 //   AKANTU_DEBUG_ASSERT(stiffness_matrix != NULL,
 //                       "You should first initialize the implicit solver and assemble the stiffness matrix");
 
 //   UInt nb_nodes = displacement->getSize();
 //   UInt nb_degree_of_freedom = displacement->getNbComponent();
 
 //   //  if(method != _static)
 //   jacobian_matrix->copyContent(*stiffness_matrix);
 
 //   Array<Real> * residual_rotated = new Array<Real > (nb_nodes, nb_degree_of_freedom, "residual_rotated");
 
 //   //stiffness_matrix->saveMatrix("stiffness_original.out");
 //   jacobian_matrix->applyBoundaryNormal(boundary_normal, EulerAngles, *residual, (*stiffness_matrix).getA(), *residual_rotated);
 //   //jacobian_matrix->saveMatrix("stiffness_rotated_dir.out");
 
 //   jacobian_matrix->applyBoundary(*blocked_dofs);
 
 //   solver->setRHS(*residual_rotated);
 
 //   delete residual_rotated;
 
 //   if (!increment) setIncrementFlagOn();
 
 //   solver->solve(*increment);
 
 //   Matrix<Real> T(nb_degree_of_freedom, nb_degree_of_freedom);
 //   Matrix<Real> small_rhs(nb_degree_of_freedom, nb_degree_of_freedom);
 //   Matrix<Real> T_small_rhs(nb_degree_of_freedom, nb_degree_of_freedom);
 
 //   Real * increment_val = increment->storage();
 //   Real * displacement_val = displacement->storage();
 //   bool * blocked_dofs_val = blocked_dofs->storage();
 
 //   for (UInt n = 0; n < nb_nodes; ++n) {
 //     bool constrain_ij = false;
 //     for (UInt j = 0; j < nb_degree_of_freedom; j++) {
 //       if (boundary_normal(n, j)) {
 //         constrain_ij = true;
 //         break;
 //       }
 //     }
 //     if (constrain_ij) {
 //       if (nb_degree_of_freedom == 2) {
 //         Real Theta = EulerAngles(n, 0);
 //         T(0, 0) = cos(Theta);
 //         T(0, 1) = -sin(Theta);
 //         T(1, 1) = cos(Theta);
 //         T(1, 0) = sin(Theta);
 //       } else if (nb_degree_of_freedom == 3) {
 //         Real Theta_x = EulerAngles(n, 0);
 //         Real Theta_y = EulerAngles(n, 1);
 //         Real Theta_z = EulerAngles(n, 2);
 
 //         T(0, 0) = cos(Theta_y) * cos(Theta_z);
 //         T(0, 1) = -cos(Theta_y) * sin(Theta_z);
 //         T(0, 2) = sin(Theta_y);
 //         T(1, 0) = cos(Theta_x) * sin(Theta_z) + cos(Theta_z) * sin(Theta_x) * sin(Theta_y);
 //         T(1, 1) = cos(Theta_x) * cos(Theta_z) - sin(Theta_x) * sin(Theta_y) * sin(Theta_z);
 //         T(1, 2) = -cos(Theta_y) * sin(Theta_x);
 //         T(2, 0) = sin(Theta_x) * sin(Theta_z) - cos(Theta_x) * cos(Theta_z) * sin(Theta_y);
 //         T(2, 1) = cos(Theta_z) * sin(Theta_x) + cos(Theta_x) * sin(Theta_y) * sin(Theta_z);
 //         T(2, 2) = cos(Theta_x) * cos(Theta_y);
 //       }
 //       small_rhs.clear();
 //       T_small_rhs.clear();
 //       for (UInt j = 0; j < nb_degree_of_freedom; j++)
 //         if(!(boundary_normal(n,j)) )
 //           small_rhs(j,j)=increment_val[j];
 
 //       T_small_rhs.mul<true, false>(T,small_rhs);
 
 //       for (UInt j = 0; j < nb_degree_of_freedom; j++){
 //         if(!(boundary_normal(n,j))){
 //           for (UInt k = 0; k < nb_degree_of_freedom; k++)
 //             displacement_val[k]+=T_small_rhs(k,j);
 //         }
 //       }
 
 
 //       displacement_val += nb_degree_of_freedom;
 //       blocked_dofs_val += nb_degree_of_freedom;
 //       increment_val += nb_degree_of_freedom;
 
 //     } else {
 //       for (UInt j = 0; j < nb_degree_of_freedom; j++, ++displacement_val, ++increment_val, ++blocked_dofs_val) {
 //         if (!(*blocked_dofs_val)) {
 //           *displacement_val += *increment_val;
 //         }
 //       }
 //     }
 
 //   }
 
 //   AKANTU_DEBUG_OUT();
 // }
 
 /* -------------------------------------------------------------------------- */
 SparseMatrix & SolidMechanicsModel::initVelocityDampingMatrix() {
   if(!velocity_damping_matrix)
     velocity_damping_matrix =
       new SparseMatrix(*jacobian_matrix, id + ":velocity_damping_matrix", memory_id);
 
   return *velocity_damping_matrix;
 }
 
 /* -------------------------------------------------------------------------- */
 template<>
 bool SolidMechanicsModel::testConvergence<_scc_increment>(Real tolerance, Real & error){
   AKANTU_DEBUG_IN();
 
   UInt nb_nodes = displacement->getSize();
   UInt nb_degree_of_freedom = displacement->getNbComponent();
 
   error = 0;
   Real norm[2] = {0., 0.};
   Real * increment_val    = increment->storage();
   bool * blocked_dofs_val     = blocked_dofs->storage();
   Real * displacement_val = displacement->storage();
 
   for (UInt n = 0; n < nb_nodes; ++n) {
     bool is_local_node = mesh.isLocalOrMasterNode(n);
     for (UInt d = 0; d < nb_degree_of_freedom; ++d) {
       if(!(*blocked_dofs_val) && is_local_node) {
         norm[0] += *increment_val * *increment_val;
         norm[1] += *displacement_val * *displacement_val;
       }
       blocked_dofs_val++;
       increment_val++;
       displacement_val++;
     }
   }
 
   StaticCommunicator::getStaticCommunicator().allReduce(norm, 2, _so_sum);
 
   norm[0] = sqrt(norm[0]);
   norm[1] = sqrt(norm[1]);
 
   AKANTU_DEBUG_ASSERT(!Math::isnan(norm[0]), "Something goes wrong in the solve phase");
 
   if (norm[1] < Math::getTolerance()) {
     error = norm[0];
     AKANTU_DEBUG_OUT();
     //    cout<<"Error 1: "<<error<<endl;
     return error < tolerance;
   }
 
 
   AKANTU_DEBUG_OUT();
   if(norm[1] > Math::getTolerance())
     error = norm[0] / norm[1];
   else
     error = norm[0]; //In case the total displacement is zero!
 
   //  cout<<"Error 2: "<<error<<endl;
 
   return (error < tolerance);
 }
 
 
 /* -------------------------------------------------------------------------- */
 template<>
 bool SolidMechanicsModel::testConvergence<_scc_residual>(Real tolerance, Real & norm) {
   AKANTU_DEBUG_IN();
 
 
 
   UInt nb_nodes = residual->getSize();
 
   norm = 0;
   Real * residual_val = residual->storage();
   bool * blocked_dofs_val = blocked_dofs->storage();
 
   for (UInt n = 0; n < nb_nodes; ++n) {
     bool is_local_node = mesh.isLocalOrMasterNode(n);
     if(is_local_node) {
       for (UInt d = 0; d < spatial_dimension; ++d) {
         if(!(*blocked_dofs_val)) {
           norm += *residual_val * *residual_val;
         }
         blocked_dofs_val++;
         residual_val++;
       }
     } else {
       blocked_dofs_val += spatial_dimension;
       residual_val += spatial_dimension;
     }
   }
 
   StaticCommunicator::getStaticCommunicator().allReduce(&norm, 1, _so_sum);
 
   norm = sqrt(norm);
 
   AKANTU_DEBUG_ASSERT(!Math::isnan(norm), "Something goes wrong in the solve phase");
 
   AKANTU_DEBUG_OUT();
   return (norm < tolerance);
 }
 
 /* -------------------------------------------------------------------------- */
 template<>
 bool SolidMechanicsModel::testConvergence<_scc_residual_mass_wgh>(Real tolerance,
                                                                   Real & norm) {
   AKANTU_DEBUG_IN();
 
 
 
   UInt nb_nodes = residual->getSize();
 
   norm = 0;
   Real * residual_val = residual->storage();
   Real * mass_val = this->mass->storage();
   bool * blocked_dofs_val = blocked_dofs->storage();
 
   for (UInt n = 0; n < nb_nodes; ++n) {
     bool is_local_node = mesh.isLocalOrMasterNode(n);
     if(is_local_node) {
       for (UInt d = 0; d < spatial_dimension; ++d) {
         if(!(*blocked_dofs_val)) {
           norm += *residual_val * *residual_val/(*mass_val * *mass_val);
         }
         blocked_dofs_val++;
         residual_val++;
         mass_val++;
       }
     } else {
       blocked_dofs_val += spatial_dimension;
       residual_val += spatial_dimension;
       mass_val += spatial_dimension;
     }
   }
 
   StaticCommunicator::getStaticCommunicator().allReduce(&norm, 1, _so_sum);
 
   norm = sqrt(norm);
 
   AKANTU_DEBUG_ASSERT(!Math::isnan(norm), "Something goes wrong in the solve phase");
 
   AKANTU_DEBUG_OUT();
   return (norm < tolerance);
 }
 
 /* -------------------------------------------------------------------------- */
 bool SolidMechanicsModel::testConvergenceResidual(Real tolerance){
   AKANTU_DEBUG_IN();
 
   Real error=0;
   bool res = this->testConvergence<_scc_residual>(tolerance, error);
   AKANTU_DEBUG_OUT();
   return res;
 }
 
 /* -------------------------------------------------------------------------- */
 bool SolidMechanicsModel::testConvergenceResidual(Real tolerance, Real & error){
   AKANTU_DEBUG_IN();
 
   bool res = this->testConvergence<_scc_residual>(tolerance, error);
 
   AKANTU_DEBUG_OUT();
   return res;
 }
 
 /* -------------------------------------------------------------------------- */
 bool SolidMechanicsModel::testConvergenceIncrement(Real tolerance){
   AKANTU_DEBUG_IN();
 
   Real error=0;
   bool res = this->testConvergence<_scc_increment>(tolerance, error);
 
   AKANTU_DEBUG_OUT();
   return res;
 }
 
 /* -------------------------------------------------------------------------- */
 bool SolidMechanicsModel::testConvergenceIncrement(Real tolerance, Real & error){
   AKANTU_DEBUG_IN();
 
   bool res = this->testConvergence<_scc_increment>(tolerance, error);
 
   AKANTU_DEBUG_OUT();
   return res;
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::implicitPred() {
   AKANTU_DEBUG_IN();
 
   if(previous_displacement) previous_displacement->copy(*displacement);
 
   if(method == _implicit_dynamic)
     integrator->integrationSchemePred(time_step,
                                       *displacement,
                                       *velocity,
                                       *acceleration,
                                       *blocked_dofs);
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::implicitCorr() {
   AKANTU_DEBUG_IN();
 
   if(method == _implicit_dynamic) {
     integrator->integrationSchemeCorrDispl(time_step,
                                            *displacement,
                                            *velocity,
                                            *acceleration,
                                            *blocked_dofs,
                                            *increment);
   } else {
     UInt nb_nodes = displacement->getSize();
     UInt nb_degree_of_freedom = displacement->getNbComponent() * nb_nodes;
 
     Real * incr_val = increment->storage();
     Real * disp_val = displacement->storage();
     bool * boun_val = blocked_dofs->storage();
 
     for (UInt j = 0; j < nb_degree_of_freedom; ++j, ++disp_val, ++incr_val, ++boun_val){
       *incr_val *= (1. - *boun_val);
       *disp_val += *incr_val;
     }
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::updateIncrement() {
   AKANTU_DEBUG_IN();
 
   AKANTU_DEBUG_ASSERT(previous_displacement,"The previous displacement has to be initialized."
                       << " Are you working with Finite or Ineslactic deformations?");
 
   UInt nb_nodes = displacement->getSize();
   UInt nb_degree_of_freedom = displacement->getNbComponent() * nb_nodes;
 
   Real * incr_val = increment->storage();
   Real * disp_val = displacement->storage();
   Real * prev_disp_val = previous_displacement->storage();
 
   for (UInt j = 0; j < nb_degree_of_freedom; ++j, ++disp_val, ++incr_val, ++prev_disp_val)
     *incr_val = (*disp_val - *prev_disp_val);
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::updatePreviousDisplacement() {
   AKANTU_DEBUG_IN();
 
   AKANTU_DEBUG_ASSERT(previous_displacement,"The previous displacement has to be initialized."
                       << " Are you working with Finite or Ineslactic deformations?");
 
   previous_displacement->copy(*displacement);
 
   AKANTU_DEBUG_OUT();
 }
 /* -------------------------------------------------------------------------- */
 /* Information                                                                */
 /* -------------------------------------------------------------------------- */
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::synchronizeBoundaries() {
   AKANTU_DEBUG_IN();
   AKANTU_DEBUG_ASSERT(synch_registry,"Synchronizer registry was not initialized."
                       << " Did you call initParallel?");
   synch_registry->synchronize(_gst_smm_boundary);
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::synchronizeResidual() {
   AKANTU_DEBUG_IN();
   AKANTU_DEBUG_ASSERT(synch_registry,"Synchronizer registry was not initialized."
                       << " Did you call initPBC?");
   synch_registry->synchronize(_gst_smm_res);
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::setIncrementFlagOn() {
   AKANTU_DEBUG_IN();
 
   if(!increment) {
     UInt nb_nodes = mesh.getNbNodes();
     std::stringstream sstr_inc; sstr_inc << id << ":increment";
     increment = &(alloc<Real>(sstr_inc.str(), nb_nodes, spatial_dimension, 0.));
   }
 
   increment_flag = true;
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 Real SolidMechanicsModel::getStableTimeStep() {
   AKANTU_DEBUG_IN();
 
   Real min_dt = getStableTimeStep(_not_ghost);
 
   /// reduction min over all processors
   StaticCommunicator::getStaticCommunicator().allReduce(&min_dt, 1, _so_min);
 
   AKANTU_DEBUG_OUT();
   return min_dt;
 }
 
 /* -------------------------------------------------------------------------- */
 Real SolidMechanicsModel::getStableTimeStep(const GhostType & ghost_type) {
   AKANTU_DEBUG_IN();
 
   Material ** mat_val = &(materials.at(0));
   Real min_dt = std::numeric_limits<Real>::max();
 
   updateCurrentPosition();
 
   Element elem;
   elem.ghost_type = ghost_type;
   elem.kind = _ek_regular;
 
   Mesh::type_iterator it  = mesh.firstType(spatial_dimension, ghost_type);
   Mesh::type_iterator end = mesh.lastType(spatial_dimension, ghost_type);
   for(; it != end; ++it) {
     elem.type = *it;
     UInt nb_nodes_per_element = mesh.getNbNodesPerElement(*it);
     UInt nb_element           = mesh.getNbElement(*it);
 
     Array<UInt>::iterator< Vector<UInt> > eibm =
       element_index_by_material(*it, ghost_type).begin(2);
 
     Array<Real> X(0, nb_nodes_per_element*spatial_dimension);
     FEEngine::extractNodalToElementField(mesh, *current_position,
                                          X, *it, _not_ghost);
 
     Array<Real>::matrix_iterator X_el =
       X.begin(spatial_dimension, nb_nodes_per_element);
 
     for (UInt el = 0; el < nb_element; ++el, ++X_el, ++eibm) {
       elem.element = (*eibm)(1);
       Real el_h  = getFEEngine().getElementInradius(*X_el, *it);
       Real el_c  = mat_val[(*eibm)(0)]->getCelerity(elem);
       Real el_dt = el_h / el_c;
 
       min_dt = std::min(min_dt, el_dt);
     }
   }
 
   AKANTU_DEBUG_OUT();
   return min_dt;
 }
 
 /* -------------------------------------------------------------------------- */
 Real SolidMechanicsModel::getPotentialEnergy() {
   AKANTU_DEBUG_IN();
   Real energy = 0.;
 
   /// call update residual on each local elements
   std::vector<Material *>::iterator mat_it;
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     energy += (*mat_it)->getPotentialEnergy();
   }
 
   /// reduction sum over all processors
   StaticCommunicator::getStaticCommunicator().allReduce(&energy, 1, _so_sum);
 
   AKANTU_DEBUG_OUT();
   return energy;
 }
 
 /* -------------------------------------------------------------------------- */
 Real SolidMechanicsModel::getKineticEnergy() {
   AKANTU_DEBUG_IN();
 
   if (!mass && !mass_matrix)
     AKANTU_DEBUG_ERROR("No function called to assemble the mass matrix.");
 
 
   Real ekin = 0.;
 
   UInt nb_nodes = mesh.getNbNodes();
 
   Real * vel_val  = velocity->storage();
   Real * mass_val = mass->storage();
 
   for (UInt n = 0; n < nb_nodes; ++n) {
     Real mv2 = 0;
     bool is_local_node = mesh.isLocalOrMasterNode(n);
     bool is_not_pbc_slave_node = !isPBCSlaveNode(n);
     bool count_node = is_local_node && is_not_pbc_slave_node;
     for (UInt i = 0; i < spatial_dimension; ++i) {
       if (count_node)
         mv2 += *vel_val * *vel_val * *mass_val;
 
       vel_val++;
       mass_val++;
     }
     ekin += mv2;
   }
 
   StaticCommunicator::getStaticCommunicator().allReduce(&ekin, 1, _so_sum);
 
   AKANTU_DEBUG_OUT();
   return ekin * .5;
 }
 
 /* -------------------------------------------------------------------------- */
 Real SolidMechanicsModel::getKineticEnergy(const ElementType & type, UInt index) {
   AKANTU_DEBUG_IN();
 
   UInt nb_quadrature_points = getFEEngine().getNbQuadraturePoints(type);
 
   Array<Real> vel_on_quad(nb_quadrature_points, spatial_dimension);
   Array<UInt> filter_element(1, 1, index);
 
   getFEEngine().interpolateOnQuadraturePoints(*velocity, vel_on_quad,
                                               spatial_dimension,
                                               type, _not_ghost,
                                               filter_element);
 
   Array<Real>::vector_iterator vit   = vel_on_quad.begin(spatial_dimension);
   Array<Real>::vector_iterator vend  = vel_on_quad.end(spatial_dimension);
 
   Vector<Real> rho_v2(nb_quadrature_points);
 
   Real rho = materials[element_index_by_material(type)(index, 0)]->getRho();
 
   for (UInt q = 0; vit != vend; ++vit, ++q) {
     rho_v2(q) = rho * vit->dot(*vit);
   }
 
   AKANTU_DEBUG_OUT();
 
   return .5*getFEEngine().integrate(rho_v2, type, index);
 }
 
 
 /* -------------------------------------------------------------------------- */
 Real SolidMechanicsModel::getExternalWork() {
   AKANTU_DEBUG_IN();
 
   Real * velo = velocity->storage();
   Real * forc = force->storage();
   Real * resi = residual->storage();
   bool * boun = blocked_dofs->storage();
 
   Real work = 0.;
 
   UInt nb_nodes = mesh.getNbNodes();
 
   for (UInt n = 0; n < nb_nodes; ++n) {
     bool is_local_node = mesh.isLocalOrMasterNode(n);
     bool is_not_pbc_slave_node = !isPBCSlaveNode(n);
     bool count_node = is_local_node && is_not_pbc_slave_node;
 
     for (UInt i = 0; i < spatial_dimension; ++i) {
       if (count_node) {
         if(*boun)
           work -= *resi * *velo * time_step;
         else
           work += *forc * *velo * time_step;
       }
 
       ++velo;
       ++forc;
       ++resi;
       ++boun;
     }
   }
 
   StaticCommunicator::getStaticCommunicator().allReduce(&work, 1, _so_sum);
 
   AKANTU_DEBUG_OUT();
   return work;
 }
 
 /* -------------------------------------------------------------------------- */
 Real SolidMechanicsModel::getEnergy(const std::string & energy_id) {
   AKANTU_DEBUG_IN();
 
   if (energy_id == "kinetic") {
     return getKineticEnergy();
   } else if (energy_id == "external work"){
     return getExternalWork();
   }
 
   Real energy = 0.;
   std::vector<Material *>::iterator mat_it;
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     energy += (*mat_it)->getEnergy(energy_id);
   }
 
   /// reduction sum over all processors
   StaticCommunicator::getStaticCommunicator().allReduce(&energy, 1, _so_sum);
 
   AKANTU_DEBUG_OUT();
   return energy;
 }
 /* -------------------------------------------------------------------------- */
 Real SolidMechanicsModel::getEnergy(const std::string & energy_id,
                                     const ElementType & type,
                                     UInt index){
   AKANTU_DEBUG_IN();
 
   if (energy_id == "kinetic") {
     return getKineticEnergy(type, index);
   }
 
   std::vector<Material *>::iterator mat_it;
   Vector<UInt> mat = element_index_by_material(type, _not_ghost).begin(2)[index];
   Real energy = materials[mat(0)]->getEnergy(energy_id, type, mat(1));
 
   AKANTU_DEBUG_OUT();
   return energy;
 }
 
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::onNodesAdded(const Array<UInt> & nodes_list,
                                        __attribute__((unused)) const NewNodesEvent & event) {
   AKANTU_DEBUG_IN();
   UInt nb_nodes = mesh.getNbNodes();
 
   if(displacement) displacement->resize(nb_nodes);
   if(mass        ) mass        ->resize(nb_nodes);
   if(velocity    ) velocity    ->resize(nb_nodes);
   if(acceleration) acceleration->resize(nb_nodes);
   if(force       ) force       ->resize(nb_nodes);
   if(residual    ) residual    ->resize(nb_nodes);
   if(blocked_dofs) blocked_dofs->resize(nb_nodes);
 
   if(previous_displacement) previous_displacement->resize(nb_nodes);
   if(increment_acceleration) increment_acceleration->resize(nb_nodes);
   if(increment) increment->resize(nb_nodes);
 
   if(current_position) current_position->resize(nb_nodes);
 
   delete dof_synchronizer;
   dof_synchronizer = new DOFSynchronizer(mesh, spatial_dimension);
   dof_synchronizer->initLocalDOFEquationNumbers();
   dof_synchronizer->initGlobalDOFEquationNumbers();
 
   std::vector<Material *>::iterator mat_it;
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     (*mat_it)->onNodesAdded(nodes_list, event);
   }
 
   if (method != _explicit_lumped_mass) {
     delete stiffness_matrix;
     delete jacobian_matrix;
     delete solver;
     SolverOptions  solver_options;
     initImplicit((method == _implicit_dynamic), solver_options);
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::onElementsAdded(const Array<Element> & element_list,
                                           const NewElementsEvent & event) {
   AKANTU_DEBUG_IN();
 
   getFEEngine().initShapeFunctions(_not_ghost);
   getFEEngine().initShapeFunctions(_ghost);
 
   Array<Element>::const_iterator<Element> it  = element_list.begin();
   Array<Element>::const_iterator<Element> end = element_list.end();
 
   /// \todo have rules to choose the correct material
   UInt mat_id = 0;
 
   UInt * mat_id_vect = NULL;
   try {
     const NewMaterialElementsEvent & event_mat = dynamic_cast<const NewMaterialElementsEvent &>(event);
     mat_id_vect = event_mat.getMaterialList().storage();
   } catch(...) {  }
 
   for (UInt el = 0; it != end; ++it, ++el) {
     const Element & elem = *it;
 
     if(mat_id_vect) mat_id = mat_id_vect[el];
     else mat_id = (*material_selector)(elem);
 
     Material & mat = *materials[mat_id];
 
     UInt mat_index = mat.addElement(elem.type, elem.element, elem.ghost_type);
     Vector<UInt> id(2);
     id[0] = mat_id; id[1] = mat_index;
     if(!element_index_by_material.exists(elem.type, elem.ghost_type))
       element_index_by_material.alloc(0, 2, elem.type, elem.ghost_type);
 
     element_index_by_material(elem.type, elem.ghost_type).push_back(id);
   }
 
   std::vector<Material *>::iterator mat_it;
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     (*mat_it)->onElementsAdded(element_list, event);
   }
 
   if(method != _explicit_lumped_mass) AKANTU_DEBUG_TO_IMPLEMENT();
 
   assembleMassLumped();
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::onElementsRemoved(__attribute__((unused)) const Array<Element> & element_list,
                                             const ElementTypeMapArray<UInt> & new_numbering,
                                             const RemovedElementsEvent & event) {
   //  MeshUtils::purifyMesh(mesh);
 
   getFEEngine().initShapeFunctions(_not_ghost);
   getFEEngine().initShapeFunctions(_ghost);
 
   std::vector<Material *>::iterator mat_it;
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     (*mat_it)->onElementsRemoved(element_list, new_numbering, event);
   }
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::onNodesRemoved(__attribute__((unused)) const Array<UInt> & element_list,
                                          const Array<UInt> & new_numbering,
                                          __attribute__((unused)) const RemovedNodesEvent & event) {
   if(displacement) mesh.removeNodesFromArray(*displacement, new_numbering);
   if(mass        ) mesh.removeNodesFromArray(*mass        , new_numbering);
   if(velocity    ) mesh.removeNodesFromArray(*velocity    , new_numbering);
   if(acceleration) mesh.removeNodesFromArray(*acceleration, new_numbering);
   if(force       ) mesh.removeNodesFromArray(*force       , new_numbering);
   if(residual    ) mesh.removeNodesFromArray(*residual    , new_numbering);
   if(blocked_dofs) mesh.removeNodesFromArray(*blocked_dofs, new_numbering);
 
   if(increment_acceleration) mesh.removeNodesFromArray(*increment_acceleration, new_numbering);
   if(increment)              mesh.removeNodesFromArray(*increment             , new_numbering);
 
   delete dof_synchronizer;
   dof_synchronizer = new DOFSynchronizer(mesh, spatial_dimension);
   dof_synchronizer->initLocalDOFEquationNumbers();
   dof_synchronizer->initGlobalDOFEquationNumbers();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::reassignMaterial() {
   AKANTU_DEBUG_IN();
 
   std::vector< Array<Element> > element_to_add   (materials.size());
   std::vector< Array<Element> > element_to_remove(materials.size());
 
   Element element;
   for (ghost_type_t::iterator gt = ghost_type_t::begin(); gt != ghost_type_t::end(); ++gt) {
     GhostType ghost_type = *gt;
     element.ghost_type = ghost_type;
 
     Mesh::type_iterator it  = mesh.firstType(spatial_dimension, ghost_type, _ek_regular);
     Mesh::type_iterator end = mesh.lastType(spatial_dimension, ghost_type, _ek_regular);
     for(; it != end; ++it) {
       ElementType type = *it;
       element.type = type;
       element.kind = Mesh::getKind(type);
 
       UInt nb_element = mesh.getNbElement(type, ghost_type);
       Array<UInt> & el_index_by_mat = element_index_by_material(type, ghost_type);
 
       for (UInt el = 0; el < nb_element; ++el) {
         element.element = el;
 
         UInt old_material = el_index_by_mat(el, 0);
         UInt new_material = (*material_selector)(element);
 
         if(old_material != new_material) {
           element_to_add   [new_material].push_back(element);
           element_to_remove[old_material].push_back(element);
         }
       }
     }
   }
 
   std::vector<Material *>::iterator mat_it;
   UInt mat_index = 0;
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it, ++mat_index) {
     (*mat_it)->removeElements(element_to_remove[mat_index]);
     (*mat_it)->addElements   (element_to_add[mat_index]);
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 bool SolidMechanicsModel::isInternal(const std::string & field_name,
 				     const ElementKind & element_kind){
 
   bool is_internal = false;
   
   /// check if at least one material contains field_id as an internal
   for (UInt m = 0; m < materials.size() && !is_internal; ++m) {
     is_internal |= materials[m]->isInternal(field_name, element_kind);
   }
   
   return is_internal;
 }
 /* -------------------------------------------------------------------------- */
 
 ElementTypeMap<UInt> SolidMechanicsModel::getInternalDataPerElem(const std::string & field_name,
 								const ElementKind & element_kind){
 
 
   if (!(this->isInternal(field_name,element_kind))) AKANTU_EXCEPTION("unknown internal " << field_name);
 
   for (UInt m = 0; m < materials.size() ; ++m) {
     if (materials[m]->isInternal(field_name, element_kind))
       return materials[m]->getInternalDataPerElem(field_name,element_kind);
   }
   
   return ElementTypeMap<UInt>();
 }
 
 
 /* -------------------------------------------------------------------------- */
 ElementTypeMapArray<Real> & SolidMechanicsModel::flattenInternal(const std::string & field_name,
 								const ElementKind & kind){
 
   std::pair<std::string,ElementKind> key(field_name,kind);
   if (this->registered_internals.count(key) == 0){
     this->registered_internals[key] =
       new ElementTypeMapArray<Real>(field_name,this->id);
   }
 
   ElementTypeMapArray<Real> * internal_flat = this->registered_internals[key];
   for (UInt m = 0; m < materials.size(); ++m)
     materials[m]->flattenInternal(field_name,*internal_flat,_not_ghost,kind);
   
   return  *internal_flat;
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::flattenAllRegisteredInternals(const ElementKind & kind){
 
   std::map<std::pair<std::string,ElementKind>,ElementTypeMapArray<Real> *> ::iterator it = this->registered_internals.begin();
   std::map<std::pair<std::string,ElementKind>,ElementTypeMapArray<Real> *>::iterator end = this->registered_internals.end();
 
   while (it != end){
     if (kind == it->first.second)
       this->flattenInternal(it->first.first,kind);
     ++it;
   }
 }
 
 /* -------------------------------------------------------------------------- */
 
 void SolidMechanicsModel::onDump(){
   this->flattenAllRegisteredInternals(_ek_regular);
 }
 /* -------------------------------------------------------------------------- */
 
 #ifdef AKANTU_USE_IOHELPER
 
 dumper::Field * SolidMechanicsModel
 ::createElementalField(const std::string & field_name, 
 		       const std::string & group_name,
 		       bool padding_flag,
 		       const ElementKind & kind){
   
   dumper::Field * field = NULL;
 
   if(field_name == "partitions") 
     field = mesh.createElementalField<UInt, dumper::ElementPartitionField>(mesh.getConnectivities(),group_name,this->spatial_dimension,kind);
   else if(field_name == "element_index_by_material") 
     field = mesh.createElementalField<UInt, Vector, dumper::ElementalField >(field_name,group_name,this->spatial_dimension,kind);
   else {
 
     bool is_internal = this->isInternal(field_name,kind);
 
     if (is_internal) {
 
       ElementTypeMap<UInt> nb_data_per_elem = this->getInternalDataPerElem(field_name,kind);
       ElementTypeMapArray<Real> & internal_flat = this->flattenInternal(field_name,kind);
       field = mesh.createElementalField<Real, dumper::InternalMaterialField>(internal_flat,
 									     group_name,
 									     this->spatial_dimension,kind,nb_data_per_elem);
       
       //treat the paddings
       if (padding_flag){
 	if (field_name == "stress"){
 	  if (this->spatial_dimension == 2) {
 	    dumper::StressPadder<2> * foo = new dumper::StressPadder<2>(*this);
 	    field = dumper::FieldComputeProxy::createFieldCompute(field,*foo);
 	  }
 	}
 	// else if (field_name == "strain"){
 	//   if (this->spatial_dimension == 2) {
 	//     dumper::StrainPadder<2> * foo = new dumper::StrainPadder<2>(*this);
 	//     field = dumper::FieldComputeProxy::createFieldCompute(field,*foo);
 	//   }
 	// }
       }
 
       // homogenize the field
       dumper::ComputeFunctorInterface * foo = 
 	dumper::HomogenizerProxy::createHomogenizer(*field);
 
       field = dumper::FieldComputeProxy::createFieldCompute(field,*foo);
 
     } 
   }
   return field;
 }
 
 /* -------------------------------------------------------------------------- */
 
 dumper::Field * SolidMechanicsModel::createNodalFieldReal(const std::string & field_name,
 							  const std::string & group_name,
 							  bool padding_flag) {
   
   std::map<std::string,Array<Real>* > real_nodal_fields;
   real_nodal_fields["displacement"             ] = displacement;
   real_nodal_fields["mass"                     ] = mass;
   real_nodal_fields["velocity"                 ] = velocity;
   real_nodal_fields["acceleration"             ] = acceleration;
   real_nodal_fields["force"                    ] = force;
   real_nodal_fields["residual"                 ] = residual;
   real_nodal_fields["increment"                ] = increment;
 
   dumper::Field * field = NULL;
   if (padding_flag)
     field = mesh.createNodalField(real_nodal_fields[field_name],group_name, 3);
   else
     field = mesh.createNodalField(real_nodal_fields[field_name],group_name);
   
   return field;
 }
 /* -------------------------------------------------------------------------- */
 
 dumper::Field * SolidMechanicsModel::createNodalFieldBool(const std::string & field_name,
 							  const std::string & group_name,
 bool padding_flag) {
   
   std::map<std::string,Array<bool>* > uint_nodal_fields;
   uint_nodal_fields["blocked_dofs"             ] = blocked_dofs;
 
   dumper::Field * field = NULL;
   field = mesh.createNodalField(uint_nodal_fields[field_name],group_name);
   return field;
 
 }
 /* -------------------------------------------------------------------------- */
 #else
 /* -------------------------------------------------------------------------- */
 
 dumper::Field * SolidMechanicsModel
 ::createElementalField(const std::string & field_name, 
 		       const std::string & group_name,
 		       bool padding_flag,
 		       const ElementKind & kind){
   return NULL;
 }
 
 /* -------------------------------------------------------------------------- */
 
 dumper::Field * SolidMechanicsModel::createNodalFieldReal(const std::string & field_name,
 							  const std::string & group_name,
 							  bool padding_flag) {
   return NULL;
 }
 
 /* -------------------------------------------------------------------------- */
 
 dumper::Field * SolidMechanicsModel::createNodalFieldBool(const std::string & field_name,
 							  const std::string & group_name,
 bool padding_flag) {
   return NULL;
 }
 
 #endif
 /* -------------------------------------------------------------------------- */
 
 void SolidMechanicsModel::dump(const std::string & dumper_name) {
   this->onDump();
   EventManager::sendEvent(SolidMechanicsModelEvent::BeforeDumpEvent());
   synch_registry->synchronize(_gst_for_dump);
   mesh.dump(dumper_name);
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::dump(const std::string & dumper_name, UInt step) {
   this->onDump();
   EventManager::sendEvent(SolidMechanicsModelEvent::BeforeDumpEvent());
   synch_registry->synchronize(_gst_for_dump);
   mesh.dump(dumper_name, step);
 }
 
 /* ------------------------------------------------------------------------- */
 void SolidMechanicsModel::dump(const std::string & dumper_name, Real time, UInt step) {
   this->onDump();
   EventManager::sendEvent(SolidMechanicsModelEvent::BeforeDumpEvent());
   synch_registry->synchronize(_gst_for_dump);
   mesh.dump(dumper_name, time, step);
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::dump() {
   this->onDump();
   EventManager::sendEvent(SolidMechanicsModelEvent::BeforeDumpEvent());
   mesh.dump();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::dump(UInt step) {
   this->onDump();
   EventManager::sendEvent(SolidMechanicsModelEvent::BeforeDumpEvent());
   mesh.dump(step);
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::dump(Real time, UInt step) {
   this->onDump();
   EventManager::sendEvent(SolidMechanicsModelEvent::BeforeDumpEvent());
   mesh.dump(time, step);
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::computeCauchyStresses() {
   AKANTU_DEBUG_IN();
 
   // call compute stiffness matrix on each local elements
   std::vector<Material *>::iterator mat_it;
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     Material & mat = **mat_it;
     if(mat.isFiniteDeformation())
       mat.computeAllCauchyStresses(_not_ghost);
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::saveStressAndStrainBeforeDamage() {
   EventManager::sendEvent(SolidMechanicsModelEvent::BeginningOfDamageIterationEvent());
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::updateEnergiesAfterDamage() {
   EventManager::sendEvent(SolidMechanicsModelEvent::AfterDamageEvent());
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModel::printself(std::ostream & stream, int indent) const {
   std::string space;
   for(Int i = 0; i < indent; i++, space += AKANTU_INDENT);
 
   stream << space << "Solid Mechanics Model [" << std::endl;
   stream << space << " + id                : " << id << std::endl;
   stream << space << " + spatial dimension : " << spatial_dimension << std::endl;
   stream << space << " + fem [" << std::endl;
   getFEEngine().printself(stream, indent + 2);
   stream << space << AKANTU_INDENT << "]" << std::endl;
   stream << space << " + nodals information [" << std::endl;
   displacement->printself(stream, indent + 2);
   mass        ->printself(stream, indent + 2);
   velocity    ->printself(stream, indent + 2);
   acceleration->printself(stream, indent + 2);
   force       ->printself(stream, indent + 2);
   residual    ->printself(stream, indent + 2);
   blocked_dofs->printself(stream, indent + 2);
   stream << space << AKANTU_INDENT << "]" << std::endl;
 
   stream << space << " + connectivity type information [" << std::endl;
   element_index_by_material.printself(stream, indent + 2);
   stream << space << AKANTU_INDENT << "]" << std::endl;
 
   stream << space << " + materials [" << std::endl;
   std::vector<Material *>::const_iterator mat_it;
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     const Material & mat = *(*mat_it);
     mat.printself(stream, indent + 1);
   }
   stream << space << AKANTU_INDENT << "]" << std::endl;
 
   stream << space << "]" << std::endl;
 }
 
 /* -------------------------------------------------------------------------- */
 
 __END_AKANTU__
diff --git a/src/model/solid_mechanics/solid_mechanics_model_cohesive.cc b/src/model/solid_mechanics/solid_mechanics_model_cohesive.cc
index 8c50b1e9a..1991a4f54 100644
--- a/src/model/solid_mechanics/solid_mechanics_model_cohesive.cc
+++ b/src/model/solid_mechanics/solid_mechanics_model_cohesive.cc
@@ -1,903 +1,904 @@
 /**
  * @file   solid_mechanics_model_cohesive.cc
  *
  * @author Marco Vocialta <marco.vocialta@epfl.ch>
  *
  * @date   Tue May 08 13:01:18 2012
  *
  * @brief  Solid mechanics model for cohesive elements
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 #include <algorithm>
 #include "shape_cohesive.hh"
 #include "solid_mechanics_model_cohesive.hh"
+#include "dumpable_inline_impl.hh"
 #include "material_cohesive.hh"
 
 #ifdef AKANTU_USE_IOHELPER
 #  include "dumper_paraview.hh"
 #endif
 
 /* -------------------------------------------------------------------------- */
 
 __BEGIN_AKANTU__
 
 const SolidMechanicsModelCohesiveOptions default_solid_mechanics_model_cohesive_options(_explicit_lumped_mass,
 											false,
 											false,
 											true);
 
 /* -------------------------------------------------------------------------- */
 
 SolidMechanicsModelCohesive::SolidMechanicsModelCohesive(Mesh & mesh,
 							 UInt dim,
 							 const ID & id,
 							 const MemoryID & memory_id) :
   SolidMechanicsModel(mesh, dim, id, memory_id),
   tangents("tangents", id),
   stress_on_facet("stress_on_facet", id),
   facet_stress("facet_stress", id),
   facet_material("facet_material", id) {
   AKANTU_DEBUG_IN();
 
   inserter = NULL;
 
 #if defined(AKANTU_PARALLEL_COHESIVE_ELEMENT)
   facet_synchronizer = NULL;
   facet_stress_synchronizer = NULL;
   cohesive_distributed_synchronizer = NULL;
   global_connectivity = NULL;
 #endif
 
   delete material_selector;
   material_selector = new DefaultMaterialCohesiveSelector(*this);
 
   this->registerEventHandler(*this);
 
 #if defined(AKANTU_USE_IOHELPER)
   this->mesh.registerDumper<DumperParaview>("cohesive elements", id);
   this->mesh.addDumpMeshToDumper("cohesive elements",
 			    mesh, spatial_dimension, _not_ghost, _ek_cohesive);
 #endif
 
   AKANTU_DEBUG_OUT();
 }
 
 
 /* -------------------------------------------------------------------------- */
 SolidMechanicsModelCohesive::~SolidMechanicsModelCohesive() {
   AKANTU_DEBUG_IN();
 
   delete inserter;
 
 #if defined(AKANTU_PARALLEL_COHESIVE_ELEMENT)
   delete cohesive_distributed_synchronizer;
   delete facet_synchronizer;
   delete facet_stress_synchronizer;
 #endif
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::setTimeStep(Real time_step) {
   SolidMechanicsModel::setTimeStep(time_step);
 
 #if defined(AKANTU_USE_IOHELPER)
   this->mesh.getDumper("cohesive elements").setTimeStep(time_step);
 #endif
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::initFull(const ModelOptions & options) {
   AKANTU_DEBUG_IN();
 
   const SolidMechanicsModelCohesiveOptions & smmc_options =
     dynamic_cast<const SolidMechanicsModelCohesiveOptions &>(options);
 
   this->stress_interpolation = smmc_options.stress_interpolation;
   this->is_extrinsic = smmc_options.extrinsic;
 
   if (!inserter)
     inserter = new CohesiveElementInserter(mesh, is_extrinsic, synch_parallel,
 					   id+":cohesive_element_inserter");
 
   SolidMechanicsModel::initFull(options);
 
 #if defined(AKANTU_PARALLEL_COHESIVE_ELEMENT)
   if (facet_synchronizer != NULL)
     inserter->initParallel(facet_synchronizer);
 #endif
 
   if (is_extrinsic)
     initAutomaticInsertion();
 
   AKANTU_DEBUG_OUT();
 }
 
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::initMaterials() {
   AKANTU_DEBUG_IN();
 
   // make sure the material are instantiated
   if(!are_materials_instantiated) instantiateMaterials();
 
   /// find the first cohesive material
   UInt cohesive_index = 0;
 
   while ((dynamic_cast<MaterialCohesive *>(materials[cohesive_index]) == NULL)
 	 && cohesive_index <= materials.size())
     ++cohesive_index;
 
   AKANTU_DEBUG_ASSERT(cohesive_index != materials.size(),
 		      "No cohesive materials in the material input file");
 
   material_selector->setFallback(cohesive_index);
 
   // set the facet information in the material in case of dynamic insertion
   if (is_extrinsic) {
     const Mesh & mesh_facets = inserter->getMeshFacets();
     mesh_facets.initElementTypeMapArray(facet_material, 1, spatial_dimension - 1);
 
     Element element;
     for (ghost_type_t::iterator gt = ghost_type_t::begin(); gt != ghost_type_t::end(); ++gt) {
       element.ghost_type = *gt;
       Mesh::type_iterator first = mesh_facets.firstType(spatial_dimension - 1, *gt);
       Mesh::type_iterator last  = mesh_facets.lastType(spatial_dimension - 1, *gt);
       for(;first != last; ++first) {
 	element.type = *first;
 	Array<UInt> & f_material = facet_material(*first, *gt);
 	UInt nb_element = mesh_facets.getNbElement(*first, *gt);
 	f_material.resize(nb_element);
 	f_material.set(cohesive_index);
 	for (UInt el = 0; el < nb_element; ++el) {
 	  element.element = el;
 	  UInt mat_index = (*material_selector)(element);
 	  f_material(el) = mat_index;
 	  MaterialCohesive & mat = dynamic_cast<MaterialCohesive &>(*materials[mat_index]);
 	  mat.addFacet(element);
 	}
       }
     }
   } else {
     for (ghost_type_t::iterator gt = ghost_type_t::begin(); gt != ghost_type_t::end(); ++gt) {
       Mesh::type_iterator first = mesh.firstType(spatial_dimension, *gt, _ek_cohesive);
       Mesh::type_iterator last  = mesh.lastType(spatial_dimension, *gt, _ek_cohesive);
 
       for(;first != last; ++first) {
 	Array<UInt> & el_id_by_mat = element_index_by_material(*first, *gt);
 	Vector<UInt> el_mat(2); el_mat(0) = cohesive_index; el_mat(1) = 0;
 	el_id_by_mat.set(el_mat);
       }
     }
   }
 
   SolidMechanicsModel::initMaterials();
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 /**
  * Initialize the model,basically it  pre-compute the shapes, shapes derivatives
  * and jacobian
  *
  */
 void SolidMechanicsModelCohesive::initModel() {
   AKANTU_DEBUG_IN();
 
   SolidMechanicsModel::initModel();
 
   registerFEEngineObject<MyFEEngineCohesiveType>("CohesiveFEEngine", mesh, spatial_dimension);
 
   /// add cohesive type connectivity
   ElementType type = _not_defined;
 
   for (ghost_type_t::iterator gt = ghost_type_t::begin();
        gt != ghost_type_t::end(); ++gt) {
 
     GhostType type_ghost = *gt;
 
     Mesh::type_iterator it   = mesh.firstType(spatial_dimension, type_ghost);
     Mesh::type_iterator last = mesh.lastType(spatial_dimension, type_ghost);
 
     for (; it != last; ++it) {
       const Array<UInt> & connectivity = mesh.getConnectivity(*it, type_ghost);
       if (connectivity.getSize() != 0) {
 	type = *it;
 	ElementType type_facet = Mesh::getFacetType(type);
 	ElementType type_cohesive = FEEngine::getCohesiveElementType(type_facet);
 	mesh.addConnectivityType(type_cohesive, type_ghost);
       }
     }
   }
 
   AKANTU_DEBUG_ASSERT(type != _not_defined, "No elements in the mesh");
 
   getFEEngine("CohesiveFEEngine").initShapeFunctions(_not_ghost);
   getFEEngine("CohesiveFEEngine").initShapeFunctions(_ghost);
 
   registerFEEngineObject<MyFEEngineType>("FacetsFEEngine",
 					 mesh.getMeshFacets(),
 					 spatial_dimension - 1);
 
   if (is_extrinsic) {
     getFEEngine("FacetsFEEngine").initShapeFunctions(_not_ghost);
     getFEEngine("FacetsFEEngine").initShapeFunctions(_ghost);
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::limitInsertion(BC::Axis axis,
 						 Real first_limit,
 						 Real second_limit) {
   AKANTU_DEBUG_IN();
   inserter->setLimit(axis, first_limit, second_limit);
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::insertIntrinsicElements() {
   AKANTU_DEBUG_IN();
   inserter->insertIntrinsicElements();
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::initAutomaticInsertion() {
   AKANTU_DEBUG_IN();
 
 #if defined(AKANTU_PARALLEL_COHESIVE_ELEMENT)
   if (facet_stress_synchronizer != NULL) {
     DataAccessor * data_accessor = this;
     const ElementTypeMapArray<UInt> & rank_to_element = synch_parallel->getPrankToElement();
 
     facet_stress_synchronizer->updateFacetStressSynchronizer(*inserter,
 							     rank_to_element,
 							     *data_accessor);
   }
 #endif
 
   inserter->getMeshFacets().initElementTypeMapArray(facet_stress,
 						    2 * spatial_dimension * spatial_dimension,
 						    spatial_dimension - 1);
 
   resizeFacetStress();
 
   /// compute normals on facets
   computeNormals();
 
   /// allocate stress_on_facet to store element stress on facets
   mesh.initElementTypeMapArray(stress_on_facet,
 			      spatial_dimension * spatial_dimension,
 			      spatial_dimension);
 
   Mesh::type_iterator it   = mesh.firstType(spatial_dimension);
   Mesh::type_iterator last = mesh.lastType(spatial_dimension);
 
   for (; it != last; ++it) {
     ElementType type = *it;
     UInt nb_element = mesh.getNbElement(type);
 
     UInt nb_facet_per_elem = Mesh::getNbFacetsPerElement(type);
     ElementType type_facet = Mesh::getFacetType(type);
     UInt nb_quad_per_facet = getFEEngine("FacetsFEEngine").getNbQuadraturePoints(type_facet);
 
     stress_on_facet(type).resize(nb_quad_per_facet * nb_facet_per_elem * nb_element);
   }
 
   if (stress_interpolation)
     initStressInterpolation();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::updateAutomaticInsertion() {
   AKANTU_DEBUG_IN();
 
   inserter->limitCheckFacets();
 
 #if defined(AKANTU_PARALLEL_COHESIVE_ELEMENT)
     if (facet_stress_synchronizer != NULL) {
       DataAccessor * data_accessor = this;
       const ElementTypeMapArray<UInt> & rank_to_element = synch_parallel->getPrankToElement();
 
       facet_stress_synchronizer->updateFacetStressSynchronizer(*inserter,
 							       rank_to_element,
 							       *data_accessor);
     }
 #endif
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::initStressInterpolation() {
   Mesh & mesh_facets = inserter->getMeshFacets();
 
   /// compute quadrature points coordinates on facets
   Array<Real> & position = mesh.getNodes();
 
   ElementTypeMapArray<Real> quad_facets("quad_facets", id);
   mesh_facets.initElementTypeMapArray(quad_facets,
 				     spatial_dimension, spatial_dimension - 1);
 
   getFEEngine("FacetsFEEngine").interpolateOnQuadraturePoints(position, quad_facets);
 
   /// compute elements quadrature point positions and build
   /// element-facet quadrature points data structure
   ElementTypeMapArray<Real> elements_quad_facets("elements_quad_facets", id);
 
   mesh.initElementTypeMapArray(elements_quad_facets,
 			      spatial_dimension,
 			      spatial_dimension);
 
   for (ghost_type_t::iterator gt = ghost_type_t::begin();
        gt != ghost_type_t::end(); ++gt) {
 
     GhostType elem_gt = *gt;
 
     Mesh::type_iterator it   = mesh.firstType(spatial_dimension, elem_gt);
     Mesh::type_iterator last = mesh.lastType(spatial_dimension, elem_gt);
 
     for (; it != last; ++it) {
       ElementType type = *it;
       UInt nb_element = mesh.getNbElement(type, elem_gt);
       if (nb_element == 0) continue;
 
       /// compute elements' quadrature points and list of facet
       /// quadrature points positions by element
       Array<Element> & facet_to_element = mesh_facets.getSubelementToElement(type,
 									     elem_gt);
       UInt nb_facet_per_elem = facet_to_element.getNbComponent();
 
       Array<Real> & el_q_facet = elements_quad_facets(type, elem_gt);
 
       ElementType facet_type = Mesh::getFacetType(type);
 
       UInt nb_quad_per_facet =
 	getFEEngine("FacetsFEEngine").getNbQuadraturePoints(facet_type);
 
       el_q_facet.resize(nb_element * nb_facet_per_elem * nb_quad_per_facet);
 
       for (UInt el = 0; el < nb_element; ++el) {
 	for (UInt f = 0; f < nb_facet_per_elem; ++f) {
 	  Element global_facet_elem = facet_to_element(el, f);
 	  UInt global_facet = global_facet_elem.element;
 	  GhostType facet_gt = global_facet_elem.ghost_type;
 	  const Array<Real> & quad_f = quad_facets(facet_type, facet_gt);
 
 	  for (UInt q = 0; q < nb_quad_per_facet; ++q) {
 	    for (UInt s = 0; s < spatial_dimension; ++s) {
 	      el_q_facet(el * nb_facet_per_elem * nb_quad_per_facet
 			 + f * nb_quad_per_facet + q, s)
 		= quad_f(global_facet * nb_quad_per_facet + q, s);
 	    }
 	  }
 	}
       }
     }
   }
 
   /// loop over non cohesive materials
   for (UInt m = 0; m < materials.size(); ++m) {
     try {
       MaterialCohesive & mat __attribute__((unused)) =
 	dynamic_cast<MaterialCohesive &>(*materials[m]);
     } catch(std::bad_cast&) {
       /// initialize the interpolation function
       materials[m]->initElementalFieldInterpolation(elements_quad_facets);
     }
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::updateResidual(bool need_initialize) {
   AKANTU_DEBUG_IN();
 
   if (need_initialize) initializeUpdateResidualData();
 
   // f -= fint
   std::vector<Material *>::iterator mat_it;
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     try {
       MaterialCohesive & mat = dynamic_cast<MaterialCohesive &>(**mat_it);
       mat.computeTraction(_not_ghost);
     } catch (std::bad_cast & bce) { }
   }
 
   SolidMechanicsModel::updateResidual(false);
 
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     try {
       MaterialCohesive & mat = dynamic_cast<MaterialCohesive &>(**mat_it);
       mat.computeEnergies();
     } catch (std::bad_cast & bce) { }
   }
 
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::computeNormals() {
   AKANTU_DEBUG_IN();
 
   Mesh & mesh_facets = inserter->getMeshFacets();
   getFEEngine("FacetsFEEngine").computeNormalsOnControlPoints(_not_ghost);
 
   /**
    *  @todo store tangents while computing normals instead of
    *  recomputing them as follows:
    */
   /* ------------------------------------------------------------------------ */
   UInt tangent_components = spatial_dimension * (spatial_dimension - 1);
 
   mesh_facets.initElementTypeMapArray(tangents,
 				     tangent_components,
 				     spatial_dimension - 1);
 
   Mesh::type_iterator it   = mesh_facets.firstType(spatial_dimension - 1);
   Mesh::type_iterator last = mesh_facets.lastType(spatial_dimension - 1);
 
   for (; it != last; ++it) {
     ElementType facet_type = *it;
 
     const Array<Real> & normals =
       getFEEngine("FacetsFEEngine").getNormalsOnQuadPoints(facet_type);
 
     UInt nb_quad = normals.getSize();
 
     Array<Real> & tang = tangents(facet_type);
     tang.resize(nb_quad);
 
     Real * normal_it = normals.storage();
     Real * tangent_it = tang.storage();
 
     /// compute first tangent
     for (UInt q = 0; q < nb_quad; ++q) {
 
       /// if normal is orthogonal to xy plane, arbitrarly define tangent
       if ( Math::are_float_equal(Math::norm2(normal_it), 0) )
 	tangent_it[0] = 1;
       else
 	Math::normal2(normal_it, tangent_it);
 
       normal_it += spatial_dimension;
       tangent_it += tangent_components;
     }
 
     /// compute second tangent (3D case)
     if (spatial_dimension == 3) {
       normal_it = normals.storage();
       tangent_it = tang.storage();
 
       for (UInt q = 0; q < nb_quad; ++q) {
 	Math::normal3(normal_it, tangent_it, tangent_it + spatial_dimension);
 	normal_it += spatial_dimension;
 	tangent_it += tangent_components;
       }
     }
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::averageStressOnFacets(UInt material_index) {
   AKANTU_DEBUG_IN();
 
   Mesh::type_iterator it   = mesh.firstType(spatial_dimension);
   Mesh::type_iterator last = mesh.lastType(spatial_dimension);
 
   /// loop over element type
   for (; it != last; ++it) {
     ElementType type = *it;
     UInt nb_element = mesh.getNbElement(type);
     UInt nb_quad_per_element = getFEEngine().getNbQuadraturePoints(type);
     const Array<Real> & stress = materials[material_index]->getStress(type);
     Array<Real> & s_on_facet = stress_on_facet(type);
 
     UInt nb_facet_per_elem = Mesh::getNbFacetsPerElement(type);
     ElementType type_facet = Mesh::getFacetType(type);
     UInt nb_quad_per_facet = getFEEngine("FacetsFEEngine").getNbQuadraturePoints(type_facet);
     UInt nb_facet_quad_per_elem = nb_quad_per_facet * nb_facet_per_elem;
 
     Array<Real>::const_iterator<Matrix<Real> > stress_it
       = stress.begin(spatial_dimension, spatial_dimension);
     Array<Real>::iterator<Matrix<Real> > s_on_facet_it
       = s_on_facet.begin(spatial_dimension, spatial_dimension);
 
     Matrix<Real> average_stress(spatial_dimension, spatial_dimension);
 
     for (UInt el = 0; el < nb_element; ++el) {
 
       /// compute average stress
       average_stress.clear();
 
       for (UInt q = 0; q < nb_quad_per_element; ++q, ++stress_it)
 	average_stress += *stress_it;
 
       average_stress /= nb_quad_per_element;
 
       /// store average stress
       for (UInt q = 0; q < nb_facet_quad_per_elem; ++q, ++s_on_facet_it)
 	*s_on_facet_it = average_stress;
     }
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::fillStressOnFacet() {
   AKANTU_DEBUG_IN();
 
   Mesh & mesh_facets = inserter->getMeshFacets();
   UInt sp2 = spatial_dimension * spatial_dimension;
   UInt sp4 = sp2 * 2;
 
   /// loop over materials
   for (UInt m = 0; m < materials.size(); ++m) {
     try {
       MaterialCohesive & mat __attribute__((unused)) =
 	dynamic_cast<MaterialCohesive &>(*materials[m]);
     } catch(std::bad_cast&) {
 
       if (stress_interpolation)
 	/// interpolate stress on facet quadrature points positions
 	materials[m]->interpolateStress(stress_on_facet);
       else
 	averageStressOnFacets(m);
 
       GhostType ghost_type = _not_ghost;
 
       Mesh::type_iterator it   = mesh.firstType(spatial_dimension, ghost_type);
       Mesh::type_iterator last = mesh.lastType(spatial_dimension, ghost_type);
 
       /// loop over element type
       for (; it != last; ++it) {
 	ElementType type = *it;
 	UInt nb_element = mesh.getNbElement(type, ghost_type);
 	if (nb_element == 0) continue;
 
 	Array<Real> & stress_on_f = stress_on_facet(type, ghost_type);
 
 	/// store the interpolated stresses on the facet_stress vector
 	Array<Element> & facet_to_element =
 	  mesh_facets.getSubelementToElement(type, ghost_type);
 
 	UInt nb_facet_per_elem = facet_to_element.getNbComponent();
 
 	Array<Element>::iterator<Vector<Element> > facet_to_el_it =
 	  facet_to_element.begin(nb_facet_per_elem);
 
 	Array<Real>::iterator< Matrix<Real> > stress_on_f_it =
 	  stress_on_f.begin(spatial_dimension, spatial_dimension);
 
 	ElementType facet_type = _not_defined;
 	GhostType facet_gt = _casper;
 	Array<std::vector<Element> > * element_to_facet = NULL;
 	Array<Real> * f_stress = NULL;
 	Array<bool> * f_check = NULL;
 	UInt nb_quad_per_facet = 0;
 	UInt element_rank = 0;
 
 	Element current_el(type, 0, ghost_type);
 
 	for (UInt el = 0; el < nb_element; ++el, ++facet_to_el_it) {
 	  current_el.element = el;
 	  for (UInt f = 0; f < nb_facet_per_elem; ++f) {
 	    Element global_facet_elem = (*facet_to_el_it)(f);
 	    UInt global_facet = global_facet_elem.element;
 
 	    if (facet_type != global_facet_elem.type ||
 		facet_gt != global_facet_elem.ghost_type) {
 	      facet_type = global_facet_elem.type;
 	      facet_gt = global_facet_elem.ghost_type;
 
 	      element_to_facet =
 		&( mesh_facets.getElementToSubelement(facet_type, facet_gt) );
 	      f_stress = &( facet_stress(facet_type, facet_gt) );
 
 	      nb_quad_per_facet =
 		getFEEngine("FacetsFEEngine").getNbQuadraturePoints(facet_type, facet_gt);
 
 	      f_check = &( inserter->getCheckFacets(facet_type, facet_gt) );
 	    }
 
 	    if (!(*f_check)(global_facet)) {
 	      stress_on_f_it += nb_quad_per_facet;
 	      continue;
 	    }
 
 	    for (UInt q = 0; q < nb_quad_per_facet; ++q, ++stress_on_f_it) {
 
 	      element_rank = (*element_to_facet)(global_facet)[0] != current_el;
 
 	      Matrix<Real> facet_stress_local(f_stress->storage()
 					      + (global_facet * nb_quad_per_facet + q) * sp4
 					      + element_rank * sp2,
 					      spatial_dimension,
 					      spatial_dimension);
 
 	      facet_stress_local = *stress_on_f_it;
 	    }
 	  }
 	}
       }
     }
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::reassignMaterial() {
   AKANTU_DEBUG_IN();
 
   SolidMechanicsModel::reassignMaterial();
 
   std::vector< Array<Element> > element_to_add   (materials.size());
   std::vector< Array<Element> > element_to_remove(materials.size());
 
   Element element;
   for (ghost_type_t::iterator gt = ghost_type_t::begin(); gt != ghost_type_t::end(); ++gt) {
     GhostType ghost_type = *gt;
     element.ghost_type = ghost_type;
 
     Mesh::type_iterator it  = mesh.firstType(spatial_dimension, ghost_type, _ek_cohesive);
     Mesh::type_iterator end = mesh.lastType(spatial_dimension, ghost_type, _ek_cohesive);
     for(; it != end; ++it) {
 
       ElementType type = *it;
       element.type = type;
       element.kind = Mesh::getKind(type);
 
       UInt nb_element = mesh.getNbElement(type, ghost_type);
 
       Array<UInt> & el_index_by_mat = element_index_by_material(type, ghost_type);
 
       for (UInt el = 0; el < nb_element; ++el) {
 	element.element = el;
 
 	UInt old_material = el_index_by_mat(el, 0);
 	UInt new_material = (*material_selector)(element);
 
 	if(old_material != new_material) {
 	  element_to_add   [new_material].push_back(element);
 	  element_to_remove[old_material].push_back(element);
 	}
       }
     }
   }
 
   std::vector<Material *>::iterator mat_it;
   UInt mat_index = 0;
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it, ++mat_index) {
     (*mat_it)->removeElements(element_to_remove[mat_index]);
     (*mat_it)->addElements   (element_to_add[mat_index]);
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::checkCohesiveStress() {
   AKANTU_DEBUG_IN();
 
   fillStressOnFacet();
 
 #if defined(AKANTU_DEBUG_TOOLS)
   debug::element_manager.printData(debug::_dm_model_cohesive,
 				   "Interpolated stresses before",
 				   facet_stress);
 #endif
 
   synch_registry->synchronize(_gst_smmc_facets_stress);
 
 #if defined(AKANTU_DEBUG_TOOLS)
   debug::element_manager.printData(debug::_dm_model_cohesive,
 				   "Interpolated stresses",
 				   facet_stress);
 #endif
 
   for (UInt m = 0; m < materials.size(); ++m) {
     try {
       MaterialCohesive & mat_cohesive = dynamic_cast<MaterialCohesive &>(*materials[m]);
       /// check which not ghost cohesive elements are to be created
       mat_cohesive.checkInsertion();
     } catch(std::bad_cast&) { }
   }
 
   /// communicate data among processors
   synch_registry->synchronize(_gst_smmc_facets);
 
   /// insert cohesive elements
   inserter->insertElements();
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::onElementsAdded(const Array<Element> & element_list,
 						  const NewElementsEvent & event) {
   AKANTU_DEBUG_IN();
 
   SolidMechanicsModel::onElementsAdded(element_list, event);
 
   /// update shape functions
   getFEEngine("CohesiveFEEngine").initShapeFunctions(_not_ghost);
   getFEEngine("CohesiveFEEngine").initShapeFunctions(_ghost);
 
 #if defined(AKANTU_PARALLEL_COHESIVE_ELEMENT)
   updateCohesiveSynchronizers();
 #endif
 
   if (is_extrinsic) resizeFacetStress();
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::onNodesAdded(const Array<UInt> & doubled_nodes,
 					       __attribute__((unused)) const NewNodesEvent & event) {
   AKANTU_DEBUG_IN();
 
   UInt nb_new_nodes = doubled_nodes.getSize();
   Array<UInt> nodes_list(nb_new_nodes);
 
   for (UInt n = 0; n < nb_new_nodes; ++n)
     nodes_list(n) = doubled_nodes(n, 1);
 
   SolidMechanicsModel::onNodesAdded(nodes_list, event);
 
   for (UInt n = 0; n < nb_new_nodes; ++n) {
 
     UInt old_node = doubled_nodes(n, 0);
     UInt new_node = doubled_nodes(n, 1);
 
     for (UInt dim = 0; dim < spatial_dimension; ++dim) {
       (*displacement)(new_node, dim) = (*displacement)(old_node, dim);
       (*velocity)    (new_node, dim) = (*velocity)    (old_node, dim);
       (*acceleration)(new_node, dim) = (*acceleration)(old_node, dim);
       (*blocked_dofs)(new_node, dim) = (*blocked_dofs)(old_node, dim);
 
       if (current_position)
 	(*current_position)(new_node, dim) = (*current_position)(old_node, dim);
 
       if (increment_acceleration)
 	(*increment_acceleration)(new_node, dim)
 	  = (*increment_acceleration)(old_node, dim);
 
       if (increment)
 	(*increment)(new_node, dim) = (*increment)(old_node, dim);
 
       if (previous_displacement)
 	(*previous_displacement)(new_node, dim)
 	  = (*previous_displacement)(old_node, dim);
     }
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::onEndSolveStep(const AnalysisMethod & method) {
 
   AKANTU_DEBUG_IN();
 
   /******************************************************************************
     This is required because the Cauchy stress is the stress measure that is used
      to check the insertion of cohesive elements
   ******************************************************************************/
 
   std::vector<Material *>::iterator mat_it;
   for(mat_it = materials.begin(); mat_it != materials.end(); ++mat_it) {
     Material & mat = **mat_it;
     if(mat.isFiniteDeformation())
       mat.computeAllCauchyStresses(_not_ghost);
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::printself(std::ostream & stream, int indent) const {
   std::string space;
   for(Int i = 0; i < indent; i++, space += AKANTU_INDENT);
 
   stream << space << "SolidMechanicsModelCohesive [" << std::endl;
 
   SolidMechanicsModel::printself(stream, indent + 1);
 
   stream << space << "]" << std::endl;
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::resizeFacetStress() {
   AKANTU_DEBUG_IN();
 
   Mesh & mesh_facets = inserter->getMeshFacets();
 
   for (ghost_type_t::iterator gt = ghost_type_t::begin();
        gt != ghost_type_t::end();
        ++gt) {
     GhostType ghost_type = *gt;
 
     Mesh::type_iterator it  = mesh_facets.firstType(spatial_dimension - 1, ghost_type);
     Mesh::type_iterator end = mesh_facets.lastType(spatial_dimension - 1, ghost_type);
     for(; it != end; ++it) {
       ElementType type = *it;
 
       UInt nb_facet = mesh_facets.getNbElement(type, ghost_type);
 
       UInt nb_quadrature_points =
 	getFEEngine("FacetsFEEngine").getNbQuadraturePoints(type, ghost_type);
 
       UInt new_size = nb_facet * nb_quadrature_points;
 
       facet_stress(type, ghost_type).resize(new_size);
     }
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void SolidMechanicsModelCohesive::addDumpGroupFieldToDumper(const std::string & dumper_name,
 							    const std::string & field_id,
 							    const std::string & group_name,
 							    const ElementKind & element_kind,
 							    bool padding_flag) {
   AKANTU_DEBUG_IN();
 
   ElementKind _element_kind = element_kind;
   if (dumper_name == "cohesive elements") {
     _element_kind = _ek_cohesive;
   }
   SolidMechanicsModel::addDumpGroupFieldToDumper(dumper_name, 
 						 field_id,
 						 group_name,
 						 _element_kind,
 						 padding_flag);
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 
 void SolidMechanicsModelCohesive::onDump(){
   this->flattenAllRegisteredInternals(_ek_cohesive);
   SolidMechanicsModel::onDump();
 }
 
 /* -------------------------------------------------------------------------- */
 
 
 
 __END_AKANTU__
diff --git a/src/model/structural_mechanics/structural_mechanics_model.cc b/src/model/structural_mechanics/structural_mechanics_model.cc
index 400b5a5a1..d7e9e9919 100644
--- a/src/model/structural_mechanics/structural_mechanics_model.cc
+++ b/src/model/structural_mechanics/structural_mechanics_model.cc
@@ -1,1139 +1,1142 @@
 /**
  * @file   structural_mechanics_model.cc
  * @author Fabian Barras <fabian.barras@epfl.ch>
  * @date   Thu May  5 15:52:38 2011
  *
  * @brief
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 #include "structural_mechanics_model.hh"
+#include "group_manager_inline_impl.cc"
+#include "dumpable_inline_impl.hh"
 #include "aka_math.hh"
 #include "integration_scheme_2nd_order.hh"
 #include "static_communicator.hh"
 #include "sparse_matrix.hh"
 #include "solver.hh"
 
 #ifdef AKANTU_USE_MUMPS
 #include "solver_mumps.hh"
 #endif
 
 #ifdef AKANTU_USE_IOHELPER
 #  include "dumper_paraview.hh"
+#  include "dumper_elemental_field.hh" 
 #endif
 /* -------------------------------------------------------------------------- */
 
 __BEGIN_AKANTU__
 
 const StructuralMechanicsModelOptions default_structural_mechanics_model_options(_static);
 
 /* -------------------------------------------------------------------------- */
 StructuralMechanicsModel::StructuralMechanicsModel(Mesh & mesh,
 						   UInt dim,
 						   const ID & id,
 						   const MemoryID & memory_id) :
   Model(mesh, dim, id, memory_id), 
   time_step(NAN), f_m2a(1.0),
   stress("stress", id, memory_id),
   element_material("element_material", id, memory_id),
   set_ID("beam sets", id, memory_id),
   stiffness_matrix(NULL),
   mass_matrix(NULL),
   velocity_damping_matrix(NULL),
   jacobian_matrix(NULL),
   solver(NULL),
   rotation_matrix("rotation_matices", id, memory_id),
   increment_flag(false),
   integrator(NULL) {
   AKANTU_DEBUG_IN();
 
   registerFEEngineObject<MyFEEngineType>("StructuralMechanicsFEEngine", mesh, spatial_dimension);
 
   this->displacement_rotation = NULL;
   this->mass                  = NULL;
   this->velocity              = NULL;
   this->acceleration          = NULL;
   this->force_momentum        = NULL;
   this->residual              = NULL;
   this->blocked_dofs              = NULL;
   this->increment             = NULL;
 
   this->previous_displacement = NULL;
 
   if(spatial_dimension == 2)
     nb_degree_of_freedom = 3;
   else if (spatial_dimension == 3)
     nb_degree_of_freedom = 6;
   else {
     AKANTU_DEBUG_TO_IMPLEMENT();
   }
 
   this->mesh.registerDumper<DumperParaview>("paraview_all", id, true);
   this->mesh.addDumpMesh(mesh, spatial_dimension, _not_ghost, _ek_structural);
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 StructuralMechanicsModel::~StructuralMechanicsModel() {
   AKANTU_DEBUG_IN();
 
   delete integrator;
   delete solver;
   delete stiffness_matrix;
   delete jacobian_matrix;
   delete mass_matrix;
   delete velocity_damping_matrix;
 
   AKANTU_DEBUG_OUT();
 }
 
 void StructuralMechanicsModel::setTimeStep(Real time_step) {
   this->time_step = time_step;
 
 #if defined(AKANTU_USE_IOHELPER)
   this->mesh.getDumper().setTimeStep(time_step);
 #endif
 }
 
 /* -------------------------------------------------------------------------- */
 /* Initialisation                                                             */
 /* -------------------------------------------------------------------------- */
 
 void StructuralMechanicsModel::initFull(const ModelOptions & options) {
   
   const StructuralMechanicsModelOptions & stmm_options =
     dynamic_cast<const StructuralMechanicsModelOptions &>(options);
 
   method = stmm_options.analysis_method;
   
   initModel();
   initArrays();
 
   displacement_rotation->clear();
   velocity             ->clear();
   acceleration         ->clear();
   force_momentum       ->clear();
   residual             ->clear();
   blocked_dofs             ->clear();
   increment            ->clear();
 
 
   Mesh::type_iterator it = getFEEngine().getMesh().firstType(spatial_dimension, _not_ghost, _ek_structural);
   Mesh::type_iterator end = getFEEngine().getMesh().lastType(spatial_dimension, _not_ghost, _ek_structural);
   for (; it != end; ++it) {
     computeRotationMatrix(*it);
   }
 
   switch(method) {
   case _implicit_dynamic:
     initImplicit();
     break;
   case _static:
     initSolver();
     break;
   default:
     AKANTU_EXCEPTION("analysis method not recognised by StructuralMechanicsModel");
       break;
   }
 }
 
 /* -------------------------------------------------------------------------- */
 void StructuralMechanicsModel::initArrays() {
   AKANTU_DEBUG_IN();
 
   UInt nb_nodes = getFEEngine().getMesh().getNbNodes();
   std::stringstream sstr_disp; sstr_disp << id << ":displacement";
   std::stringstream sstr_velo; sstr_velo << id << ":velocity";
   std::stringstream sstr_acce; sstr_acce << id << ":acceleration";
   std::stringstream sstr_forc; sstr_forc << id << ":force";
   std::stringstream sstr_resi; sstr_resi << id << ":residual";
   std::stringstream sstr_boun; sstr_boun << id << ":blocked_dofs";
   std::stringstream sstr_incr; sstr_incr << id << ":increment";
 
   displacement_rotation = &(alloc<Real>(sstr_disp.str(), nb_nodes, nb_degree_of_freedom, REAL_INIT_VALUE));
   velocity              = &(alloc<Real>(sstr_velo.str(), nb_nodes, nb_degree_of_freedom, REAL_INIT_VALUE));
   acceleration          = &(alloc<Real>(sstr_acce.str(), nb_nodes, nb_degree_of_freedom, REAL_INIT_VALUE));
   force_momentum        = &(alloc<Real>(sstr_forc.str(), nb_nodes, nb_degree_of_freedom, REAL_INIT_VALUE));
   residual              = &(alloc<Real>(sstr_resi.str(), nb_nodes, nb_degree_of_freedom, REAL_INIT_VALUE));
   blocked_dofs              = &(alloc<bool>(sstr_boun.str(), nb_nodes, nb_degree_of_freedom, false));
   increment             = &(alloc<Real>(sstr_incr.str(), nb_nodes, nb_degree_of_freedom, REAL_INIT_VALUE));
 
   Mesh::type_iterator it = getFEEngine().getMesh().firstType(spatial_dimension, _not_ghost, _ek_structural);
   Mesh::type_iterator end = getFEEngine().getMesh().lastType(spatial_dimension, _not_ghost, _ek_structural);
   for (; it != end; ++it) {
     UInt nb_element = getFEEngine().getMesh().getNbElement(*it);
     UInt nb_quadrature_points       = getFEEngine().getNbQuadraturePoints(*it);
 
     element_material.alloc(nb_element, 1, *it, _not_ghost);
     set_ID.alloc(nb_element, 1, *it, _not_ghost);
 
     UInt size = getTangentStiffnessVoigtSize(*it);
     stress.alloc(nb_element * nb_quadrature_points, size , *it, _not_ghost);
   }
 
   dof_synchronizer = new DOFSynchronizer(getFEEngine().getMesh(), nb_degree_of_freedom);
   dof_synchronizer->initLocalDOFEquationNumbers();
   dof_synchronizer->initGlobalDOFEquationNumbers();
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void StructuralMechanicsModel::initModel() {
   getFEEngine().initShapeFunctions(_not_ghost);
 }
 
 /* -------------------------------------------------------------------------- */
 void StructuralMechanicsModel::initSolver(__attribute__((unused)) SolverOptions & options) {
   AKANTU_DEBUG_IN();
 
   const Mesh & mesh = getFEEngine().getMesh();
 #if !defined(AKANTU_USE_MUMPS) // or other solver in the future \todo add AKANTU_HAS_SOLVER in CMake
   AKANTU_DEBUG_ERROR("You should at least activate one solver.");
 #else
   UInt nb_global_node = mesh.getNbGlobalNodes();
 
   std::stringstream sstr; sstr << id << ":jacobian_matrix";
   jacobian_matrix = new SparseMatrix(nb_global_node * nb_degree_of_freedom, _symmetric,
 				     nb_degree_of_freedom, sstr.str(), memory_id);
 
   jacobian_matrix->buildProfile(mesh, *dof_synchronizer);
 
   std::stringstream sstr_sti; sstr_sti << id << ":stiffness_matrix";
   stiffness_matrix = new SparseMatrix(*jacobian_matrix, sstr_sti.str(), memory_id);
 
 #ifdef AKANTU_USE_MUMPS
   std::stringstream sstr_solv; sstr_solv << id << ":solver";
   solver = new SolverMumps(*jacobian_matrix, sstr_solv.str());
 
   dof_synchronizer->initScatterGatherCommunicationScheme();
 #else
   AKANTU_DEBUG_ERROR("You should at least activate one solver.");
 #endif //AKANTU_USE_MUMPS
 
   solver->initialize(options);
 #endif //AKANTU_HAS_SOLVER
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
  void StructuralMechanicsModel::initImplicit(bool dynamic, SolverOptions & solver_options) {
    AKANTU_DEBUG_IN();
  
    if (!increment) setIncrementFlagOn();
 
    initSolver(solver_options);
 
    if(integrator) delete integrator;
    integrator = new TrapezoidalRule2();
 
    AKANTU_DEBUG_OUT();
  }
 
 /* -------------------------------------------------------------------------- */
 UInt StructuralMechanicsModel::getTangentStiffnessVoigtSize(const ElementType & type) {
   UInt size;
 #define GET_TANGENT_STIFFNESS_VOIGT_SIZE(type)	\
   size = getTangentStiffnessVoigtSize<type>();
 
   AKANTU_BOOST_STRUCTURAL_ELEMENT_SWITCH(GET_TANGENT_STIFFNESS_VOIGT_SIZE);
 #undef GET_TANGENT_STIFFNESS_VOIGT_SIZE
 
   return size;
 }
 
 /* -------------------------------------------------------------------------- */
 void StructuralMechanicsModel::assembleStiffnessMatrix() {
   AKANTU_DEBUG_IN();
 
   stiffness_matrix->clear();
 
   Mesh::type_iterator it = getFEEngine().getMesh().firstType(spatial_dimension, _not_ghost, _ek_structural);
   Mesh::type_iterator end = getFEEngine().getMesh().lastType(spatial_dimension, _not_ghost, _ek_structural);
   for (; it != end; ++it) {
     ElementType type = *it;
 
 #define ASSEMBLE_STIFFNESS_MATRIX(type)		\
     assembleStiffnessMatrix<type>();
 
     AKANTU_BOOST_STRUCTURAL_ELEMENT_SWITCH(ASSEMBLE_STIFFNESS_MATRIX);
 #undef ASSEMBLE_STIFFNESS_MATRIX
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 template<>
 void StructuralMechanicsModel::computeRotationMatrix<_bernoulli_beam_2>(Array<Real> & rotations){
 
   ElementType type = _bernoulli_beam_2;
   Mesh & mesh = getFEEngine().getMesh();
   UInt nb_element = mesh.getNbElement(type);
 
   Array<UInt>::iterator< Vector<UInt> > connec_it = mesh.getConnectivity(type).begin(2);
   Array<Real>::vector_iterator nodes_it = mesh.getNodes().begin(spatial_dimension);
   Array<Real>::matrix_iterator R_it = rotations.begin(nb_degree_of_freedom, nb_degree_of_freedom);
 
   for (UInt e = 0; e < nb_element; ++e, ++R_it, ++connec_it) {
     Matrix<Real> & R = *R_it;
     Vector<UInt> & connec = *connec_it;
 
     Vector<Real> x2;
     x2 = nodes_it[connec(1)]; // X2
     Vector<Real> x1;
     x1 = nodes_it[connec(0)]; // X1
 
     Real le = x1.distance(x2);
     Real c = (x2(0) - x1(0)) / le;
     Real s = (x2(1) - x1(1)) / le;
 
     /// Definition of the rotation matrix
     R(0,0) =  c;  R(0,1) = s;  R(0,2) = 0.;
     R(1,0) = -s;  R(1,1) = c;  R(1,2) = 0.;
     R(2,0) =  0.; R(2,1) = 0.; R(2,2) = 1.;
   }
 }
 
 
 /* -------------------------------------------------------------------------- */
 template<>
 void StructuralMechanicsModel::computeRotationMatrix<_bernoulli_beam_3>(Array<Real> & rotations){
   ElementType type = _bernoulli_beam_3;
   Mesh & mesh = getFEEngine().getMesh();
   UInt nb_element = mesh.getNbElement(type);
 
   Array<Real>::vector_iterator n_it = mesh.getNormals(type).begin(spatial_dimension);
   Array<UInt>::iterator< Vector<UInt> > connec_it = mesh.getConnectivity(type).begin(2);
   Array<Real>::vector_iterator nodes_it = mesh.getNodes().begin(spatial_dimension);
 
   Matrix<Real> Pe    (spatial_dimension, spatial_dimension);
   Matrix<Real> Pg    (spatial_dimension, spatial_dimension);
   Matrix<Real> inv_Pg(spatial_dimension, spatial_dimension);
   Vector<Real> x_n(spatial_dimension); // x vect n
 
   Array<Real>::matrix_iterator R_it =
     rotations.begin(nb_degree_of_freedom, nb_degree_of_freedom);
 
   for (UInt e=0 ; e < nb_element; ++e, ++n_it, ++connec_it, ++R_it) {
     Vector<Real> & n = *n_it;
     Matrix<Real> & R = *R_it;
     Vector<UInt> & connec = *connec_it;
 
     Vector<Real> x;
     x = nodes_it[connec(1)]; // X2
     Vector<Real> y;
     y = nodes_it[connec(0)]; // X1
 
     Real l = x.distance(y);
     x -= y; // X2 - X1
     x_n.crossProduct(x, n);
 
     Pe.eye();
     Pe(0, 0) *=  l;
     Pe(1, 1) *= -l;
 
     Pg(0,0) = x(0); Pg(0,1) = x_n(0); Pg(0,2) = n(0);
     Pg(1,0) = x(1); Pg(1,1) = x_n(1); Pg(1,2) = n(1);
     Pg(2,0) = x(2); Pg(2,1) = x_n(2); Pg(2,2) = n(2);
 
     inv_Pg.inverse(Pg);
 
     Pe *= inv_Pg;
     for (UInt i = 0; i < spatial_dimension; ++i) {
       for (UInt j = 0; j < spatial_dimension; ++j) {
 	R(i, j) = Pe(i, j);
 	R(i + spatial_dimension,j + spatial_dimension) = Pe(i, j);
       }
     }
   }
 }
 
 /* -------------------------------------------------------------------------- */
 template<> 
 void StructuralMechanicsModel::computeRotationMatrix<_kirchhoff_shell>(Array<Real> & rotations){
   ElementType type = _kirchhoff_shell;
   Mesh & mesh = getFEEngine().getMesh();
   UInt nb_element = mesh.getNbElement(type);
   
   Array<UInt>::iterator< Vector<UInt> > connec_it = mesh.getConnectivity(type).begin(3);
   Array<Real>::vector_iterator nodes_it = mesh.getNodes().begin(spatial_dimension);
   
   Matrix<Real> Pe    (spatial_dimension, spatial_dimension);
   Matrix<Real> Pg    (spatial_dimension, spatial_dimension);
   Matrix<Real> inv_Pg(spatial_dimension, spatial_dimension);
   
   Array<Real>::matrix_iterator R_it =
     rotations.begin(nb_degree_of_freedom, nb_degree_of_freedom);
   
   for (UInt e=0 ; e < nb_element; ++e, ++connec_it, ++R_it) { 
       
     Pe.eye();
     
     Matrix<Real> & R = *R_it;
     Vector<UInt> & connec = *connec_it;
 
     Vector<Real> x2;
     x2 = nodes_it[connec(1)]; // X2
     Vector<Real> x1;
     x1 = nodes_it[connec(0)]; // X1
     Vector<Real> x3;
     x3 = nodes_it[connec(2)]; // X3
 
 
 
 
     Vector<Real> Pg_col_1=x2-x1;
     
     Vector<Real> Pg_col_2 = x3-x1;
     
     Vector<Real> Pg_col_3(spatial_dimension);
     Pg_col_3.crossProduct(Pg_col_1, Pg_col_2);
       
       
     for (UInt i = 0; i <spatial_dimension; ++i) {
       Pg(i,0) = Pg_col_1(i);
       Pg(i,1) = Pg_col_2(i);
       Pg(i,2) = Pg_col_3(i);
     }
   
 
     inv_Pg.inverse(Pg);
     // Pe *= inv_Pg;
     Pe.eye(); 
     
     for (UInt i = 0; i < spatial_dimension; ++i) {
       for (UInt j = 0; j < spatial_dimension; ++j) {
 	R(i, j) = Pe(i, j);
 	R(i + spatial_dimension,j + spatial_dimension) = Pe(i, j);
       }
     }  
 
   }
 }
 
 /* -------------------------------------------------------------------------- */
 void StructuralMechanicsModel::computeRotationMatrix(const ElementType & type) {
   Mesh & mesh = getFEEngine().getMesh();
 
   UInt nb_nodes_per_element = Mesh::getNbNodesPerElement(type);
   UInt nb_element = mesh.getNbElement(type);
 
   if(!rotation_matrix.exists(type)) {
     rotation_matrix.alloc(nb_element,
 			  nb_degree_of_freedom*nb_nodes_per_element * nb_degree_of_freedom*nb_nodes_per_element,
 			  type);
   } else {
     rotation_matrix(type).resize(nb_element);
   }
   rotation_matrix(type).clear();
 
   Array<Real>rotations(nb_element, nb_degree_of_freedom * nb_degree_of_freedom);
   rotations.clear();
 
 #define COMPUTE_ROTATION_MATRIX(type)	\
   computeRotationMatrix<type>(rotations);
 
   AKANTU_BOOST_STRUCTURAL_ELEMENT_SWITCH(COMPUTE_ROTATION_MATRIX);
 #undef COMPUTE_ROTATION_MATRIX
 
 
   Array<Real>::matrix_iterator R_it = rotations.begin(nb_degree_of_freedom, nb_degree_of_freedom);
   Array<Real>::matrix_iterator T_it =
     rotation_matrix(type).begin(nb_degree_of_freedom*nb_nodes_per_element,
 				nb_degree_of_freedom*nb_nodes_per_element);
 
   for (UInt el = 0; el < nb_element; ++el, ++R_it, ++T_it) {
     Matrix<Real> & T = *T_it;
     Matrix<Real> & R = *R_it;
     T.clear();
     for (UInt k = 0; k < nb_nodes_per_element; ++k){
       for (UInt i = 0; i < nb_degree_of_freedom; ++i)
 	for (UInt j = 0; j < nb_degree_of_freedom; ++j)
 	  T(k*nb_degree_of_freedom + i, k*nb_degree_of_freedom + j) = R(i, j);
     }
   }
 }
 
 /* -------------------------------------------------------------------------- */
 void StructuralMechanicsModel::computeStresses() {
   AKANTU_DEBUG_IN();
 
   Mesh::type_iterator it = getFEEngine().getMesh().firstType(spatial_dimension, _not_ghost, _ek_structural);
   Mesh::type_iterator end = getFEEngine().getMesh().lastType(spatial_dimension, _not_ghost, _ek_structural);
   for (; it != end; ++it) {
     ElementType type = *it;
 
 #define COMPUTE_STRESS_ON_QUAD(type)		\
     computeStressOnQuad<type>();
 
     AKANTU_BOOST_STRUCTURAL_ELEMENT_SWITCH(COMPUTE_STRESS_ON_QUAD);
 #undef COMPUTE_STRESS_ON_QUAD
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void StructuralMechanicsModel::updateResidual() {
  AKANTU_DEBUG_IN();
  residual->copy(*force_momentum);
 
  Array<Real> ku(*displacement_rotation, true);
  ku *= *stiffness_matrix;
  *residual -= ku;
 
  this->updateResidualInternal();
 
  AKANTU_DEBUG_OUT();
 
 }
 
 /* -------------------------------------------------------------------------- */
 void StructuralMechanicsModel::implicitPred() {
   AKANTU_DEBUG_IN();
 
   if(previous_displacement) previous_displacement->copy(*displacement_rotation);
 
   if(method == _implicit_dynamic)
     integrator->integrationSchemePred(time_step,
                                     *displacement_rotation,
                                     *velocity,
                                     *acceleration,
                                     *blocked_dofs);
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 void StructuralMechanicsModel::implicitCorr() {
   AKANTU_DEBUG_IN();
   
   Real * incr_val = increment->storage();
   bool * boun_val = blocked_dofs->storage();
 
   UInt nb_nodes = displacement_rotation->getSize();
   
   for (UInt j = 0; j < nb_nodes * nb_degree_of_freedom; ++j, ++incr_val, ++boun_val){
       *incr_val *= (1. - *boun_val);
   }
 
   if(method == _implicit_dynamic) {
     integrator->integrationSchemeCorrDispl(time_step,
                                            *displacement_rotation,
                                            *velocity,
                                            *acceleration,
                                            *blocked_dofs,
                                            *increment);
   } else {
 
     Real * disp_val = displacement_rotation->storage();
     incr_val = increment->storage();
 
     for (UInt j = 0; j < nb_nodes *nb_degree_of_freedom; ++j, ++disp_val){
       *disp_val += *incr_val;
     }
   }
 
   AKANTU_DEBUG_OUT();
 }
 /* -------------------------------------------------------------------------- */
 void StructuralMechanicsModel::updateResidualInternal() {
   AKANTU_DEBUG_IN();
 
   AKANTU_DEBUG_INFO("Update the residual");
   // f = f_ext - f_int - Ma - Cv = r - Ma - Cv;
 
   if(method != _static) {
     // f -= Ma
     if(mass_matrix) {
       // if full mass_matrix
       Array<Real> * Ma = new Array<Real>(*acceleration, true, "Ma");
       *Ma *= *mass_matrix;
       /// \todo check unit conversion for implicit dynamics
       //      *Ma /= f_m2a
       *residual -= *Ma;
       delete Ma;
     } else if (mass) {
 
       // else lumped mass
       UInt nb_nodes = acceleration->getSize();
       UInt nb_degree_of_freedom = acceleration->getNbComponent();
 
       Real * mass_val     = mass->storage();
       Real * accel_val    = acceleration->storage();
       Real * res_val      = residual->storage();
       bool * blocked_dofs_val = blocked_dofs->storage();
 
       for (UInt n = 0; n < nb_nodes * nb_degree_of_freedom; ++n) {
         if(!(*blocked_dofs_val)) {
           *res_val -= *accel_val * *mass_val /f_m2a;
         }
         blocked_dofs_val++;
         res_val++;
         mass_val++;
         accel_val++;
       }
     } else {
       AKANTU_DEBUG_ERROR("No function called to assemble the mass matrix.");
     }
 
     // f -= Cv
     if(velocity_damping_matrix) {
       Array<Real> * Cv = new Array<Real>(*velocity);
       *Cv *= *velocity_damping_matrix;
       *residual -= *Cv;
       delete Cv;
     }
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 
 /* -------------------------------------------------------------------------- */
 void StructuralMechanicsModel::setIncrementFlagOn() {
   AKANTU_DEBUG_IN();
 
   if(!increment) {
     UInt nb_nodes = mesh.getNbNodes();
     std::stringstream sstr_inc; sstr_inc << id << ":increment";
     increment = &(alloc<Real>(sstr_inc.str(), nb_nodes, spatial_dimension, 0.));
   }
 
   increment_flag = true;
 
   AKANTU_DEBUG_OUT();
 }
 
 
 /* -------------------------------------------------------------------------- */
 void StructuralMechanicsModel::solve() {
   AKANTU_DEBUG_IN();
 
   AKANTU_DEBUG_INFO("Solving an implicit step.");
 
   UInt nb_nodes = displacement_rotation->getSize();
 
   /// todo residual = force - Kxr * d_bloq
   jacobian_matrix->copyContent(*stiffness_matrix);
   jacobian_matrix->applyBoundary(*blocked_dofs);
 
   jacobian_matrix->saveMatrix("Kbound.mtx");
 
   increment->clear();
 
   solver->setRHS(*residual);
 
   solver->factorize();
   solver->solve(*increment);
 
   Real * increment_val     = increment->storage();
   Real * displacement_val  = displacement_rotation->storage();
   bool * blocked_dofs_val      = blocked_dofs->storage();
 
   for (UInt n = 0; n < nb_nodes * nb_degree_of_freedom; ++n) {
     if(!(*blocked_dofs_val)) {
       *displacement_val += *increment_val;
     }
     else {
       *increment_val = 0.0;
     }
 
     displacement_val++;
     blocked_dofs_val++;
     increment_val++;
   }
 
   AKANTU_DEBUG_OUT();
 }
 
 /* -------------------------------------------------------------------------- */
 template<>
 bool StructuralMechanicsModel::testConvergence<_scc_increment>(Real tolerance, Real & error){
   AKANTU_DEBUG_IN();
 
   UInt nb_nodes = displacement_rotation->getSize();
   UInt nb_degree_of_freedom = displacement_rotation->getNbComponent();
 
   error = 0;
   Real norm[2] = {0., 0.};
   Real * increment_val    = increment->storage();
   bool * blocked_dofs_val     = blocked_dofs->storage();
   Real * displacement_val = displacement_rotation->storage();
 
   for (UInt n = 0; n < nb_nodes; ++n) {
     for (UInt d = 0; d < nb_degree_of_freedom; ++d) {
       if(!(*blocked_dofs_val)) {
         norm[0] += *increment_val * *increment_val;
         norm[1] += *displacement_val * *displacement_val;
       }
       blocked_dofs_val++;
       increment_val++;
       displacement_val++;
     }
   }
 
   StaticCommunicator::getStaticCommunicator().allReduce(norm, 2, _so_sum);
 
   norm[0] = sqrt(norm[0]);
   norm[1] = sqrt(norm[1]);
   AKANTU_DEBUG_ASSERT(!Math::isnan(norm[0]), "Something went wrong in the solve phase");
 
   AKANTU_DEBUG_OUT();
   if(norm[1] > Math::getTolerance())
     error = norm[0] / norm[1];
   else
     error = norm[0]; //In case the total displacement is zero!
   return (error < tolerance);
 }
 
 /* -------------------------------------------------------------------------- */
 template<>
 bool StructuralMechanicsModel::testConvergence<_scc_residual>(Real tolerance, Real & norm) {
   AKANTU_DEBUG_IN();
 
   UInt nb_nodes = residual->getSize();
 
   norm = 0;
   Real * residual_val = residual->storage();
   bool * blocked_dofs_val = blocked_dofs->storage();
 
   for (UInt n = 0; n < nb_nodes; ++n) {
     bool is_local_node = mesh.isLocalOrMasterNode(n);
     if(is_local_node) {
       for (UInt d = 0; d < spatial_dimension; ++d) {
         if(!(*blocked_dofs_val)) {
           norm += *residual_val * *residual_val;
         }
         blocked_dofs_val++;
         residual_val++;
       }
     } else {
       blocked_dofs_val += spatial_dimension;
       residual_val += spatial_dimension;
     }
   }
 
   StaticCommunicator::getStaticCommunicator().allReduce(&norm, 1, _so_sum);
 
   norm = sqrt(norm);
 
   AKANTU_DEBUG_ASSERT(!Math::isnan(norm), "Something goes wrong in the solve phase");
 
   AKANTU_DEBUG_OUT();
   return (norm < tolerance);
 }
 
 
 /* -------------------------------------------------------------------------- */
 bool StructuralMechanicsModel::testConvergenceIncrement(Real tolerance) {
   Real error;
   bool tmp = testConvergenceIncrement(tolerance, error);
 
   AKANTU_DEBUG_INFO("Norm of increment : " << error);
 
   return tmp;
 }
 
 /* -------------------------------------------------------------------------- */
 bool StructuralMechanicsModel::testConvergenceIncrement(Real tolerance, Real & error) {
   AKANTU_DEBUG_IN();
   Mesh & mesh= getFEEngine().getMesh();
   UInt nb_nodes = displacement_rotation->getSize();
   UInt nb_degree_of_freedom = displacement_rotation->getNbComponent();
 
   Real norm = 0;
   Real * increment_val     = increment->storage();
   bool * blocked_dofs_val      = blocked_dofs->storage();
 
   for (UInt n = 0; n < nb_nodes; ++n) {
     bool is_local_node = mesh.isLocalOrMasterNode(n);
     for (UInt d = 0; d < nb_degree_of_freedom; ++d) {
       if(!(*blocked_dofs_val) && is_local_node) {
 	norm += *increment_val * *increment_val;
       }
       blocked_dofs_val++;
       increment_val++;
     }
   }
 
   StaticCommunicator::getStaticCommunicator().allReduce(&norm, 1, _so_sum);
 
   error = sqrt(norm);
   AKANTU_DEBUG_ASSERT(!Math::isnan(norm), "Something goes wrong in the solve phase");
 
   AKANTU_DEBUG_OUT();
   return (error < tolerance);
 }
 
 /* -------------------------------------------------------------------------- */
 template<>
 void StructuralMechanicsModel::computeTangentModuli<_bernoulli_beam_2>(Array<Real> & tangent_moduli) {
   UInt nb_element                 = getFEEngine().getMesh().getNbElement(_bernoulli_beam_2);
   UInt nb_quadrature_points       = getFEEngine().getNbQuadraturePoints(_bernoulli_beam_2);
   UInt tangent_size = 2;
 
   Array<Real>::matrix_iterator D_it = tangent_moduli.begin(tangent_size, tangent_size);
   Array<UInt> & el_mat = element_material(_bernoulli_beam_2, _not_ghost);
 
   for (UInt e = 0; e < nb_element; ++e) {
     UInt mat = el_mat(e);
     Real E = materials[mat].E;
     Real A = materials[mat].A;
     Real I = materials[mat].I;
     for (UInt q = 0; q < nb_quadrature_points; ++q, ++D_it) {
       Matrix<Real> & D = *D_it;
       D(0,0) = E * A;
       D(1,1) = E * I;
     }
   }
 }
 /* -------------------------------------------------------------------------- */
 template<>
 void StructuralMechanicsModel::computeTangentModuli<_bernoulli_beam_3>(Array<Real> & tangent_moduli) {
   UInt nb_element                 = getFEEngine().getMesh().getNbElement(_bernoulli_beam_3);
   UInt nb_quadrature_points       = getFEEngine().getNbQuadraturePoints(_bernoulli_beam_3);
   UInt tangent_size = 4;
 
   Array<Real>::matrix_iterator D_it = tangent_moduli.begin(tangent_size, tangent_size);
 
   for (UInt e = 0; e < nb_element; ++e) {
     UInt mat = element_material(_bernoulli_beam_3, _not_ghost)(e);
     Real E = materials[mat].E;
     Real A = materials[mat].A;
     Real Iz = materials[mat].Iz;
     Real Iy = materials[mat].Iy;
     Real GJ = materials[mat].GJ;
     for (UInt q = 0; q < nb_quadrature_points; ++q, ++D_it) {
       Matrix<Real> & D = *D_it;
       D(0,0) = E * A;
       D(1,1) = E * Iz;
       D(2,2) = E * Iy;
       D(3,3) = GJ;
     }
   }
 }
 
 /* -------------------------------------------------------------------------- */
 template<>
 void StructuralMechanicsModel::computeTangentModuli<_kirchhoff_shell>(Array<Real> & tangent_moduli) {
   UInt nb_element                 = getFEEngine().getMesh().getNbElement(_kirchhoff_shell);
   UInt nb_quadrature_points       = getFEEngine().getNbQuadraturePoints(_kirchhoff_shell);
   UInt tangent_size = 6;
 
   Array<Real>::matrix_iterator D_it = tangent_moduli.begin(tangent_size, tangent_size);
 
   for (UInt e = 0; e < nb_element; ++e) {
     UInt mat = element_material(_kirchhoff_shell, _not_ghost)(e);
     Real E = materials[mat].E;
     Real nu = materials[mat].nu;
     Real t = materials[mat].t;
 
     Real HH=E*t/(1-nu*nu);
     Real DD=E*t*t*t/(12*(1-nu*nu));
     
     for (UInt q = 0; q < nb_quadrature_points; ++q, ++D_it) {
       Matrix<Real> & D = *D_it;
       D(0,0) = HH;
       D(0,1) = HH*nu;
       D(1,0) = HH*nu;      
       D(1,1) = HH;
       D(2,2) = HH*(1-nu)/2;
       D(3,3) = DD;
       D(3,4) = DD*nu;
       D(4,3) = DD*nu;
       D(4,4) = DD;
       D(5,5) = DD*(1-nu)/2;
     }
   }
 }
 
 /* -------------------------------------------------------------------------- */
 template<>
 void StructuralMechanicsModel::transferBMatrixToSymVoigtBMatrix<_bernoulli_beam_2>(Array<Real> & b, bool local) {
   UInt nb_element                 = getFEEngine().getMesh().getNbElement(_bernoulli_beam_2);
   UInt nb_nodes_per_element       = Mesh::getNbNodesPerElement(_bernoulli_beam_2);
   UInt nb_quadrature_points       = getFEEngine().getNbQuadraturePoints(_bernoulli_beam_2);
 
   MyFEEngineType & fem = getFEEngineClass<MyFEEngineType>();
   Array<Real>::const_vector_iterator shape_Np  = fem.getShapesDerivatives(_bernoulli_beam_2, _not_ghost, 0).begin(nb_nodes_per_element);
   Array<Real>::const_vector_iterator shape_Mpp = fem.getShapesDerivatives(_bernoulli_beam_2, _not_ghost, 1).begin(nb_nodes_per_element);
   Array<Real>::const_vector_iterator shape_Lpp = fem.getShapesDerivatives(_bernoulli_beam_2, _not_ghost, 2).begin(nb_nodes_per_element);
 
   UInt tangent_size = getTangentStiffnessVoigtSize<_bernoulli_beam_2>();
   UInt bt_d_b_size  = nb_nodes_per_element * nb_degree_of_freedom;
   b.clear();
   Array<Real>::matrix_iterator B_it = b.begin(tangent_size, bt_d_b_size);
 
   for (UInt e = 0; e < nb_element; ++e) {
     for (UInt q = 0; q < nb_quadrature_points; ++q) {
       Matrix<Real> & B = *B_it;
       const Vector<Real> & Np  = *shape_Np;
       const Vector<Real> & Lpp = *shape_Lpp;
       const Vector<Real> & Mpp = *shape_Mpp;
 
       B(0,0) = Np(0);
       B(0,3) = Np(1);
 
       B(1,1) = Mpp(0);
       B(1,2) = Lpp(0);
       B(1,4) = Mpp(1);
       B(1,5) = Lpp(1);
 
       ++B_it;
       ++shape_Np;
       ++shape_Mpp;
       ++shape_Lpp;
     }
 
     // ++R_it;
   }
 }
 
 /* -------------------------------------------------------------------------- */
 template<> 
 void StructuralMechanicsModel::transferBMatrixToSymVoigtBMatrix<_bernoulli_beam_3>(Array<Real> & b, bool local) {
   MyFEEngineType & fem = getFEEngineClass<MyFEEngineType>();
 
   UInt nb_element                 = getFEEngine().getMesh().getNbElement(_bernoulli_beam_3);
   UInt nb_nodes_per_element       = Mesh::getNbNodesPerElement(_bernoulli_beam_3);
   UInt nb_quadrature_points       = getFEEngine().getNbQuadraturePoints(_bernoulli_beam_3);
 
   Array<Real>::const_vector_iterator shape_Np  = fem.getShapesDerivatives(_bernoulli_beam_3, _not_ghost, 0).begin(nb_nodes_per_element);
   Array<Real>::const_vector_iterator shape_Mpp = fem.getShapesDerivatives(_bernoulli_beam_3, _not_ghost, 1).begin(nb_nodes_per_element);
   Array<Real>::const_vector_iterator shape_Lpp = fem.getShapesDerivatives(_bernoulli_beam_3, _not_ghost, 2).begin(nb_nodes_per_element);
 
   UInt tangent_size = getTangentStiffnessVoigtSize<_bernoulli_beam_3>();
   UInt bt_d_b_size  = nb_nodes_per_element * nb_degree_of_freedom;
 
   b.clear();
 
   Array<Real>::matrix_iterator B_it = b.begin(tangent_size, bt_d_b_size);
 
   for (UInt e = 0; e < nb_element; ++e) {
     for (UInt q = 0; q < nb_quadrature_points; ++q) {
       Matrix<Real> & B  = *B_it;
 
       const Vector<Real> & Np  = *shape_Np;
       const Vector<Real> & Lpp = *shape_Lpp;
       const Vector<Real> & Mpp = *shape_Mpp;
 
       B(0,0)  =  Np(0);
       B(0,6)  =  Np(1);
 
       B(1,1)  =  Mpp(0);
       B(1,5)  =  Lpp(0);
       B(1,7)  =  Mpp(1);
       B(1,11) =  Lpp(1);
 
       B(2,2)  =  Mpp(0);
       B(2,4)  = -Lpp(0);
       B(2,8)  =  Mpp(1);
       B(2,10) = -Lpp(1);
 
       B(3,3)  =  Np(0);
       B(3,9)  =  Np(1);
 
       ++B_it;
       ++shape_Np;
       ++shape_Mpp;
       ++shape_Lpp;
     }
   }
 }
 /* -------------------------------------------------------------------------- */
 template<> 
 void StructuralMechanicsModel::transferBMatrixToSymVoigtBMatrix<_kirchhoff_shell>(Array<Real> & b, bool local) {
   MyFEEngineType & fem = getFEEngineClass<MyFEEngineType>();
 
 
   UInt nb_element                 = getFEEngine().getMesh().getNbElement(_kirchhoff_shell);
   UInt nb_nodes_per_element       = Mesh::getNbNodesPerElement(_kirchhoff_shell);
   UInt nb_quadrature_points       = getFEEngine().getNbQuadraturePoints(_kirchhoff_shell);
 
 
 
   Array<Real>::const_matrix_iterator shape_Np   = fem.getShapesDerivatives(_kirchhoff_shell, _not_ghost, 0).begin(2,nb_nodes_per_element);
   Array<Real>::const_matrix_iterator shape_Nx1p = fem.getShapesDerivatives(_kirchhoff_shell, _not_ghost, 1).begin(2,nb_nodes_per_element);
   Array<Real>::const_matrix_iterator shape_Nx2p = fem.getShapesDerivatives(_kirchhoff_shell, _not_ghost, 2).begin(2,nb_nodes_per_element);
   Array<Real>::const_matrix_iterator shape_Nx3p = fem.getShapesDerivatives(_kirchhoff_shell, _not_ghost, 3).begin(2,nb_nodes_per_element);
   Array<Real>::const_matrix_iterator shape_Ny1p = fem.getShapesDerivatives(_kirchhoff_shell, _not_ghost, 4).begin(2,nb_nodes_per_element);
   Array<Real>::const_matrix_iterator shape_Ny2p = fem.getShapesDerivatives(_kirchhoff_shell, _not_ghost, 5).begin(2,nb_nodes_per_element);
   Array<Real>::const_matrix_iterator shape_Ny3p = fem.getShapesDerivatives(_kirchhoff_shell, _not_ghost, 6).begin(2,nb_nodes_per_element);
 
   UInt tangent_size = getTangentStiffnessVoigtSize<_kirchhoff_shell>();
   UInt bt_d_b_size  = nb_nodes_per_element * nb_degree_of_freedom;
 
   b.clear();
 
   Array<Real>::matrix_iterator B_it = b.begin(tangent_size, bt_d_b_size);
 
   for (UInt e = 0; e < nb_element; ++e) {
     for (UInt q = 0; q < nb_quadrature_points; ++q) { 
       Matrix<Real> & B  = *B_it;
 
       const Matrix<Real> & Np   = *shape_Np;
       const Matrix<Real> & Nx1p = *shape_Nx1p; 
       const Matrix<Real> & Nx2p = *shape_Nx2p;
       const Matrix<Real> & Nx3p = *shape_Nx3p;
       const Matrix<Real> & Ny1p = *shape_Ny1p;
       const Matrix<Real> & Ny2p = *shape_Ny2p;
       const Matrix<Real> & Ny3p = *shape_Ny3p;
 
       B(0,0)  =  Np(0,0);
       B(0,6)  =  Np(0,1);  
       B(0,12) =  Np(0,2);
 
       B(1,1)  =  Np(1,0);
       B(1,7)  =  Np(1,1);
       B(1,13) =  Np(1,2);
 
       B(2,0)  =  Np(1,0);
       B(2,1)  =  Np(0,0);
       B(2,6)  =  Np(1,1);
       B(2,7)  =  Np(0,1);
       B(2,12) =  Np(1,2);
       B(2,13) =  Np(0,2);
 
       B(3,2)  =  Nx1p(0,0);
       B(3,3)  =  Nx2p(0,0);
       B(3,4)  =  Nx3p(0,0);
       B(3,8)  =  Nx1p(0,1);
       B(3,9)  =  Nx2p(0,1);
       B(3,10) =  Nx3p(0,1);
       B(3,14) =  Nx1p(0,2);
       B(3,15) =  Nx2p(0,2);
       B(3,16) =  Nx3p(0,2);
 
       B(4,2)  =  Ny1p(1,0);
       B(4,3)  =  Ny2p(1,0);
       B(4,4)  =  Ny3p(1,0);
       B(4,8)  =  Ny1p(1,1);
       B(4,9)  =  Ny2p(1,1);
       B(4,10) =  Ny3p(1,1);
       B(4,14) =  Ny1p(1,2);
       B(4,15) =  Ny2p(1,2);
       B(4,16) =  Ny3p(1,2);
 
       B(5,2)  =  Nx1p(1,0) + Ny1p(0,0);
       B(5,3)  =  Nx2p(1,0) + Ny2p(0,0);
       B(5,4)  =  Nx3p(1,0) + Ny3p(0,0);
       B(5,8)  =  Nx1p(1,1) + Ny1p(0,1);
       B(5,9)  =  Nx2p(1,1) + Ny2p(0,1);
       B(5,10) =  Nx3p(1,1) + Ny3p(0,1);
       B(5,14) =  Nx1p(1,2) + Ny1p(0,2);
       B(5,15) =  Nx2p(1,2) + Ny2p(0,2);
       B(5,16) =  Nx3p(1,2) + Ny3p(0,2);
 
       ++B_it;
       ++shape_Np;
       ++shape_Nx1p;
       ++shape_Nx2p;
       ++shape_Nx3p;
       ++shape_Ny1p;
       ++shape_Ny2p; 
       ++shape_Ny3p;
     }
   }
 }
 
 
 /* -------------------------------------------------------------------------- */
 
 dumper::Field * StructuralMechanicsModel
 ::createNodalFieldBool(const std::string & field_name,
 		       const std::string & group_name,
 		       bool padding_flag) {
   
   std::map<std::string,Array<bool>* > uint_nodal_fields;
   uint_nodal_fields["blocked_dofs"             ] = blocked_dofs;
 
   dumper::Field * field = NULL;
   field = mesh.createNodalField(uint_nodal_fields[field_name],group_name);
   return field;
 
 }
 
 /* -------------------------------------------------------------------------- */
 
 
 dumper::Field * StructuralMechanicsModel
 ::createNodalFieldReal(const std::string & field_name,
 		       const std::string & group_name,
 		       bool padding_flag) {
 
   UInt n;
   if(spatial_dimension == 2) {
     n = 2;
   } else n = 3;
 
   dumper::Field * field = NULL;
 
   if (field_name == "displacement"){
     field = mesh.createStridedNodalField(displacement_rotation,group_name,n,0,padding_flag);
   }
   if (field_name == "rotation"){
     field = mesh.createStridedNodalField(displacement_rotation,group_name,
 					 nb_degree_of_freedom-n,n,padding_flag);
   }
   if (field_name == "force"){
     field = mesh.createStridedNodalField(force_momentum,group_name,n,0,padding_flag);
   }
   if (field_name == "momentum"){
     field = mesh.createStridedNodalField(force_momentum,group_name,
 					 nb_degree_of_freedom-n,n,padding_flag);
   }
   if (field_name == "residual"){
     field = mesh.createNodalField(residual,group_name,padding_flag);
   }
 
   return field;
 
 }
 
 /* -------------------------------------------------------------------------- */
 
 dumper::Field * StructuralMechanicsModel
 ::createElementalField(const std::string & field_name, 
 		       const std::string & group_name,
 		       bool padding_flag,
 		       const ElementKind & kind){
 
 
   dumper::Field * field = NULL;
 
   if(field_name == "element_index_by_material") 
     field = mesh.createElementalField<UInt, Vector, dumper::ElementalField >(field_name,group_name,this->spatial_dimension,kind);
 
   return field;
 }
 
 /* -------------------------------------------------------------------------- */
 
 
 
 
 
 __END_AKANTU__
diff --git a/test/test_io/test_dumper/test_dumper.cc b/test/test_io/test_dumper/test_dumper.cc
index 4f78d5dd9..40a49c6b1 100644
--- a/test/test_io/test_dumper/test_dumper.cc
+++ b/test/test_io/test_dumper/test_dumper.cc
@@ -1,160 +1,159 @@
 /**
  * @file   test_dumper.cc
  * @author David Kammer <david.kammer@epfl.ch>
  * @date   Tue Sep  2 16:52:47 2014
  *
  * @brief  test dumper
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
-//#include <iostream>
-//#include "mesh_io.hh"
 #include "solid_mechanics_model.hh"
 #include "dumper_text.hh"
 #include "dumper_variable.hh"
 #include "dumper_paraview.hh"
+#include "dumper_nodal_field.hh" 
 
 using namespace akantu;
 
 
 int main(int argc, char *argv[]) {
   initialize("input_file.dat", argc, argv);
 
   UInt spatial_dimension = 3;
   Mesh mesh(spatial_dimension);
   mesh.read("test_dumper.msh");
   mesh.createGroupsFromMeshData<std::string>("physical_names");
 
   SolidMechanicsModel model(mesh);
   MeshDataMaterialSelector<std::string> mat_selector("physical_names", model);
   model.setMaterialSelector(mat_selector);  
 
   model.initFull();
   model.setIncrementFlagOn();
   model.updateResidual();
   
   Real time_step = 0.1;
 
   const Array<Real> & coord = mesh.getNodes();
   Array<Real> & disp        = model.getDisplacement();
   Array<bool> & bound       = model.getBlockedDOFs();
 
   for (UInt n=0; n<mesh.getNbNodes(); ++n) {
     Real dist = 0.;
     for (UInt d=0; d<spatial_dimension; ++d) {
       dist += coord(n,d) * coord(n,d);
     }
     dist = sqrt(dist);
     
     for (UInt d=0; d<spatial_dimension; ++d) {
       disp(n,d) = (d+1) * dist;
       bound(n,d) = bool((n % 2) + d);
     }
   }
 
   // dump boundary bottom as reference
   model.setGroupDirectory("paraview", "Bottom");
   model.setGroupBaseName("paraview_bottom", "Bottom");
   model.addDumpGroupField("displacement", "Bottom");
   model.addDumpGroupField("blocked_dofs", "Bottom");
 
   UInt nbp = 3;
   DumperParaview prvdumper("paraview_bottom_parallel",
 			   "paraview",
 			   false);
   iohelper::Dumper & prvdpr = prvdumper.getDumper();
   for (UInt p=0; p<nbp; ++p) {
     prvdpr.setParallelContext(p, nbp, 0);
     if (p != 0) {
       prvdumper.unRegisterField("connectivities");
       prvdumper.unRegisterField("element_type");
       prvdumper.unRegisterField("positions");
       prvdumper.unRegisterField("displacement");
     } 
     prvdumper.registerFilteredMesh(mesh,
 				   mesh.getElementGroup("Bottom").getElements(),
 				   mesh.getElementGroup("Bottom").getNodes());
     prvdumper.registerField("displacement", 
 			    new dumper::NodalField<Real,true>(model.getDisplacement(),
 							      0,
 							      0,
 							      &(mesh.getElementGroup("Bottom").getNodes())));
     prvdumper.dump(0);
   }
 
 
   DumperText txtdumper("text_bottom", iohelper::_tdm_csv);
   txtdumper.setDirectory("paraview");
   txtdumper.setPrecision(8);
   txtdumper.setTimeStep(time_step);
   txtdumper.registerFilteredMesh(mesh,
    				 mesh.getElementGroup("Bottom").getElements(),
    				 mesh.getElementGroup("Bottom").getNodes());
   txtdumper.registerField("displacement",
 			  new dumper::NodalField<Real,true>(model.getDisplacement(), 
 							    0, 
 							    0, 
 							    &(mesh.getElementGroup("Bottom").getNodes())));
   txtdumper.registerField("blocked_dofs",
 			  new dumper::NodalField<bool,true>(model.getBlockedDOFs(), 
 								    0, 
 								    0, 
 								    &(mesh.getElementGroup("Bottom").getNodes())));
   
   Real pot_energy = 1.2345567891;
   Vector<Real> gforces(2,1.);
   txtdumper.registerVariable("potential_energy",
 			     new dumper::Variable<Real>(pot_energy));
   txtdumper.registerVariable("global_forces",
 			     new dumper::Variable< Vector<Real> >(gforces));
 
   // dump a first time before the main loop
   model.dumpGroup("Bottom");
   txtdumper.dump();
 
   Real time = 0.;
   for (UInt i=1; i<5; ++i) {
     pot_energy += 2.;
     gforces(0) += 0.1;
     gforces(1) += 0.2;
 
     // pre -> cor
 
     // increment time after all steps of integration
     time += time_step;
 
     // dump after time increment
     if (i%2 == 0) {
       txtdumper.dump(time,i);
       model.dumpGroup("Bottom");
       
       // parallel test
       for (UInt p=0; p<nbp; ++p) {
 	prvdpr.setParallelContext(p, nbp, 0);
 	prvdumper.dump(i);
       }
     }
   }
 
   finalize();
   return EXIT_SUCCESS;
 }
diff --git a/test/test_mesh_utils/test_mesh_partitionate/test_mesh_partitionate_mesh_data.cc b/test/test_mesh_utils/test_mesh_partitionate/test_mesh_partitionate_mesh_data.cc
index 8e9d1f3f2..e2e7777e5 100644
--- a/test/test_mesh_utils/test_mesh_partitionate/test_mesh_partitionate_mesh_data.cc
+++ b/test/test_mesh_utils/test_mesh_partitionate/test_mesh_partitionate_mesh_data.cc
@@ -1,105 +1,106 @@
 /**
  * @file   test_mesh_partitionate_mesh_data.cc
  *
  * @author Dana Christen <dana.christen@epfl.ch>
  *
  * @date   Tue May 07 17:16:12 2013
  *
  * @brief  test of manual partitioner
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 #include <cmath>
 /* -------------------------------------------------------------------------- */
 #include "aka_common.hh"
 #include "mesh.hh"
 #include "mesh_partition_mesh_data.hh"
 /* -------------------------------------------------------------------------- */
 #ifdef AKANTU_USE_IOHELPER
 #  include "dumper_paraview.hh"
+#include "dumper_elemental_field.hh"
 #endif //AKANTU_USE_IOHELPER
 
 using namespace akantu;
 /* -------------------------------------------------------------------------- */
 /* Main                                                                       */
 /* -------------------------------------------------------------------------- */
 int main(int argc, char *argv[])
 {
   initialize(argc, argv);
 
   UInt dim = 2;
   UInt nb_partitions = 8;
   akantu::Mesh mesh(dim);
   mesh.read("quad.msh");
   ElementTypeMapArray<UInt> partition;
   UInt nb_component = 1;
   GhostType gt = _not_ghost;
   Mesh::type_iterator tit = mesh.firstType(dim, gt);
   Mesh::type_iterator tend = mesh.lastType(dim, gt);
 
   for(; tit != tend; ++tit) {
     UInt nb_element = mesh.getNbElement(*tit, gt);
     partition.alloc(nb_element, nb_component, *tit, gt);
     Array<UInt> & type_partition_reference = partition(*tit, gt);
     for(UInt i(0); i < nb_element; ++i) {
       Real barycenter[dim];
       mesh.getBarycenter(i, *tit, barycenter, gt);
       Real real_proc = barycenter[0] * nb_partitions;
       if(real_proc-round(real_proc) < 10*std::numeric_limits<Real>::min()) {
         type_partition_reference(i) = round(real_proc);
       } else {
         std::cout << "*";
         type_partition_reference(i) = floor(real_proc);
       }
       std::cout << "Assigned proc " << type_partition_reference(i) << " to elem " << i << " (type " << *tit << ", barycenter x-coordinate " << barycenter[0] << ")" << std::endl;
     }
   }
 
   akantu::MeshPartitionMeshData * partitioner = new akantu::MeshPartitionMeshData(mesh, dim);
   partitioner->setPartitionMapping(partition);
   partitioner->partitionate(nb_partitions);
 
   tit = mesh.firstType(dim, gt);
   for(; tit != tend; ++tit) {
     UInt nb_element = mesh.getNbElement(*tit, gt);
     const Array<UInt> & type_partition_reference = partition(*tit, gt);
     const Array<UInt> & type_partition = partitioner->getPartitions()(*tit, gt);
     for(UInt i(0); i < nb_element; ++i) {
       AKANTU_DEBUG_ASSERT(type_partition(i) == type_partition_reference(i), "Incorrect partitioning");
     }
   }
 
 #ifdef AKANTU_USE_IOHELPER
   DumperParaview dumper("test-mesh-data-partition");
   dumper::Field * field =
     new dumper::ElementalField<UInt>(partitioner->getPartitions(), dim);
   dumper.registerMesh(mesh, dim);
   dumper.registerField("partitions", field);
   dumper.dump();
 #endif //AKANTU_USE_IOHELPER
 
   delete partitioner;
 
   finalize();
 
   return EXIT_SUCCESS;
 }
diff --git a/test/test_mesh_utils/test_mesh_partitionate/test_mesh_partitionate_scotch.cc b/test/test_mesh_utils/test_mesh_partitionate/test_mesh_partitionate_scotch.cc
index 8d996132d..668970f81 100644
--- a/test/test_mesh_utils/test_mesh_partitionate/test_mesh_partitionate_scotch.cc
+++ b/test/test_mesh_utils/test_mesh_partitionate/test_mesh_partitionate_scotch.cc
@@ -1,75 +1,76 @@
 /**
  * @file   test_mesh_partitionate_scotch.cc
  *
  * @author Nicolas Richart <nicolas.richart@epfl.ch>
  *
  * @date   Wed Sep 01 17:57:12 2010
  *
  * @brief  test of internal facet extraction
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 
 /* -------------------------------------------------------------------------- */
 #include "aka_common.hh"
 #include "mesh.hh"
 #include "mesh_partition_scotch.hh"
 /* -------------------------------------------------------------------------- */
 #ifdef AKANTU_USE_IOHELPER
 #  include "dumper_paraview.hh"
+#  include "dumper_elemental_field.hh" 
 #endif //AKANTU_USE_IOHELPER
 
 using namespace akantu;
 /* -------------------------------------------------------------------------- */
 /* Main                                                                       */
 /* -------------------------------------------------------------------------- */
 int main(int argc, char *argv[])
 {
   initialize(argc, argv);
   debug::setDebugLevel(akantu::dblDump);
 
   int dim = 2;
 
   akantu::Mesh mesh(dim);
   mesh.read("triangle.msh");
 
   akantu::MeshPartition * partition = new akantu::MeshPartitionScotch(mesh, dim);
   partition->partitionate(8);
 
 #ifdef AKANTU_USE_IOHELPER
   DumperParaview dumper("test-scotch-partition");
   dumper::Field * field = new dumper::ElementalField<UInt>(partition->getPartitions(),
 							   dim);
   dumper.registerMesh(mesh, dim);
   dumper.registerField("partitions", field);
   dumper.dump();
 #endif //AKANTU_USE_IOHELPER
 
   partition->reorder();
   mesh.write("triangle_reorder.msh");
 
   delete partition;
 
   finalize();
 
   return EXIT_SUCCESS;
 }
diff --git a/test/test_mesh_utils/test_mesh_partitionate/test_mesh_partitionate_scotch_advanced.cc b/test/test_mesh_utils/test_mesh_partitionate/test_mesh_partitionate_scotch_advanced.cc
index b73ce416c..664e0a445 100644
--- a/test/test_mesh_utils/test_mesh_partitionate/test_mesh_partitionate_scotch_advanced.cc
+++ b/test/test_mesh_utils/test_mesh_partitionate/test_mesh_partitionate_scotch_advanced.cc
@@ -1,397 +1,398 @@
 /**
  * @file   test_mesh_partitionate_scotch_advanced.cc
  * @author Nicolas Richart <nicolas.richart@epfl.ch>
  * @author David Kammer <david.kammer@epfl.ch>
  * @date   Tue Oct 16 09:20:24 2012
  *
  * @brief
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 
 /* -------------------------------------------------------------------------- */
 #include "aka_common.hh"
 #include "aka_array.hh"
 #include "mesh.hh"
 #include "fe_engine.hh"
 #include "mesh_utils.hh"
 #include "mesh_partition_scotch.hh"
 #include "element_group.hh"
 
 /* -------------------------------------------------------------------------- */
 #ifdef AKANTU_USE_IOHELPER
 #  include "dumper_paraview.hh"
+#  include <io_helper.hh>
 #endif //AKANTU_USE_IOHELPER
 
 using namespace akantu;
 
 ElementType type = _quadrangle_4;
 UInt nb_quadrature_points = 4;
 UInt nb_nodes_per_element = 4;
 
 
 
 /* -------------------------------------------------------------------------- */
 void getInterfaceNodePairs(Mesh & mesh,
 			   Array<UInt> & pairs);
 void getPartition(const Mesh & mesh,
 		  const MeshPartition::EdgeLoadFunctor & fctr,
 		  const Array<UInt> & pairs,
 		  MeshPartition * partition,
 		  Array<double> & parts);
 void dumpParaview(Mesh & mesh, std::string name,
 		  double * part_1, double * part_2);
 
 
 /* -------------------------------------------------------------------------- */
 class DoNotCutInterfaceFunctor : public MeshPartition::EdgeLoadFunctor {
 public:
   DoNotCutInterfaceFunctor(const Mesh & mesh) : mesh(mesh) {
 
   }
 
   virtual inline Int operator()(const Element & el1,
 					const Element & el2) const {
 
     const Array<UInt> & conn_1 = this->mesh.getConnectivity(el1.type);
     const Array<UInt> & conn_2 = this->mesh.getConnectivity(el2.type);
     std::set<UInt> nodes;
 
     // count number of nodes
     UInt nb_npe_1 = this->mesh.getNbNodesPerElement(el1.type);
     for (UInt i=0; i<nb_npe_1; ++i) {
       nodes.insert(conn_1(el1.element,i));
     }
     UInt nb_npe_2 = this->mesh.getNbNodesPerElement(el2.type);
     for (UInt i=0; i<nb_npe_2; ++i) {
       nodes.insert(conn_2(el2.element,i));
     }
     int max_nb_element = std::max(this->mesh.getNbElement(el1.type),
 				  this->mesh.getNbElement(el2.type));
     int max_nb_npe = std::max(nb_npe_1, nb_npe_2);
 
     // get barycenter of elements to put different weights in vert. and horiz. dir.
     Real bc_1[2];
     mesh.getBarycenter(el1.element,el1.type,bc_1);
     Real bc_2[2];
     mesh.getBarycenter(el2.element,el2.type,bc_2);
     Real bc_diff[2];
     bc_diff[0] = std::fabs(bc_1[0] - bc_2[0]);
     bc_diff[1] = std::fabs(bc_1[1] - bc_2[1]);
 
     // put weights according to criterion
     int weight = 1;
     if (nodes.size() == nb_npe_1 + nb_npe_2)
       weight = max_nb_element*max_nb_npe*4;
     else if (bc_diff[0] < bc_diff[1])
       weight = 5;
 
     return weight;
   }
 
 protected:
   const Mesh & mesh;
 };
 
 
 /* -------------------------------------------------------------------------- */
 /* Main                                                                       */
 /* -------------------------------------------------------------------------- */
 int main(int argc, char *argv[])
 {
   initialize(argc, argv);
   debug::setDebugLevel(dblDump);
   debug::setDebugLevel(dblWarning);
 
   int dim = 2;
 
   /* ---------- check if node pairs are considered with mesh_L --------- */
   Mesh mesh_l(dim);
   mesh_l.read("squares_L.msh");
 
   // get interface node pairs
   Array<UInt> pairs_l(0,2);
   Array<UInt> pairs_empty(0,2);
   getInterfaceNodePairs(mesh_l,pairs_l);
 
   MeshPartition * partition = new MeshPartitionScotch(mesh_l, mesh_l.getSpatialDimension());
 
   // make normal partition -> it should cut along the interface
   Array<double> parts(0,nb_quadrature_points);
   getPartition(mesh_l,
 	       MeshPartition::ConstEdgeLoadFunctor(),
 	       pairs_empty,
 	       partition,
 	       parts);
   double * part = parts.storage();
 
   // make partition with node pairs -> it should cut perpendicular to the interface
   Array<double> parts_adv(0,nb_quadrature_points);
   getPartition(mesh_l,
 	       MeshPartition::ConstEdgeLoadFunctor(),
 	       pairs_l,
 	       partition,
 	       parts_adv);
   double * part_adv = parts_adv.storage();
 
   // output to visualize
 #ifdef AKANTU_USE_IOHELPER
   dumpParaview(mesh_l, "test-scotch-partition-mesh-L",
 	       part, part_adv);
 #endif //AKANTU_USE_IOHELPER
 
   // check
   unsigned int nb_element = mesh_l.getNbElement(type);
   Real bb_center[2];
   mesh_l.getBarycenter(0,type,bb_center);
 
   // define solution for part
   unsigned int top_p_v = 0;
   unsigned int bot_p_v = 1;
   if (!(bb_center[1] > 0 && parts(0,0) == top_p_v) &&
       !(bb_center[1] < 0 && parts(0,0) == bot_p_v)) {
     top_p_v = 1;
     bot_p_v = 0;
   }
   std::cout << "top part = " << top_p_v << " | bot part = " << bot_p_v << std::endl;
 
   // define solution for part_adv
   unsigned int left_p_v = 0;
   unsigned int right_p_v = 1;
   if (!(bb_center[0] > 0 && parts_adv(0,0) == right_p_v) &&
       !(bb_center[0] < 0 && parts_adv(0,0) == left_p_v)) {
     left_p_v = 1;
     right_p_v = 0;
   }
   std::cout << "left part = " << left_p_v << " | right part = " << right_p_v << std::endl;
 
   // check
   for (UInt i=1; i<nb_element; ++i) {
     mesh_l.getBarycenter(i,type,bb_center);
 
     if (!(bb_center[1] > 0 && parts(i,0) == top_p_v) &&
 	!(bb_center[1] < 0 && parts(i,0) == bot_p_v)) {
       std::cerr << " ** ERROR with mesh-L without node pairs" << std::endl;
       return EXIT_FAILURE;
     }
     if (!(bb_center[0] > 0 && parts_adv(i,0) == right_p_v) &&
 	!(bb_center[0] < 0 && parts_adv(i,0) == left_p_v)) {
       std::cerr << " ** ERROR with mesh-L with node pairs" << std::endl;
       return EXIT_FAILURE;
     }
   }
 
   delete partition;
 
 
   /* ---------- check if node pairs and functor are considered with mesh_H --------- */
   Mesh mesh_h(dim, "mesh_h", 1);
   mesh_h.read("squares_H.msh");
   Array<UInt> pairs_h(0,2);
   getInterfaceNodePairs(mesh_h,pairs_h);
 
   partition = new MeshPartitionScotch(mesh_h, mesh_h.getSpatialDimension());
 
   // make normal partition -> it should cut along the interface
   getPartition(mesh_h,
 	       MeshPartition::ConstEdgeLoadFunctor(),
 	       pairs_h,
 	       partition,
 	       parts);
   part = parts.storage();
 
   // make partition with node pairs -> it should cut perpendicular to the interface
   DoNotCutInterfaceFunctor fctr = DoNotCutInterfaceFunctor(mesh_h);
   getPartition(mesh_h,
 	       fctr,
 	       pairs_h,
 	       partition,
 	       parts_adv);
   part_adv = parts_adv.storage();
 
   // output to visualize
 #ifdef AKANTU_USE_IOHELPER
   dumpParaview(mesh_h, "test-scotch-partition-mesh-H",
 	       part, part_adv);
 #endif //AKANTU_USE_IOHELPER
 
   // check
   nb_element = mesh_h.getNbElement(type);
   mesh_h.getBarycenter(0,type,bb_center);
 
   // define solution for part
   top_p_v = 0;
   bot_p_v = 1;
   if (!(bb_center[1] > 0 && parts(0,0) == top_p_v) &&
       !(bb_center[1] < 0 && parts(0,0) == bot_p_v)) {
     top_p_v = 1;
     bot_p_v = 0;
   }
   std::cout << "top part = " << top_p_v << " | bot part = " << bot_p_v << std::endl;
 
   // define solution for part_adv
   left_p_v = 0;
   right_p_v = 1;
   if (!(bb_center[0] > 0 && parts_adv(0,0) == right_p_v) &&
       !(bb_center[0] < 0 && parts_adv(0,0) == left_p_v)) {
     left_p_v = 1;
     right_p_v = 0;
   }
   std::cout << "left part = " << left_p_v << " | right part = " << right_p_v << std::endl;
 
   // check
   for (UInt i=1; i<nb_element; ++i) {
     mesh_h.getBarycenter(i,type,bb_center);
 
     if (!(bb_center[1] > 0 && parts(i,0) == top_p_v) &&
 	!(bb_center[1] < 0 && parts(i,0) == bot_p_v)) {
       std::cerr << " ** ERROR with mesh-H with node pairs and without functor" << std::endl;
       return EXIT_FAILURE;
     }
     if (!(bb_center[0] > 0 && parts_adv(i,0) == right_p_v) &&
 	!(bb_center[0] < 0 && parts_adv(i,0) == left_p_v)) {
       std::cerr << " ** ERROR with mesh-H with node pairs and with functor" << std::endl;
       return EXIT_FAILURE;
     }
   }
 
   delete partition;
 
   finalize();
   return EXIT_SUCCESS;
 }
 
 /* -------------------------------------------------------------------------- */
 void dumpParaview(Mesh & mesh, std::string name,
 		  double * part_1, double * part_2) {
 
   unsigned int nb_nodes = mesh.getNbNodes();
   unsigned int nb_element = mesh.getNbElement(type);
 
   iohelper::DumperParaview dumper;
   dumper.setMode(iohelper::TEXT);
   dumper.setPoints(mesh.getNodes().storage(), mesh.getSpatialDimension(),
 		   nb_nodes, name);
   dumper.setConnectivity((int*) mesh.getConnectivity(type).storage(),
    			 iohelper::QUAD1, nb_element, iohelper::C_MODE);
 
   dumper.addElemDataField("partition_1", part_1, 1, nb_element);
   dumper.addElemDataField("partition_2", part_2, 1, nb_element);
   dumper.setPrefix("paraview");
   dumper.init();
   dumper.dump();
 }
 
 /* -------------------------------------------------------------------------- */
 void getPartition(const Mesh & mesh,
 		  const MeshPartition::EdgeLoadFunctor & fctr,
 		  const Array<UInt> & pairs,
 		  MeshPartition * partition,
 		  Array<double> & parts) {
 
   //  partition->partitionate(2, MeshPartition::ConstEdgeLoadFunctor(), pairs_l);
   partition->partitionate(2, fctr, pairs);
 
   // get partition value for each element
   unsigned int nb_element = mesh.getNbElement(type);
 
   parts.resize(nb_element);
   //  double * part = new double[nb_element*nb_quadrature_points];
   UInt * part_val = partition->getPartition(type).storage();
   for (unsigned int i = 0; i < nb_element; ++i)
     for (unsigned int q = 0; q < nb_quadrature_points; ++q)
       //part[i*nb_quadrature_points + q] = part_val[i];
       parts(i,q) = part_val[i];
 }
 
 
 /* -------------------------------------------------------------------------- */
 void getInterfaceNodePairs(Mesh & mesh,
 			   Array<UInt> & pairs) {
 
   // put correct number of surfaces (gmsh starts with 1 but we need 0)
   Array<unsigned int> & surf =  const_cast<Array<unsigned int> &>(mesh.getData<unsigned int>("tag_1", _segment_2));
   Array<unsigned int>::iterator<unsigned int> it = surf.begin();
   Array<unsigned int>::iterator<unsigned int> end = surf.end();
 
   for (;it != end; ++it) --(*it);
 
   // set surface id
   // mesh.setSurfaceIDsFromIntData("tag_1");
   mesh.createGroupsFromMeshData<UInt>("tag_1");
 
 //  CSR<UInt> all_surface_nodes;
 //  MeshUtils::buildNodesPerSurface(mesh, all_surface_nodes);
 
   // find top interface nodes
   Array<UInt> top_nodes(0);
   std::string top = "1";
   const ElementGroup & topBoundary = mesh.getElementGroup(top);
   for(ElementGroup::const_node_iterator node(topBoundary.node_begin()); node != topBoundary.node_end(); ++node) {
       top_nodes.push_back(*node);
     }
 
   // find bottom interface nodes
   Array<UInt> bot_nodes(0);
   std::string bot = "4";
   const ElementGroup & botBoundary = mesh.getElementGroup(bot);
   for(ElementGroup::const_node_iterator node(botBoundary.node_begin()); node != botBoundary.node_end(); ++node) {
     bot_nodes.push_back(*node);
   }
 
   // verify that there is the same number of top and bottom nodes
   int nb_pairs = 0;
   if (bot_nodes.getSize() != top_nodes.getSize()) {
     std::cerr << " ** ERROR: Interface does not have the same number of top and bottom nodes" << std::endl;
   }
   else {
     nb_pairs = top_nodes.getSize();
   }
 
   // make pairs according to their x coordinate
   const Array<Real> & coords = mesh.getNodes();
   int dir = 0;
   for (int i=0; i<nb_pairs; ++i) {
     int top_min = -1;
     int bot_min = -1;
     double top_min_v = std::numeric_limits<double>::max();
     double bot_min_v = std::numeric_limits<double>::max();
     for (UInt j=0; j<top_nodes.getSize(); ++j) {
       if (coords(top_nodes(j),dir) < top_min_v) {
 	top_min = j;
 	top_min_v = coords(top_nodes(j),dir);
       }
       if (coords(bot_nodes(j),dir) < bot_min_v) {
 	bot_min = j;
 	bot_min_v = coords(bot_nodes(j),dir);
       }
     }
 
     UInt pair[2];
     pair[0] = top_nodes(top_min);
     pair[1] = bot_nodes(bot_min);
     pairs.push_back(pair);
     top_nodes.erase(top_min);
     bot_nodes.erase(bot_min);
   }
 
 }
diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic/test_cohesive_intrinsic_quadrangle.cc b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic/test_cohesive_intrinsic_quadrangle.cc
index 9bc94eeaa..72cfd46a0 100644
--- a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic/test_cohesive_intrinsic_quadrangle.cc
+++ b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic/test_cohesive_intrinsic_quadrangle.cc
@@ -1,228 +1,229 @@
 /**
  * @file   test_cohesive_intrinsic_quadrangle.cc
  *
  * @author Marco Vocialta <marco.vocialta@epfl.ch>
  *
  * @date   Wed Oct 03 10:20:53 2012
  *
  * @brief  Intrinsic cohesive elements' test for quadrangles
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 
 /* -------------------------------------------------------------------------- */
 #include <limits>
 #include <fstream>
 #include <iostream>
 
 /* -------------------------------------------------------------------------- */
 #include "solid_mechanics_model_cohesive.hh"
 #include "dumper_paraview.hh"
+#include "dumper_nodal_field.hh" 
 /* -------------------------------------------------------------------------- */
 
 using namespace akantu;
 
 static void updateDisplacement(SolidMechanicsModelCohesive &,
 			       Array<UInt> &,
 			       ElementType,
 			       Real);
 
 int main(int argc, char *argv[]) {
   initialize("material.dat", argc, argv);
 
   const UInt spatial_dimension = 2;
   const UInt max_steps = 350;
 
   const ElementType type = _quadrangle_4;
 
   Mesh mesh(spatial_dimension);
   mesh.read("quadrangle.msh");
 
 
   // debug::setDebugLevel(dblDump);
   // std::cout << mesh << std::endl;
   // debug::setDebugLevel(dblWarning);
 
   SolidMechanicsModelCohesive model(mesh);
 
   /// model initialization
   model.initFull();
 
   model.limitInsertion(BC::_x, -0.01, 0.01);
   model.insertIntrinsicElements();
 
   // mesh.write("mesh_cohesive_quadrangle.msh");
 
   // debug::setDebugLevel(dblDump);
   // std::cout << mesh << std::endl;
   // debug::setDebugLevel(dblWarning);
 
 
   Real time_step = model.getStableTimeStep()*0.8;
   model.setTimeStep(time_step);
   //  std::cout << "Time step: " << time_step << std::endl;
 
   model.assembleMassLumped();
 
 
   Array<bool> & boundary = model.getBlockedDOFs();
   //  const Array<Real> & residual = model.getResidual();
 
   UInt nb_nodes = mesh.getNbNodes();
   UInt nb_element = mesh.getNbElement(type);
 
   /// boundary conditions
   for (UInt dim = 0; dim < spatial_dimension; ++dim) {
     for (UInt n = 0; n < nb_nodes; ++n) {
       boundary(n, dim) = true;
     }
   }
 
   model.updateResidual();
 
   model.setBaseName("intrinsic_quadrangle");
   model.addDumpFieldVector("displacement");
   model.addDumpField("velocity"    );
   model.addDumpField("acceleration");
   model.addDumpField("residual"    );
   model.addDumpField("stress");
   model.addDumpField("grad_u");
   model.addDumpField("force");
   model.dump();
 
   DumperParaview dumper("cohesive_elements_quadrangle");
   dumper.registerMesh(mesh, spatial_dimension, _not_ghost, _ek_cohesive);
   dumper::NodalField<Real> * cohesive_displacement =
     new dumper::NodalField<Real>(model.getDisplacement());
   
   cohesive_displacement->setPadding(3);
   dumper.registerField("displacement", cohesive_displacement);
   dumper.dump();
 
   /// update displacement
   Array<UInt> elements;
   Real * bary = new Real[spatial_dimension];
   for (UInt el = 0; el < nb_element; ++el) {
     mesh.getBarycenter(el, type, bary);
     if (bary[0] > 0.) elements.push_back(el);
   }
   delete[] bary;
 
   Real increment = 0.01;
 
   updateDisplacement(model, elements, type, increment);
 
   // for (UInt n = 0; n < nb_nodes; ++n) {
   //   if (position(n, 1) + displacement(n, 1) > 0) {
   //     if (position(n, 0) == 0) {
   // 	displacement(n, 1) -= 0.25;
   //     }
   //     if (position(n, 0) == 1) {
   // 	displacement(n, 1) += 0.25;
   //     }
   //   }
   // }
 
   // std::ofstream edis("edis.txt");
   // std::ofstream erev("erev.txt");
 
   /// Main loop
   for (UInt s = 1; s <= max_steps; ++s) {
 
     model.explicitPred();
     model.updateResidual();
     model.updateAcceleration();
     model.explicitCorr();
 
     updateDisplacement(model, elements, type, increment);
 
     if(s % 1 == 0) {
       model.dump();
       dumper.dump();
       std::cout << "passing step " << s << "/" << max_steps << std::endl;
     }
 
     // // update displacement
     // for (UInt n = 0; n < nb_nodes; ++n) {
     //   if (position(n, 1) + displacement(n, 1) > 0) {
     // 	displacement(n, 0) -= 0.01;
     //   }
     // }
 
     //    Real Ed = dynamic_cast<MaterialCohesive&> (model.getMaterial(1)).getDissipatedEnergy();
     //    Real Er = dynamic_cast<MaterialCohesive&> (model.getMaterial(1)).getReversibleEnergy();
 
     // edis << s << " "
     // 	 << Ed << std::endl;
 
     // erev << s << " "
     // 	 << Er << std::endl;
 
   }
 
   // edis.close();
   // erev.close();
 
   Real Ed = model.getEnergy("dissipated");
 
   Real Edt = 1;
 
   std::cout << Ed << " " << Edt << std::endl;
 
   if (Ed < Edt * 0.999 || Ed > Edt * 1.001) {
     std::cout << "The dissipated energy is incorrect" << std::endl;
     return EXIT_FAILURE;
   }
 
   finalize();
 
   std::cout << "OK: test_cohesive_intrinsic_quadrangle was passed!" << std::endl;
   return EXIT_SUCCESS;
 }
 
 
 static void updateDisplacement(SolidMechanicsModelCohesive & model,
 			       Array<UInt> & elements,
 			       ElementType type,
 			       Real increment) {
 
   Mesh & mesh = model.getFEEngine().getMesh();
   UInt nb_element = elements.getSize();
   UInt nb_nodes = mesh.getNbNodes();
   UInt nb_nodes_per_element = mesh.getNbNodesPerElement(type);
 
   const Array<UInt> & connectivity = mesh.getConnectivity(type);
   Array<Real> & displacement = model.getDisplacement();
   Array<bool> update(nb_nodes);
   update.clear();
 
   for (UInt el = 0; el < nb_element; ++el) {
     for (UInt n = 0; n < nb_nodes_per_element; ++n) {
       UInt node = connectivity(elements(el), n);
       if (!update(node)) {
 	displacement(node, 0) += increment;
 	//	displacement(node, 1) += increment;
 	update(node) = true;
       }
     }
   }
 }
diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic/test_cohesive_intrinsic_tetrahedron_fragmentation.cc b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic/test_cohesive_intrinsic_tetrahedron_fragmentation.cc
index fd6bbd566..56536a2a3 100644
--- a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic/test_cohesive_intrinsic_tetrahedron_fragmentation.cc
+++ b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic/test_cohesive_intrinsic_tetrahedron_fragmentation.cc
@@ -1,135 +1,135 @@
 /**
  * @file   test_cohesive_intrinsic_tetrahedron.cc
  *
  * @author Marco Vocialta <marco.vocialta@epfl.ch>
  *
  * @date   Tue Aug 20 14:37:18 2013
  *
  * @brief  Test for cohesive elements
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu 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 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 #include <limits>
 #include <fstream>
 #include <iostream>
 
 /* -------------------------------------------------------------------------- */
 #include "solid_mechanics_model_cohesive.hh"
 #include "dumper_paraview.hh"
-
+#include "dumper_nodal_field.hh" 
 /* -------------------------------------------------------------------------- */
 
 using namespace akantu;
 
 int main(int argc, char *argv[]) {
   initialize("material.dat", argc, argv);
 
   //  debug::setDebugLevel(dblDump);
   ElementType type = _tetrahedron_10;
 
   const UInt spatial_dimension = 3;
   const UInt max_steps = 100;
 
   Mesh mesh(spatial_dimension);
   mesh.read("tetrahedron_full.msh");
 
   SolidMechanicsModelCohesive model(mesh);
 
   /// model initialization
   model.initFull();
   model.insertIntrinsicElements();
 
   Real time_step = model.getStableTimeStep()*0.8;
   model.setTimeStep(time_step);
   //  std::cout << "Time step: " << time_step << std::endl;
 
   model.assembleMassLumped();
 
   model.updateResidual();
 
   model.setBaseName("intrinsic_tetrahedron_fragmentation");
   model.addDumpFieldVector("displacement");
   model.addDumpField("velocity"    );
   model.addDumpField("acceleration");
   model.addDumpField("residual"    );
   model.addDumpField("stress");
   model.addDumpField("grad_u");
   model.dump();
 
   DumperParaview dumper("cohesive_elements_tetrahedron_fragmentation");
   dumper.registerMesh(mesh, spatial_dimension, _not_ghost, _ek_cohesive);
   dumper::NodalField<Real> * cohesive_displacement =
     new dumper::NodalField<Real>(model.getDisplacement());
 
   cohesive_displacement->setPadding(3);
 
 
   dumper.registerField("displacement", cohesive_displacement);
 
   dumper.dump();
 
   /// update displacement
   UInt nb_element = mesh.getNbElement(type);
   UInt nb_nodes = mesh.getNbNodes();
   UInt nb_nodes_per_element = mesh.getNbNodesPerElement(type);
   Real * bary = new Real[spatial_dimension];
 
   const Array<UInt> & connectivity = mesh.getConnectivity(type);
   Array<Real> & displacement = model.getDisplacement();
   Array<bool> update(nb_nodes);
 
 
   for (UInt s = 0; s < max_steps; ++s) {
     Real increment = s / 10.;
     update.clear();
 
     for (UInt el = 0; el < nb_element; ++el) {
       mesh.getBarycenter(el, type, bary);
       for (UInt n = 0; n < nb_nodes_per_element; ++n) {
 	UInt node = connectivity(el, n);
 	if (!update(node)) {
 	  for (UInt dim = 0; dim < spatial_dimension; ++dim) {
 	    displacement(node, dim) = increment * bary[dim];
 	    update(node) = true;
 	  }
 	}
       }
     }
 
     if (s % 10 == 0) {
       model.dump();
       dumper.dump();
     }
   }
 
   delete[] bary;
 
   if (nb_nodes != nb_element * Mesh::getNbNodesPerElement(type)) {
     std::cout << "Wrong number of nodes" << std::endl;
     finalize();
     return EXIT_FAILURE;
   }
 
   finalize();
   std::cout << "OK: test_cohesive_intrinsic_tetrahedron was passed!" << std::endl;
   return EXIT_SUCCESS;
 }