Index: src/Filling/Makefile.am
===================================================================
--- src/Filling/Makefile.am	(revision 748fc7c0d1024191307cd0382559ca5a2f64eacb)
+++ src/Filling/Makefile.am	(revision cae61447a8c102b09ec82b970c3991c54f311fb5)
@@ -19,5 +19,7 @@
 	Filling/Predicates/IsValidInDomain_FillPredicate.cpp \
 	Filling/Predicates/IsVoidNode_FillPredicate.cpp \
-	Filling/Predicates/Ops_FillPredicate.cpp
+	Filling/Predicates/Ops_FillPredicate.cpp \
+	Filling/Preparators/BaseFillerPreparator.cpp \
+	Filling/Preparators/BoxFillerPreparator.cpp
 	
 FILLINGHEADER = \
@@ -44,6 +46,7 @@
 	Filling/Predicates/IsVoidNode_FillPredicate.hpp \
 	Filling/Predicates/Ops_FillPredicate.hpp \
-	Filling/Predicates/Ops_FillPredicate_impl.hpp
-				  
+	Filling/Predicates/Ops_FillPredicate_impl.hpp \
+	Filling/Preparators/BaseFillerPreparator.hpp \
+	Filling/Preparators/BoxFillerPreparator.hpp
 
 noinst_LTLIBRARIES += libMolecuilderFilling.la
Index: src/Filling/Preparators/BaseFillerPreparator.cpp
===================================================================
--- src/Filling/Preparators/BaseFillerPreparator.cpp	(revision cae61447a8c102b09ec82b970c3991c54f311fb5)
+++ src/Filling/Preparators/BaseFillerPreparator.cpp	(revision cae61447a8c102b09ec82b970c3991c54f311fb5)
@@ -0,0 +1,140 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2014 Frederik Heber. All rights reserved.
+ *
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder 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 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder 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 MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * BaseFillerPreparator.cpp
+ *
+ *  Created on: Sep 2, 2014
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "BaseFillerPreparator.hpp"
+
+#include "CodePatterns/Log.hpp"
+
+#include "Atom/atom.hpp"
+#include "Filling/Cluster.hpp"
+#include "Filling/Filler.hpp"
+#include "Filling/Inserter/Inserter.hpp"
+#include "Filling/Inserter/RandomInserter.hpp"
+#include "Filling/Mesh/CubeMesh.hpp"
+#include "Filling/Mesh/MeshAdaptor.hpp"
+#include "Filling/Predicates/IsInsideSurface_FillPredicate.hpp"
+#include "Filling/Predicates/IsVoidNode_FillPredicate.hpp"
+#include "Filling/Predicates/Ops_FillPredicate.hpp"
+#include "LinkedCell/linkedcell.hpp"
+#include "LinkedCell/PointCloudAdaptor.hpp"
+#include "molecule.hpp"
+#include "Shapes/BaseShapes.hpp"
+#include "Tesselation/tesselation.hpp"
+
+
+BaseFillerPreparator::BaseFillerPreparator(molecule *_filler) :
+  filler(_filler),
+  surface_predicate(NULL),
+  LC(NULL),
+  TesselStruct(NULL),
+  voidnode_predicate(NULL),
+  Andpredicate(NULL),
+  mesh(NULL),
+  inserter(NULL),
+  fillerFunction(NULL)
+{}
+
+BaseFillerPreparator::~BaseFillerPreparator()
+{
+  // free all structures if allocated
+  delete fillerFunction;
+  delete inserter;
+  delete mesh;
+  delete Andpredicate;
+  delete voidnode_predicate;
+  delete TesselStruct;
+  delete LC;
+  delete surface_predicate;
+  // given filler molecule is from someplace else
+  filler = NULL;
+}
+
+void BaseFillerPreparator::addSurfacePredicate(
+    const double _radius,
+    std::vector<atom *> &_atoms)
+{
+  // create adaptor for the selected atoms
+  PointCloudAdaptor< std::vector<atom *> > cloud(&_atoms, std::string("Selected atoms"));
+
+  // create tesselation
+  LC = new LinkedCell_deprecated(cloud, 2.*_radius);
+  TesselStruct = new Tesselation;
+  (*TesselStruct)(cloud, _radius);
+
+  // and create predicate
+  surface_predicate = new FillPredicate( IsInsideSurface_FillPredicate( *TesselStruct, *LC ) );
+}
+
+void BaseFillerPreparator::addRandomInserter(
+    const double _RandAtomDisplacement,
+    const double _RandMoleculeDisplacement,
+    const bool _DoRotate)
+{
+  inserter = new Inserter(
+      Inserter::impl_ptr(
+          new RandomInserter(
+              _RandAtomDisplacement,
+              _RandMoleculeDisplacement,
+              _DoRotate)
+          )
+      );
+}
+
+void BaseFillerPreparator::addVoidPredicate(
+    const double _mindistance)
+{
+  voidnode_predicate = new FillPredicate(
+      IsVoidNode_FillPredicate(
+          Sphere(zeroVec, _mindistance)
+          )
+      );
+}
+
+bool BaseFillerPreparator::operator()()
+{
+  if ((mesh != NULL)
+      && (inserter != NULL)
+      && (voidnode_predicate != NULL)) {
+
+    FillPredicate Andpredicate = *voidnode_predicate;
+    if (surface_predicate != NULL)
+      Andpredicate = (Andpredicate) && !(*surface_predicate);
+    fillerFunction = new Filler(*mesh, Andpredicate, *inserter);
+    return true;
+  } else {
+    return false;
+  }
+}
Index: src/Filling/Preparators/BaseFillerPreparator.hpp
===================================================================
--- src/Filling/Preparators/BaseFillerPreparator.hpp	(revision cae61447a8c102b09ec82b970c3991c54f311fb5)
+++ src/Filling/Preparators/BaseFillerPreparator.hpp	(revision cae61447a8c102b09ec82b970c3991c54f311fb5)
@@ -0,0 +1,75 @@
+/*
+ * BaseFillerPrepator.hpp
+ *
+ *  Created on: Sep 2, 2014
+ *      Author: heber
+ */
+
+#ifndef BASEFILLERPREPARATOR_HPP_
+#define BASEFILLERPREPARATOR_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+class atom;
+class Filler;
+class FillPredicate;
+class Inserter;
+class LinkedCell_deprecated;
+class Mesh;
+class molecule;
+class Tesselation;
+
+#include <vector>
+
+/** BaseFillerPrepator is the base class for all specific filler preparators.
+ *
+ * Specific preparators combine all the various aspects of filling into a specific
+ * package for easy and convenient calling for returning a filler function.
+ *
+ * It defines both the interface and implements some common functions.
+ */
+class BaseFillerPreparator
+{
+public:
+  BaseFillerPreparator(molecule *_filler);
+  virtual ~BaseFillerPreparator();
+
+  void addSurfacePredicate(
+      const double _radius,
+      std::vector<atom *> &_atoms);
+  void addRandomInserter(
+      const double _RandAtomDisplacement,
+      const double _RandMoleculeDisplacement,
+      const bool _DoRotate);
+  void addVoidPredicate(
+      const double _mindistance);
+  bool operator()();
+
+  /* The operator is just a getter for the constructed fillerFunction.
+   *
+   * \return allocated Filler (is not deleted here)
+   */
+  Filler* obtainFiller()
+  {
+    Filler *temp = fillerFunction;
+    fillerFunction = NULL;
+    return temp;
+  }
+
+protected:
+  molecule *filler;
+  FillPredicate * surface_predicate;
+  LinkedCell_deprecated * LC;
+  Tesselation * TesselStruct;
+  FillPredicate *voidnode_predicate;
+  FillPredicate *Andpredicate;
+  Mesh *mesh;
+  Inserter *inserter;
+  Filler *fillerFunction;
+};
+
+
+#endif /* BASEFILLERPREPARATOR_HPP_ */
Index: src/Filling/Preparators/BoxFillerPreparator.cpp
===================================================================
--- src/Filling/Preparators/BoxFillerPreparator.cpp	(revision cae61447a8c102b09ec82b970c3991c54f311fb5)
+++ src/Filling/Preparators/BoxFillerPreparator.cpp	(revision cae61447a8c102b09ec82b970c3991c54f311fb5)
@@ -0,0 +1,57 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2014 Frederik Heber. All rights reserved.
+ *
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder 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 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder 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 MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * BoxFillerPreparator.cpp
+ *
+ *  Created on: Sep 2, 2014
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "BoxFillerPreparator.hpp"
+
+#include "LinearAlgebra/RealSpaceMatrix.hpp"
+
+#include "Filling/Mesh/CubeMesh.hpp"
+#include "molecule.hpp"
+
+BoxFillerPreparator::BoxFillerPreparator(molecule *_filler) :
+  BaseFillerPreparator(_filler)
+{}
+
+BoxFillerPreparator::~BoxFillerPreparator()
+{}
+
+void BoxFillerPreparator::addCubeMesh(
+    const std::vector<unsigned int> _counts,
+    const Vector &_offset,
+    const RealSpaceMatrix &_M)
+{
+  mesh = new CubeMesh(_counts, _offset, _M);
+}
Index: src/Filling/Preparators/BoxFillerPreparator.hpp
===================================================================
--- src/Filling/Preparators/BoxFillerPreparator.hpp	(revision cae61447a8c102b09ec82b970c3991c54f311fb5)
+++ src/Filling/Preparators/BoxFillerPreparator.hpp	(revision cae61447a8c102b09ec82b970c3991c54f311fb5)
@@ -0,0 +1,42 @@
+/*
+ * BoxFillerPreparator.hpp
+ *
+ *  Created on: Sep 2, 2014
+ *      Author: heber
+ */
+
+#ifndef BOXFILLERPREPARATOR_HPP_
+#define BOXFILLERPREPARATOR_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "BaseFillerPreparator.hpp"
+
+#include <vector>
+
+#include "LinearAlgebra/Vector.hpp"
+
+class RealSpaceMatrix;
+
+/** This class prepares a filler for filling the whole domain at specific points.
+ *
+ */
+class BoxFillerPreparator :
+  public BaseFillerPreparator
+{
+public:
+    BoxFillerPreparator(molecule *_filler);
+    ~BoxFillerPreparator();
+
+    void addCubeMesh(
+        const std::vector<unsigned int> _counts,
+        const Vector &_offset,
+        const RealSpaceMatrix &_M);
+
+};
+
+
+#endif /* BOXFILLERPREPARATOR_HPP_ */
