diff --git a/apps/benchmarks/ComplexGeometry/ComplexGeometry.cpp b/apps/benchmarks/ComplexGeometry/ComplexGeometry.cpp
index 6272dbc8d97504afc1d18d65b9b289d297e896b4..e8d56f6c3af993167745bf4e0763f750ad35d408 100644
--- a/apps/benchmarks/ComplexGeometry/ComplexGeometry.cpp
+++ b/apps/benchmarks/ComplexGeometry/ComplexGeometry.cpp
@@ -57,6 +57,7 @@
 #include "mesh/TriangleMeshes.h"
 #include "mesh/MeshOperations.h"
 #include "mesh/DistanceComputations.h"
+#include "mesh/DistanceFunction.h"
 #include "mesh/MeshIO.h"
 #include "mesh/MatrixVectorOperations.h"
 #include "mesh/blockforest/BlockForestInitialization.h"
@@ -67,6 +68,7 @@
 #include "mesh/boundary/BoundarySetup.h"
 #include "mesh/boundary/BoundaryInfo.h"
 #include "mesh/boundary/BoundaryLocation.h"
+#include "mesh/boundary/BoundaryLocationFunction.h"
 #include "mesh/boundary/BoundaryUIDFaceDataSource.h"
 #include "mesh/boundary/ColorToBoundaryMapper.h"
 #include "mesh/vtk/VTKMeshWriter.h"
@@ -84,47 +86,6 @@
 
 namespace walberla {
 
-
-template< typename MeshDistanceType >
-struct MeshDistanceFunction
-{
-   MeshDistanceFunction( const shared_ptr< MeshDistanceType > & meshDistanceObject ) : meshDistanceObject_( meshDistanceObject ) { }
-
-   inline real_t operator()( const Vector3< real_t > & p ) const { return real_c( meshDistanceObject_->sqSignedDistance( mesh::toOpenMesh( p ) ) ); }
-
-   shared_ptr< MeshDistanceType > meshDistanceObject_;
-};
-
-template< typename MeshDistanceType >
-inline MeshDistanceFunction< MeshDistanceType > makeMeshDistanceFunction( const shared_ptr< MeshDistanceType > & meshDistanceObject )
-{
-   return MeshDistanceFunction< MeshDistanceType >( meshDistanceObject );
-}
-
-
-template< typename MeshDistanceType, typename MeshType >
-struct BoundaryLocationFunction
-{
-   BoundaryLocationFunction( const shared_ptr< MeshDistanceType > & meshDistanceObject, const shared_ptr< mesh::BoundaryLocation< MeshType > > & boundaryLocation )
-      : meshDistanceObject_( meshDistanceObject ), boundaryLocation_( boundaryLocation ) { }
-
-   inline const mesh::BoundaryInfo & operator()( const Vector3< real_t > & p ) const
-   {
-      typename MeshType::FaceHandle fh;
-      meshDistanceObject_->sqSignedDistance( mesh::toOpenMesh( p ), fh );
-      return (*boundaryLocation_)[ fh ];
-   }
-
-   shared_ptr< MeshDistanceType > meshDistanceObject_;
-   shared_ptr< mesh::BoundaryLocation< MeshType > > boundaryLocation_;
-};
-
-template< typename MeshDistanceType, typename MeshType >
-inline BoundaryLocationFunction< MeshDistanceType, MeshType > makeBoundaryLocationFunction( const shared_ptr< MeshDistanceType > & meshDistanceObject, const shared_ptr< mesh::BoundaryLocation< MeshType > > & boundaryLocation )
-{
-   return BoundaryLocationFunction< MeshDistanceType, MeshType >( meshDistanceObject, boundaryLocation );
-}
-
 template< typename MeshType >
 void vertexToFaceColor( MeshType & mesh, const typename MeshType::Color & defaultColor )
 {
diff --git a/src/mesh/DistanceFunction.h b/src/mesh/DistanceFunction.h
index b3ab0bf62bb39b4b43e2e14a3643ee99f1354cd2..3ad98451cd728b6086370583132a42574db7149b 100644
--- a/src/mesh/DistanceFunction.h
+++ b/src/mesh/DistanceFunction.h
@@ -13,19 +13,17 @@
 //  You should have received a copy of the GNU General Public License along
 //  with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
-//! \file BoundarySetup.h
+//! \file DistanceFunction.h
 //! \ingroup mesh
 //! \author Christian Godenschwager <christian.godenschwager@fau.de>
-//! \author Christian Godenschwager <martin.bauer@fau.de>
+//! \author Martin Bauer <martin.bauer@fau.de>
 //
 //======================================================================================================================
 
-#include "core/DataTypes.h"
-
+#include "core/math/Vector3.h"
+#include "mesh/MatrixVectorOperations.h"
 
 namespace walberla {
-namespace mesh {
-
 
 template<typename MeshDistanceType>
 struct MeshDistanceFunction
@@ -48,5 +46,4 @@ makeMeshDistanceFunction( const shared_ptr <MeshDistanceType> & meshDistanceObje
    return MeshDistanceFunction<MeshDistanceType>( meshDistanceObject );
 }
 
-} // namespace mesh
 } // namespace walberla
diff --git a/src/mesh/boundary/BoundaryLocationFunction.h b/src/mesh/boundary/BoundaryLocationFunction.h
new file mode 100644
index 0000000000000000000000000000000000000000..0cd1e160b4a77f36ea75c7b6be24dab281b6ecf1
--- /dev/null
+++ b/src/mesh/boundary/BoundaryLocationFunction.h
@@ -0,0 +1,51 @@
+//======================================================================================================================
+//
+//  This file is part of waLBerla. waLBerla is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  waLBerla 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 General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file BoundaryLocationFunction.h
+//! \ingroup mesh
+//! \author Christoph Schwarzmeier <christoph.schwarzmeier@fau.de>
+//
+//======================================================================================================================
+
+namespace walberla {
+
+template< typename MeshDistanceType, typename MeshType >
+struct BoundaryLocationFunction
+{
+   BoundaryLocationFunction(const shared_ptr< MeshDistanceType >& meshDistanceObject,
+                            const shared_ptr< mesh::BoundaryLocation< MeshType > >& boundaryLocation)
+      : meshDistanceObject_(meshDistanceObject), boundaryLocation_(boundaryLocation)
+   {}
+
+   inline const mesh::BoundaryInfo& operator()(const Vector3< real_t >& p) const
+   {
+      typename MeshType::FaceHandle fh;
+      meshDistanceObject_->sqSignedDistance(mesh::toOpenMesh(p), fh);
+      return (*boundaryLocation_)[fh];
+   }
+
+   shared_ptr< MeshDistanceType > meshDistanceObject_;
+   shared_ptr< mesh::BoundaryLocation< MeshType > > boundaryLocation_;
+};
+
+template< typename MeshDistanceType, typename MeshType >
+inline BoundaryLocationFunction< MeshDistanceType, MeshType >
+   makeBoundaryLocationFunction(const shared_ptr< MeshDistanceType >& meshDistanceObject,
+                                const shared_ptr< mesh::BoundaryLocation< MeshType > >& boundaryLocation)
+{
+   return BoundaryLocationFunction< MeshDistanceType, MeshType >(meshDistanceObject, boundaryLocation);
+}
+
+} // namespace walberla
\ No newline at end of file