Index: src/LinkedCell/unittests/LinkedCell_ViewUnitTest.cpp
===================================================================
--- src/LinkedCell/unittests/LinkedCell_ViewUnitTest.cpp	(revision 5344e4935985c68c502a7e1e2e936a0ac622ef57)
+++ src/LinkedCell/unittests/LinkedCell_ViewUnitTest.cpp	(revision 5344e4935985c68c502a7e1e2e936a0ac622ef57)
@@ -0,0 +1,180 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2011 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * LinkedCell_ViewUnitTest.cpp
+ *
+ *  Created on: Nov 18, 2011
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+using namespace std;
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+#include <algorithm>
+#include <list>
+
+#include "Box.hpp"
+#include "CodePatterns/Assert.hpp"
+#include "CodePatterns/Log.hpp"
+#include "LinearAlgebra/defs.hpp"
+#include "LinearAlgebra/RealSpaceMatrix.hpp"
+#include "LinkedCell/LinkedCell.hpp"
+#include "LinkedCell/LinkedCell_Model.hpp"
+#include "LinkedCell/LinkedCell_View.hpp"
+#include "LinkedCell/PointCloudAdaptor.hpp"
+
+#include "LinkedCell_ViewUnitTest.hpp"
+
+#ifdef HAVE_TESTRUNNER
+#include "UnitTestMain.hpp"
+#endif /*HAVE_TESTRUNNER*/
+
+/********************************************** Test classes **************************************/
+
+#define DOMAINLENGTH 20.
+#define EDGELENGTH 2.
+#define NUMBERCELLS DOMAINLENGTH/EDGELENGTH
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( LinkedCell_ViewTest );
+
+
+void LinkedCell_ViewTest::setUp()
+{
+  // failing asserts should be thrown
+  ASSERT_DO(Assert::Throw);
+
+  //setVerbosity(3);
+
+  // create diag(20.) matrix
+  RealSpaceMatrix BoxM;
+  BoxM.setIdentity();
+  BoxM *= 20.;
+
+  // create Box with this matrix
+  domain = new Box(BoxM);
+
+  // create LinkedCell structure with this Box
+  LCImpl = new LinkedCell::LinkedCell_Model(EDGELENGTH, *domain);
+
+  // create a list of nodes and add to LCImpl
+  std::vector< Vector > VectorList;
+  for (size_t i=0;i<((size_t)floor(NUMBERCELLS));++i)
+    VectorList.push_back(Vector((double)i*EDGELENGTH,(double)i*EDGELENGTH,(double)i*EDGELENGTH));
+  for (size_t i=0;i<VectorList.size();++i) {
+    TesselPoint * Walker = new TesselPoint();
+    Walker->setName(std::string("Walker")+toString(i));
+    Walker->setPosition(VectorList[i]);
+    NodeList.insert(Walker);
+    LCImpl->addNode(Walker);
+  }
+
+  // create LinkedCell_View from that
+  LC = new LinkedCell::LinkedCell_View(*LCImpl);
+}
+
+
+void LinkedCell_ViewTest::tearDown()
+{
+  delete LC;
+  delete LCImpl;
+  delete domain;
+
+  // remove all nodes again
+  for (PointSet::iterator iter = NodeList.begin();
+      !NodeList.empty();
+      iter = NodeList.begin()) {
+    delete *iter;
+    NodeList.erase(iter);
+  }
+}
+
+
+/** UnitTest for getAllNeighbors()
+ */
+void LinkedCell_ViewTest::getAllNeighborsTest()
+{
+  // define some center vector
+  Vector center(DOMAINLENGTH/2.,DOMAINLENGTH/2.,DOMAINLENGTH/2.);
+
+  // get LinkedList from LC
+  const double distance = 2.;
+  LinkedCell::LinkedList NeighborList = LC->getAllNeighbors(distance, center);
+//  for (LinkedCell::LinkedList::const_iterator iter = NeighborList.begin();
+//      iter != NeighborList.end(); ++iter)
+//    std::cout << **iter << " is in returned neighbor list." << std::endl;
+
+  // gather points from NodeList
+  LinkedCell::LinkedList ComparisonList;
+  for (PointSet::const_iterator iter = NodeList.begin(); iter != NodeList.end(); ++iter)
+    if (center.DistanceSquared((*iter)->getPosition()) <= distance*distance) {
+      ComparisonList.push_back(*iter);
+      //std::cout << **iter << " is inside of " << center << " plus " << distance << "." << std::endl;
+    }
+  // check that we get at least as many as needed
+  CPPUNIT_ASSERT(ComparisonList.size() <= NeighborList.size());
+
+  // sort lists to ease comparison
+  ComparisonList.sort();
+  NeighborList.sort();
+
+  // check element-wise and skip unrequired ones
+  LinkedCell::LinkedList::iterator iter1 = ComparisonList.begin();
+  LinkedCell::LinkedList::iterator iter2 = NeighborList.begin();
+  for(;(iter1 != ComparisonList.end()) && (iter2 != NeighborList.end()); ++iter1, ++iter2) {
+    while (*iter1 != *iter2)
+      ++iter2;
+    //std::cout << **iter1 << " == " << **iter2 << std::endl;
+    CPPUNIT_ASSERT( iter2 != NeighborList.end() );
+  }
+}
+
+/** UnitTest for getPointsInsideSphere()
+ */
+void LinkedCell_ViewTest::getPointsInsideSphereTest()
+{
+  // define some center vector
+  Vector center(DOMAINLENGTH/2.,DOMAINLENGTH/2.,DOMAINLENGTH/2.);
+
+  // get LinkedList from LC
+  const double distance = 2.;
+  LinkedCell::LinkedList NeighborList = LC->getPointsInsideSphere(distance, center);
+//  for (LinkedCell::LinkedList::const_iterator iter = NeighborList.begin();
+//      iter != NeighborList.end(); ++iter)
+//    std::cout << **iter << " is in returned restricted neighbor list." << std::endl;
+
+  // gather points from NodeList
+  LinkedCell::LinkedList ComparisonList;
+  for (PointSet::const_iterator iter = NodeList.begin(); iter != NodeList.end(); ++iter)
+    if (center.DistanceSquared((*iter)->getPosition()) <= distance*distance) {
+      ComparisonList.push_back(*iter);
+      //std::cout << **iter << " is inside of " << center << " plus " << distance << "." << std::endl;
+    }
+  // check that we get at least as many as needed
+  CPPUNIT_ASSERT(ComparisonList.size() == NeighborList.size());
+
+  // sort lists to ease comparison
+  ComparisonList.sort();
+  NeighborList.sort();
+
+  // check element-wise and skip unrequired ones
+  LinkedCell::LinkedList::iterator iter1 = ComparisonList.begin();
+  LinkedCell::LinkedList::iterator iter2 = NeighborList.begin();
+  for(;(iter1 != ComparisonList.end()) && (iter2 != NeighborList.end()); ++iter1, ++iter2) {
+    //std::cout << **iter1 << " == " << **iter2 << std::endl;
+    CPPUNIT_ASSERT( *iter1 == *iter2 );
+  }
+}
Index: src/LinkedCell/unittests/LinkedCell_ViewUnitTest.hpp
===================================================================
--- src/LinkedCell/unittests/LinkedCell_ViewUnitTest.hpp	(revision 5344e4935985c68c502a7e1e2e936a0ac622ef57)
+++ src/LinkedCell/unittests/LinkedCell_ViewUnitTest.hpp	(revision 5344e4935985c68c502a7e1e2e936a0ac622ef57)
@@ -0,0 +1,50 @@
+/*
+ * LinkedCell_ViewUnitTest.hpp
+ *
+ *  Created on: Nov 18, 2011
+ *      Author: heber
+ */
+
+#ifndef LINKEDCELL_VIEWUNITTEST_HPP_
+#define LINKEDCELL_VIEWUNITTEST_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+class Box;
+
+namespace LinkedCell {
+  class LinkedCell_View;
+}
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/********************************************** Test classes **************************************/
+
+class LinkedCell_ViewTest : public CppUnit::TestFixture
+{
+    CPPUNIT_TEST_SUITE( LinkedCell_ViewTest) ;
+    CPPUNIT_TEST ( getAllNeighborsTest );
+    CPPUNIT_TEST ( getPointsInsideSphereTest );
+    CPPUNIT_TEST_SUITE_END();
+
+public:
+      void setUp();
+      void tearDown();
+
+      void getAllNeighborsTest();
+      void getPointsInsideSphereTest();
+
+private:
+      typedef std::set<TesselPoint *> PointSet;
+      PointSet NodeList;
+
+      Box *domain;
+      LinkedCell::LinkedCell_Model *LCImpl;
+      LinkedCell::LinkedCell_View *LC;
+};
+
+
+#endif /* LINKEDCELL_VIEWUNITTEST_HPP_ */
Index: src/LinkedCell/unittests/Makefile.am
===================================================================
--- src/LinkedCell/unittests/Makefile.am	(revision d8296152e374a74c483120eb411121989ba27a98)
+++ src/LinkedCell/unittests/Makefile.am	(revision 5344e4935985c68c502a7e1e2e936a0ac622ef57)
@@ -5,6 +5,8 @@
 	../LinkedCell/LinkedCell.cpp \
 	../LinkedCell/LinkedCell_Model.cpp \
+	../LinkedCell/LinkedCell_View.cpp \
 	../LinkedCell/unittests/LinkedCellUnitTest.cpp \
 	../LinkedCell/unittests/LinkedCell_ModelUnitTest.cpp \
+	../LinkedCell/unittests/LinkedCell_ViewUnitTest.cpp \
 	../LinkedCell/unittests/linkedcellUnitTest.cpp
 
@@ -12,7 +14,9 @@
 	../LinkedCell/LinkedCell.hpp \
 	../LinkedCell/LinkedCell_Model.hpp \
+	../LinkedCell/LinkedCell_View.hpp \
 	../LinkedCell/PointCloudAdaptor.hpp \
 	../LinkedCell/unittests/LinkedCellUnitTest.hpp \
 	../LinkedCell/unittests/LinkedCell_ModelUnitTest.hpp \
+	../LinkedCell/unittests/LinkedCell_ViewUnitTest.hpp \
 	../LinkedCell/unittests/linkedcellUnitTest.hpp
 
@@ -20,4 +24,5 @@
   LinkedCellUnitTest \
   LinkedCell_ModelUnitTest \
+  LinkedCell_ViewUnitTest \
   linkedcellUnitTest
 
@@ -59,4 +64,15 @@
 LinkedCell_ModelUnitTest_LDADD = $(LINKEDCELLLIBS)
 
+LinkedCell_ViewUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
+	../LinkedCell/unittests/LinkedCell_ViewUnitTest.cpp \
+	../LinkedCell/unittests/LinkedCell_ViewUnitTest.hpp \
+	../LinkedCell/LinkedCell.cpp \
+	../LinkedCell/LinkedCell_Model.cpp \
+	../LinkedCell/LinkedCell_View.cpp \
+	../LinkedCell/LinkedCell.hpp \
+	../LinkedCell/LinkedCell_Model.hpp \
+	../LinkedCell/LinkedCell_View.hpp \
+	../LinkedCell/PointCloudAdaptor.hpp
+LinkedCell_ViewUnitTest_LDADD = $(LINKEDCELLLIBS)
 
 #AUTOMAKE_OPTIONS = parallel-tests
