Changeset 8c31865 for src/LinkedCell
- 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:
- 54f3d1
- Parents:
- e776dc
- git-author:
- Frederik Heber <heber@…> (12/20/11 14:28:33)
- git-committer:
- Frederik Heber <heber@…> (01/02/12 13:34:42)
- Location:
- src/LinkedCell
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/LinkedCell/LinkedCell_Model.cpp
re776dc r8c31865 41 41 #include "LinkedCell/LinkedCell.hpp" 42 42 #include "LinkedCell/LinkedCell_Model_changeModel.hpp" 43 #include "LinkedCell/LinkedCell_Model_LinkedCellArrayCache.hpp" 43 44 #include "World.hpp" 44 45 #include "LinkedCell_Model_inline.hpp"46 45 47 46 // initialize static entities … … 58 57 Changes( new changeModel(radius) ), 59 58 internal_Sizes(NULL), 59 N(new LinkedCellArrayCache(Changes, boost::bind(&changeModel::performUpdates, Changes), std::string("N_cached"))), 60 60 domain(_domain) 61 61 { … … 83 83 Changes( new changeModel(radius) ), 84 84 internal_Sizes(NULL), 85 N(new LinkedCellArrayCache(Changes, boost::bind(&changeModel::performUpdates, Changes), std::string("N_cached"))), 85 86 domain(_domain) 86 87 { … … 146 147 for (int i=0;i<NDIM;i++) 147 148 index[i] = static_cast<LinkedCellArray::index>(Dimensions.at(i,i)); 148 N .resize(index);149 N->setN().resize(index); 149 150 ASSERT(getSize(0)*getSize(1)*getSize(2) < MAX_LINKEDCELLNODES, 150 151 "LinkedCell_Model::AllocateCells() - Number linked of linked cell nodes exceeded hard-coded limit, use greater edge length!"); … … 155 156 for(index[2] = 0; index[2] != static_cast<LinkedCellArray::index>(Dimensions.at(2,2)); ++index[2]) { 156 157 LOG(5, "INFO: Creating cell at " << index[0] << " " << index[1] << " " << index[2] << "."); 157 N (index) = new LinkedCell(index);158 N->setN()(index) = new LinkedCell(index); 158 159 } 159 160 } … … 167 168 { 168 169 // free all LinkedCell instances 169 for(iterator3 iter3 = N .begin(); iter3 != N.end(); ++iter3) {170 for(iterator3 iter3 = N->setN().begin(); iter3 != N->setN().end(); ++iter3) { 170 171 for(iterator2 iter2 = (*iter3).begin(); iter2 != (*iter3).end(); ++iter2) { 171 172 for(iterator1 iter1 = (*iter2).begin(); iter1 != (*iter2).end(); ++iter1) { … … 175 176 } 176 177 // set dimensions to zero 177 N .resize(boost::extents[0][0][0]);178 N->setN().resize(boost::extents[0][0][0]); 178 179 } 179 180 … … 314 315 LOG(2, "INFO: " << *Walker << " goes into cell " << index[0] << ", " << index[1] << ", " << index[2] << "."); 315 316 LOG(2, "INFO: Cell's indices are " 316 << N(index)->getIndex(0) << " "317 << N(index)->getIndex(1) << " "318 << N(index)->getIndex(2) << ".");317 << (N->getN())(index)->getIndex(0) << " " 318 << (N->getN())(index)->getIndex(1) << " " 319 << (N->getN())(index)->getIndex(2) << "."); 319 320 // add to cell 320 N(index)->addPoint(Walker);321 (N->setN())(index)->addPoint(Walker); 321 322 // add to index with check for presence 322 std::pair<MapPointToCell::iterator, bool> inserter = CellLookup.insert( std::make_pair(Walker, N(index)) );323 std::pair<MapPointToCell::iterator, bool> inserter = CellLookup.insert( std::make_pair(Walker, (N->setN())(index)) ); 323 324 ASSERT( inserter.second, 324 325 "LinkedCell_Model::addNode() - Walker " … … 341 342 "LinkedCell_Model::deleteNode() - Walker not present in cell stored under CellLookup."); 342 343 if (iter != CellLookup.end()) { 344 // remove from lookup 343 345 CellLookup.erase(iter); 346 // remove from cell 344 347 iter->second->deletePoint(Walker); 345 348 } … … 361 364 iter->second->deletePoint(Walker); 362 365 // add to new cell 363 N (index)->addPoint(Walker);366 N->setN()(index)->addPoint(Walker); 364 367 // update lookup 365 iter->second = N (index);368 iter->second = N->setN()(index); 366 369 } 367 370 } … … 482 485 } 483 486 487 /** Returns a reference to the cell indicated by LinkedCell_Model::internal_index. 488 * 489 * \return LinkedCell ref to current cell 490 */ 491 const LinkedCell::LinkedCell& LinkedCell::LinkedCell_Model::getCell(const tripleIndex &index) const 492 { 493 return *(N->getN()(index)); 494 } 495 496 497 /** Returns size of array for given \a dim. 498 * 499 * @param dim desired dimension 500 * @return size of array along dimension 501 */ 502 LinkedCell::LinkedCellArray::index LinkedCell::LinkedCell_Model::getSize(const size_t dim) const 503 { 504 ASSERT((dim >= 0) && (dim < NDIM), 505 "LinkedCell_Model::getSize() - dimension " 506 +toString(dim)+" is out of bounds."); 507 return N->getN().shape()[dim]; 508 } 509 484 510 /** Callback function for Observer mechanism. 485 511 * -
src/LinkedCell/LinkedCell_Model.hpp
re776dc r8c31865 118 118 boost::array<double, 3> EdgeLength; 119 119 120 //!> Linked cell array 121 LinkedCellArray N; 120 // forward declaration for LinkedCellArrayContainer, containing cached LinkedCellArray 121 class LinkedCellArrayCache; 122 //!> Linked cell array cache 123 LinkedCellArrayCache *N; 122 124 123 125 //!> matrix to divide Box with … … 133 135 } 134 136 135 // inlined functions136 #include "LinkedCell_Model_inline.hpp"137 138 137 #endif /* LINKEDCELL_MODEL_HPP_ */ -
src/LinkedCell/LinkedCell_Model_changeModel.cpp
re776dc r8c31865 21 21 22 22 #include "LinkedCell_Model_changeModel.hpp" 23 24 #include "CodePatterns/toString.hpp" 23 25 24 26 /** Constructor of LinkedCell_Model::changeModel. -
src/LinkedCell/LinkedCell_Model_changeModel.hpp
re776dc r8c31865 41 41 boost::function<void (const TesselPoint *)> _updateMethod 42 42 ); 43 protected: 43 private: 44 //!> grant LinkedCell_Model access to bind LinkedCellArrayCache to update funcation 45 friend class LinkedCell_Model; 44 46 void performUpdates(); 45 47 private: -
src/LinkedCell/LinkedCell_Model_inline.hpp
re776dc r8c31865 14 14 #endif 15 15 16 #include "LinkedCell_Model_LinkedCellArrayCache.hpp" 17 16 18 // have all includes only needed here extra 17 19 #ifdef HAVE_INLINE … … 28 30 const LinkedCell::LinkedCell& LinkedCell::LinkedCell_Model::getCell(const tripleIndex &index) const 29 31 { 30 return * N(index);32 return *(N->getN()(index)); 31 33 } 32 34 … … 45 47 "LinkedCell_Model::getSize() - dimension " 46 48 +toString(dim)+" is out of bounds."); 47 return N .shape()[dim];49 return N->getN().shape()[dim]; 48 50 } 49 51 -
src/LinkedCell/Makefile.am
re776dc r8c31865 8 8 LinkedCell/LinkedCell_Model.cpp \ 9 9 LinkedCell/LinkedCell_Model_changeModel.cpp \ 10 LinkedCell/LinkedCell_Model_LinkedCellArrayCache.cpp \ 10 11 LinkedCell/LinkedCell_Model_Update.cpp \ 11 12 LinkedCell/LinkedCell_View.cpp \ … … 19 20 LinkedCell/LinkedCell_Model.hpp \ 20 21 LinkedCell/LinkedCell_Model_changeModel.hpp \ 21 LinkedCell/LinkedCell_Model_ inline.hpp \22 LinkedCell/LinkedCell_Model_LinkedCellArrayCache.hpp \ 22 23 LinkedCell/LinkedCell_Model_Update.hpp \ 23 24 LinkedCell/LinkedCell_View.hpp \ -
src/LinkedCell/unittests/LinkedCell_ModelUnitTest.cpp
re776dc r8c31865 32 32 #include "LinkedCell/LinkedCell.hpp" 33 33 #include "LinkedCell/LinkedCell_Model.hpp" 34 #include "LinkedCell/LinkedCell_Model_LinkedCellArrayCache.hpp" 34 35 #include "LinkedCell/PointCloudAdaptor.hpp" 35 36 #include "LinkedCell/unittests/defs.hpp" … … 99 100 LinkedCell::tripleIndex index; 100 101 index[0] = index[1] = index[2] = 0; 101 CPPUNIT_ASSERT(LC->N (index) != NULL);102 CPPUNIT_ASSERT(LC->N->getN()(index) != NULL); 102 103 103 104 // check that very last cell is allocated 104 105 index[0] = index[1] = index[2] = (size_t)floor(NUMBERCELLS)-1; 105 CPPUNIT_ASSERT(LC->N (index) != NULL);106 CPPUNIT_ASSERT(LC->N->getN()(index) != NULL); 106 107 107 108 } … … 146 147 index[0] = index[1] = index[2] = i; 147 148 // assert that in the destined cell we have one Walker 148 CPPUNIT_ASSERT_EQUAL((size_t)1, LC->N (index)->size());149 CPPUNIT_ASSERT_EQUAL((size_t)1, LC->N->getN()(index)->size()); 149 150 } 150 151 index[0] = 9; 151 152 index[1] = index[2] = 0; 152 153 // assert that in the destined cell we have one Walker 153 CPPUNIT_ASSERT_EQUAL((size_t)0, LC->N (index)->size());154 155 } 156 157 /** UnitTest for insertPointCloud()154 CPPUNIT_ASSERT_EQUAL((size_t)0, LC->N->getN()(index)->size()); 155 156 } 157 158 /** UnitTest for setPartition() 158 159 */ 159 160 void LinkedCell_ModelTest::setPartitionTest() … … 173 174 } 174 175 175 /** UnitTest for insertPointCloud()176 /** UnitTest for getStep() 176 177 */ 177 178 void LinkedCell_ModelTest::getStepTest() … … 197 198 } 198 199 199 /** UnitTest for insertPointCloud()200 /** UnitTest for getIndexToVector() 200 201 */ 201 202 void LinkedCell_ModelTest::getIndexToVectorTest() … … 221 222 } 222 223 223 /** UnitTest for insertPointCloud()224 /** UnitTest for updating nodes 224 225 */ 225 226 void LinkedCell_ModelTest::nodeTest()
Note:
See TracChangeset
for help on using the changeset viewer.