diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4f2ffc0b6..80f471fb7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,71 +1,75 @@
 cmake_minimum_required(VERSION 2.6)
 project(Akantu_SimTools)
 
 set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries.")
 
 set(AKANTU_SIMTOOLS_SRCS
 
   common/synchronized_array.cc
   common/parameter_reader.cc
   common/manual_restart.cc
 
+  functions/boundary_functions.cc
+
   ntn_contact/ntn_contact.cc
   ntn_contact/ntn_friction.cc
   ntn_contact/friction_laws/ntn_friction_coulomb.cc
   ntn_contact/friction_laws/ntn_friction_linear_slip_weakening.cc
 
   ntrf_contact/ntrf_contact.cc
   ntrf_contact/ntrf_friction.cc
   ntrf_contact/friction_laws/ntrf_friction_coulomb.cc
   ntrf_contact/friction_laws/ntrf_friction_regularized_coulomb.cc
   ntrf_contact/friction_laws/ntrf_friction_linear_slip_weakening.cc
   )
 
 set(AKANTU_SIMTOOLS_HDRS
   common/ast_common.hh
   akantu_simtools.hh
 
   # headers
   common/synchronized_array.hh
   common/parameter_reader.hh
   common/manual_restart.hh
 
+  functions/boundary_functions.hh
+
   ntn_contact/ntn_contact.hh
   ntn_contact/ntn_friction.hh
   ntn_contact/friction_laws/ntn_friction_coulomb.hh
   ntn_contact/friction_laws/ntn_friction_linear_slip_weakening.hh
 
   ntrf_contact/ntrf_contact.hh
   ntrf_contact/ntrf_friction.hh
   ntrf_contact/friction_laws/ntrf_friction_coulomb.hh
   ntrf_contact/friction_laws/ntrf_friction_regularized_coulomb.hh
   ntrf_contact/friction_laws/ntrf_friction_linear_slip_weakening.hh
 
   # inlines
   common/synchronized_array_inline_impl.cc
   )
 
 
 find_package(Akantu REQUIRED)
 include_directories(${AKANTU_INCLUDE_DIR})
 
 
 add_library(akantu_simtools
   ${AKANTU_SIMTOOLS_SRCS}
   )
 
 include_directories(common/)
 include_directories(ntn_contact/)
 include_directories(ntn_contact/friction_laws/)
 include_directories(ntrf_contact/)
 include_directories(ntrf_contact/friction_laws/)
 
 target_link_libraries(akantu_simtools ${AKANTU_LIBRARIES})
 set_target_properties(akantu_simtools
   PROPERTIES PUBLIC_HEADER "${AKANTU_SIMTOOLS_HDRS}")
 
 install(TARGETS akantu_simtools
   LIBRARY DESTINATION lib
   ARCHIVE DESTINATION lib
   PUBLIC_HEADER DESTINATION include/akantu_simtools
   )
diff --git a/akantu_simtools.hh b/akantu_simtools.hh
index 139adcc57..0fc7ee1f4 100644
--- a/akantu_simtools.hh
+++ b/akantu_simtools.hh
@@ -1,19 +1,22 @@
 // ast common
 #include "ast_common.hh"
 #include "synchronized_array.hh"
 #include "parameter_reader.hh"
 #include "manual_restart.hh"
 
+// functions
+#include "boundary_functions.hh"
+
 // ntn contact/friction
 #include "ntn_contact.hh"
 #include "ntn_friction.hh"
 #include "ntn_friction_coulomb.hh"
 #include "ntn_friction_linear_slip_weakening.hh"
 
 // ntrf contact/friction
 #include "ntrf_contact.hh"
 #include "ntrf_friction.hh"
 #include "ntrf_friction_coulomb.hh"
 #include "ntrf_friction_regularized_coulomb.hh"
 #include "ntrf_friction_linear_slip_weakening.hh"
 
diff --git a/functions/boundary_functions.cc b/functions/boundary_functions.cc
new file mode 100644
index 000000000..f0effbc34
--- /dev/null
+++ b/functions/boundary_functions.cc
@@ -0,0 +1,28 @@
+#include "boundary_functions.hh"
+
+__BEGIN_SIMTOOLS__
+
+/* -------------------------------------------------------------------------- */
+Real integrateResidual(const std::string & sub_boundary_name,
+		       const SolidMechanicsModel & model,
+		       UInt dir) {
+  Real int_res = 0.;
+  
+  const Mesh & mesh = model.getMesh();
+  const Array<Real> & residual = model.getResidual();
+
+  const SubBoundary & boundary = mesh.getSubBoundary(sub_boundary_name);
+  SubBoundary::nodes_const_iterator nit  = boundary.nodes_begin();
+  SubBoundary::nodes_const_iterator nend = boundary.nodes_end();
+  for (; nit != nend; ++nit) {
+    bool is_local_node = mesh.isLocalOrMasterNode(*nit);
+    if (is_local_node) {
+      int_res += residual(*nit, dir);
+    }
+  }
+
+  StaticCommunicator::getStaticCommunicator().allReduce(&int_res, 1, _so_sum);
+  return int_res;
+}
+
+__END_SIMTOOLS__
diff --git a/functions/boundary_functions.hh b/functions/boundary_functions.hh
new file mode 100644
index 000000000..40066a71c
--- /dev/null
+++ b/functions/boundary_functions.hh
@@ -0,0 +1,43 @@
+/**
+ * @file   boundary_functions.hh
+ * @author David Kammer <david.kammer@epfl.ch>
+ * @date   Mon Jun 17 14:15:57 2013
+ *
+ * @brief  functions for boundaries
+ *
+ * @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/>.
+ *
+ */
+
+/* -------------------------------------------------------------------------- */
+// akantu
+#include "aka_common.hh"
+#include "solid_mechanics_model.hh"
+
+// simtools
+#include "ast_common.hh"
+
+__BEGIN_SIMTOOLS__
+
+using namespace akantu;
+
+Real integrateResidual(const std::string & sub_boundary_name,
+		       const SolidMechanicsModel & model,
+		       UInt dir);
+__END_SIMTOOLS__