Changeset 4eee8f


Ignore:
Timestamp:
Apr 30, 2010, 10:07:23 AM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
Children:
59e7832
Parents:
f70c2a
Message:

Declared the Vector class as single point spaces

Location:
molecuilder/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/Makefile.am

    rf70c2a r4eee8f  
    1010                           gslvector.cpp \
    1111                           linearsystemofequations.cpp \
     12                           Space.cpp \
    1213                           vector.cpp
    1314                           
     
    1516                           gslvector.hpp \
    1617                           linearsystemofequations.hpp \
     18                           Space.hpp \
    1719                           vector.hpp
    1820                           
     
    127129                 periodentafel.cpp \
    128130                 Plane.cpp \
    129                  Space.cpp \
    130131                 tesselation.cpp \
    131132                 tesselationhelpers.cpp \
     
    166167          periodentafel.hpp \
    167168          Plane.hpp \
    168           Space.hpp \
    169169          stackclass.hpp \
    170170          tesselation.hpp \
  • molecuilder/src/analysis_correlation.cpp

    rf70c2a r4eee8f  
    131131                                checkOtherX = Vector(Othern[0], Othern[1], Othern[2]) + periodicOtherX;
    132132                                checkOtherX.MatrixMultiplication(FullMatrix);
    133                                 distance = checkX.Distance(checkOtherX);
     133                                distance = checkX.distance(checkOtherX);
    134134                                //Log() << Verbose(1) <<"Inserting " << *Walker << " and " << *OtherWalker << endl;
    135135                                outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> (Walker, OtherWalker) ) );
     
    224224                checkX = Vector(n[0], n[1], n[2]) + periodicX;
    225225                checkX.MatrixMultiplication(FullMatrix);
    226                 distance = checkX.Distance(*point);
     226                distance = checkX.distance(*point);
    227227                DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
    228228                outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (Walker, point) ) );
  • molecuilder/src/atom.cpp

    rf70c2a r4eee8f  
    261261double atom::DistanceToVector(const Vector &origin) const
    262262{
    263   return origin.Distance(x);
     263  return origin.distance(x);
    264264};
    265265
  • molecuilder/src/atom_trajectoryparticle.cpp

    rf70c2a r4eee8f  
    4949  // set forces
    5050  for (int i=NDIM;i++;)
    51     Force->Matrix[0][nr][5+i] += 2.*constant*sqrt(Trajectory.R.at(startstep).Distance(Sprinter->Trajectory.R.at(endstep)));
     51    Force->Matrix[0][nr][5+i] += 2.*constant*sqrt(Trajectory.R.at(startstep).distance(Sprinter->Trajectory.R.at(endstep)));
    5252};
    5353
  • molecuilder/src/bond.cpp

    rf70c2a r4eee8f  
    119119double bond::GetDistance() const
    120120{
    121   return (leftatom->node->Distance(*rightatom->node));
     121  return (leftatom->node->distance(*rightatom->node));
    122122};
    123123
  • molecuilder/src/molecule_dynamics.cpp

    rf70c2a r4eee8f  
    4848    // check whether either is zero()
    4949    if ((Norm1 < MYEPSILON) && (Norm2 < MYEPSILON)) {
    50       tmp = Walker->Trajectory.R.at(Params.startstep).Distance(Runner->Trajectory.R.at(Params.startstep));
     50      tmp = Walker->Trajectory.R.at(Params.startstep).distance(Runner->Trajectory.R.at(Params.startstep));
    5151    } else if (Norm1 < MYEPSILON) {
    5252      Sprinter = Params.PermutationMap[Walker->nr];   // find first target point
     
    6666  //        Log() << Verbose(0) << " and ";
    6767  //        Log() << Verbose(0) << trajectory2;
    68       tmp = Walker->Trajectory.R.at(Params.startstep).Distance(Runner->Trajectory.R.at(Params.startstep));
     68      tmp = Walker->Trajectory.R.at(Params.startstep).distance(Runner->Trajectory.R.at(Params.startstep));
    6969  //        Log() << Verbose(0) << " with distance " << tmp << "." << endl;
    7070    } else { // determine distance by finding minimum distance
     
    166166    // first term: distance to target
    167167    Runner = Params.PermutationMap[Walker->nr];   // find target point
    168     tmp = (Walker->Trajectory.R.at(Params.startstep).Distance(Runner->Trajectory.R.at(Params.endstep)));
     168    tmp = (Walker->Trajectory.R.at(Params.startstep).distance(Runner->Trajectory.R.at(Params.endstep)));
    169169    tmp *= Params.IsAngstroem ? 1. : 1./AtomicLengthToAngstroem;
    170170    result += Params.PenaltyConstants[0] * tmp;
     
    225225    while(Runner->next != mol->end) {
    226226      Runner = Runner->next;
    227       Params.DistanceList[Walker->nr]->insert( DistancePair(Walker->Trajectory.R.at(Params.startstep).Distance(Runner->Trajectory.R.at(Params.endstep)), Runner) );
     227      Params.DistanceList[Walker->nr]->insert( DistancePair(Walker->Trajectory.R.at(Params.startstep).distance(Runner->Trajectory.R.at(Params.endstep)), Runner) );
    228228    }
    229229  }
  • molecuilder/src/moleculelist.cpp

    rf70c2a r4eee8f  
    502502          if ((Runner->type->Z == 1) && (Runner->nr > Walker->nr) && (Binder->GetOtherAtom(Runner) != Binder->GetOtherAtom(Walker))) { // (hydrogens have only one bonding partner!)
    503503            // 4. evaluate the morse potential for each matrix component and add up
    504             distance = Runner->x.Distance(Walker->x);
     504            distance = Runner->x.distance(Walker->x);
    505505            //Log() << Verbose(0) << "Fragment " << (*ListRunner)->name << ": " << *Runner << "<= " << distance << "=>" << *Walker << ":" << endl;
    506506            for (int k = 0; k < a; k++) {
  • molecuilder/src/tesselation.cpp

    rf70c2a r4eee8f  
    10971097    DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << OtherOptCenter << ":" << endl);
    10981098    for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    1099       DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->Distance(OtherOptCenter) << "." << endl);
     1099      DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->distance(OtherOptCenter) << "." << endl);
    11001100
    11011101    // remove baseline's endpoints and candidates
     
    20502050  DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << CandidateLine.OtherOptCenter << ":" << endl);
    20512051  for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    2052     DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->Distance(CandidateLine.OtherOptCenter) << "." << endl);
     2052    DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->distance(CandidateLine.OtherOptCenter) << "." << endl);
    20532053
    20542054  // remove triangles's endpoints
     
    20662066    DoLog(1) && (Log() << Verbose(1) << "External atoms inside of sphere at " << CandidateLine.OtherOptCenter << ":" << endl);
    20672067    for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    2068       DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->Distance(CandidateLine.OtherOptCenter) << "." << endl);
     2068      DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->distance(CandidateLine.OtherOptCenter) << "." << endl);
    20692069  }
    20702070  delete (ListofPoints);
  • molecuilder/src/tesselationhelpers.cpp

    rf70c2a r4eee8f  
    8888  center->at(2) =  0.5 * m14/ m11;
    8989
    90   if (fabs(a.Distance(*center) - RADIUS) > MYEPSILON)
    91     DoeLog(1) && (eLog()<< Verbose(1) << "The given center is further way by " << fabs(a.Distance(*center) - RADIUS) << " from a than RADIUS." << endl);
     90  if (fabs(a.distance(*center) - RADIUS) > MYEPSILON)
     91    DoeLog(1) && (eLog()<< Verbose(1) << "The given center is further way by " << fabs(a.distance(*center) - RADIUS) << " from a than RADIUS." << endl);
    9292
    9393  gsl_matrix_free(A);
     
    232232    alpha = 2.*M_PI - alpha;
    233233  DoLog(1) && (Log() << Verbose(1) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << RelativeOldSphereCenter << " and resulting angle is " << alpha << "." << endl);
    234   radius = helper.Distance(RelativeOldSphereCenter);
     234  radius = helper.distance(RelativeOldSphereCenter);
    235235  helper.ProjectOntoPlane(NormalVector);
    236236  // check whether new center is somewhat away or at least right over the current baseline to prevent intersecting triangles
  • molecuilder/src/triangleintersectionlist.cpp

    rf70c2a r4eee8f  
    146146  if (DistanceList.empty())
    147147    for (TriangleVectorMap::const_iterator runner = IntersectionList.begin(); runner != IntersectionList.end(); runner++)
    148       DistanceList.insert( pair<double, BoundaryTriangleSet *> (Point->Distance(*(*runner).second), (*runner).first) );
     148      DistanceList.insert( pair<double, BoundaryTriangleSet *> (Point->distance(*(*runner).second), (*runner).first) );
    149149
    150150  //for (DistanceTriangleMap::const_iterator runner = DistanceList.begin(); runner != DistanceList.end(); runner++)
  • molecuilder/src/unittests/vectorunittest.cpp

    rf70c2a r4eee8f  
    159159void VectorTest::EuclidianDistancesTest()
    160160{
    161   CPPUNIT_ASSERT_EQUAL( 1., zero.Distance(unit) );
    162   CPPUNIT_ASSERT_EQUAL( sqrt(2.), otherunit.Distance(unit) );
    163   CPPUNIT_ASSERT_EQUAL( sqrt(2.), zero.Distance(notunit) );
    164   CPPUNIT_ASSERT_EQUAL( 1., otherunit.Distance(notunit) );
    165   CPPUNIT_ASSERT_EQUAL( sqrt(5.), two.Distance(notunit) );
     161  CPPUNIT_ASSERT_EQUAL( 1., zero.distance(unit) );
     162  CPPUNIT_ASSERT_EQUAL( sqrt(2.), otherunit.distance(unit) );
     163  CPPUNIT_ASSERT_EQUAL( sqrt(2.), zero.distance(notunit) );
     164  CPPUNIT_ASSERT_EQUAL( 1., otherunit.distance(notunit) );
     165  CPPUNIT_ASSERT_EQUAL( sqrt(5.), two.distance(notunit) );
    166166}
    167167
  • molecuilder/src/vector.cpp

    rf70c2a r4eee8f  
    7979 * \return \f$| x - y |\f$
    8080 */
    81 double Vector::Distance(const Vector &y) const
     81double Vector::distance(const Vector &y) const
    8282{
    8383  return (sqrt(DistanceSquared(y)));
    8484};
     85
     86Vector Vector::getClosestPoint(const Vector &point) const{
     87  // the closest point to a single point space is always the single point itself
     88  return *this;
     89}
    8590
    8691/** Calculates distance between this and another vector in a periodic cell.
     
    9196double Vector::PeriodicDistance(const Vector &y, const double * const cell_size) const
    9297{
    93   double res = Distance(y), tmp, matrix[NDIM*NDIM];
     98  double res = distance(y), tmp, matrix[NDIM*NDIM];
    9499    Vector Shiftedy, TranslationVector;
    95100    int N[NDIM];
     
    115120          Shiftedy = y + TranslationVector;
    116121          // get distance and compare with minimum so far
    117           tmp = Distance(Shiftedy);
     122          tmp = distance(Shiftedy);
    118123          if (tmp < res) res = tmp;
    119124        }
  • molecuilder/src/vector.hpp

    rf70c2a r4eee8f  
    1818
    1919#include "defs.hpp"
     20#include "Space.hpp"
    2021
    2122/********************************************** declarations *******************************/
     
    2425 * basically, just a x[3] but with helpful functions
    2526 */
    26 class Vector {
     27class Vector : public Space{
    2728protected:
    2829  // this struct is used to indicate calls to the Baseconstructor from inside vectors.
     
    7980
    8081  // Methods that are derived directly from other methods
    81   double Distance(const Vector &y) const;
    8282  double Norm() const;
    8383  double NormSquared() const;
     
    9393  Vector const operator+(const Vector& b) const;
    9494  Vector const operator-(const Vector& b) const;
     95
     96  // Methods inherited from Space
     97  virtual double distance(const Vector &point) const;
     98  virtual Vector getClosestPoint(const Vector &point) const;
    9599
    96100protected:
Note: See TracChangeset for help on using the changeset viewer.