Ignore:
Timestamp:
Oct 27, 2009, 4:11:22 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
069034
Parents:
55a71b
Message:

Huge refactoring to make const what is const (ticket #38), continued.

  • too many changes because of too many cross-references to be able to list them up here.
  • NOTE that "make check" runs fine and did catch several error.
  • note that we had to use const_iterator several times when the map, ... was declared const.
  • at times we changed an allocated LinkedCell LCList(...) into

const LinkedCell *LCList;
LCList = new LinkedCell(...);

  • also mutable (see ticket #5) was used, e.g. for molecule::InternalPointer (PointCloud changes are allowed, because they are just accounting).

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

Location:
molecuilder/src/unittests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/unittests/ActOnAllUnitTest.cpp

    r55a71b ra9b2a0a  
    6262
    6363  // scaling by value
    64   VL.ActOnAll( (void (Vector::*)(double)) &Vector::Scale, 2. );
     64  VL.ActOnAll( (void (Vector::*)(const double)) &Vector::Scale, 2. );
    6565  CPPUNIT_ASSERT_EQUAL( VL == Ref , false );
    6666
    67   VL.ActOnAll( (void (Vector::*)(double)) &Vector::Scale, 0.5 );
     67  VL.ActOnAll( (void (Vector::*)(const double)) &Vector::Scale, 0.5 );
    6868  CPPUNIT_ASSERT_EQUAL( VL == Ref , true );
    6969
    7070  // scaling by ref
    71   VL.ActOnAll( (void (Vector::*)(double *)) &Vector::Scale, &factor );
     71  VL.ActOnAll( (void (Vector::*)(const double * const)) &Vector::Scale, (const double * const)&factor );
    7272  CPPUNIT_ASSERT_EQUAL( VL == Ref , false );
    7373
    74   VL.ActOnAll( (void (Vector::*)(double *)) &Vector::Scale, &inverse );
     74  VL.ActOnAll( (void (Vector::*)(const double * const)) &Vector::Scale, (const double * const)&inverse );
    7575  CPPUNIT_ASSERT_EQUAL( VL == Ref , true );
    7676
     
    8282    inverses[i] = 1./factors[i];
    8383  }
    84   VL.ActOnAll( (void (Vector::*)(double **)) &Vector::Scale, &factors );
     84  VL.ActOnAll( (void (Vector::*)(const double ** const)) &Vector::Scale, (const double ** const)&factors );
    8585  CPPUNIT_ASSERT_EQUAL( VL == Ref , false );
    8686
    87   VL.ActOnAll( (void (Vector::*)(double **)) &Vector::Scale, &inverses );
     87  VL.ActOnAll( (void (Vector::*)(const double ** const)) &Vector::Scale, (const double ** const)&inverses );
    8888  CPPUNIT_ASSERT_EQUAL( VL == Ref , true );
    8989};
  • molecuilder/src/unittests/AnalysisCorrelationToPointUnitTest.cpp

    r55a71b ra9b2a0a  
    7777
    7878  // init maps
    79   pointmap = CorrelationToPoint( (ofstream *)&cout, TestMolecule, hydrogen, point );
     79  pointmap = CorrelationToPoint( (ofstream *)&cout, (const molecule * const)TestMolecule, (const element * const)hydrogen, (const Vector *)point );
    8080  binmap = NULL;
    8181
  • molecuilder/src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp

    r55a71b ra9b2a0a  
    8181  // init tesselation and linked cell
    8282  Surface = new Tesselation;
    83   TestMolecule->TesselStruct = Surface;
    84   FindNonConvexBorder((ofstream *)&cerr, TestMolecule, LC, 2.5, NULL);
     83  FindNonConvexBorder((ofstream *)&cerr, TestMolecule, Surface, (const LinkedCell *&)LC, 2.5, NULL);
    8584  LC = new LinkedCell(TestMolecule, 5.);
    8685  CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() );
     
    123122  // remove
    124123  delete(TestMolecule);
    125   // note that Surface and all the atoms are cleaned by TestMolecule
     124  delete(Surface);
     125  // note that all the atoms are cleaned by TestMolecule
    126126  delete(LC);
    127127  delete(tafel);
Note: See TracChangeset for help on using the changeset viewer.