Changes in / [510f81:22425a]


Ignore:
Files:
4 added
94 deleted
60 edited

Legend:

Unmodified
Added
Removed
  • LinearAlgebra/src/LinearAlgebra/Line.cpp

    r510f81 r22425a  
    3131#include "defs.hpp"
    3232#include "Exceptions.hpp"
    33 #include "LinePoint.hpp"
    3433#include "MatrixContent.hpp"
    3534#include "Plane.hpp"
     
    309308}
    310309
    311 std::ostream& operator<<(std::ostream& ost, const Line& m)
     310/******************************** Points on the line ********************/
     311
     312LinePoint::LinePoint(const LinePoint &src) :
     313  line(src.line),param(src.param)
     314{}
     315
     316LinePoint::LinePoint(const Line &_line, double _param) :
     317  line(_line),param(_param)
     318{}
     319
     320LinePoint& LinePoint::operator=(const LinePoint &src){
     321  line=src.line;
     322  param=src.param;
     323  return *this;
     324}
     325
     326Vector LinePoint::getPoint() const{
     327  ASSERT(!isInfinite(),"getPoint() on infinite LinePoint called");
     328  return (*line.origin)+param*(*line.direction);
     329}
     330
     331Line LinePoint::getLine() const{
     332  return line;
     333}
     334
     335bool LinePoint::isInfinite() const{
     336  return isPosInfinity() || isNegInfinity();
     337}
     338bool LinePoint::isPosInfinity() const{
     339  return param == numeric_limits<double>::infinity();
     340}
     341bool LinePoint::isNegInfinity() const{
     342  return param ==-numeric_limits<double>::infinity();
     343}
     344
     345bool operator==(const LinePoint &x, const LinePoint &y){
     346  ASSERT(x.line==y.line,"Operation on two points of different lines");
     347  return x.param == y.param;
     348
     349}
     350bool operator<(const LinePoint &x, const LinePoint &y){
     351  ASSERT(x.line==y.line,"Operation on two points of different lines");
     352  return x.param<y.param;
     353}
     354
     355ostream& operator<<(ostream& ost, const Line& m)
    312356{
    313357  const Vector origin = m.getOrigin();
     
    329373};
    330374
    331 
    332 /******************************** Points on the line ********************/
  • LinearAlgebra/src/LinearAlgebra/Line.hpp

    r510f81 r22425a  
    2525class LinePoint;
    2626
    27 /** This class represents a line in space stretching to infinity.
    28  *
    29  * It is defined by its origin and a direction.
    30  *
    31  * \sa LinePoint and LineSegment
    32  */
    3327class Line : public Space
    3428{
     
    8074Line makeLineThrough(const Vector &x1, const Vector &x2);
    8175
     76/**
     77 * Class for representing points on a line
     78 * These objects allow comparison of points on the same line as well as specifying the
     79 * infinite "endpoints" of a line.
     80 */
     81class LinePoint{
     82  friend class Line;
     83  friend bool operator==(const LinePoint&, const LinePoint&);
     84  friend bool operator<(const LinePoint&, const LinePoint&);
     85public:
     86  LinePoint(const LinePoint&);
     87  LinePoint& operator=(const LinePoint&);
     88  Vector getPoint() const;
     89  Line getLine() const;
     90  bool isInfinite() const;
     91  bool isPosInfinity() const;
     92  bool isNegInfinity() const;
     93
     94private:
     95  LinePoint(const Line&,double);
     96  Line line;
     97  double param;
     98};
     99
     100bool operator==(const LinePoint&, const LinePoint&);
     101bool operator<(const LinePoint&, const LinePoint&);
     102
     103inline bool operator!= (const LinePoint& x, const LinePoint& y) { return !(x==y); }
     104inline bool operator>  (const LinePoint& x, const LinePoint& y) { return y<x; }
     105inline bool operator<= (const LinePoint& x, const LinePoint& y) { return !(y<x); }
     106inline bool operator>= (const LinePoint& x, const LinePoint& y) { return !(x<y); }
     107
     108
    82109#endif /* LINE_HPP_ */
  • LinearAlgebra/src/LinearAlgebra/LineSegment.cpp

    r510f81 r22425a  
    2424
    2525#include "Line.hpp"
    26 #include "LinePoint.hpp"
    2726#include "Vector.hpp"
    2827
  • LinearAlgebra/src/LinearAlgebra/LineSegment.hpp

    r510f81 r22425a  
    2121class LinePoint;
    2222
    23 /** This class represents a specific segment of a line, defined through
    24  * two points on the same line that form start and end.
    25  *
    26  */
    2723class LineSegment
    2824{
  • LinearAlgebra/src/LinearAlgebra/LineSegmentSet.cpp

    r510f81 r22425a  
    2424#include "CodePatterns/Assert.hpp"
    2525#include "Line.hpp"
    26 #include "LinePoint.hpp"
    2726#include "LineSegment.hpp"
    2827
  • LinearAlgebra/src/LinearAlgebra/LineSegmentSet.hpp

    r510f81 r22425a  
    2222class LineSegment;
    2323
    24 /** This class represents a continous set of LineSegment's all on the same
    25  * underlying line.
    26  *
    27  * Hence, it is basically a sorted container for LinePoints but
    28  * we iterate over it segment-wise.
    29  *
    30  */
    3124class LineSegmentSet {
    3225  friend LineSegmentSet merge(const LineSegmentSet&,const LineSegmentSet&);
  • LinearAlgebra/src/LinearAlgebra/Makefile.am

    r510f81 r22425a  
    1111  leastsquaremin.cpp \
    1212  Line.cpp \
    13   LinePoint.cpp \
    1413  LineSegment.cpp \
    1514  LineSegmentSet.cpp \
     
    3231  leastsquaremin.hpp \
    3332  Line.hpp \
    34   LinePoint.hpp \
    3533  LineSegment.hpp \
    3634  LineSegmentSet.hpp \
  • LinearAlgebra/src/LinearAlgebra/defs.hpp

    r510f81 r22425a  
    2323double LINALG_MYEPSILON()
    2424{
    25   return (std::numeric_limits<double>::epsilon()*1.e+4);
     25  return (std::numeric_limits<double>::epsilon()*100.);
    2626}
    2727
  • LinearAlgebra/src/documentation/mainpage.dox

    r510f81 r22425a  
    2525 *
    2626 *
    27  * \ref lines Lines and subtypes
    28  *
    2927 * \date 2011-11-02
    3028 *
  • LinearAlgebra/tests/CodeChecks/Makefile.am

    r510f81 r22425a  
    11AUTOM4TE = autom4te
     2EXTRA_DIST = \
     3        atlocal.in \
     4        package.m4 \
     5        testsuite.at \
     6        testsuite-config_h.at \
     7        testsuite-date_in_dox.at \
     8        testsuite-memdebug.at \
     9        testsuite-project-disclaimer.at \
     10        $(TESTSUITE)
     11TESTSUITE = $(srcdir)/testsuite
    212
    3 TESTSUITE = $(srcdir)/testsuite
     13DISTCLEANFILES = atconfig
    414
    515TESTSCRIPTS = \
    616        testsuite-config_h.at \
    717        testsuite-date_in_dox.at \
    8         testsuite-header-dist.at \
    918        testsuite-memdebug.at \
    1019        testsuite-project-disclaimer.at
    11 
    12 DISTCLEANFILES = atconfig
    13 
    14 EXTRA_DIST = \
    15         atlocal.in \
    16         package.m4 \
    17         testsuite.at \
    18         $(TESTSUITE) \
    19         $(TESTSCRIPTS)
    2020
    2121max_jobs = 4
  • LinearAlgebra/tests/CodeChecks/testsuite.at

    r510f81 r22425a  
    2121m4_include(testsuite-project-disclaimer.at)
    2222
    23 m4_include(testsuite-header-dist.at)
  • src/Actions/GlobalListOfActions.hpp

    r510f81 r22425a  
    105105        (SelectionNotAllAtomsInsideCuboid) \
    106106        (SelectionAtomById) \
    107         (FragmentationFragmentation) \
    108         (FillRegularGrid)
     107        (FragmentationFragmentation)
    109108
    110109#endif /* GLOBALLISTOFACTIONS_HPP_ */
  • src/Actions/Makefile.am

    r510f81 r22425a  
    5252  ${ATOMACTIONSOURCE} \
    5353  ${CMDACTIONSOURCE} \
    54   ${FILLACTIONSOURCE} \
    5554  ${FRAGMENTATIONACTIONSOURCE} \
    5655  ${GRAPHACTIONSOURCE} \
     
    6867  ${ATOMACTIONHEADER} \
    6968  ${CMDACTIONHEADER} \
    70   ${FILLACTIONHEADER} \
    7169  ${FRAGMENTATIONACTIONHEADER} \
    7270  ${GRAPHACTIONHEADER} \
     
    8482  ${ATOMACTIONDEFS} \
    8583  ${CMDACTIONDEFS} \
    86   ${FILLACTIONDEFS} \
    8784  ${FRAGMENTATIONACTIONDEFS} \
    8885  ${GRAPHACTIONDEFS} \
     
    176173  Actions/CommandAction/VersionAction.def \
    177174  Actions/CommandAction/WarrantyAction.def
    178 
    179 FILLACTIONSOURCE = \
    180         Actions/FillAction/FillRegularGridAction.cpp
    181 FILLACTIONHEADER = \
    182         Actions/FillAction/FillRegularGridAction.hpp
    183 FILLACTIONDEFS = \
    184         Actions/FillAction/FillRegularGridAction.def
    185 
    186175
    187176FRAGMENTATIONACTIONSOURCE = \
  • src/Actions/SelectionAction/Atoms/AllAtomsInsideCuboidAction.cpp

    r510f81 r22425a  
    5454  LOG(1, "Selecting all atoms inside a rotated " << RotationMatrix << " cuboid at " << params.position << " and extension of " << params.extension << ".");
    5555  Shape s = translate(transform(stretch(Cuboid(),params.extension),RotationMatrix),params.position);
    56   std::vector<atom *> selectedAtoms = World::getInstance().getAllAtoms(AtomsBySelection() && AtomsByShape(s));
    57   World::getInstance().selectAllAtoms(AtomsByShape(s));
     56  std::vector<atom *> selectedAtoms = World::getInstance().getAllAtoms(AtomsBySelection() && AtomByShape(s));
     57  World::getInstance().selectAllAtoms(AtomByShape(s));
    5858  LOG(0, World::getInstance().countSelectedAtoms() << " atoms selected.");
    5959  return Action::state_ptr(new SelectionAllAtomsInsideCuboidState(selectedAtoms, s, params));
     
    6363  SelectionAllAtomsInsideCuboidState *state = assert_cast<SelectionAllAtomsInsideCuboidState*>(_state.get());
    6464
    65   World::getInstance().unselectAllAtoms(AtomsByShape(state->s));
     65  World::getInstance().unselectAllAtoms(AtomByShape(state->s));
    6666  BOOST_FOREACH(atom *_atom, state->selectedAtoms)
    6767    World::getInstance().selectAtom(_atom);
     
    7474  RealSpaceMatrix RotationMatrix;
    7575
    76   World::getInstance().selectAllAtoms(AtomsByShape(state->s));
     76  World::getInstance().selectAllAtoms(AtomByShape(state->s));
    7777
    7878  return Action::state_ptr(_state);
  • src/Actions/SelectionAction/Atoms/AllAtomsInsideSphereAction.cpp

    r510f81 r22425a  
    4949  LOG(1, "Selecting all atoms inside a sphere at " << params.position << " with radius " << params.radius << ".");
    5050  Shape s = translate(resize(Sphere(),params.radius),params.position);
    51   std::vector<atom *> selectedAtoms = World::getInstance().getAllAtoms(AtomsBySelection() && AtomsByShape(s));
    52   World::getInstance().selectAllAtoms(AtomsByShape(s));
     51  std::vector<atom *> selectedAtoms = World::getInstance().getAllAtoms(AtomsBySelection() && AtomByShape(s));
     52  World::getInstance().selectAllAtoms(AtomByShape(s));
    5353  LOG(0, World::getInstance().countSelectedAtoms() << " atoms selected.");
    5454  return Action::state_ptr(new SelectionAllAtomsInsideSphereState(selectedAtoms, s, params));
     
    5858  SelectionAllAtomsInsideSphereState *state = assert_cast<SelectionAllAtomsInsideSphereState*>(_state.get());
    5959
    60   World::getInstance().unselectAllAtoms(AtomsByShape(state->s));
     60  World::getInstance().unselectAllAtoms(AtomByShape(state->s));
    6161  BOOST_FOREACH(atom *_atom, state->selectedAtoms)
    6262    World::getInstance().selectAtom(_atom);
     
    6868  SelectionAllAtomsInsideSphereState *state = assert_cast<SelectionAllAtomsInsideSphereState*>(_state.get());
    6969
    70   World::getInstance().selectAllAtoms(AtomsByShape(state->s));
     70  World::getInstance().selectAllAtoms(AtomByShape(state->s));
    7171
    7272  return Action::state_ptr(_state);
  • src/Actions/SelectionAction/Atoms/NotAllAtomsInsideCuboidAction.cpp

    r510f81 r22425a  
    5353  LOG(1, "Unselecting all atoms inside a rotated " << RotationMatrix << " cuboid at " << params.position << " and extension of " << params.extension << ".");
    5454  Shape s = translate(transform(stretch(Cuboid(),params.extension),RotationMatrix),params.position);
    55   std::vector<atom *> unselectedAtoms = World::getInstance().getAllAtoms((!AtomsBySelection()) && AtomsByShape(s));
    56   World::getInstance().unselectAllAtoms(AtomsByShape(s));
     55  std::vector<atom *> unselectedAtoms = World::getInstance().getAllAtoms((!AtomsBySelection()) && AtomByShape(s));
     56  World::getInstance().unselectAllAtoms(AtomByShape(s));
    5757  LOG(0, World::getInstance().countSelectedAtoms() << " atoms remain selected.");
    5858  return Action::state_ptr(new SelectionNotAllAtomsInsideCuboidState(unselectedAtoms, s, params));
     
    6262  SelectionNotAllAtomsInsideCuboidState *state = assert_cast<SelectionNotAllAtomsInsideCuboidState*>(_state.get());
    6363
    64   World::getInstance().selectAllAtoms(AtomsByShape(state->s));
     64  World::getInstance().selectAllAtoms(AtomByShape(state->s));
    6565  BOOST_FOREACH(atom *_atom, state->unselectedAtoms)
    6666    World::getInstance().unselectAtom(_atom);
     
    7373  RealSpaceMatrix RotationMatrix;
    7474
    75   World::getInstance().unselectAllAtoms(AtomsByShape(state->s));
     75  World::getInstance().unselectAllAtoms(AtomByShape(state->s));
    7676
    7777  return Action::state_ptr(_state);
  • src/Actions/SelectionAction/Atoms/NotAllAtomsInsideSphereAction.cpp

    r510f81 r22425a  
    4949  LOG(1, "Unselecting all atoms inside a sphere at " << params.position << " with radius " << params.radius << ".");
    5050  Shape s = translate(resize(Sphere(),params.radius),params.position);
    51   std::vector<atom *> unselectedAtoms = World::getInstance().getAllAtoms((!AtomsBySelection()) && AtomsByShape(s));
    52   World::getInstance().unselectAllAtoms(AtomsByShape(s));
     51  std::vector<atom *> unselectedAtoms = World::getInstance().getAllAtoms((!AtomsBySelection()) && AtomByShape(s));
     52  World::getInstance().unselectAllAtoms(AtomByShape(s));
    5353  LOG(0, World::getInstance().countSelectedAtoms() << " atoms remain selected.");
    5454  return Action::state_ptr(new SelectionNotAllAtomsInsideSphereState(unselectedAtoms, s, params));
     
    5858  SelectionNotAllAtomsInsideSphereState *state = assert_cast<SelectionNotAllAtomsInsideSphereState*>(_state.get());
    5959
    60   World::getInstance().selectAllAtoms(AtomsByShape(state->s));
     60  World::getInstance().selectAllAtoms(AtomByShape(state->s));
    6161  BOOST_FOREACH(atom *_atom, state->unselectedAtoms)
    6262    World::getInstance().unselectAtom(_atom);
     
    6868  SelectionNotAllAtomsInsideSphereState *state = assert_cast<SelectionNotAllAtomsInsideSphereState*>(_state.get());
    6969
    70   World::getInstance().unselectAllAtoms(AtomsByShape(state->s));
     70  World::getInstance().unselectAllAtoms(AtomByShape(state->s));
    7171
    7272  return Action::state_ptr(_state);
  • src/Atom/Makefile.am

    r510f81 r22425a  
    2929  Atom/TesselPoint.hpp
    3030
    31 COPYATOMSSOURCE = \
    32         Atom/CopyAtoms/CopyAtoms_SaturateDanglingBonds.cpp \
    33         Atom/CopyAtoms/CopyAtoms_withBonds.cpp
    34 
    35 COPYATOMSHEADER = \
    36         Atom/CopyAtoms/CopyAtoms_SaturateDanglingBonds.hpp \
    37         Atom/CopyAtoms/CopyAtoms_Simple.hpp \
    38         Atom/CopyAtoms/CopyAtoms_withBonds.hpp \
    39         Atom/CopyAtoms/CopyAtomsInterface.hpp
    4031
    4132noinst_LTLIBRARIES += libMolecuilderAtom.la
    4233libMolecuilderAtom_la_includedir = $(includedir)/MoleCuilder/Atom/
    4334
    44 nobase_libMolecuilderAtom_la_include_HEADERS = $(ATOMHEADER) $(COPYATOMSHEADER)
     35nobase_libMolecuilderAtom_la_include_HEADERS = ${ATOMHEADER}
    4536
    4637## Define the source file list for the "libexample-@MOLECUILDER_API_VERSION@.la"
     
    5243## from each source file.  Note that it is not necessary to list header files
    5344## which are already listed elsewhere in a _HEADERS variable assignment.
    54 libMolecuilderAtom_la_SOURCES = $(ATOMSOURCE) $(COPYATOMSSOURCE)
     45libMolecuilderAtom_la_SOURCES = ${ATOMSOURCE}
    5546
    5647## Instruct libtool to include ABI version information in the generated shared
  • src/Atom/unittests/Makefile.am

    r510f81 r22425a  
    44ATOMTESTSSOURCES = \
    55        ../Atom/unittests/AtomObserverUnitTest.cpp \
    6         ../Atom/unittests/CopyAtomsInterfaceUnitTest.cpp \
    76        stubs/ObserverStub.cpp
    87
    98ATOMTESTSHEADERS = \
    109        ../Atom/unittests/AtomObserverUnitTest.hpp \
    11         ../Atom/unittests/CopyAtomsInterfaceUnitTest.hpp \
    1210        stubs/ObserverStub.hpp
    1311
    1412ATOMTESTS = \
    15   AtomObserverUnitTest \
    16   CopyAtomsInterfaceUnitTest
     13  AtomObserverUnitTest
    1714
    1815TESTS += $(ATOMTESTS)
     
    3835AtomObserverUnitTest_LDADD = ${ATOMTESTLIBS}
    3936
    40 CopyAtomsInterfaceUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
    41         ../Atom/unittests/CopyAtomsInterfaceUnitTest.cpp \
    42         ../Atom/unittests/CopyAtomsInterfaceUnitTest.hpp
    43 CopyAtomsInterfaceUnitTest_LDADD = ${ATOMTESTLIBS}
    4437
    4538
  • src/Descriptors/AtomShapeDescriptor.cpp

    r510f81 r22425a  
    3535}
    3636
    37 atom* AtomShapeDescriptor_impl::find(){
    38   LinkedCell::LinkedCell_View view = World::getInstance().getLinkedCell(shape.getRadius());
    39   LinkedCell::LinkedList list = view.getPointsInsideSphere(shape.getRadius(), shape.getCenter());
    40   for (LinkedCell::LinkedList::iterator iter = list.begin(); iter != list.end(); ++iter) {
    41     atom * const _atom = static_cast<atom *>(const_cast<TesselPoint *>(*iter));
    42     if (shape.isInside(_atom->getPosition()))
    43       return _atom;
    44   }
    45   return NULL;
    46 }
    4737
    48 std::vector<atom*> AtomShapeDescriptor_impl::findAll(){
    49   LinkedCell::LinkedCell_View view = World::getInstance().getLinkedCell(shape.getRadius());
    50   LinkedCell::LinkedList list = view.getPointsInsideSphere(shape.getRadius(), shape.getCenter());
    51   std::vector<atom*> res;
    52   for (LinkedCell::LinkedList::iterator iter = list.begin(); iter != list.end(); ++iter) {
    53     atom * const _atom = static_cast<atom *>(const_cast<TesselPoint *>(*iter));
    54     if (shape.isInside(_atom->getPosition()))
    55       res.push_back(_atom);
    56   }
    57   return res;
    58 }
    59 
    60 
    61 AtomDescriptor AtomsByShape(const Shape &shape){
     38AtomDescriptor AtomByShape(const Shape &shape){
    6239  return AtomDescriptor(AtomDescriptor::impl_ptr(new AtomShapeDescriptor_impl(shape)));
    6340}
  • src/Descriptors/AtomShapeDescriptor.hpp

    r510f81 r22425a  
    2020class Shape;
    2121
    22 AtomDescriptor AtomsByShape(const Shape &shape);
     22AtomDescriptor AtomByShape(const Shape &shape);
    2323
    2424#endif /* ATOMSHAPEDESCRIPTOR_HPP_ */
  • src/Descriptors/AtomShapeDescriptor_impl.hpp

    r510f81 r22425a  
    2727  bool predicate(std::pair<atomId_t,atom*> atom);
    2828private:
    29   virtual atom* find();
    30   virtual std::vector<atom*> findAll();
    31 
    3229  Shape shape;
    3330};
  • src/Fragmentation/Fragmentation.cpp

    r510f81 r22425a  
    2727#include "Atom/atom.hpp"
    2828#include "Bond/bond.hpp"
    29 #include "Descriptors/MoleculeDescriptor.hpp"
    3029#include "Element/element.hpp"
    3130#include "Element/periodentafel.hpp"
  • src/Graph/DepthFirstSearchAnalysis.cpp

    r510f81 r22425a  
    3232#include "CodePatterns/Verbose.hpp"
    3333#include "Descriptors/AtomDescriptor.hpp"
    34 #include "Descriptors/MoleculeDescriptor.hpp"
    3534#include "molecule.hpp"
    3635#include "MoleculeLeafClass.hpp"
  • src/IdPool_impl.hpp

    r510f81 r22425a  
    9696    return;
    9797  }
    98   LOG(3, "DEBUG: Defragmenting id pool.");
     98  LOG(1, "STATUS: Defragmenting id pool.");
    9999  for(typename IdPool_t::iterator iter = pool.begin();iter!=pool.end();) {
    100100    // see if this range is adjacent to the next one
  • src/LinkedCell/Makefile.am

    r510f81 r22425a  
    2020  LinkedCell/LinkedCell_Model.hpp \
    2121  LinkedCell/LinkedCell_Model_changeModel.hpp \
    22   LinkedCell/LinkedCell_Model_inline.hpp \
    2322  LinkedCell/LinkedCell_Model_LinkedCellArrayCache.hpp \
    2423  LinkedCell/LinkedCell_Model_Update.hpp \
  • src/LinkedCell/unittests/Makefile.am

    r510f81 r22425a  
    5353        ../LinkedCell/unittests/LinkedCell_ControllerUnitTest.hpp \
    5454        ../LinkedCell/unittests/defs.hpp \
    55         stubs/AtomStub.cpp \
     55        ../LinkedCell/unittests/stubs/AtomStub.cpp \
    5656        ../LinkedCell/unittests/stubs/AtomObserverStub.cpp \
    5757        ../LinkedCell/unittests/stubs/ObserverBoxStub.cpp \
    5858        ../LinkedCell/unittests/stubs/TesselPointStub.cpp \
     59        ../LinkedCell/unittests/stubs/WorldStub.cpp \
    5960        ../LinkedCell/unittests/stubs/WorldTimeStub.cpp \
    60         stubs/WorldStub.cpp \
    6161        ../LinkedCell/PointCloudAdaptor.hpp \
    6262        ../Box_BoundaryConditions.cpp \
  • src/Makefile.am

    r510f81 r22425a  
    1313include Atom/Makefile.am
    1414include Element/Makefile.am
    15 include Filling/Makefile.am
    1615include Fragmentation/Makefile.am
    1716include Graph/Makefile.am
     
    125124
    126125TESSELATIONSOURCE = \
    127   Tesselation/ApproximateShapeArea.cpp \
    128   Tesselation/ApproximateShapeVolume.cpp \
    129126  Tesselation/boundary.cpp \
    130127  Tesselation/BoundaryLineSet.cpp \
     
    139136 
    140137TESSELATIONHEADER = \
    141   Tesselation/ApproximateShapeArea.hpp \
    142   Tesselation/ApproximateShapeVolume.hpp \
    143138  Tesselation/boundary.hpp \
    144139  Tesselation/BoundaryLineSet.hpp \
     
    159154  ${THERMOSTATSOURCE} \
    160155  ${TESSELATIONSOURCE} \
    161   AtomIdSet.cpp \
    162156  Box.cpp \
    163157  Box_BoundaryConditions.cpp \
     
    181175  ${THERMOSTATHEADER} \
    182176  ${TESSELATIONHEADER} \
    183   AtomIdSet.hpp \
    184177  Box.hpp \
    185178  Box_BoundaryConditions.hpp \
  • src/Shapes/BaseShapes.cpp

    r510f81 r22425a  
    3737#include <algorithm>
    3838
    39 bool Sphere_impl::isInside(const Vector &point) const{
    40   return point.NormSquared()<=1.;
    41 }
    42 
    43 bool Sphere_impl::isOnSurface(const Vector &point) const{
    44   return fabs(point.NormSquared()-1.)<MYEPSILON;
    45 }
    46 
    47 Vector Sphere_impl::getNormal(const Vector &point) const throw(NotOnSurfaceException){
     39bool Sphere_impl::isInside(const Vector &point){
     40  return point.NormSquared()<=1;
     41}
     42
     43bool Sphere_impl::isOnSurface(const Vector &point){
     44  return fabs(point.NormSquared()-1)<MYEPSILON;
     45}
     46
     47Vector Sphere_impl::getNormal(const Vector &point) throw(NotOnSurfaceException){
    4848  if(!isOnSurface(point)){
    4949    throw NotOnSurfaceException() << ShapeVector(&point);
     
    5252}
    5353
    54 Vector Sphere_impl::getCenter() const
    55 {
    56   return Vector(0.,0.,0.);
    57 }
    58 
    59 double Sphere_impl::getRadius() const
    60 {
    61   return 1.;
    62 }
    63 
    64 double Sphere_impl::getVolume() const
    65 {
    66         return (4./3.)*M_PI; // 4/3 pi r^3
    67 }
    68 
    69 double Sphere_impl::getSurfaceArea() const
    70 {
    71         return 2.*M_PI; // 2 pi r^2
    72 }
    73 
    74 
    75 LineSegmentSet Sphere_impl::getLineIntersections(const Line &line) const{
     54LineSegmentSet Sphere_impl::getLineIntersections(const Line &line){
    7655  LineSegmentSet res(line);
    7756  std::vector<Vector> intersections = line.getSphereIntersections();
     
    8261}
    8362
    84 std::string Sphere_impl::toString() const{
     63std::string Sphere_impl::toString(){
    8564  return "Sphere()";
    86 }
    87 
    88 enum ShapeType Sphere_impl::getType() const
    89 {
    90         return SphereType;
    9165}
    9266
     
    141115}
    142116
    143 std::vector<Vector> Sphere_impl::getHomogeneousPointsInVolume(const size_t N) const {
    144         ASSERT(0,
    145                         "Sphere_impl::getHomogeneousPointsInVolume() - not implemented.");
    146         return std::vector<Vector>();
    147 }
    148117
    149118Shape Sphere(){
     
    160129}
    161130
    162 bool Cuboid_impl::isInside(const Vector &point) const{
     131bool Cuboid_impl::isInside(const Vector &point){
    163132  return (point[0]>=0 && point[0]<=1) && (point[1]>=0 && point[1]<=1) && (point[2]>=0 && point[2]<=1);
    164133}
    165134
    166 bool Cuboid_impl::isOnSurface(const Vector &point) const{
     135bool Cuboid_impl::isOnSurface(const Vector &point){
    167136  bool retVal = isInside(point);
    168137  // test all borders of the cuboid
     
    175144}
    176145
    177 Vector Cuboid_impl::getNormal(const Vector &point) const throw(NotOnSurfaceException){
     146Vector Cuboid_impl::getNormal(const Vector &point) throw(NotOnSurfaceException){
    178147  if(!isOnSurface(point)){
    179148    throw NotOnSurfaceException() << ShapeVector(&point);
     
    193162}
    194163
    195 
    196 Vector Cuboid_impl::getCenter() const
    197 {
    198   return Vector(0.5,0.5,0.5);
    199 }
    200 
    201 double Cuboid_impl::getRadius() const
    202 {
    203   return .5;
    204 }
    205 
    206 double Cuboid_impl::getVolume() const
    207 {
    208         return 1.; // l^3
    209 }
    210 
    211 double Cuboid_impl::getSurfaceArea() const
    212 {
    213         return 6.;      // 6 * l^2
    214 }
    215 
    216 LineSegmentSet Cuboid_impl::getLineIntersections(const Line &line) const{
     164LineSegmentSet Cuboid_impl::getLineIntersections(const Line &line){
    217165  LineSegmentSet res(line);
    218166  // get the intersection on each of the six faces
     
    244192}
    245193
    246 std::string Cuboid_impl::toString() const{
     194std::string Cuboid_impl::toString(){
    247195  return "Cuboid()";
    248 }
    249 
    250 enum ShapeType Cuboid_impl::getType() const
    251 {
    252         return CuboidType;
    253196}
    254197
     
    260203  ASSERT(false, "Cuboid_impl::getHomogeneousPointsOnSurface() not implemented yet");
    261204  return PointsOnSurface;
    262 }
    263 
    264 std::vector<Vector> Cuboid_impl::getHomogeneousPointsInVolume(const size_t N) const {
    265         ASSERT(0,
    266                         "Cuboid_impl::getHomogeneousPointsInVolume() - not implemented.");
    267         return std::vector<Vector>();
    268205}
    269206
  • src/Shapes/BaseShapes_impl.hpp

    r510f81 r22425a  
    2020#include "Shapes/Shape_impl.hpp"
    2121#include "Shapes/ShapeExceptions.hpp"
    22 #include "Shapes/ShapeType.hpp"
    2322
    2423class Sphere_impl : public Shape_impl {
    25   virtual bool isInside(const Vector &point) const;
    26   virtual bool isOnSurface(const Vector &point) const;
    27   virtual Vector getNormal(const Vector &point) const throw(NotOnSurfaceException);
    28   virtual Vector getCenter() const;
    29   virtual double getRadius() const;
    30   virtual double getVolume() const;
    31   virtual double getSurfaceArea() const;
    32   virtual LineSegmentSet getLineIntersections(const Line&) const;
    33   virtual std::string toString() const;
    34   virtual enum ShapeType getType() const;
     24  virtual bool isInside(const Vector &point);
     25  virtual bool isOnSurface(const Vector &point);
     26  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException);
     27  virtual LineSegmentSet getLineIntersections(const Line&);
     28  virtual std::string toString();
    3529  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
    36   virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    3730};
    3831
    3932class Cuboid_impl : public Shape_impl {
    40   virtual bool isInside(const Vector &point) const;
    41   virtual bool isOnSurface(const Vector &point) const;
    42   virtual Vector getNormal(const Vector &point) const throw(NotOnSurfaceException);
    43   virtual Vector getCenter() const;
    44   virtual double getRadius() const;
    45   virtual double getVolume() const;
    46   virtual double getSurfaceArea() const;
    47   virtual LineSegmentSet getLineIntersections(const Line&) const;
    48   virtual std::string toString() const;
    49   virtual enum ShapeType getType() const;
     33  virtual bool isInside(const Vector &point);
     34  virtual bool isOnSurface(const Vector &point);
     35  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException);
     36  virtual LineSegmentSet getLineIntersections(const Line&);
     37  virtual std::string toString();
    5038  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
    51   virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    5239};
    5340
  • src/Shapes/Makefile.am

    r510f81 r22425a  
    1313  Shapes/ShapeExceptions.hpp \
    1414  Shapes/ShapeOps.hpp \
    15   Shapes/ShapeOps_impl.hpp \
    16   Shapes/ShapeType.hpp
     15  Shapes/ShapeOps_impl.hpp
    1716
     17 
    1818
    1919noinst_LTLIBRARIES += libMolecuilderShapes.la
  • src/Shapes/Shape.cpp

    r510f81 r22425a  
    2626#include "Shapes/Shape_impl.hpp"
    2727#include "Shapes/ShapeExceptions.hpp"
    28 #include "Shapes/ShapeType.hpp"
    29 
    30 #include "Tesselation/ApproximateShapeArea.hpp"
    31 #include "Tesselation/ApproximateShapeVolume.hpp"
    32 
    33 #include <algorithm>
    34 #include <limits>
     28
    3529#include <string>
    3630
     
    5448}
    5549
    56 Vector Shape::getCenter() const{
    57   return impl->getCenter();
    58 }
    59 
    60 double Shape::getRadius() const{
    61   return impl->getRadius();
    62 }
    63 
    64 /** Returns the volume of the Shape.
    65  *
    66  * If the underlying implementation does not have a working implementation,
    67  * i.e. returns -1., then we use an approximate method to calculate the
    68  * volume via a mesh of grid points and checking for isInside (basically
    69  * a Monte-Carlo integration of the volume).
    70  *
    71  * \return volume of the shape
    72  */
    73 double Shape::getVolume() const
    74 {
    75         const double volume = impl->getVolume();
    76         if (volume  != -1.) {
    77                 return volume;
    78         } else {
    79                 ApproximateShapeVolume Approximator(*this);
    80                 return Approximator();
    81         }
    82 }
    83 
    84 /** Returns the surface area of the Shape.
    85  *
    86  * If the underlying implementation does not have a working implementation,
    87  * i.e. returns -1., then we use the working filling of the shapes surface
    88  * with points and subsequent tesselation and obtaining the approximate
    89  * surface area therefrom.
    90  *
    91  * @return surface area of the Shape
    92  */
    93 double Shape::getSurfaceArea() const
    94 {
    95         const double surfacearea = impl->getSurfaceArea();
    96         if (surfacearea != -1.) {
    97                 return surfacearea;
    98         } else {
    99                 ApproximateShapeArea Approximator(*this);
    100                 return Approximator();
    101         }
    102 }
    103 
    104 LineSegmentSet Shape::getLineIntersections(const Line &line) const{
     50LineSegmentSet Shape::getLineIntersections(const Line &line){
    10551  return impl->getLineIntersections(line);
    10652}
     
    10854std::vector<Vector> Shape::getHomogeneousPointsOnSurface(const size_t N) const {
    10955  return impl->getHomogeneousPointsOnSurface(N);
    110 }
    111 
    112 std::vector<Vector> Shape::getHomogeneousPointsInVolume(const size_t N) const {
    113         return impl->getHomogeneousPointsInVolume(N);
    11456}
    11557
     
    12567}
    12668
    127 bool Shape::operator==(const Shape &rhs) const{
    128         return (this->getType() == rhs.getType());
    129 }
    130 
    13169std::string Shape::toString() const{
    13270  return impl->toString();
    133 }
    134 
    135 enum ShapeType Shape::getType() const{
    136         return impl->getType();
    13771}
    13872
     
    168102AndShape_impl::~AndShape_impl(){}
    169103
    170 bool AndShape_impl::isInside(const Vector &point) const{
     104bool AndShape_impl::isInside(const Vector &point){
    171105  return lhs->isInside(point) && rhs->isInside(point);
    172106}
    173107
    174 bool AndShape_impl::isOnSurface(const Vector &point) const{
     108bool AndShape_impl::isOnSurface(const Vector &point){
    175109  // check the number of surfaces that this point is on
    176110  int surfaces =0;
     
    204138}
    205139
    206 Vector AndShape_impl::getNormal(const Vector &point) const throw (NotOnSurfaceException){
     140Vector AndShape_impl::getNormal(const Vector &point) throw (NotOnSurfaceException){
    207141  Vector res;
    208142  if(!isOnSurface(point)){
     
    215149}
    216150
    217 Vector AndShape_impl::getCenter() const
    218 {
    219   // calculate closest position on sphere surface to other center ..
    220   const Vector rhsDistance = rhs->getCenter() + rhs->getRadius()*((lhs->getCenter() - rhs->getCenter()).getNormalized());
    221   const Vector lhsDistance = lhs->getCenter() + lhs->getRadius()*((rhs->getCenter() - lhs->getCenter()).getNormalized());
    222   // .. and then it's right in between those two
    223   return 0.5*(rhsDistance + lhsDistance);
    224 }
    225 
    226 double AndShape_impl::getRadius() const
    227 {
    228   const double distance = (lhs->getCenter() - rhs->getCenter()).Norm();
    229   const double minradii = std::min(lhs->getRadius(), rhs->getRadius());
    230   // if no intersection
    231   if (distance > (lhs->getRadius() + rhs->getRadius()))
    232     return 0.;
    233   else // if intersection it can only be the smaller one
    234     return minradii;
    235 }
    236 
    237 double AndShape_impl::getVolume() const
    238 {
    239         // TODO
    240         return -1.;
    241 }
    242 
    243 double AndShape_impl::getSurfaceArea() const
    244 {
    245         // TODO
    246         return -1.;
    247 }
    248 
    249 LineSegmentSet AndShape_impl::getLineIntersections(const Line &line) const{
     151LineSegmentSet AndShape_impl::getLineIntersections(const Line &line){
    250152  return intersect(lhs->getLineIntersections(line),rhs->getLineIntersections(line));
    251153}
    252154
    253 std::string AndShape_impl::toString() const{
     155std::string AndShape_impl::toString() {
    254156  return std::string("(") + lhs->toString() + std::string("&&") + rhs->toString() + std::string(")");
    255 }
    256 
    257 enum ShapeType AndShape_impl::getType() const{
    258         return CombinedType;
    259157}
    260158
     
    276174}
    277175
    278 std::vector<Vector> AndShape_impl::getHomogeneousPointsInVolume(const size_t N) const {
    279         ASSERT(0,
    280                         "AndShape_impl::getHomogeneousPointsInVolume() - not implemented.");
    281         return std::vector<Vector>();
    282 }
    283 
    284176
    285177Shape operator&&(const Shape &lhs,const Shape &rhs){
     
    296188OrShape_impl::~OrShape_impl(){}
    297189
    298 bool OrShape_impl::isInside(const Vector &point) const{
     190bool OrShape_impl::isInside(const Vector &point){
    299191  return rhs->isInside(point) || lhs->isInside(point);
    300192}
    301193
    302 bool OrShape_impl::isOnSurface(const Vector &point) const{
     194bool OrShape_impl::isOnSurface(const Vector &point){
    303195  // check the number of surfaces that this point is on
    304196  int surfaces =0;
     
    332224}
    333225
    334 Vector OrShape_impl::getNormal(const Vector &point) const throw (NotOnSurfaceException){
     226Vector OrShape_impl::getNormal(const Vector &point) throw (NotOnSurfaceException){
    335227  Vector res;
    336228  if(!isOnSurface(point)){
     
    343235}
    344236
    345 Vector OrShape_impl::getCenter() const
    346 {
    347   // calculate furthest position on sphere surface to other center ..
    348   const Vector rhsDistance = rhs->getCenter() + rhs->getRadius()*((rhs->getCenter() - lhs->getCenter()).getNormalized());
    349   const Vector lhsDistance = lhs->getCenter() + lhs->getRadius()*((lhs->getCenter() - rhs->getCenter()).getNormalized());
    350   // .. and then it's right in between those two
    351   return .5*(rhsDistance + lhsDistance);
    352 }
    353 
    354 double OrShape_impl::getRadius() const
    355 {
    356   const Vector rhsDistance = rhs->getCenter() + rhs->getRadius()*((rhs->getCenter() - lhs->getCenter()).getNormalized());
    357   const Vector lhsDistance = lhs->getCenter() + lhs->getRadius()*((lhs->getCenter() - rhs->getCenter()).getNormalized());
    358   return .5*(rhsDistance - lhsDistance).Norm();
    359 }
    360 
    361 double OrShape_impl::getVolume() const
    362 {
    363         // TODO
    364         return -1.;
    365 }
    366 
    367 double OrShape_impl::getSurfaceArea() const
    368 {
    369         // TODO
    370         return -1.;
    371 }
    372 
    373 LineSegmentSet OrShape_impl::getLineIntersections(const Line &line) const{
     237LineSegmentSet OrShape_impl::getLineIntersections(const Line &line){
    374238  return merge(lhs->getLineIntersections(line),rhs->getLineIntersections(line));
    375239}
    376240
    377 std::string OrShape_impl::toString() const{
     241std::string OrShape_impl::toString() {
    378242  return std::string("(") + lhs->toString() + std::string("||") + rhs->toString() + std::string(")");
    379 }
    380 
    381 enum ShapeType OrShape_impl::getType() const{
    382         return CombinedType;
    383243}
    384244
     
    400260}
    401261
    402 std::vector<Vector> OrShape_impl::getHomogeneousPointsInVolume(const size_t N) const {
    403         ASSERT(0,
    404                         "OrShape_impl::getHomogeneousPointsInVolume() - not implemented.");
    405         return std::vector<Vector>();
    406 }
    407 
    408262Shape operator||(const Shape &lhs,const Shape &rhs){
    409263  Shape::impl_ptr newImpl = Shape::impl_ptr(new OrShape_impl(getShapeImpl(lhs),getShapeImpl(rhs)));
     
    419273NotShape_impl::~NotShape_impl(){}
    420274
    421 bool NotShape_impl::isInside(const Vector &point) const{
     275bool NotShape_impl::isInside(const Vector &point){
    422276  return !arg->isInside(point);
    423277}
    424278
    425 bool NotShape_impl::isOnSurface(const Vector &point) const{
     279bool NotShape_impl::isOnSurface(const Vector &point){
    426280  return arg->isOnSurface(point);
    427281}
    428282
    429 Vector NotShape_impl::getNormal(const Vector &point) const throw(NotOnSurfaceException){
     283Vector NotShape_impl::getNormal(const Vector &point) throw(NotOnSurfaceException){
    430284  return -1.*arg->getNormal(point);
    431285}
    432286
    433 Vector NotShape_impl::getCenter() const
    434 {
    435   return arg->getCenter();
    436 }
    437 
    438 double NotShape_impl::getRadius() const
    439 {
    440   return std::numeric_limits<double>::infinity();
    441 }
    442 
    443 double NotShape_impl::getVolume() const
    444 {
    445         // TODO
    446         return -1.; //-arg->getVolume();
    447 }
    448 
    449 double NotShape_impl::getSurfaceArea() const
    450 {
    451         // TODO
    452         return -1.; // -arg->getSurfaceArea();
    453 }
    454 
    455 LineSegmentSet NotShape_impl::getLineIntersections(const Line &line) const{
     287LineSegmentSet NotShape_impl::getLineIntersections(const Line &line){
    456288  return invert(arg->getLineIntersections(line));
    457289}
    458290
    459 std::string NotShape_impl::toString() const{
     291std::string NotShape_impl::toString(){
    460292  return std::string("!") + arg->toString();
    461 }
    462 
    463 enum ShapeType NotShape_impl::getType() const{
    464         return CombinedType;
    465293}
    466294
     
    468296  // surfaces are the same, only normal direction is different
    469297  return arg->getHomogeneousPointsOnSurface(N);
    470 }
    471 
    472 std::vector<Vector> NotShape_impl::getHomogeneousPointsInVolume(const size_t N) const {
    473         ASSERT(0,
    474                         "NotShape_impl::getHomogeneousPointsInVolume() - not implemented.");
    475         return std::vector<Vector>();
    476298}
    477299
  • src/Shapes/Shape.hpp

    r510f81 r22425a  
    1919
    2020#include "Shapes/ShapeExceptions.hpp"
    21 #include "Shapes/ShapeType.hpp"
    2221
    2322#include <vector>
     
    4241  Vector getNormal(const Vector &point) const throw(NotOnSurfaceException);
    4342
    44   Vector getCenter() const;
    45   double getRadius() const;
    46   double getVolume() const;
    47   double getSurfaceArea() const;
    48 
    49   LineSegmentSet getLineIntersections(const Line&) const;
     43  LineSegmentSet getLineIntersections(const Line&);
    5044  std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
    51   std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    5245
    5346  Shape &operator=(const Shape& rhs);
    5447
    55   bool operator==(const Shape &rhs) const;
    56 
    5748  std::string toString() const;
    58   enum ShapeType getType() const;
    59 
    6049protected:
    6150  impl_ptr getImpl() const;
  • src/Shapes/ShapeOps.cpp

    r510f81 r22425a  
    2020#include "CodePatterns/MemDebug.hpp"
    2121
    22 #include <algorithm>
    23 #include <boost/bind.hpp>
    24 
    2522#include "Shapes/ShapeExceptions.hpp"
    2623#include "Shapes/ShapeOps.hpp"
     
    3734ShapeOpsBase_impl::~ShapeOpsBase_impl(){}
    3835
    39 bool ShapeOpsBase_impl::isInside(const Vector &point) const{
     36bool ShapeOpsBase_impl::isInside(const Vector &point){
    4037  return arg->isInside(translateIn(point));
    4138}
    4239
    43 bool ShapeOpsBase_impl::isOnSurface(const Vector &point) const{
     40bool ShapeOpsBase_impl::isOnSurface(const Vector &point){
    4441  return arg->isOnSurface(translateIn(point));
    4542}
    4643
    47 Vector ShapeOpsBase_impl::getNormal(const Vector &point) const throw (NotOnSurfaceException){
     44Vector ShapeOpsBase_impl::getNormal(const Vector &point) throw (NotOnSurfaceException){
    4845  Vector helper = translateIn(point);
    4946  if(!arg->isOnSurface(helper)){
     
    5552}
    5653
    57 Vector ShapeOpsBase_impl::getCenter() const
    58 {
    59   return arg->getCenter();
    60 }
    61 
    62 double ShapeOpsBase_impl::getRadius() const
    63 {
    64   return translateOutPos(Vector(arg->getRadius(), 0., 0.)).Norm();
    65 }
    66 
    67 
    68 LineSegmentSet ShapeOpsBase_impl::getLineIntersections(const Line &line) const{
     54LineSegmentSet ShapeOpsBase_impl::getLineIntersections(const Line &line){
    6955  Line newLine(translateIn(line.getOrigin()),translateIn(line.getDirection()));
    7056  LineSegmentSet res(line);
     
    8571}
    8672
    87 enum ShapeType ShapeOpsBase_impl::getType() const {
    88         return getArg()->getType();
    89 }
    90 
    9173std::vector<Vector> ShapeOpsBase_impl::getHomogeneousPointsOnSurface(const size_t N) const {
    92   return getArg()->getHomogeneousPointsOnSurface(N);
    93 }
    94 
    95 std::vector<Vector> ShapeOpsBase_impl::getHomogeneousPointsInVolume(const size_t N) const {
    96   return getArg()->getHomogeneousPointsInVolume(N);
     74  return getArg()->getHomogeneousPointsOnSurface(N);;
    9775}
    9876
     
    11189Resize_impl::~Resize_impl(){}
    11290
    113 double Resize_impl::getVolume() const
    114 {
    115         return getArg()->getVolume() * size;
    116 }
    117 
    118 double Resize_impl::getSurfaceArea() const
    119 {
    120         return getArg()->getSurfaceArea() * size;
    121 }
    122 
    123 
    124 bool Resize_impl::isInside(const Vector& point) const{
     91bool Resize_impl::isInside(const Vector& point){
    12592  return getArg()->isInside((1/size) * point);
    12693}
    12794
    128 Vector Resize_impl::translateIn(const Vector& point) const{
     95Vector Resize_impl::translateIn(const Vector& point){
    12996  return (1/size) * point;
    13097}
    13198
    132 Vector Resize_impl::translateOutPos(const Vector& point) const{
     99Vector Resize_impl::translateOutPos(const Vector& point){
    133100  return size * point;
    134101}
    135102
    136 Vector Resize_impl::translateOutNormal(const Vector& point) const{
     103Vector Resize_impl::translateOutNormal(const Vector& point){
    137104  return point;
    138105}
    139106
    140 std::string Resize_impl::toString() const{
     107std::string Resize_impl::toString() {
    141108  std::stringstream sstr;
    142109  sstr << "resize(" << getArg()->toString() << "," << size << ")";
     
    146113std::vector<Vector> Resize_impl::getHomogeneousPointsOnSurface(const size_t N) const {
    147114  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N);
    148   std::for_each(PointsOnSurface.begin(), PointsOnSurface.end(),
    149                 boost::bind(&Vector::operator*, _1, size) );
    150   return PointsOnSurface;
    151 }
    152 
    153 std::vector<Vector> Resize_impl::getHomogeneousPointsInVolume(const size_t N) const {
    154   std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsInVolume(N);
    155   std::for_each(PointsOnSurface.begin(), PointsOnSurface.end(),
    156                 boost::bind(&Vector::operator*, _1, size) );
    157         return std::vector<Vector>();
     115  for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
     116    *iter *= size;
     117  }
     118  return PointsOnSurface;
    158119}
    159120
     
    172133Translate_impl::~Translate_impl(){}
    173134
    174 bool Translate_impl::isInside(const Vector& point) const{
     135bool Translate_impl::isInside(const Vector& point){
    175136  return getArg()->isInside(point-offset);
    176137}
    177138
    178 Vector Translate_impl::getCenter() const
    179 {
    180   return getArg()->getCenter()+offset;
    181 }
    182 
    183 double Translate_impl::getRadius() const
    184 {
    185   return getArg()->getRadius();
    186 }
    187 
    188 double Translate_impl::getVolume() const
    189 {
    190         return getArg()->getVolume();
    191 }
    192 
    193 double Translate_impl::getSurfaceArea() const
    194 {
    195         return getArg()->getSurfaceArea();
    196 }
    197 
    198 Vector Translate_impl::translateIn(const Vector& point) const{
     139Vector Translate_impl::translateIn(const Vector& point){
    199140  return point-offset;
    200141}
    201142
    202 Vector Translate_impl::translateOutPos(const Vector& point) const{
     143Vector Translate_impl::translateOutPos(const Vector& point){
    203144  return point+offset;
    204145}
    205146
    206 Vector Translate_impl::translateOutNormal(const Vector& point) const{
     147Vector Translate_impl::translateOutNormal(const Vector& point){
    207148  return point;
    208149}
    209150
    210 std::string Translate_impl::toString() const{
     151std::string Translate_impl::toString() {
    211152  std::stringstream sstr;
    212153  sstr << "translate(" << getArg()->toString() << "," << offset << ")";
     
    216157std::vector<Vector> Translate_impl::getHomogeneousPointsOnSurface(const size_t N) const {
    217158  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N);
    218   std::for_each(PointsOnSurface.begin(), PointsOnSurface.end(),
    219                 boost::bind(&Vector::operator+, _1, offset) );
    220   return PointsOnSurface;
    221 }
    222 
    223 std::vector<Vector> Translate_impl::getHomogeneousPointsInVolume(const size_t N) const {
    224   std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsInVolume(N);
    225   std::for_each(PointsOnSurface.begin(), PointsOnSurface.end(),
    226                 boost::bind(&Vector::operator+, _1, offset) );
     159  for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
     160    *iter += offset;
     161  }
    227162  return PointsOnSurface;
    228163}
     
    238173  ShapeOpsBase_impl(_arg),factors(_factors)
    239174{
     175  ASSERT(factors[0]>0,"cannot stretch a shape by a negative amount");
     176  ASSERT(factors[1]>0,"cannot stretch a shape by a negative amount");
     177  ASSERT(factors[2]>0,"cannot stretch a shape by a negative amount");
    240178  for(int i = NDIM;i--;){
    241     ASSERT(factors[i]>0.,"cannot stretch a shape by a negative amount");
    242     reciFactors[i] = 1./factors[i];
     179    reciFactors[i] = 1/factors[i];
    243180  }
    244181}
     
    246183Stretch_impl::~Stretch_impl(){}
    247184
    248 double Stretch_impl::getVolume() const
    249 {
    250         // TODO
    251         return -1.;
    252 }
    253 
    254 double Stretch_impl::getSurfaceArea() const
    255 {
    256         // TODO
    257         return -1.;
    258 }
    259 
    260 bool Stretch_impl::isInside(const Vector& point) const{
     185bool Stretch_impl::isInside(const Vector& point){
    261186  Vector helper=point;
    262187  helper.ScaleAll(reciFactors);
     
    264189}
    265190
    266 Vector Stretch_impl::translateIn(const Vector& point) const{
     191Vector Stretch_impl::translateIn(const Vector& point){
    267192  Vector helper=point;
    268193  helper.ScaleAll(reciFactors);
     
    270195}
    271196
    272 Vector Stretch_impl::translateOutPos(const Vector& point) const{
     197Vector Stretch_impl::translateOutPos(const Vector& point){
    273198  Vector helper=point;
    274199  helper.ScaleAll(factors);
     
    276201}
    277202
    278 Vector Stretch_impl::translateOutNormal(const Vector& point) const{
     203Vector Stretch_impl::translateOutNormal(const Vector& point){
    279204  Vector helper=point;
    280205  // the normalFactors are derived from appearances of the factors
     
    288213}
    289214
    290 std::string Stretch_impl::toString() const{
     215std::string Stretch_impl::toString() {
    291216  std::stringstream sstr;
    292217  sstr << "stretch(" << getArg()->toString() << "," << factors << ")";
     
    296221std::vector<Vector> Stretch_impl::getHomogeneousPointsOnSurface(const size_t N) const {
    297222  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N);
    298   std::for_each(PointsOnSurface.begin(), PointsOnSurface.end(),
    299                 boost::bind( static_cast<void (Vector::*)(const Vector&)>(&Vector::ScaleAll), _1, reciFactors) );
    300   return PointsOnSurface;
    301 }
    302 
    303 std::vector<Vector> Stretch_impl::getHomogeneousPointsInVolume(const size_t N) const {
    304   std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsInVolume(N);
    305   std::for_each(PointsOnSurface.begin(), PointsOnSurface.end(),
    306       boost::bind( static_cast<void (Vector::*)(const Vector&)>(&Vector::ScaleAll), _1, reciFactors) );
     223  for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
     224    (*iter).ScaleAll(reciFactors);
     225  }
    307226  return PointsOnSurface;
    308227}
     
    323242Transform_impl::~Transform_impl(){}
    324243
    325 double Transform_impl::getVolume() const
    326 {
    327         return getArg()->getVolume();
    328 }
    329 
    330 double Transform_impl::getSurfaceArea() const
    331 {
    332         return getArg()->getSurfaceArea();
    333 }
    334 
    335 bool Transform_impl::isInside(const Vector& point) const{
     244bool Transform_impl::isInside(const Vector& point){
    336245  return getArg()->isInside(transformationInv * point);
    337246}
    338247
    339 Vector Transform_impl::translateIn(const Vector& point) const{
     248Vector Transform_impl::translateIn(const Vector& point){
    340249  return transformationInv * point;
    341250}
    342251
    343 Vector Transform_impl::translateOutPos(const Vector& point) const{
     252Vector Transform_impl::translateOutPos(const Vector& point){
    344253  return transformation * point;
    345254}
    346255
    347 Vector Transform_impl::translateOutNormal(const Vector& point) const
    348 {
     256Vector Transform_impl::translateOutNormal(const Vector& point){
    349257  RealSpaceMatrix mat = transformation.invert().transpose();
    350258  return mat * point;
    351259}
    352260
    353 std::string Transform_impl::toString() const{
     261std::string Transform_impl::toString() {
    354262  std::stringstream sstr;
    355263  sstr << "transform(" << getArg()->toString() << "," << transformation << ")";
     
    359267std::vector<Vector> Transform_impl::getHomogeneousPointsOnSurface(const size_t N) const {
    360268  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N);
    361   std::transform( PointsOnSurface.begin(), PointsOnSurface.end(), PointsOnSurface.begin(),
    362       boost::bind(static_cast<Vector(*)(const RealSpaceMatrix&,const Vector&)>(operator*), transformation, _1));
    363   return PointsOnSurface;
    364 }
    365 
    366 std::vector<Vector> Transform_impl::getHomogeneousPointsInVolume(const size_t N) const {
    367   std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsInVolume(N);
    368   std::transform( PointsOnSurface.begin(), PointsOnSurface.end(), PointsOnSurface.begin(),
    369       boost::bind(static_cast<Vector(*)(const RealSpaceMatrix&,const Vector&)>(operator*), transformation, _1));
     269  for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
     270    *iter = transformation * (*iter);
     271  }
    370272  return PointsOnSurface;
    371273}
  • src/Shapes/ShapeOps_impl.hpp

    r510f81 r22425a  
    1717#include "Shapes/Shape_impl.hpp"
    1818#include "Shapes/ShapeExceptions.hpp"
    19 #include "Shapes/ShapeType.hpp"
    2019#include "LinearAlgebra/Vector.hpp"
    2120#include "LinearAlgebra/RealSpaceMatrix.hpp"
     
    2928  ShapeOpsBase_impl(const Shape::impl_ptr&);
    3029  virtual ~ShapeOpsBase_impl();
    31   virtual bool isInside(const Vector &point) const;
    32   virtual bool isOnSurface(const Vector &point) const;
    33   virtual Vector getNormal(const Vector &point) const throw (NotOnSurfaceException);
    34   virtual Vector getCenter() const;
    35   virtual double getRadius() const;
    36   virtual LineSegmentSet getLineIntersections(const Line&) const;
    37   virtual enum ShapeType getType() const;
     30  virtual bool isInside(const Vector &point);
     31  virtual bool isOnSurface(const Vector &point);
     32  virtual Vector getNormal(const Vector &point) throw (NotOnSurfaceException);
     33  virtual LineSegmentSet getLineIntersections(const Line&);
    3834  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
    39   virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    4035protected:
    41   virtual Vector translateIn(const Vector &point) const=0;
    42   virtual Vector translateOutPos(const Vector &point) const=0;
    43   virtual Vector translateOutNormal(const Vector &point) const=0;
     36  virtual Vector translateIn(const Vector &point)=0;
     37  virtual Vector translateOutPos(const Vector &point)=0;
     38  virtual Vector translateOutNormal(const Vector &point)=0;
    4439  Shape::impl_ptr getArg() const;
    4540private:
     
    5348  virtual ~Resize_impl();
    5449protected:
    55   virtual double getVolume() const;
    56   virtual double getSurfaceArea() const;
    57   virtual Vector translateIn(const Vector &point) const;
    58   virtual Vector translateOutPos(const Vector &point) const;
    59   virtual Vector translateOutNormal(const Vector &point) const;
    60   virtual std::string toString() const;
    61   virtual bool isInside(const Vector& point) const;
     50  virtual Vector translateIn(const Vector &point);
     51  virtual Vector translateOutPos(const Vector &point);
     52  virtual Vector translateOutNormal(const Vector &point);
     53  virtual std::string toString();
     54  virtual bool isInside(const Vector& point);
    6255  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
    63   virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    6456private:
    6557  double size;
     
    7264  virtual ~Translate_impl();
    7365protected:
    74   virtual Vector getCenter() const;
    75   virtual double getRadius() const;
    76   virtual double getVolume() const;
    77   virtual double getSurfaceArea() const;
    78   virtual Vector translateIn(const Vector &point) const;
    79   virtual Vector translateOutPos(const Vector &point) const;
    80   virtual Vector translateOutNormal(const Vector &point) const;
    81   virtual std::string toString() const;
    82   virtual bool isInside(const Vector& point) const;
     66  virtual Vector translateIn(const Vector &point);
     67  virtual Vector translateOutPos(const Vector &point);
     68  virtual Vector translateOutNormal(const Vector &point);
     69  virtual std::string toString();
     70  virtual bool isInside(const Vector& point);
    8371  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
    84   virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    8572private:
    8673  Vector offset;
     
    9077{
    9178public:
    92 
    93 
    94         Stretch_impl(const Shape::impl_ptr&, const Vector&);
     79  Stretch_impl(const Shape::impl_ptr&, const Vector&);
    9580  virtual ~Stretch_impl();
    9681protected:
    97   virtual double getVolume() const;
    98   virtual double getSurfaceArea() const;
    99   virtual Vector translateIn(const Vector &point) const;
    100   virtual Vector translateOutPos(const Vector &point) const;
    101   virtual Vector translateOutNormal(const Vector &point) const;
    102   virtual std::string toString() const;
    103   virtual bool isInside(const Vector& point) const;
     82  virtual Vector translateIn(const Vector &point);
     83  virtual Vector translateOutPos(const Vector &point);
     84  virtual Vector translateOutNormal(const Vector &point);
     85  virtual std::string toString();
     86  virtual bool isInside(const Vector& point);
    10487  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
    105   virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    10688private:
    10789  Vector factors;
     
    11597  virtual ~Transform_impl();
    11698protected:
    117   virtual double getVolume() const;
    118   virtual double getSurfaceArea() const;
    119   virtual Vector translateIn(const Vector &point) const;
    120   virtual Vector translateOutPos(const Vector &point) const;
    121   virtual Vector translateOutNormal(const Vector &point) const;
    122   virtual std::string toString() const;
    123   virtual bool isInside(const Vector& point) const;
     99  virtual Vector translateIn(const Vector &point);
     100  virtual Vector translateOutPos(const Vector &point);
     101  virtual Vector translateOutNormal(const Vector &point);
     102  virtual std::string toString();
     103  virtual bool isInside(const Vector& point);
    124104  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
    125   virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    126105private:
    127106  RealSpaceMatrix transformation;
  • src/Shapes/Shape_impl.hpp

    r510f81 r22425a  
    1515
    1616
    17 #include <limits>
    1817#include <vector>
    19 
    20 #include "CodePatterns/Assert.hpp"
    2118
    2219#include "Shapes/Shape.hpp"
    2320#include "Shapes/ShapeExceptions.hpp"
    24 #include "Shapes/ShapeType.hpp"
    2521#include "LinearAlgebra/Line.hpp"
    26 #include "LinearAlgebra/LinePoint.hpp"
    2722#include "LinearAlgebra/LineSegment.hpp"
    2823#include "LinearAlgebra/LineSegmentSet.hpp"
     
    3429  Shape_impl(){};
    3530  virtual ~Shape_impl(){};
    36   virtual bool isInside(const Vector &point) const=0;
    37   virtual bool isOnSurface(const Vector &point) const=0;
    38   virtual Vector getNormal(const Vector &point) const throw(NotOnSurfaceException)=0;
    39   virtual Vector getCenter() const=0;
    40   virtual double getRadius() const=0;
    41   virtual double getVolume() const=0;
    42   virtual double getSurfaceArea() const=0;
    43   virtual LineSegmentSet getLineIntersections(const Line&) const=0;
    44   virtual std::string toString() const =0;
    45   virtual enum ShapeType getType() const =0;
     31  virtual bool isInside(const Vector &point)=0;
     32  virtual bool isOnSurface(const Vector &point)=0;
     33  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException)=0;
     34  virtual LineSegmentSet getLineIntersections(const Line&)=0;
     35  virtual std::string toString()=0;
    4636  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const=0;
    47   virtual   std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const=0;
    4837};
    4938
    5039class Everywhere_impl : public Shape_impl {
    5140public:
    52   virtual bool isInside(const Vector &point) const{
     41  virtual bool isInside(const Vector &point){
    5342    return true;
    5443  }
    55   virtual bool isOnSurface(const Vector &point) const{
     44  virtual bool isOnSurface(const Vector &point){
    5645    return false;
    5746  }
    58   virtual Vector getNormal(const Vector &point) const throw(NotOnSurfaceException){
     47  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException){
    5948    throw NotOnSurfaceException() << ShapeVector(&point);
    6049  }
    61   virtual Vector getCenter() const {
    62     return Vector(0.,0.,0.);
    63   }
    64   virtual double getRadius() const {
    65     return std::numeric_limits<double>::infinity();
    66   }
    67   virtual double getVolume() const
    68   {
    69         // TODO
    70         return 0.;
    71   }
    72   virtual double getSurfaceArea() const
    73   {
    74         // TODO
    75         return 0.;
    76   }
    77   virtual LineSegmentSet getLineIntersections(const Line &line) const{
     50  virtual LineSegmentSet getLineIntersections(const Line &line){
    7851    LineSegmentSet res(line);
    7952    res.insert(LineSegment(line.negEndpoint(),line.posEndpoint()));
    8053    return res;
    8154  }
    82   virtual std::string toString() const{
     55  virtual std::string toString(){
    8356    return "Everywhere()";
    84   }
    85   virtual enum ShapeType getType() const {
    86         return EverywhereType;
    8757  }
    8858  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const {
     
    9060    return PointsOnSurface;
    9161  }
    92   std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const {
    93         ASSERT(0,
    94                         "Everywhere_impl::getHomogeneousPointsInVolume() - not implemented.");
    95         return std::vector<Vector>();
    96   }
    9762};
    9863
    9964class Nowhere_impl : public Shape_impl {
    100   virtual bool isInside(const Vector &point) const{
     65  virtual bool isInside(const Vector &point){
    10166    return false;
    10267  }
    103   virtual bool isOnSurface(const Vector &point) const{
     68  virtual bool isOnSurface(const Vector &point){
    10469    return false;
    10570  }
    106   virtual Vector getNormal(const Vector &point) const throw(NotOnSurfaceException){
     71  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException){
    10772    throw NotOnSurfaceException() << ShapeVector(&point);
    10873  }
    109   virtual Vector getCenter() const {
    110     return Vector(0.,0.,0.);
    111   }
    112   virtual double getRadius() const {
    113     return 0.;
    114   }
    115   virtual double getVolume() const
    116   {
    117         return 0.;
    118   }
    119   virtual double getSurfaceArea() const
    120   {
    121         return 0.;
    122   }
    123   virtual LineSegmentSet getLineIntersections(const Line &line) const{
     74  virtual LineSegmentSet getLineIntersections(const Line &line){
    12475    return LineSegmentSet(line);
    12576  }
    126   virtual std::string toString() const{
     77  virtual std::string toString(){
    12778    return "Nowhere()";
    128   }
    129   virtual enum ShapeType getType() const {
    130         return NowhereType;
    13179  }
    13280  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const {
    13381    std::vector<Vector> PointsOnSurface;
    13482    return PointsOnSurface;
    135   }
    136   std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const {
    137         return std::vector<Vector>();
    13883  }
    13984};
     
    14388  AndShape_impl(const Shape::impl_ptr&, const Shape::impl_ptr&);
    14489  virtual ~AndShape_impl();
    145   virtual bool isInside(const Vector &point) const;
    146   virtual bool isOnSurface(const Vector &point) const;
    147   virtual Vector getNormal(const Vector &point) const throw(NotOnSurfaceException);
    148   virtual Vector getCenter() const;
    149   virtual double getRadius() const;
    150   virtual double getVolume() const;
    151   virtual double getSurfaceArea() const;
    152   virtual LineSegmentSet getLineIntersections(const Line&) const;
    153   virtual std::string toString() const;
    154   virtual enum ShapeType getType() const;
     90  virtual bool isInside(const Vector &point);
     91  virtual bool isOnSurface(const Vector &point);
     92  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException);
     93  virtual LineSegmentSet getLineIntersections(const Line&);
     94  virtual std::string toString();
    15595  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
    156   virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    15796private:
    15897  Shape::impl_ptr lhs;
     
    164103  OrShape_impl(const Shape::impl_ptr&, const Shape::impl_ptr&);
    165104  virtual ~OrShape_impl();
    166   virtual bool isInside(const Vector &point) const;
    167   virtual bool isOnSurface(const Vector &point) const;
    168   virtual Vector getNormal(const Vector &point) const throw(NotOnSurfaceException);
    169   virtual Vector getCenter() const;
    170   virtual double getRadius() const;
    171   virtual double getVolume() const;
    172   virtual double getSurfaceArea() const;
    173   virtual LineSegmentSet getLineIntersections(const Line&) const;
    174   virtual std::string toString() const;
    175   virtual enum ShapeType getType() const;
     105  virtual bool isInside(const Vector &point);
     106  virtual bool isOnSurface(const Vector &point);
     107  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException);
     108  virtual LineSegmentSet getLineIntersections(const Line&);
     109  virtual std::string toString();
    176110  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
    177   virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    178111private:
    179112  Shape::impl_ptr lhs;
     
    185118  NotShape_impl(const Shape::impl_ptr&);
    186119  virtual ~NotShape_impl();
    187   virtual bool isInside(const Vector &point) const;
    188   virtual bool isOnSurface(const Vector &point) const;
    189   virtual Vector getNormal(const Vector &point) const throw(NotOnSurfaceException);
    190   virtual Vector getCenter() const;
    191   virtual double getRadius() const;
    192   virtual double getVolume() const;
    193   virtual double getSurfaceArea() const;
    194   virtual LineSegmentSet getLineIntersections(const Line&) const;
    195   virtual std::string toString() const;
    196   virtual enum ShapeType getType() const;
     120  virtual bool isInside(const Vector &point);
     121  virtual bool isOnSurface(const Vector &point);
     122  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException);
     123  virtual LineSegmentSet getLineIntersections(const Line&);
     124  virtual std::string toString();
    197125  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
    198   virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    199126private:
    200127  Shape::impl_ptr arg;
  • src/Shapes/unittests/Makefile.am

    r510f81 r22425a  
    44
    55SHAPETESTSSOURCES = \
    6         ../Shapes/unittests/BaseShapesUnitTest.cpp \
    7         ../Shapes/unittests/ShapeOpsUnitTest.cpp \
    8         ../Shapes/unittests/Shape_HomogeneousPointsUnitTest.cpp
     6        ../Shapes/unittests/ShapeUnitTest.cpp
    97
    108SHAPETESTSHEADERS= \
    11         ../Shapes/unittests/BaseShapesUnitTest.hpp \
    12         ../Shapes/unittests/ShapeOpsUnitTest.hpp \
    13         ../Shapes/unittests/Shape_HomogeneousPointsUnitTest.cpp
     9        ../Shapes/unittests/ShapeUnitTest.hpp
    1410
    1511SHAPETESTS = \
    16   BaseShapesUnitTest \
    17   ShapeOpsUnitTest \
    18   Shape_HomogeneousPointsUnitTest
     12  ShapeUnittest
    1913 
    2014TESTS += $(SHAPETESTS)
     
    2822#       $(BOOST_LIB)
    2923
    30 BaseShapesUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
    31         ../Shapes/unittests/BaseShapesUnitTest.cpp \
    32         ../Shapes/unittests/BaseShapesUnitTest.hpp \
    33         ../Shapes/unittests/stubs/ApproximateShapeAreaStub.cpp \
    34         ../Shapes/unittests/stubs/ApproximateShapeVolumeStub.cpp
    35 nodist_BaseShapesUnitTest_SOURCES = \
     24ShapeUnittest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     25        ../Shapes/unittests/ShapeUnitTest.cpp \
     26        ../Shapes/unittests/ShapeUnitTest.hpp
     27nodist_ShapeUnittest_SOURCES = \
    3628        ../Helpers/defs.hpp \
    3729        ../Helpers/defs.cpp
    38 BaseShapesUnitTest_LDADD = $(SHAPELIBS)
    39 
    40 ShapeOpsUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
    41         ../Shapes/unittests/ShapeOpsUnitTest.cpp \
    42         ../Shapes/unittests/ShapeOpsUnitTest.hpp \
    43         ../Shapes/unittests/stubs/ApproximateShapeAreaStub.cpp \
    44         ../Shapes/unittests/stubs/ApproximateShapeVolumeStub.cpp
    45 nodist_ShapeOpsUnitTest_SOURCES = \
    46         ../Helpers/defs.hpp \
    47         ../Helpers/defs.cpp
    48 ShapeOpsUnitTest_LDADD = $(SHAPELIBS)
    49 
    50 Shape_HomogeneousPointsUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
    51         ../Shapes/unittests/Shape_HomogeneousPointsUnitTest.cpp \
    52         ../Shapes/unittests/Shape_HomogeneousPointsUnitTest.hpp
    53 nodist_Shape_HomogeneousPointsUnitTest_SOURCES = \
    54         ../Helpers/defs.hpp \
    55         ../Helpers/defs.cpp
    56 Shape_HomogeneousPointsUnitTest_LDADD = $(SHAPELIBS)
     30ShapeUnittest_LDADD = $(SHAPELIBS)
    5731
    5832
  • src/Tesselation/BoundaryTriangleSet.cpp

    r510f81 r22425a  
    230230  Vector Direction;
    231231
    232   // 1. get intersection with plane and place in ClosestPoint
     232  // 1. get intersection with plane
    233233  LOG(1, "INFO: Looking for closest point of triangle " << *this << " to " << x << ".");
    234   LOG(1, "INFO: endpoints are " << endpoints[0]->node->getPosition() << ","
    235       << endpoints[1]->node->getPosition() << ", and " << endpoints[2]->node->getPosition() << ".");
     234  GetCenter(Direction);
    236235  try {
    237     ClosestPoint = Plane(NormalVector, (endpoints[0]->node->getPosition())).getClosestPoint(x);
     236    Line l = makeLineThrough(x, Direction);
     237    ClosestPoint = Plane(NormalVector, (endpoints[0]->node->getPosition())).GetIntersection(l);
    238238  }
    239239  catch (LinearAlgebraException &excp) {
    240240    (ClosestPoint) = (x);
    241241  }
    242   Vector InPlane(ClosestPoint); // points from plane intersection to straight-down point
    243242
    244243  // 2. Calculate in plane part of line (x, intersection)
    245   LOG(2, "INFO: Closest point on triangle plane is " << ClosestPoint << ".");
     244  Vector InPlane = (x) - (ClosestPoint); // points from plane intersection to straight-down point
     245  InPlane.ProjectOntoPlane(NormalVector);
     246  InPlane += ClosestPoint;
     247
     248  LOG(2, "INFO: Triangle is " << *this << ".");
     249  LOG(2, "INFO: Line is from " << Direction << " to " << x << ".");
     250  LOG(2, "INFO: In-plane part is " << InPlane << ".");
    246251
    247252  // Calculate cross point between one baseline and the desired point such that distance is shortest
     253  double ShortestDistance = -1.;
     254  bool InsideFlag = false;
    248255  Vector CrossDirection[3];
    249256  Vector CrossPoint[3];
    250   for (int i = 0; i < 3; i++) {
    251     const Vector Direction = (endpoints[i%3]->node->getPosition()) - (endpoints[(i+1)%3]->node->getPosition());
     257  Vector helper;
     258  for (int i = 0; i < 3; i++) {
     259    // treat direction of line as normal of a (cut)plane and the desired point x as the plane offset, the intersect line with point
     260    Direction = (endpoints[(i+1)%3]->node->getPosition()) - (endpoints[i%3]->node->getPosition());
    252261    // calculate intersection, line can never be parallel to Direction (is the same vector as PlaneNormal);
    253262    Line l = makeLineThrough((endpoints[i%3]->node->getPosition()), (endpoints[(i+1)%3]->node->getPosition()));
    254     CrossPoint[i] = l.getClosestPoint(InPlane);
    255     // NOTE: direction of line is normalized, hence s must not necessarily be in [0,1] for the baseline
    256     LOG(2, "INFO: Closest point on line from " << (endpoints[(i+1)%3]->node->getPosition())
    257         << " to " << (endpoints[i%3]->node->getPosition()) << " is " << CrossPoint[i] << ".");
    258     CrossPoint[i] -= (endpoints[(i+1)%3]->node->getPosition());  // cross point was returned as absolute vector
     263    CrossPoint[i] = Plane(Direction, InPlane).GetIntersection(l);
     264    CrossDirection[i] = CrossPoint[i] - InPlane;
     265    CrossPoint[i] -= (endpoints[i%3]->node->getPosition());  // cross point was returned as absolute vector
    259266    const double s = CrossPoint[i].ScalarProduct(Direction)/Direction.NormSquared();
    260267    LOG(2, "INFO: Factor s is " << s << ".");
    261268    if ((s >= -MYEPSILON) && ((s-1.) <= MYEPSILON)) {
    262       CrossPoint[i] += (endpoints[(i+1)%3]->node->getPosition());  // make cross point absolute again
    263       LOG(2, "INFO: Crosspoint is " << CrossPoint[i] << ", intersecting BoundaryLine between "
    264           << endpoints[i % 3]->node->getPosition() << " and "
    265           << endpoints[(i + 1) % 3]->node->getPosition() << ".");
    266     } else {
    267       // set to either endpoint of BoundaryLine
    268       if (s < -MYEPSILON)
    269         CrossPoint[i] = (endpoints[(i+1)%3]->node->getPosition());
    270       else
    271         CrossPoint[i] = (endpoints[i%3]->node->getPosition());
    272       LOG(2, "INFO: Crosspoint is " << CrossPoint[i] << ", intersecting outside of BoundaryLine between "
    273           << endpoints[i % 3]->node->getPosition() << " and "
    274           << endpoints[(i + 1) % 3]->node->getPosition() << ".");
    275     }
    276     CrossDirection[i] = CrossPoint[i] - InPlane;
    277   }
    278 
    279   bool InsideFlag = true;
    280   double ShortestDistance = -1.;
     269          CrossPoint[i] += (endpoints[i%3]->node->getPosition());  // make cross point absolute again
     270      LOG(2, "INFO: Crosspoint is " << CrossPoint[i] << ", intersecting BoundaryLine between " << endpoints[i % 3]->node->getPosition() << " and " << endpoints[(i + 1) % 3]->node->getPosition() << ".");
     271      const double distance = CrossPoint[i].DistanceSquared(x);
     272      if ((ShortestDistance < 0.) || (ShortestDistance > distance)) {
     273        ShortestDistance = distance;
     274        (ClosestPoint) = CrossPoint[i];
     275      }
     276    } else
     277      CrossPoint[i].Zero();
     278  }
     279  InsideFlag = true;
    281280  for (int i = 0; i < 3; i++) {
    282281    const double sign = CrossDirection[i].ScalarProduct(CrossDirection[(i + 1) % 3]);
     
    285284    if ((sign > -MYEPSILON) && (othersign > -MYEPSILON)) // have different sign
    286285      InsideFlag = false;
    287     // update current best candidate
    288     const double distance = CrossPoint[i].DistanceSquared(x);
    289     if ((ShortestDistance < 0.) || (ShortestDistance > distance)) {
    290       ShortestDistance = distance;
    291       (ClosestPoint) = CrossPoint[i];
    292     }
    293   }
    294 
     286  }
    295287  if (InsideFlag) {
    296288    (ClosestPoint) = InPlane;
    297289    ShortestDistance = InPlane.DistanceSquared(x);
    298   }
    299 
     290  } else { // also check endnodes
     291    for (int i = 0; i < 3; i++) {
     292      const double distance = x.DistanceSquared(endpoints[i]->node->getPosition());
     293      if ((ShortestDistance < 0.) || (ShortestDistance > distance)) {
     294        ShortestDistance = distance;
     295        (ClosestPoint) = (endpoints[i]->node->getPosition());
     296      }
     297    }
     298  }
    300299  LOG(1, "INFO: Closest Point is " << ClosestPoint << " with shortest squared distance is " << ShortestDistance << ".");
    301300  return ShortestDistance;
     
    371370}
    372371;
    373 
    374 /** Checks whether a given point is inside the plane of the triangle and inside the
    375  * bounds defined by its BoundaryLineSet's.
    376  *
    377  * @param point point to check
    378  * @return true - point is inside place and inside all BoundaryLine's
    379  */
    380 bool BoundaryTriangleSet::IsInsideTriangle(const Vector &point) const
    381 {
    382   Info FunctionInfo(__func__);
    383 
    384   // check if it's inside the plane
    385   try {
    386     Plane trianglePlane(
    387         endpoints[0]->node->getPosition(),
    388         endpoints[1]->node->getPosition(),
    389         endpoints[2]->node->getPosition());
    390     if (!trianglePlane.isContained(point)) {
    391       LOG(1, "INFO: Point " << point << " is not inside plane " << trianglePlane << " by "
    392           << trianglePlane.distance(point) << ".");
    393       return false;
    394     }
    395   } catch(LinearDependenceException) {
    396     // triangle is degenerated, it's just a line (i.e. one endpoint is right in between two others
    397     for (size_t i = 0; i < NDIM; ++i) {
    398       try {
    399         Line l = makeLineThrough(
    400             lines[i]->endpoints[0]->node->getPosition(),
    401             lines[i]->endpoints[1]->node->getPosition());
    402         if (l.isContained(GetThirdEndpoint(lines[i])->node->getPosition())) {
    403           // we have the largest of the three lines
    404           LOG(1, "INFO: Linear-dependent case where point " << point << " is on line " << l << ".");
    405           return (l.isContained(point));
    406         }
    407       } catch(ZeroVectorException) {
    408         // two points actually coincide
    409         try {
    410           Line l = makeLineThrough(
    411               lines[i]->endpoints[0]->node->getPosition(),
    412               GetThirdEndpoint(lines[i])->node->getPosition());
    413           LOG(1, "INFO: Degenerated case where point " << point << " is on line " << l << ".");
    414           return (l.isContained(point));
    415         } catch(ZeroVectorException) {
    416           // all three points coincide
    417           if (point.DistanceSquared(lines[i]->endpoints[0]->node->getPosition()) < MYEPSILON) {
    418             LOG(1, "INFO: Full-Degenerated case where point " << point << " is on three endpoints "
    419                 << lines[i]->endpoints[0]->node->getPosition() << ".");
    420             return true;
    421           }
    422           else return false;
    423         }
    424       }
    425     }
    426   }
    427 
    428   // check whether it lies on the correct side as given by third endpoint for
    429   // each BoundaryLine.
    430   // NOTE: we assume here that endpoints are linear independent, as the case
    431   // has been caught before already extensively
    432   for (size_t i = 0; i < NDIM; ++i) {
    433     Line l = makeLineThrough(
    434         lines[i]->endpoints[0]->node->getPosition(),
    435         lines[i]->endpoints[1]->node->getPosition());
    436     Vector onLine( l.getClosestPoint(point) );
    437     LOG(1, "INFO: Closest point on boundary line is " << onLine << ".");
    438     Vector inTriangleDirection( GetThirdEndpoint(lines[i])->node->getPosition() - onLine );
    439     Vector inPointDirection(point - onLine);
    440     if ((inTriangleDirection.NormSquared() > MYEPSILON) && (inPointDirection.NormSquared() > MYEPSILON))
    441       if (inTriangleDirection.ScalarProduct(inPointDirection) < -MYEPSILON)
    442         return false;
    443   }
    444 
    445   return true;
    446 }
    447 
    448372
    449373/** Returns the endpoint which is not contained in the given \a *line.
  • src/Tesselation/BoundaryTriangleSet.hpp

    r510f81 r22425a  
    4242    bool IsPresentTupel(const BoundaryPointSet * const Points[3]) const;
    4343    bool IsPresentTupel(const BoundaryTriangleSet * const T) const;
    44     bool IsInsideTriangle(const Vector &point) const;
    4544
    4645    Plane getPlane() const;
  • src/Tesselation/boundary.cpp

    r510f81 r22425a  
    10291029  for (int i=0;i<NDIM;i++) {
    10301030    phi[i] = (random()/(rng_max-rng_min))*(2.*M_PI);
    1031     LOG(4, "DEBUG: Random angle is " << phi[i] << ".");
     1031    std::cout << "Random angle is " << phi[i] << std::endl;
    10321032  }
    10331033
  • src/Tesselation/triangleintersectionlist.cpp

    r510f81 r22425a  
    197197  if (!DistanceList.empty()) {
    198198    // get closest triangle(s)
    199     std::pair< DistanceTriangleMap::const_iterator, DistanceTriangleMap::const_iterator >  DistanceRange =
     199    std::pair< DistanceTriangleMap::iterator, DistanceTriangleMap::iterator >  DistanceRange =
    200200        DistanceList.equal_range(DistanceList.begin()->first);
    201     {
    202       size_t count = 0;
    203       for (DistanceTriangleMap::const_iterator iter = DistanceRange.first;
    204           iter != DistanceRange.second; ++iter)
    205         ++count;
    206       LOG(1, "INFO: There are " << count << " possible triangles at the smallest distance.");
    207     }
    208201    // if there is more than one, check all of their normal vectors
    209     // return the one with positive SKP if present because if the point
    210     // would be truely inside, all of the closest triangles would have to show
    211     // their inner side
    212     LOG(1, "INFO: Looking for first SKP greater than zero ...");
    213     for (DistanceTriangleMap::const_iterator iter = DistanceRange.first;
    214         iter != DistanceRange.second; ++iter) {
    215       // find the entry by the triangle key in IntersectionList to get the Intersection point
    216       runner = IntersectionList.find(iter->second);
    217       Vector TestVector = (Point) - (*(*runner).second);
    218       // construct SKP
    219       const double sign = (*iter).second->NormalVector.ScalarProduct(TestVector);
    220       LOG(1, "INFO: Checking SKP of closest triangle " << *(iter->second) << " = " << sign << ".");
    221       // if positive return
    222       if (sign > 0)
    223         break;
    224     }
    225     // if there's just one or all are negative, runner is not set yet
    226     if (runner == IntersectionList.end())
    227       runner = IntersectionList.find(DistanceList.begin()->second);
     202    // return the one with positive SKP if present
     203
     204    runner = IntersectionList.find(DistanceList.begin()->second);
    228205  }
    229206  return runner;
  • src/Tesselation/unittests/Makefile.am

    r510f81 r22425a  
    1414TESSELATIONTESTS = \
    1515  TesselationUnitTest \
    16   Tesselation_BoundaryTriangleUnitTest \
    17   Tesselation_InOutsideUnitTest
     16  Tesselation_BoundaryTriangleUnitTest
     17 
     18XFAIL_TESTS += Tesselation_InOutsideUnitTest
    1819
    1920TESTS += $(TESSELATIONTESTS)
  • src/Tesselation/unittests/Tesselation_BoundaryTriangleUnitTest.cpp

    r510f81 r22425a  
    3030#include "Helpers/defs.hpp"
    3131#include "Atom/TesselPoint.hpp"
    32 #include "LinearAlgebra/Plane.hpp"
    33 #include "LinearAlgebra/RealSpaceMatrix.hpp"
    34 #include "LinearAlgebra/VectorSet.hpp"
    3532#include "Tesselation/BoundaryPointSet.hpp"
    3633#include "Tesselation/BoundaryLineSet.hpp"
     
    5249
    5350
    54 void TesselationBoundaryTriangleTest::createTriangle(const std::vector<Vector> &Vectors)
    55 {
    56   CPPUNIT_ASSERT_EQUAL( (size_t)3, Vectors.size() );
     51void TesselationBoundaryTriangleTest::setUp()
     52{
     53  setVerbosity(5);
    5754
    5855  // create nodes
    59   for (size_t count = 0; count < NDIM; ++count) {
    60     tesselpoints[count] = new TesselPoint;
    61     tesselpoints[count]->setPosition( Vectors[count] );
    62     tesselpoints[count]->setName(toString(count));
    63     tesselpoints[count]->setNr(count);
    64     points[count] = new BoundaryPointSet(tesselpoints[count]);
    65   }
     56  tesselpoints[0] = new TesselPoint;
     57  tesselpoints[0]->setPosition(Vector(0., 0., 0.));
     58  tesselpoints[0]->setName("1");
     59  tesselpoints[0]->setNr(1);
     60  points[0] = new BoundaryPointSet(tesselpoints[0]);
     61  tesselpoints[1] = new TesselPoint;
     62  tesselpoints[1]->setPosition(Vector(0., 1., 0.));
     63  tesselpoints[1]->setName("2");
     64  tesselpoints[1]->setNr(2);
     65  points[1] = new BoundaryPointSet(tesselpoints[1]);
     66  tesselpoints[2] = new TesselPoint;
     67  tesselpoints[2]->setPosition(Vector(1., 0., 0.));
     68  tesselpoints[2]->setName("3");
     69  tesselpoints[2]->setNr(3);
     70  points[2] = new BoundaryPointSet(tesselpoints[2] );
    6671
    6772  // create line
     
    7277  // create triangle
    7378  triangle = new BoundaryTriangleSet(lines, 0);
    74   Plane p(Vectors[0], Vectors[1], Vectors[2]);
    75   triangle->GetNormalVector(p.getNormal());
    76 }
    77 
    78 void TesselationBoundaryTriangleTest::setUp()
    79 {
    80   setVerbosity(5);
    81 
    82   // create nodes
    83   std::vector<Vector> Vectors;
    84   Vectors.push_back( Vector(0., 0., 0.) );
    85   Vectors.push_back( Vector(0., 1., 0.) );
    86   Vectors.push_back( Vector(1., 0., 0.) );
    87 
    88   // create triangle
    89   createTriangle(Vectors);
    90 }
     79  triangle->GetNormalVector(Vector(0.,0.,1.));
     80};
     81
    9182
    9283void TesselationBoundaryTriangleTest::tearDown()
     
    9990  logger::purgeInstance();
    10091  errorLogger::purgeInstance();
    101 }
    102 
    103 /** UnitTest for Tesselation::IsInsideTriangle()
    104  */
    105 void TesselationBoundaryTriangleTest::IsInsideTriangleTest()
    106 {
    107   // inside points
    108   {
    109     // check each endnode
    110     for (size_t i=0; i< NDIM; ++i) {
    111       const Vector testPoint(triangle->endpoints[i]->node->getPosition());
    112       LOG(1, "INFO: Testing whether " << testPoint << " is an inner point.");
    113       CPPUNIT_ASSERT( triangle->IsInsideTriangle( testPoint ) );
    114     }
    115   }
    116 
    117   {
    118     // check points along each BoundaryLine
    119     for (size_t i=0; i< NDIM; ++i) {
    120       Vector offset = triangle->endpoints[i%3]->node->getPosition();
    121       Vector direction = triangle->endpoints[(i+1)%3]->node->getPosition() - offset;
    122       for (double s = 0.1; s < 1.; s+= 0.1) {
    123         Vector testPoint = offset + s*direction;
    124         LOG(1, "INFO: Testing whether " << testPoint << " is an inner point.");
    125         CPPUNIT_ASSERT( triangle->IsInsideTriangle( testPoint ) );
    126       }
    127     }
    128   }
    129 
    130   {
    131     // check central point
    132     Vector center;
    133     triangle->GetCenter(center);
    134     LOG(1, "INFO: Testing whether " << center << " is an inner point.");
    135     CPPUNIT_ASSERT( triangle->IsInsideTriangle( center ) );
    136   }
    137 
    138   // outside points
    139   {
    140     // check points outside (i.e. those not in xy-plane through origin)
    141     double n[3];
    142     const double boundary = 4.;
    143     const double step = 1.;
    144     // go through the cube and check each point
    145     for (n[0] = -boundary; n[0] <= boundary; n[0]+=step)
    146       for (n[1] = -boundary; n[1] <= boundary; n[1]+=step)
    147         for (n[2] = -boundary; n[2] <= boundary; n[2]+=step) {
    148           const Vector testPoint(n[0], n[1], n[2]);
    149           if (n[2] != 0) {
    150             LOG(1, "INFO: Testing whether " << testPoint << " is not an inner point.");
    151             CPPUNIT_ASSERT( !triangle->IsInsideTriangle( testPoint ) );
    152           }
    153         }
    154   }
    155 
    156   {
    157     // check points within the plane but outside of triangle
    158     double n[3];
    159     const double boundary = 4.;
    160     const double step = 1.;
    161     n[2] = 0;
    162     for (n[0] = -boundary; n[0] <= boundary; n[0]+=step)
    163       for (n[1] = -boundary; n[1] <= boundary; n[1]+=step) {
    164         const Vector testPoint(n[0], n[1], n[2]);
    165         if ((n[0] >=0) && (n[1] >=0) && (n[0]<=1) && (n[1]<=1)) {
    166           if (n[0]+n[1] <= 1) {
    167             LOG(1, "INFO: Testing whether " << testPoint << " is an inner point.");
    168             CPPUNIT_ASSERT( triangle->IsInsideTriangle( testPoint) );
    169           } else {
    170             LOG(1, "INFO: Testing whether " << testPoint << " is not an inner point.");
    171             CPPUNIT_ASSERT( !triangle->IsInsideTriangle( testPoint) );
    172           }
    173         } else {
    174           LOG(1, "INFO: Testing whether " << testPoint << " is not an inner point.");
    175           CPPUNIT_ASSERT( !triangle->IsInsideTriangle( testPoint) );
    176         }
    177       }
    178   }
    179 }
    180 
    181 /** UnitTest for Tesselation::IsInsideTriangle()
    182  *
    183  * We test for some specific points that occured in larger examples of the code.
    184  *
    185  */
    186 void TesselationBoundaryTriangleTest::IsInsideTriangle_specificTest()
    187 {
    188   {
    189     delete triangle;
    190     // test is from --create-micelle 200 --radius 30. --position "0,0,0" of sles.data
    191     // failure is: Intersection (23.1644,24.1867,65.1272) is not inside triangle [659|Na2451,O3652,Na3762].
    192     const Vector testPoint(1.57318,1.57612,10.9874);
    193     const Vector testIntersection(23.1644,24.1867,65.1272);
    194     std::vector<Vector> vectors;
    195     vectors.push_back( Vector(23.0563,30.4673,73.7555) );
    196     vectors.push_back( Vector(25.473,25.1512,68.5467) );
    197     vectors.push_back( Vector(23.1644,24.1867,65.1272) );
    198     createTriangle(vectors);
    199     CPPUNIT_ASSERT( triangle->IsInsideTriangle( testIntersection ) );
    200   }
    201   {
    202     delete triangle;
    203     // test is from --create-micelle 200 --radius 30. --position "0,0,0" of sles.data
    204     // failure is: Intersection (20.6787,70.655,71.5657) is not inside triangle [622|Na1197,Na2166,O3366].
    205     // fix is lower LINALG_MYEPSILON (not std::numeric_limits<doubble>*100 but *1e-4)
    206     const Vector testPoint(1.57318,14.185,61.2155);
    207     const Vector testIntersection(20.67867516517798,70.65496977054023,71.56572984946152);
    208     std::vector<Vector> vectors;
    209     vectors.push_back( Vector(22.9592,68.7791,77.5907) );
    210     vectors.push_back( Vector(18.4729,72.0386,68.08839999999999) );
    211     vectors.push_back( Vector(20.3834,71.0154,70.1443) );
    212     createTriangle(vectors);
    213     CPPUNIT_ASSERT( triangle->IsInsideTriangle( testIntersection ) );
    214   }
    215   {
    216     delete triangle;
    217     // test is from --create-micelle 200 --radius 30. --position "0,0,0" of sles.data
    218     // failure is:Intersection (27.56537519896,13.40256646925,6.672946688134) is not inside triangle [702|Na5016,O6388,Na6498].
    219     // note that the Intersection cannot possibly lie be within the triangle!
    220     // we test now against correct intersection
    221     const Vector testIntersection(14.6872,36.204,39.8043);
    222     std::vector<Vector> vectors;
    223     vectors.push_back( Vector(10.7513,43.4247,48.4127) );
    224     vectors.push_back( Vector(13.7119,37.0827,47.4203) );
    225     vectors.push_back( Vector(14.6872,36.204,39.8043) );
    226     createTriangle(vectors);
    227     CPPUNIT_ASSERT( triangle->IsInsideTriangle( testIntersection ) );
    228   }
    229 }
    230 
    231 /** UnitTest for Tesselation::GetClosestPointInsideTriangle()
    232  *
    233  * We check whether this function always returns a intersection inside the
    234  * triangle.
    235  *
    236  */
    237 void TesselationBoundaryTriangleTest::GetClosestPointInsideTriangleTest()
    238 {
    239   Vector TestIntersection;
    240 
    241   {
    242     // march through a cube mesh on triangle in xy plane
    243     double n[3];
    244     const double boundary = 4.;
    245     const double step = 1.;
    246     // go through the cube and check each point
    247     for (n[0] = -boundary; n[0] <= boundary; n[0]+=step)
    248       for (n[1] = -boundary; n[1] <= boundary; n[1]+=step)
    249         for (n[2] = -boundary; n[2] <= boundary; n[2]+=step) {
    250           const Vector testPoint(n[0], n[1], n[2]);
    251           triangle->GetClosestPointInsideTriangle(testPoint, TestIntersection);
    252           CPPUNIT_ASSERT( triangle->IsInsideTriangle( TestIntersection ));
    253         }
    254   }
    255 
    256   delete triangle;
    257   // create better triangle;
    258   VECTORSET(std::vector) Vectors;
    259   Vectors.push_back( Vector(0., 0., 0.) );
    260   Vectors.push_back( Vector(0., 1., 0.) );
    261   Vectors.push_back( Vector(1., 0., 0.) );
    262   RealSpaceMatrix M;
    263   M.setRotation(M_PI/3., M_PI/4., 2.*M_PI/3.);
    264   Vectors.transform(M);
    265   createTriangle(Vectors);
    266 
    267   {
    268     // march through a cube mesh on rotated triangle
    269     double n[3];
    270     const double boundary = 4.;
    271     const double step = 1.;
    272     // go through the cube and check each point
    273     for (n[0] = -boundary; n[0] <= boundary; n[0]+=step)
    274       for (n[1] = -boundary; n[1] <= boundary; n[1]+=step)
    275         for (n[2] = -boundary; n[2] <= boundary; n[2]+=step) {
    276           const Vector testPoint(n[0], n[1], n[2]);
    277           triangle->GetClosestPointInsideTriangle(testPoint, TestIntersection);
    278           CPPUNIT_ASSERT( triangle->IsInsideTriangle( TestIntersection ));
    279         }
    280   }
    281 }
    282 
    283 /** UnitTest for Tesselation::GetClosestPointInsideTriangle()
    284  *
    285  * We test for some specific points that occured in larger examples of the code.
    286  *
    287  */
    288 void TesselationBoundaryTriangleTest::GetClosestPointInsideTriangle_specificTest()
    289 {
    290   {
    291     delete triangle;
    292     // test is from --create-micelle 200 --radius 30. --position "0,0,0" of sles.data
    293     // failure is:Intersection (27.56537519896,13.40256646925,6.672946688134) is not inside triangle [702|Na5016,O6388,Na6498].
    294     // note that the Intersection cannot possibly lie be within the triangle
    295     // however, it is on its plane (off only by 2.7e-12)
    296     // testPoint2 is corrected version
    297     const Vector testPoint(27.56537519896,13.40256646925,6.672946688134);
    298     const Vector testPoint2(14.6872,36.204,39.8043);
    299     Vector testIntersection;
    300     std::vector<Vector> vectors;
    301     vectors.push_back( Vector(10.7513,43.4247,48.4127) );
    302     vectors.push_back( Vector(13.7119,37.0827,47.4203) );
    303     vectors.push_back( Vector(14.6872,36.204,39.8043) );
    304     createTriangle(vectors);
    305     triangle->GetClosestPointInsideTriangle(testPoint, testIntersection);
    306     CPPUNIT_ASSERT ( testPoint != testIntersection );
    307     CPPUNIT_ASSERT ( testPoint2 == testIntersection );
    308   }
    309 }
     92};
    31093
    31194/** UnitTest for Tesselation::IsInnerPoint()
  • src/Tesselation/unittests/Tesselation_BoundaryTriangleUnitTest.hpp

    r510f81 r22425a  
    1919#include <cppunit/extensions/HelperMacros.h>
    2020
    21 #include <vector>
    22 
    23 #include "LinearAlgebra/Vector.hpp"
    2421#include "LinkedCell/linkedcell.hpp"
    2522#include "Tesselation/tesselation.hpp"
     
    3229{
    3330    CPPUNIT_TEST_SUITE( TesselationBoundaryTriangleTest) ;
    34     CPPUNIT_TEST ( IsInsideTriangleTest );
    35     CPPUNIT_TEST ( IsInsideTriangle_specificTest );
    36     CPPUNIT_TEST ( GetClosestPointInsideTriangleTest );
    37     CPPUNIT_TEST ( GetClosestPointInsideTriangle_specificTest );
    3831    CPPUNIT_TEST ( GetClosestPointOnPlaneTest );
    3932    CPPUNIT_TEST ( GetClosestPointOffPlaneTest );
     
    4336      void setUp();
    4437      void tearDown();
    45       void IsInsideTriangleTest();
    46       void IsInsideTriangle_specificTest();
    47       void GetClosestPointInsideTriangleTest();
    48       void GetClosestPointInsideTriangle_specificTest();
    4938      void GetClosestPointOnPlaneTest();
    5039      void GetClosestPointOffPlaneTest();
    5140
    5241private:
    53       void createTriangle(const std::vector<Vector> &Vectors);
    54 
    5542      static const double SPHERERADIUS;
    5643
  • src/UIElements/CommandLineUI/CommandLineParser.cpp

    r510f81 r22425a  
    5151  atom("Atom options"),
    5252  command("Command options"),
    53   fill("fill options"),
    5453  fragmentation("Fragmentation options"),
    5554  graph("Graph options"),
     
    6665  CmdParserLookup["command"] = &command;
    6766  CmdParserLookup["edit"] = &edit;
    68   CmdParserLookup["fill"] = &fill;
    6967  CmdParserLookup["fragmentation"] = &fragmentation;
    7068  CmdParserLookup["graph"] = &graph;
  • src/UIElements/CommandLineUI/CommandLineParser.hpp

    r510f81 r22425a  
    5858  po::options_description command;
    5959  po::options_description edit;
    60   po::options_description fill;
    6160  po::options_description fragmentation;
    6261  po::options_description graph;
  • src/UIElements/Makefile.am

    r510f81 r22425a  
    263263        libMolecuilderAnalysis.la \
    264264        libMolecuilderGraph.la \
    265         libMolecuilderFilling.la \
    266265        libMolecuilder.la \
    267266        libMolecuilderFragmentation.la \
  • src/UIElements/Menu/MenuDescription.cpp

    r510f81 r22425a  
    4949  MenuPositionMap->insert(std::make_pair("command",TopPosition("",3)));
    5050  MenuPositionMap->insert(std::make_pair("edit",TopPosition("",2)));
    51   MenuPositionMap->insert(std::make_pair("fill",TopPosition("tools",5)));
    5251  MenuPositionMap->insert(std::make_pair("fragmentation",TopPosition("tools",3)));
    5352  MenuPositionMap->insert(std::make_pair("graph",TopPosition("tools",4)));
     
    6463  MenuDescriptionsMap->insert(std::make_pair("command","Configuration"));
    6564  MenuDescriptionsMap->insert(std::make_pair("edit","Edit"));
    66   MenuDescriptionsMap->insert(std::make_pair("fill","Fill"));
    6765  MenuDescriptionsMap->insert(std::make_pair("fragmentation","Fragmentation"));
    6866  MenuDescriptionsMap->insert(std::make_pair("graph","Graph"));
     
    7977  MenuNameMap->insert(std::make_pair("command","Configuration"));
    8078  MenuNameMap->insert(std::make_pair("edit","Edit"));
    81   MenuNameMap->insert(std::make_pair("fill","Fill"));
    8279  MenuNameMap->insert(std::make_pair("fragmentation","Fragmentation"));
    8380  MenuNameMap->insert(std::make_pair("graph","Graph"));
  • src/documentation/constructs/atoms.dox

    r510f81 r22425a  
    5656 * compatible implementation.
    5757 *
    58  * \section atoms-copy Copying atoms
    5958 *
    60  * Copying atoms is a frequent action. That's why there are specific functors
    61  * to get it done in more and more complex ways. The functors all inherit
    62  * the \ref CopyAtomsInterface and the more complex ones build upon the
    63  * functionality of the simpler ones:
    64  * -# CopyAtomsInterface: Internally sets to the number of desired atoms.
    65  * -# CopyAtoms_Simple: Fills the internal set with true copies.
    66  * -# CopyAtoms_withBonds: Additionally also adds bonds in between the copies
    67  *    as they exist in between the original atoms.
    68  * -# CopyAtoms_SaturateDanglingBonds: additionally checks for cut bond that
    69  *    would now become dangling bonds and inserts additional hydrogens for
    70  *    each cut bond such that the copied array of atoms is saturated.
    71  *
    72  * The CopyAtomsInterface is simple to use:
    73  * \code
    74  *   std::vector<atom *> atoms_to_copy;
    75  *   CopyAtoms_Simple copyMethod;
    76  *   copyMethod(atoms_to_copy);
    77  *   std::vector<atom *> copiedAtoms = getCopiedAtoms();
    78  * \endcode
    79  *
    80  *
    81  * \date 2012-03-30
    82  *
     59 * \date 2011-10-31
    8360 */
  • src/documentation/constructs/constructs.dox

    r510f81 r22425a  
    22 * Project: MoleCuilder
    33 * Description: creates and alters molecular systems
    4  * Copyright (C)  2011-2012 University of Bonn. All rights reserved.
     4 * Copyright (C)  2010 University of Bonn. All rights reserved.
    55 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
    66 */
     
    2222 *  \li \ref atom
    2323 *  \li \ref bondgraph
    24  *  \li \ref filling
    2524 *  \li \ref descriptors
    2625 *  \li \ref fragmentation
     
    4241 *
    4342 *
    44  * \date 2012-01-16
     43 * \date 2012-01-05
    4544 *
    4645 */
  • src/molecule.cpp

    r510f81 r22425a  
    4444#include "LinkedCell/linkedcell.hpp"
    4545#include "IdPool_impl.hpp"
    46 #include "Shapes/BaseShapes.hpp"
    4746#include "Tesselation/tesselation.hpp"
    4847#include "World.hpp"
     
    166165/************************** Access to the List of Atoms ****************/
    167166
     167
     168molecule::iterator molecule::begin(){
     169  return iterator(atomIds.begin(), FromIdToAtom());
     170}
     171
     172molecule::const_iterator molecule::begin() const{
     173  return const_iterator(atomIds.begin(), FromIdToAtom());
     174}
     175
     176molecule::iterator molecule::end(){
     177  return iterator(atomIds.end(), FromIdToAtom());
     178}
     179
     180molecule::const_iterator molecule::end() const{
     181  return const_iterator(atomIds.end(), FromIdToAtom());
     182}
     183
     184bool molecule::empty() const
     185{
     186  return (atomIds.empty());
     187}
     188
     189size_t molecule::size() const
     190{
     191  size_t counter = 0;
     192  for (const_iterator iter = begin(); iter != end (); ++iter)
     193    counter++;
     194  return counter;
     195}
     196
    168197molecule::const_iterator molecule::erase( const_iterator loc )
    169198{
     
    193222}
    194223
     224molecule::const_iterator molecule::find ( atom * key ) const
     225{
     226  return const_iterator(atomIds.find(key->getId()), FromIdToAtom());
     227}
     228
    195229pair<molecule::iterator,bool> molecule::insert ( atom * const key )
    196230{
    197231  OBSERVE;
    198   std::pair<iterator,bool> res = atomIds.insert(key->getId());
     232  pair<atomIdSet::iterator,bool> res = atomIds.insert(key->getId());
    199233  if (res.second) { // push atom if went well
    200234    key->setNr(atomIdPool.getNextId());
    201235    setAtomName(key);
    202236    formula+=key->getType();
    203     return res;
     237    return pair<iterator,bool>(iterator(res.first, FromIdToAtom()),res.second);
    204238  } else {
    205239    return pair<iterator,bool>(end(),res.second);
     
    222256{
    223257  World::AtomComposite vector_of_atoms;
     258//  std::copy(MyIter(atomIds.begin(), FromIdToAtom()),
     259//      MyIter(atomIds.end(), FromIdToAtom()),
     260//      vector_of_atoms.begin());
     261//  for (MyIter iter = MyIter(atomIds.begin(), FromIdToAtom());
     262//      iter != MyIter(atomIds.end(), FromIdToAtom());
     263//      ++iter)
    224264  for (molecule::iterator iter = begin(); iter != end(); ++iter)
    225265    vector_of_atoms.push_back(*iter);
     
    549589
    550590/** Creates a copy of this molecule.
    551  * \param offset translation Vector for the new molecule relative to old one
    552591 * \return copy of molecule
    553592 */
    554 molecule *molecule::CopyMolecule(const Vector &offset) const
     593molecule *molecule::CopyMolecule() const
    555594{
    556595  molecule *copy = World::getInstance().createMolecule();
     
    560599  for (iterator iter = begin(); iter != end(); ++iter) {
    561600    atom * const copy_atom = copy->AddCopyAtom(*iter);
    562     copy_atom->setPosition(copy_atom->getPosition() + offset);
    563601    FatherFinder.insert( std::make_pair( *iter, copy_atom ) );
    564602  }
     
    813851      "molecule::isInMolecule() - atom is not designated to be in molecule '"
    814852      +toString(this->getName())+"'.");
    815   molecule::const_iterator iter = atomIds.find(_atom->getId());
     853  molecule::atomIdSet::const_iterator iter = atomIds.find(_atom->getId());
    816854  return (iter != atomIds.end());
    817855}
     
    10251063}
    10261064
    1027 Shape molecule::getBoundingShape() const
    1028 {
    1029   // get center and radius
    1030   Vector center;
    1031   double radius = 0.;
    1032   {
    1033     center.Zero();
    1034     for(const_iterator iter = begin(); iter != end(); ++iter)
    1035       center += (*iter)->getPosition();
    1036     center *= 1./(double)size();
    1037     for(const_iterator iter = begin(); iter != end(); ++iter) {
    1038       const Vector &position = (*iter)->getPosition();
    1039       const double temp_distance = position.DistanceSquared(center);
    1040       if (temp_distance > radius)
    1041         radius = temp_distance;
    1042     }
    1043   }
    1044   // convert radius to true value and add some small boundary
    1045   radius = sqrt(radius) + 1e+6*std::numeric_limits<double>::epsilon();
    1046   LOG(1, "INFO: The " << size() << " atoms of the molecule are contained in a sphere at "
    1047       << center << " with radius " << radius << ".");
    1048 
    1049   Shape BoundingShape(Sphere(center, radius));
    1050   LOG(1, "INFO: Created sphere at " << BoundingShape.getCenter() << " and radius "
    1051       << BoundingShape.getRadius() << ".");
    1052   return BoundingShape;
    1053 }
    1054 
    10551065// construct idpool
    10561066CONSTRUCT_IDPOOL(atomId_t, continuousId)
    1057 
  • src/molecule.hpp

    r510f81 r22425a  
    2121#include <vector>
    2222
     23#include <boost/iterator/transform_iterator.hpp>
     24
    2325#include <string>
    2426
    25 #include "AtomIdSet.hpp"
    2627#include "Atom/AtomSet.hpp"
    2728#include "CodePatterns/Cacheable.hpp"
    2829#include "CodePatterns/Observer/Observable.hpp"
     30#include "CodePatterns/Observer/ObservedIterator.hpp"
    2931#include "Descriptors/AtomIdDescriptor.hpp"
    3032#include "Fragmentation/HydrogenSaturation_enum.hpp"
     
    3335#include "IdPool_policy.hpp"
    3436#include "IdPool.hpp"
    35 #include "Shapes/Shape.hpp"
    3637#include "types.hpp"
     38
     39// TODO: Was is the include of MoleculeDescriptor_impl.hpp doing in molecule.hpp
     40#include "Descriptors/MoleculeDescriptor_impl.hpp"
    3741
    3842/****************************************** forward declarations *****************************/
     
    5054class MoleculeLeafClass;
    5155class MoleculeListClass;
    52 class MoleculeUnittest;
     56class periodentafel;
    5357class RealSpaceMatrix;
    5458class Vector;
     59class Shape;
     60
     61/******************************** Some definitions for easier reading **********************************/
     62
     63struct FromIdToAtom :
     64  public std::unary_function<atom *, atomId_t>
     65{
     66    atom * operator()(atomId_t id) const {
     67     return World::getInstance().getAtom(AtomById(id));
     68    }
     69};
    5570
    5671/************************************* Class definitions ****************************************/
     
    6176class molecule : public Observable
    6277{
    63   //!> grant unit test access
    64   friend class MoleculeUnittest;
    65   //!> function may access cstor
    6678  friend molecule *NewMolecule();
    67   //!> function may access dstor
    6879  friend void DeleteMolecule(molecule *);
    6980
    7081public:
    71   typedef AtomIdSet::atomIdSet atomIdSet;
    72   typedef AtomIdSet::iterator iterator;
    73   typedef AtomIdSet::const_iterator const_iterator;
     82  typedef std::set<atomId_t> atomIdSet;
     83  typedef boost::transform_iterator<FromIdToAtom, atomIdSet::iterator, atom *, atomId_t> iterator;
     84  typedef boost::transform_iterator<FromIdToAtom, atomIdSet::const_iterator, const atom *, atomId_t const &> const_iterator;
    7485
    7586  int MDSteps; //!< The number of MD steps in Trajectories
     
    8697  Cacheable<int> BondCount; //!< number of atoms, brought up-to-date by doCountBonds()
    8798  moleculeId_t id;
    88   AtomIdSet atomIds; //<!set of atomic ids to check uniqueness of atoms
     99  atomIdSet atomIds; //<!set of atomic ids to check uniqueness of atoms
    89100  IdPool<atomId_t, uniqueId> atomIdPool;  //!< pool of internal ids such that way may guarantee uniqueness
    90101
     
    114125  World::AtomComposite getAtomSet() const;
    115126
    116   // simply pass on all functions to AtomIdSet
    117   iterator begin() {
    118     return atomIds.begin();
    119   }
    120   const_iterator begin() const
    121   {
    122     return atomIds.begin();
    123   }
    124   iterator end()
    125   {
    126     return atomIds.end();
    127   }
    128   const_iterator end() const
    129   {
    130     return atomIds.end();
    131   }
    132   bool empty() const
    133   {
    134     return atomIds.empty();
    135   }
    136   size_t size() const
    137   {
    138     return atomIds.size();
    139   }
    140   const_iterator find(atom * key) const
    141   {
    142     return atomIds.find(key);
    143   }
    144 
    145   /** Returns the set of atomic ids contained in this molecule.
    146    *
    147    * @return set of atomic ids
    148    */
    149   const atomIdSet & getAtomIds() const {
    150     return atomIds.getAtomIds();
    151   }
    152 
    153   std::pair<iterator, bool> insert(atom * const key);
    154 
     127  iterator begin();
     128  const_iterator begin() const;
     129  iterator end();
     130  const_iterator end() const;
     131  bool empty() const;
     132  size_t size() const;
     133  const_iterator find(atom * key) const;
     134  pair<iterator, bool> insert(atom * const key);
    155135  bool containsAtom(atom* key);
    156136
     
    165145   */
    166146  const_iterator erase(const_iterator loc);
    167 
    168147  /** Erase an atom from the list.
    169148   * \note This should only be called by atom::removeFromMolecule(),
     
    198177
    199178public:
    200 
    201   /** Function to create a bounding spherical shape for the currently associated atoms.
    202    *
    203    */
    204   Shape getBoundingShape() const;
    205179
    206180  /// remove atoms from molecule.
     
    255229  bond * CopyBond(atom *left, atom *right, bond *CopyBond);
    256230
    257   molecule *CopyMolecule(const Vector &offset = zeroVec) const;
     231  molecule *CopyMolecule() const;
    258232  molecule* CopyMoleculeFromSubRegion(const Shape&) const;
    259233
  • src/unittests/Makefile.am

    r510f81 r22425a  
    1212include ../../src/Descriptors/unittests/Makefile.am
    1313include ../../src/Element/unittests/Makefile.am
    14 include ../../src/Filling/unittests/Makefile.am
    1514include ../../src/Fragmentation/unittests/Makefile.am
    1615include ../../src/Graph/unittests/Makefile.am
     
    2928
    3029GENERALTESTS = \
    31   AtomIdSetUnitTest \
    3230  BoxUnitTest \
    3331  Box_BoundaryConditionsTest \
    3432  FormulaUnittest \
    3533  ListOfBondsUnitTest \
    36   MoleculeUnitTest \
    3734  WorldTimeUnitTest
    3835
     
    6259
    6360ALLLIBS = \
    64         ../libMolecuilderFilling.la \
    6561        ../libMolecuilderUI.la \
    6662        ../libMolecuilder.la \
     
    7470        ${DESCRIPTORTESTSSOURCES} \
    7571        ${ELEMENTTESTSSOURCES} \
    76         ${FILLINGTESTSSOURCES} \
    7772        ${FRAGMENTATIONTESTSSOURCES} \
    7873        ${GRAPHTESTSSOURCES} \
     
    8681        ${UIELEMENTSMENUTESTSSOURCES} \
    8782        stubs/ObserverStub.cpp \
    88         AtomIdSetUnitTest.cpp \
    8983  BoxUnitTest.cpp \
    9084        Box_BoundaryConditionsUnitTest.cpp \
    9185  FormulaUnitTest.cpp \
    9286  ListOfBondsUnitTest.cpp \
    93   MoleculeUnitTest.cpp \
    9487  WorldTimeUnitTest.cpp
    9588
     
    9992        ${DESCRIPTORTESTSHEADERS} \
    10093        ${ELEMENTTESTSHEADERS} \
    101         ${FILLINGTESTSHEADERS} \
    10294        ${FRAGMENTATIONTESTSHEADERS} \
    10395        ${GRAPHTESTSHEADERS} \
     
    111103        ${UIELEMENTSMENUTESTSHEADERS} \
    112104        stubs/ObserverStub.hpp \
    113         AtomIdSetUnitTest.hpp \
    114105  BoxUnitTest.hpp \
    115106        Box_BoundaryConditionsUnitTest.hpp \
    116107  FormulaUnitTest.hpp \
    117108  ListOfBondsUnitTest.hpp \
    118   MoleculeUnitTest.hpp \
    119109  WorldTimeUnitTest.hpp
    120110 
     
    124114        BoxUnitTest.hpp \
    125115        stubs/ObserverStub.cpp \
    126         stubs/ObserverStub.hpp \
    127         ../Shapes/unittests/stubs/ApproximateShapeAreaStub.cpp \
    128         ../Shapes/unittests/stubs/ApproximateShapeVolumeStub.cpp
     116        stubs/ObserverStub.hpp 
    129117BoxUnitTest_LDADD = \
    130118        ../libMolecuilder.la \
     
    132120        ../libMolecuilderHelpers.la \
    133121        $(top_builddir)/LinearAlgebra/src/LinearAlgebra/libLinearAlgebra.la
    134 
    135 AtomIdSetUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
    136         AtomIdSetUnitTest.cpp \
    137         AtomIdSetUnitTest.hpp
    138 AtomIdSetUnitTest_LDADD =  $(ALLLIBS)
    139122
    140123Box_BoundaryConditionsTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     
    157140ListOfBondsUnitTest_LDADD = $(ALLLIBS)
    158141
    159 MoleculeUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
    160         MoleculeUnitTest.cpp \
    161         MoleculeUnitTest.hpp
    162 MoleculeUnitTest_LDADD = \
    163         ../libMolecuilderUI.la \
    164         ../libMolecuilder.la \
    165         $(top_builddir)/LinearAlgebra/src/LinearAlgebra/libLinearAlgebra.la
    166 
    167142WorldTimeUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
    168143        WorldTimeUnitTest.cpp \
  • tests/CodeChecks/Makefile.am

    r510f81 r22425a  
    11AUTOM4TE = autom4te
     2EXTRA_DIST = \
     3        atlocal.in \
     4        package.m4 \
     5        testsuite.at \
     6        testsuite-config_h.at \
     7        testsuite-date_in_dox.at \
     8        testsuite-globallistofactions_hpp.at \
     9        testsuite-memdebug.at \
     10        testsuite-project-disclaimer.at \
     11        $(TESTSUITE)
     12TESTSUITE = $(srcdir)/testsuite
    213
    3 TESTSUITE = $(srcdir)/testsuite
     14DISTCLEANFILES = atconfig
    415
    516TESTSCRIPTS = \
     
    718        testsuite-date_in_dox.at \
    819        testsuite-globallistofactions_hpp.at \
    9         testsuite-header-dist.at \
    1020        testsuite-memdebug.at \
    1121        testsuite-project-disclaimer.at
    12 
    13 DISTCLEANFILES = atconfig
    14 
    15 EXTRA_DIST = \
    16         atlocal.in \
    17         package.m4 \
    18         testsuite.at \
    19         $(TESTSUITE) \
    20         $(TESTSCRIPTS)
    2122
    2223max_jobs = 4
  • tests/CodeChecks/testsuite.at

    r510f81 r22425a  
    2323m4_include(testsuite-project-disclaimer.at)
    2424
    25 m4_include(testsuite-header-dist.at)
  • tests/Python/AllActions/options.dat

    r510f81 r22425a  
    7474MaxDistance     "-1"
    7575MDSteps "1"
    76 mesh-offset     "0.5,0.5,0.5"
    77 mesh-size       "10,10,10"
    78 min-distance    "1."
    7976molecule-by-id  "0"
    8077nonconvex-envelope      "25"
     
    170167start-step      "0"
    171168suspend-in-water        "1.0"
    172 tesselation-radius      "5."
    173169time-step-zero  "0"
    174170translate-atoms "1. 0. 0."
  • tests/regression/Makefile.am

    r510f81 r22425a  
    155155        $(srcdir)/Selection/Atoms/AtomsInsideCuboid/testsuite-selection-unselect-atoms-inside-cuboid.at \
    156156        $(srcdir)/Selection/Atoms/AtomsInsideSphere/testsuite-selection-select-atoms-inside-sphere.at \
    157         $(srcdir)/Selection/Atoms/AtomsInsideSphere/testsuite-selection-select-atoms-inside-tiny-sphere.at \
    158157        $(srcdir)/Selection/Atoms/AtomsInsideSphere/testsuite-selection-unselect-atoms-inside-sphere.at \
    159         $(srcdir)/Selection/Atoms/AtomsInsideSphere/testsuite-selection-unselect-atoms-inside-tiny-sphere.at \
    160158        $(srcdir)/Selection/Atoms/ClearAtoms/testsuite-selection-clear-atoms.at \
    161159        $(srcdir)/Selection/Molecules/testsuite-selection-molecules.at \
  • tests/regression/Selection/Atoms/AtomsInsideSphere/testsuite-selection-select-atoms-inside-sphere.at

    r510f81 r22425a  
    1414AT_SKIP_IF([! cat >/dev/null < /dev/null])  # check whether cat is there
    1515AT_SKIP_IF([! wc -l /dev/null])  # check whether wc is there
    16 AT_CHECK([cat < $file | awk -F" " '{ if ((NF == 4) && (($2-10)*($2-10)+($3-10)*($3-10)+($4-10)*($4-10)) > 100) print $1,$2,$3,$4;}' | wc -l], 0, [stdout], [ignore])
    17 AT_CHECK([fgrep "505" stdout], 0, [ignore], [ignore])
    18 AT_CHECK([cat < $file | awk -F" " '{ if ((NF == 4) && (($2-10)*($2-10)+($3-10)*($3-10)+($4-10)*($4-10)) < 100) print $1,$2,$3,$4;}' | wc -l], 0, [stdout], [ignore])
     16AT_CHECK([cat < $file | awk -F" " '{ if (($2-10)*($2-10)+($3-10)*($3-10)+($4-10)*($4-10) > 100) print $1,$2,$3,$4;}' | wc -l], 0, [stdout], [ignore])
     17AT_CHECK([fgrep "507" stdout], 0, [ignore], [ignore])
     18AT_CHECK([cat < $file | awk -F" " '{ if (($2-10)*($2-10)+($3-10)*($3-10)+($4-10)*($4-10) < 100) print $1,$2,$3,$4;}' | wc -l], 0, [stdout], [ignore])
    1919AT_CHECK([fgrep "0" stdout], 0, [ignore], [ignore])
    2020
  • tests/regression/Selection/Atoms/AtomsInsideSphere/testsuite-selection-unselect-atoms-inside-sphere.at

    r510f81 r22425a  
    1515AT_SKIP_IF([! cat >/dev/null < /dev/null])  # check whether awk is there
    1616AT_SKIP_IF([! wc -l /dev/null])  # check whether wc is there
    17 AT_CHECK([cat < $file | awk -F" " '{ if ((NF == 4) && (($2-10)*($2-10)+($3-10)*($3-10)+($4-10)*($4-10)) > 100) print $1,$2,$3,$4;}' | wc -l], 0, [stdout], [ignore])
    18 AT_CHECK([fgrep "0" stdout], 0, [ignore], [ignore])
    19 AT_CHECK([cat < $file | awk -F" " '{ if ((NF == 4) && (($2-10)*($2-10)+($3-10)*($3-10)+($4-10)*($4-10)) < 100) print $1,$2,$3,$4;}' | wc -l], 0, [stdout], [ignore])
     17AT_CHECK([cat < $file | awk -F" " '{ if (($2-10)*($2-10)+($3-10)*($3-10)+($4-10)*($4-10) > 100) print $1,$2,$3,$4;}' | wc -l], 0, [stdout], [ignore])
     18AT_CHECK([fgrep "2" stdout], 0, [ignore], [ignore])
     19AT_CHECK([cat < $file | awk -F" " '{ if (($2-10)*($2-10)+($3-10)*($3-10)+($4-10)*($4-10) < 100) print $1,$2,$3,$4;}' | wc -l], 0, [stdout], [ignore])
    2020AT_CHECK([fgrep "524" stdout], 0, [ignore], [ignore])
    2121
  • tests/regression/Selection/Atoms/testsuite-selection-atoms.at

    r510f81 r22425a  
    2626# (un)select atoms inside sphere
    2727m4_include(Selection/Atoms/AtomsInsideSphere/testsuite-selection-select-atoms-inside-sphere.at)
    28 m4_include(Selection/Atoms/AtomsInsideSphere/testsuite-selection-select-atoms-inside-tiny-sphere.at)
    2928m4_include(Selection/Atoms/AtomsInsideSphere/testsuite-selection-unselect-atoms-inside-sphere.at)
    30 m4_include(Selection/Atoms/AtomsInsideSphere/testsuite-selection-unselect-atoms-inside-tiny-sphere.at)
    3129
    3230# clear atom selection
Note: See TracChangeset for help on using the changeset viewer.