Changeset 54f3d1 for src/LinkedCell/unittests
- Timestamp:
- Jan 2, 2012, 1:34:42 PM (13 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 455043
- Parents:
- 8c31865
- git-author:
- Frederik Heber <heber@…> (12/21/11 10:35:41)
- git-committer:
- Frederik Heber <heber@…> (01/02/12 13:34:42)
- Location:
- src/LinkedCell/unittests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/LinkedCell/unittests/LinkedCell_ModelUnitTest.cpp
r8c31865 r54f3d1 32 32 #include "LinkedCell/LinkedCell.hpp" 33 33 #include "LinkedCell/LinkedCell_Model.hpp" 34 #include "LinkedCell/LinkedCell_Model_changeModel.hpp" 34 35 #include "LinkedCell/LinkedCell_Model_LinkedCellArrayCache.hpp" 36 #include "LinkedCell/LinkedCell_Model_Update.hpp" 35 37 #include "LinkedCell/PointCloudAdaptor.hpp" 36 38 #include "LinkedCell/unittests/defs.hpp" … … 141 143 LC->insertPointCloud(cloud); 142 144 145 // assure that we are updated before accessing internals 146 CPPUNIT_ASSERT_EQUAL( true, *(LC->N->UpToDate) ); 143 147 // test structure 144 148 CPPUNIT_ASSERT_EQUAL(((size_t)floor(NUMBERCELLS)), LC->CellLookup.size()); … … 236 240 { 237 241 LC->addNode(Walker); 242 // assure that we are updated before accessing internals 243 CPPUNIT_ASSERT_EQUAL( true, *(LC->N->UpToDate) ); 238 244 CPPUNIT_ASSERT_EQUAL( NodeList.size()+1, LC->CellLookup.size()); 239 245 LinkedCell::tripleIndex index1 = LC->getIndexToVector(Walker->getPosition()); … … 251 257 // we have to call moveNode ourselves, as we have just added TesselPoints, not via World 252 258 LC->moveNode(Walker); 259 // assure that we are updated before accessing internals 260 CPPUNIT_ASSERT_EQUAL( true, *(LC->N->UpToDate) ); 253 261 const LinkedCell::tripleIndex &newindex2 = LC->CellLookup[Walker]->getIndices(); 254 262 CPPUNIT_ASSERT( index2 != newindex2); … … 258 266 { 259 267 LC->deleteNode(Walker); 268 // assure that we are updated before accessing internals 269 CPPUNIT_ASSERT_EQUAL( true, *(LC->N->UpToDate) ); 260 270 CPPUNIT_ASSERT_EQUAL( NodeList.size(), LC->CellLookup.size()); 261 271 } … … 263 273 delete Walker; 264 274 } 275 276 /** UnitTest whether lazy updates are working. 277 */ 278 void LinkedCell_ModelTest::lazyUpdatesTest() 279 { 280 // create point 281 TesselPoint * Walker = new TesselPoint(); 282 Walker->setName(std::string("Walker9")); 283 Walker->setPosition(Vector(9.8,7.6,5.4)); 284 TesselPoint * Walker2 = new TesselPoint(); 285 Walker2->setName(std::string("Walker10")); 286 Walker2->setPosition(Vector(9.8,7.6,5.4)); 287 PointCloudAdaptor< PointSet > cloud(&NodeList, std::string("NodeList")); 288 LC->insertPointCloud(cloud); 289 290 // initial read operation 291 { 292 CPPUNIT_ASSERT( !NodeList.empty() ); 293 LinkedCell::tripleIndex index = LC->getIndexToVector((*NodeList.begin())->getPosition()); 294 const size_t size = LC->N->getN()(index)->size(); // this will cause the update 295 CPPUNIT_ASSERT( size >= (size_t)1 ); 296 } 297 298 // do some write ops 299 LC->addNode(Walker); 300 LC->addNode(Walker2); 301 CPPUNIT_ASSERT( LC->Changes->queue.find(Walker) != LC->Changes->queue.end() ); 302 LinkedCell::LinkedCell_Model::Update *update = LC->Changes->queue[Walker]; 303 Walker->setPosition(Vector(0.,0.,0.)); 304 LC->moveNode(Walker); 305 306 // check that they all reside in cache and nothing is changed so far 307 CPPUNIT_ASSERT( LC->Changes->queue.size() > (size_t)0 ); 308 309 // check that add priority is prefered over move 310 CPPUNIT_ASSERT( LC->Changes->queue[Walker] == update ); 311 312 // perform read op 313 { 314 LinkedCell::tripleIndex index = LC->getIndexToVector(Walker->getPosition()); 315 CPPUNIT_ASSERT( LC->N->getN()(index)->size() >= (size_t)1 ); 316 } 317 318 // check that cache is emptied 319 CPPUNIT_ASSERT( LC->Changes->queue.size() == (size_t)0 ); 320 321 delete Walker; 322 delete Walker2; 323 } -
src/LinkedCell/unittests/LinkedCell_ModelUnitTest.hpp
r8c31865 r54f3d1 35 35 CPPUNIT_TEST ( getIndexToVectorTest ); 36 36 CPPUNIT_TEST ( nodeTest ); 37 CPPUNIT_TEST ( lazyUpdatesTest ); 37 38 CPPUNIT_TEST_SUITE_END(); 38 39 … … 49 50 void getIndexToVectorTest(); 50 51 void nodeTest(); 52 void lazyUpdatesTest(); 51 53 52 54 private:
Note:
See TracChangeset
for help on using the changeset viewer.