Ignore:
Timestamp:
Apr 27, 2010, 2:25:42 PM (15 years ago)
Author:
Frederik Heber <heber@…>
Children:
90c4460
Parents:
1561e2 (diff), 2bc713 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'Analysis_PairCorrelation' into StructureRefactoring

Conflicts:

molecuilder/src/Makefile.am
molecuilder/src/World.cpp
molecuilder/src/World.hpp
molecuilder/src/boundary.cpp
molecuilder/src/builder.cpp
molecuilder/src/log.cpp
molecuilder/src/moleculelist.cpp
molecuilder/src/periodentafel.cpp
molecuilder/src/tesselation.cpp
molecuilder/src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
molecuilder/src/unittests/Makefile.am
molecuilder/src/unittests/bondgraphunittest.cpp
molecuilder/src/unittests/gslvectorunittest.cpp
molecuilder/src/unittests/logunittest.cpp
molecuilder/src/unittests/tesselation_boundarytriangleunittest.hpp
molecuilder/src/vector.cpp
molecuilder/tests/Tesselations/defs.in

Conflicts have been many and too numerous to listen here, just the few general cases

  • new molecule() replaced by World::getInstance().createMolecule()
  • new atom() replaced by World::getInstance().createAtom() where appropriate.
  • Some DoLog()s added interfered with changes to the message produced by Log() << Verbose(.) << ...
  • DoLog() has been erroneously added to TestRunner.cpp as well, there cout is appropriate
  • ...

Additionally, there was a bug in atom::clone(), sort was set to atom::nr of the atom to clone not of the clone itself. This caused a failure of the fragmentation.

This merge has been fully checked from a clean build directory with subsequent configure,make all install and make check.
It configures, compiles and runs all test cases and the test suite without errors.

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/vector.cpp

    r1561e2 r075729  
    1515#include "vector.hpp"
    1616#include "verbose.hpp"
     17#include "World.hpp"
    1718
    1819#include <gsl/gsl_linalg.h>
     
    2627 */
    2728Vector::Vector() { x[0] = x[1] = x[2] = 0.; };
     29
     30/** Constructor of class vector.
     31 */
     32Vector::Vector(const Vector * const a)
     33{
     34  x[0] = a->x[0];
     35  x[1] = a->x[1];
     36  x[2] = a->x[2];
     37};
     38
     39/** Constructor of class vector.
     40 */
     41Vector::Vector(const Vector &a)
     42{
     43  x[0] = a.x[0];
     44  x[1] = a.x[1];
     45  x[2] = a.x[2];
     46};
    2847
    2948/** Constructor of class vector.
     
    234253  Direction.SubtractVector(Origin);
    235254  Direction.Normalize();
    236   Log() << Verbose(1) << "INFO: Direction is " << Direction << "." << endl;
     255  DoLog(1) && (Log() << Verbose(1) << "INFO: Direction is " << Direction << "." << endl);
    237256  //Log() << Verbose(1) << "INFO: PlaneNormal is " << *PlaneNormal << " and PlaneOffset is " << *PlaneOffset << "." << endl;
    238257  factor = Direction.ScalarProduct(PlaneNormal);
    239258  if (fabs(factor) < MYEPSILON) { // Uniqueness: line parallel to plane?
    240     Log() << Verbose(1) << "BAD: Line is parallel to plane, no intersection." << endl;
     259    DoLog(1) && (Log() << Verbose(1) << "BAD: Line is parallel to plane, no intersection." << endl);
    241260    return false;
    242261  }
     
    245264  factor = helper.ScalarProduct(PlaneNormal)/factor;
    246265  if (fabs(factor) < MYEPSILON) { // Origin is in-plane
    247     Log() << Verbose(1) << "GOOD: Origin of line is in-plane." << endl;
     266    DoLog(1) && (Log() << Verbose(1) << "GOOD: Origin of line is in-plane." << endl);
    248267    CopyVector(Origin);
    249268    return true;
     
    252271  Direction.Scale(factor);
    253272  CopyVector(Origin);
    254   Log() << Verbose(1) << "INFO: Scaled direction is " << Direction << "." << endl;
     273  DoLog(1) && (Log() << Verbose(1) << "INFO: Scaled direction is " << Direction << "." << endl);
    255274  AddVector(&Direction);
    256275
     
    259278  helper.SubtractVector(PlaneOffset);
    260279  if (helper.ScalarProduct(PlaneNormal) < MYEPSILON) {
    261     Log() << Verbose(1) << "GOOD: Intersection is " << *this << "." << endl;
     280    DoLog(1) && (Log() << Verbose(1) << "GOOD: Intersection is " << *this << "." << endl);
    262281    return true;
    263282  } else {
    264     eLog() << Verbose(2) << "Intersection point " << *this << " is not on plane." << endl;
     283    DoeLog(2) && (eLog()<< Verbose(2) << "Intersection point " << *this << " is not on plane." << endl);
    265284    return false;
    266285  }
    267286};
    268287
    269 /** Calculates the minimum distance of this vector to the plane.
     288/** Calculates the minimum distance vector of this vector to the plane.
    270289 * \param *out output stream for debugging
    271290 * \param *PlaneNormal normal of plane
    272291 * \param *PlaneOffset offset of plane
    273  * \return distance to plane
    274  */
    275 double Vector::DistanceToPlane(const Vector * const PlaneNormal, const Vector * const PlaneOffset) const
     292 * \return distance vector onto to plane
     293 */
     294Vector Vector::GetDistanceVectorToPlane(const Vector * const PlaneNormal, const Vector * const PlaneOffset) const
    276295{
    277296  Vector temp;
     
    291310    sign = 0.;
    292311
    293   return (temp.Norm()*sign);
     312  temp.Normalize();
     313  temp.Scale(sign);
     314  return temp;
     315};
     316
     317/** Calculates the minimum distance of this vector to the plane.
     318 * \sa Vector::GetDistanceVectorToPlane()
     319 * \param *out output stream for debugging
     320 * \param *PlaneNormal normal of plane
     321 * \param *PlaneOffset offset of plane
     322 * \return distance to plane
     323 */
     324double Vector::DistanceToPlane(const Vector * const PlaneNormal, const Vector * const PlaneOffset) const
     325{
     326  return GetDistanceVectorToPlane(PlaneNormal,PlaneOffset).Norm();
    294327};
    295328
     
    319352 
    320353  //Log() << Verbose(1) << "Coefficent matrix is:" << endl;
     354  //ostream &output = Log() << Verbose(1);
    321355  //for (int i=0;i<4;i++) {
    322356  //  for (int j=0;j<4;j++)
    323   //    cout << "\t" << M->Get(i,j);
    324   //  cout << endl;
     357  //    output << "\t" << M->Get(i,j);
     358  //  output << endl;
    325359  //}
    326360  if (fabs(M->Determinant()) > MYEPSILON) {
    327     Log() << Verbose(1) << "Determinant of coefficient matrix is NOT zero." << endl;
     361    DoLog(1) && (Log() << Verbose(1) << "Determinant of coefficient matrix is NOT zero." << endl);
    328362    return false;
    329363  }
    330364  delete(M);
    331   Log() << Verbose(1) << "INFO: Line1a = " << *Line1a << ", Line1b = " << *Line1b << ", Line2a = " << *Line2a << ", Line2b = " << *Line2b << "." << endl;
     365  DoLog(1) && (Log() << Verbose(1) << "INFO: Line1a = " << *Line1a << ", Line1b = " << *Line1b << ", Line2a = " << *Line2a << ", Line2b = " << *Line2b << "." << endl);
    332366
    333367
     
    345379  d.CopyVector(Line2b);
    346380  d.SubtractVector(Line1b);
    347   Log() << Verbose(1) << "INFO: a = " << a << ", b = " << b << ", c = " << c << "." << endl;
     381  DoLog(1) && (Log() << Verbose(1) << "INFO: a = " << a << ", b = " << b << ", c = " << c << "." << endl);
    348382  if ((a.NormSquared() < MYEPSILON) || (b.NormSquared() < MYEPSILON)) {
    349383   Zero();
    350    Log() << Verbose(1) << "At least one of the lines is ill-defined, i.e. offset equals second vector." << endl;
     384   DoLog(1) && (Log() << Verbose(1) << "At least one of the lines is ill-defined, i.e. offset equals second vector." << endl);
    351385   return false;
    352386  }
     
    361395    if ((factor >= -MYEPSILON) && (factor - 1. < MYEPSILON)) {
    362396      CopyVector(Line2a);
    363       Log() << Verbose(1) << "Lines conincide." << endl;
     397      DoLog(1) && (Log() << Verbose(1) << "Lines conincide." << endl);
    364398      return true;
    365399    } else {
     
    369403      if ((factor >= -MYEPSILON) && (factor - 1. < MYEPSILON)) {
    370404        CopyVector(Line2b);
    371         Log() << Verbose(1) << "Lines conincide." << endl;
     405        DoLog(1) && (Log() << Verbose(1) << "Lines conincide." << endl);
    372406        return true;
    373407      }
    374408    }
    375     Log() << Verbose(1) << "Lines are parallel." << endl;
     409    DoLog(1) && (Log() << Verbose(1) << "Lines are parallel." << endl);
    376410    Zero();
    377411    return false;
     
    385419  temp2.CopyVector(&a);
    386420  temp2.VectorProduct(&b);
    387   Log() << Verbose(1) << "INFO: temp1 = " << temp1 << ", temp2 = " << temp2 << "." << endl;
     421  DoLog(1) && (Log() << Verbose(1) << "INFO: temp1 = " << temp1 << ", temp2 = " << temp2 << "." << endl);
    388422  if (fabs(temp2.NormSquared()) > MYEPSILON)
    389423    s = temp1.ScalarProduct(&temp2)/temp2.NormSquared();
    390424  else
    391425    s = 0.;
    392   Log() << Verbose(1) << "Factor s is " << temp1.ScalarProduct(&temp2) << "/" << temp2.NormSquared() << " = " << s << "." << endl;
     426  DoLog(1) && (Log() << Verbose(1) << "Factor s is " << temp1.ScalarProduct(&temp2) << "/" << temp2.NormSquared() << " = " << s << "." << endl);
    393427
    394428  // construct intersection
     
    396430  Scale(s);
    397431  AddVector(Line1a);
    398   Log() << Verbose(1) << "Intersection is at " << *this << "." << endl;
     432  DoLog(1) && (Log() << Verbose(1) << "Intersection is at " << *this << "." << endl);
    399433
    400434  return true;
     
    665699void Vector::Output() const
    666700{
    667   Log() << Verbose(0) << "(";
     701  DoLog(0) && (Log() << Verbose(0) << "(");
    668702  for (int i=0;i<NDIM;i++) {
    669     Log() << Verbose(0) << x[i];
     703    DoLog(0) && (Log() << Verbose(0) << x[i]);
    670704    if (i != 2)
    671       Log() << Verbose(0) << ",";
    672   }
    673   Log() << Verbose(0) << ")";
     705      DoLog(0) && (Log() << Verbose(0) << ",");
     706  }
     707  DoLog(0) && (Log() << Verbose(0) << ")");
    674708};
    675709
     
    780814      x[i] = C.x[i];
    781815  } else {
    782     eLog() << Verbose(1) << "inverse of matrix does not exists: det A = " << detA << "." << endl;
     816    DoeLog(1) && (eLog()<< Verbose(1) << "inverse of matrix does not exists: det A = " << detA << "." << endl);
    783817  }
    784818};
     
    806840  projection = ScalarProduct(n)/n->ScalarProduct(n);    // remove constancy from n (keep as logical one)
    807841  // withdraw projected vector twice from original one
    808   Log() << Verbose(1) << "Vector: ";
     842  DoLog(1) && (Log() << Verbose(1) << "Vector: ");
    809843  Output();
    810   Log() << Verbose(0) << "\t";
     844  DoLog(0) && (Log() << Verbose(0) << "\t");
    811845  for (int i=NDIM;i--;)
    812846    x[i] -= 2.*projection*n->x[i];
    813   Log() << Verbose(0) << "Projected vector: ";
     847  DoLog(0) && (Log() << Verbose(0) << "Projected vector: ");
    814848  Output();
    815   Log() << Verbose(0) << endl;
     849  DoLog(0) && (Log() << Verbose(0) << endl);
    816850};
    817851
     
    832866  x2.SubtractVector(y2);
    833867  if ((fabs(x1.Norm()) < MYEPSILON) || (fabs(x2.Norm()) < MYEPSILON) || (fabs(x1.Angle(&x2)) < MYEPSILON)) {
    834     eLog() << Verbose(2) << "Given vectors are linear dependent." << endl;
     868    DoeLog(2) && (eLog()<< Verbose(2) << "Given vectors are linear dependent." << endl);
    835869    return false;
    836870  }
     
    866900  Zero();
    867901  if ((fabs(x1.Norm()) < MYEPSILON) || (fabs(x2.Norm()) < MYEPSILON) || (fabs(x1.Angle(&x2)) < MYEPSILON)) {
    868     eLog() << Verbose(2) << "Given vectors are linear dependent." << endl;
     902    DoeLog(2) && (eLog()<< Verbose(2) << "Given vectors are linear dependent." << endl);
    869903    return false;
    870904  }
     
    917951  double norm;
    918952
    919   Log() << Verbose(4);
     953  DoLog(4) && (Log() << Verbose(4));
    920954  GivenVector->Output();
    921   Log() << Verbose(0) << endl;
     955  DoLog(0) && (Log() << Verbose(0) << endl);
    922956  for (j=NDIM;j--;)
    923957    Components[j] = -1;
     
    926960    if (fabs(GivenVector->x[j]) > MYEPSILON)
    927961      Components[Last++] = j;
    928   Log() << Verbose(4) << Last << " Components != 0: (" << Components[0] << "," << Components[1] << "," << Components[2] << ")" << endl;
     962  DoLog(4) && (Log() << Verbose(4) << Last << " Components != 0: (" << Components[0] << "," << Components[1] << "," << Components[2] << ")" << endl);
    929963
    930964  switch(Last) {
     
    9761010
    9771011  for (j=0;j<num;j++) {
    978     Log() << Verbose(1) << j << "th atom's vector: ";
     1012    DoLog(1) && (Log() << Verbose(1) << j << "th atom's vector: ");
    9791013    (vectors[j])->Output();
    980     Log() << Verbose(0) << endl;
     1014    DoLog(0) && (Log() << Verbose(0) << endl);
    9811015  }
    9821016
     
    11041138    j += i+1;
    11051139    do {
    1106       Log() << Verbose(0) << coords[i] << "[0.." << cell_size[j] << "]: ";
     1140      DoLog(0) && (Log() << Verbose(0) << coords[i] << "[0.." << cell_size[j] << "]: ");
    11071141      cin >> x[i];
    11081142    } while (((x[i] < 0) || (x[i] >= cell_size[j])) && (check));
     
    11351169  B2 = cos(beta) * x2->Norm() * c;
    11361170  C = c * c;
    1137   Log() << Verbose(2) << "A " << A << "\tB " << B1 << "\tC " << C << endl;
     1171  DoLog(2) && (Log() << Verbose(2) << "A " << A << "\tB " << B1 << "\tC " << C << endl);
    11381172  int flag = 0;
    11391173  if (fabs(x1->x[0]) < MYEPSILON) { // check for zero components for the later flipping and back-flipping
     
    11741208  D2 = -y->x[0]/x1->x[0]*x1->x[2]+y->x[2];
    11751209  D3 = y->x[0]/x1->x[0]*A-B1;
    1176   Log() << Verbose(2) << "D1 " << D1 << "\tD2 " << D2 << "\tD3 " << D3 << "\n";
     1210  DoLog(2) && (Log() << Verbose(2) << "D1 " << D1 << "\tD2 " << D2 << "\tD3 " << D3 << "\n");
    11771211  if (fabs(D1) < MYEPSILON) {
    1178     Log() << Verbose(2) << "D1 == 0!\n";
     1212    DoLog(2) && (Log() << Verbose(2) << "D1 == 0!\n");
    11791213    if (fabs(D2) > MYEPSILON) {
    1180       Log() << Verbose(3) << "D2 != 0!\n";
     1214      DoLog(3) && (Log() << Verbose(3) << "D2 != 0!\n");
    11811215      x[2] = -D3/D2;
    11821216      E1 = A/x1->x[0] + x1->x[2]/x1->x[0]*D3/D2;
    11831217      E2 = -x1->x[1]/x1->x[0];
    1184       Log() << Verbose(3) << "E1 " << E1 << "\tE2 " << E2 << "\n";
     1218      DoLog(3) && (Log() << Verbose(3) << "E1 " << E1 << "\tE2 " << E2 << "\n");
    11851219      F1 = E1*E1 + 1.;
    11861220      F2 = -E1*E2;
    11871221      F3 = E1*E1 + D3*D3/(D2*D2) - C;
    1188       Log() << Verbose(3) << "F1 " << F1 << "\tF2 " << F2 << "\tF3 " << F3 << "\n";
     1222      DoLog(3) && (Log() << Verbose(3) << "F1 " << F1 << "\tF2 " << F2 << "\tF3 " << F3 << "\n");
    11891223      if (fabs(F1) < MYEPSILON) {
    1190         Log() << Verbose(4) << "F1 == 0!\n";
    1191         Log() << Verbose(4) << "Gleichungssystem linear\n";
     1224        DoLog(4) && (Log() << Verbose(4) << "F1 == 0!\n");
     1225        DoLog(4) && (Log() << Verbose(4) << "Gleichungssystem linear\n");
    11921226        x[1] = F3/(2.*F2);
    11931227      } else {
    11941228        p = F2/F1;
    11951229        q = p*p - F3/F1;
    1196         Log() << Verbose(4) << "p " << p << "\tq " << q << endl;
     1230        DoLog(4) && (Log() << Verbose(4) << "p " << p << "\tq " << q << endl);
    11971231        if (q < 0) {
    1198           Log() << Verbose(4) << "q < 0" << endl;
     1232          DoLog(4) && (Log() << Verbose(4) << "q < 0" << endl);
    11991233          return false;
    12001234        }
     
    12031237      x[0] =  A/x1->x[0] - x1->x[1]/x1->x[0]*x[1] + x1->x[2]/x1->x[0]*x[2];
    12041238    } else {
    1205       Log() << Verbose(2) << "Gleichungssystem unterbestimmt\n";
     1239      DoLog(2) && (Log() << Verbose(2) << "Gleichungssystem unterbestimmt\n");
    12061240      return false;
    12071241    }
     
    12091243    E1 = A/x1->x[0]+x1->x[1]/x1->x[0]*D3/D1;
    12101244    E2 = x1->x[1]/x1->x[0]*D2/D1 - x1->x[2];
    1211     Log() << Verbose(2) << "E1 " << E1 << "\tE2 " << E2 << "\n";
     1245    DoLog(2) && (Log() << Verbose(2) << "E1 " << E1 << "\tE2 " << E2 << "\n");
    12121246    F1 = E2*E2 + D2*D2/(D1*D1) + 1.;
    12131247    F2 = -(E1*E2 + D2*D3/(D1*D1));
    12141248    F3 = E1*E1 + D3*D3/(D1*D1) - C;
    1215     Log() << Verbose(2) << "F1 " << F1 << "\tF2 " << F2 << "\tF3 " << F3 << "\n";
     1249    DoLog(2) && (Log() << Verbose(2) << "F1 " << F1 << "\tF2 " << F2 << "\tF3 " << F3 << "\n");
    12161250    if (fabs(F1) < MYEPSILON) {
    1217       Log() << Verbose(3) << "F1 == 0!\n";
    1218       Log() << Verbose(3) << "Gleichungssystem linear\n";
     1251      DoLog(3) && (Log() << Verbose(3) << "F1 == 0!\n");
     1252      DoLog(3) && (Log() << Verbose(3) << "Gleichungssystem linear\n");
    12191253      x[2] = F3/(2.*F2);
    12201254    } else {
    12211255      p = F2/F1;
    12221256      q = p*p - F3/F1;
    1223       Log() << Verbose(3) << "p " << p << "\tq " << q << endl;
     1257      DoLog(3) && (Log() << Verbose(3) << "p " << p << "\tq " << q << endl);
    12241258      if (q < 0) {
    1225         Log() << Verbose(3) << "q < 0" << endl;
     1259        DoLog(3) && (Log() << Verbose(3) << "q < 0" << endl);
    12261260        return false;
    12271261      }
     
    12611295    for (j=2;j>=0;j--) {
    12621296      k = (i & pot(2,j)) << j;
    1263       Log() << Verbose(2) << "k " << k << "\tpot(2,j) " << pot(2,j) << endl;
     1297      DoLog(2) && (Log() << Verbose(2) << "k " << k << "\tpot(2,j) " << pot(2,j) << endl);
    12641298      sign[j] = (k == 0) ? 1. : -1.;
    12651299    }
    1266     Log() << Verbose(2) << i << ": sign matrix is " << sign[0] << "\t" << sign[1] << "\t" << sign[2] << "\n";
     1300    DoLog(2) && (Log() << Verbose(2) << i << ": sign matrix is " << sign[0] << "\t" << sign[1] << "\t" << sign[2] << "\n");
    12671301    // apply sign matrix
    12681302    for (j=NDIM;j--;)
     
    12701304    // calculate angle and check
    12711305    ang = x2->Angle (this);
    1272     Log() << Verbose(1) << i << "th angle " << ang << "\tbeta " << cos(beta) << " :\t";
     1306    DoLog(1) && (Log() << Verbose(1) << i << "th angle " << ang << "\tbeta " << cos(beta) << " :\t");
    12731307    if (fabs(ang - cos(beta)) < MYEPSILON) {
    12741308      break;
Note: See TracChangeset for help on using the changeset viewer.