Changeset c80643 for src/LinkedCell
- Timestamp:
- Jan 2, 2012, 1:34:29 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:
- 53d894
- Parents:
- 4459fc
- git-author:
- Frederik Heber <heber@…> (12/19/11 21:49:53)
- git-committer:
- Frederik Heber <heber@…> (01/02/12 13:34:29)
- Location:
- src/LinkedCell
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/LinkedCell/LinkedCell_Controller.cpp
r4459fc rc80643 26 26 #include "LinkedCell_Model.hpp" 27 27 #include "LinkedCell_View.hpp" 28 #include "IPointCloud.hpp" 28 29 29 30 … … 153 154 * 154 155 * @param distance edge length of the requested linked cell structure 156 * @param set of initial points to insert when new model is created (not always), should be World's 155 157 * @return LinkedCell_View wrapping the best LinkedCell_Model 156 158 */ 157 LinkedCell_View LinkedCell_Controller::getView(const double distance )159 LinkedCell_View LinkedCell_Controller::getView(const double distance, IPointCloud &set) 158 160 { 159 161 /// Look for best instance. … … 163 165 if (LCModel_best == NULL) { 164 166 LinkedCell_Model *LCModel_new = new LinkedCell_Model(distance, domain); 167 LCModel_new->insertPointCloud(set); 165 168 insertNewModel(distance, LCModel_new); 166 169 LinkedCell_View view(const_cast<const LinkedCell_Model &>(*LCModel_new)); -
src/LinkedCell/LinkedCell_Controller.hpp
r4459fc rc80643 20 20 21 21 class LinkedCell_ControllerTest; 22 class IPointCloud; 22 23 23 24 namespace LinkedCell { … … 47 48 ~LinkedCell_Controller(); 48 49 49 LinkedCell_View getView(const double distance );50 LinkedCell_View getView(const double distance, IPointCloud &set); 50 51 51 52 private: -
src/LinkedCell/LinkedCell_Model.cpp
r4459fc rc80643 139 139 N.resize(index); 140 140 ASSERT(getSize(0)*getSize(1)*getSize(2) < MAX_LINKEDCELLNODES, 141 "LinkedCell_Model::AllocateCells() - Number linked of linked cell nodes exce ded hard-coded limit, use greater edge length!");141 "LinkedCell_Model::AllocateCells() - Number linked of linked cell nodes exceeded hard-coded limit, use greater edge length!"); 142 142 143 143 // allocate LinkedCell instances -
src/LinkedCell/LinkedCell_Model.hpp
r4459fc rc80643 67 67 void setPartition(double distance); 68 68 69 void insertPointCloud(IPointCloud &set); 70 69 71 //!> static indices to get nearest neighbors as default argument 70 72 static tripleIndex NearestNeighbors; … … 78 80 void AllocateCells(); 79 81 void Reset(); 80 void insertPointCloud(IPointCloud &set);81 82 82 83 void startListening(); -
src/LinkedCell/unittests/LinkedCell_ControllerUnitTest.cpp
r4459fc rc80643 24 24 #include <cppunit/ui/text/TestRunner.h> 25 25 26 #include "Atom/atom.hpp" 26 27 #include "Box.hpp" 27 28 #include "CodePatterns/Assert.hpp" … … 30 31 #include "LinkedCell/LinkedCell_View.hpp" 31 32 #include "LinkedCell/unittests/defs.hpp" 33 #include "LinkedCell/PointCloudAdaptor.hpp" 32 34 33 35 #include "LinkedCell_ControllerUnitTest.hpp" … … 57 59 58 60 controller = new LinkedCell::LinkedCell_Controller(*domain); 61 62 // create empty set 63 emptyset = new PointCloudAdaptor< std::vector<atom *> >(&emptyvector, std::string("emptyset")); 59 64 } 60 65 … … 64 69 delete controller; 65 70 delete domain; 71 delete emptyset; 66 72 } 67 73 … … 113 119 /// obtain a view 114 120 CPPUNIT_ASSERT_EQUAL( (size_t)0, controller->ModelsMap.size() ); 115 LinkedCell::LinkedCell_View view = controller->getView(2. );121 LinkedCell::LinkedCell_View view = controller->getView(2., *emptyset); 116 122 CPPUNIT_ASSERT_EQUAL( (size_t)1, controller->ModelsMap.size() ); 117 123 118 124 { 119 125 /// get same view again and check that now new instance appears 120 LinkedCell::LinkedCell_View view_again = controller->getView(2. );126 LinkedCell::LinkedCell_View view_again = controller->getView(2., *emptyset); 121 127 CPPUNIT_ASSERT_EQUAL( (size_t)1, controller->ModelsMap.size() ); 122 128 } … … 129 135 /// obtain a view 130 136 CPPUNIT_ASSERT_EQUAL( (size_t)0, controller->ModelsMap.size() ); 131 LinkedCell::LinkedCell_View view = controller->getView(2. );137 LinkedCell::LinkedCell_View view = controller->getView(2., *emptyset); 132 138 CPPUNIT_ASSERT_EQUAL( (size_t)1, controller->ModelsMap.size() ); 133 139 134 140 { 135 141 /// pick another view that is not close enough 136 LinkedCell::LinkedCell_View view_other = controller->getView(5. );142 LinkedCell::LinkedCell_View view_other = controller->getView(5., *emptyset); 137 143 CPPUNIT_ASSERT_EQUAL( (size_t)2, controller->ModelsMap.size() ); 138 144 } … … 146 152 const double edgelength = 2.; 147 153 CPPUNIT_ASSERT_EQUAL( (size_t)0, controller->ModelsMap.size() ); 148 LinkedCell::LinkedCell_View view = controller->getView(edgelength );154 LinkedCell::LinkedCell_View view = controller->getView(edgelength, *emptyset); 149 155 CPPUNIT_ASSERT_EQUAL( (size_t)1, controller->ModelsMap.size() ); 150 156 … … 153 159 { 154 160 /// ... at half lower interval half 155 LinkedCell::LinkedCell_View view_lowerhalf = controller->getView((edgelength + interval.first)/2. );161 LinkedCell::LinkedCell_View view_lowerhalf = controller->getView((edgelength + interval.first)/2., *emptyset); 156 162 CPPUNIT_ASSERT_EQUAL( (size_t)1, controller->ModelsMap.size() ); 157 163 } 158 164 { 159 165 /// ... at half upper interval half 160 LinkedCell::LinkedCell_View view_upperhalf = controller->getView((interval.last + edgelength)/2. );166 LinkedCell::LinkedCell_View view_upperhalf = controller->getView((interval.last + edgelength)/2., *emptyset); 161 167 CPPUNIT_ASSERT_EQUAL( (size_t)1, controller->ModelsMap.size() ); 162 168 } 163 169 { 164 170 /// ... close to lower boundary 165 LinkedCell::LinkedCell_View view_closelower = controller->getView(interval.first + std::numeric_limits<double>::round_error() );171 LinkedCell::LinkedCell_View view_closelower = controller->getView(interval.first + std::numeric_limits<double>::round_error(), *emptyset); 166 172 CPPUNIT_ASSERT_EQUAL( (size_t)1, controller->ModelsMap.size() ); 167 173 } 168 174 { 169 175 /// ... close to upper boundary 170 LinkedCell::LinkedCell_View view_closerupper = controller->getView(interval.last - std::numeric_limits<double>::round_error() );176 LinkedCell::LinkedCell_View view_closerupper = controller->getView(interval.last - std::numeric_limits<double>::round_error(), *emptyset); 171 177 CPPUNIT_ASSERT_EQUAL( (size_t)1, controller->ModelsMap.size() ); 172 178 } 173 179 { 174 180 /// on lower boundary 175 LinkedCell::LinkedCell_View view_onlower = controller->getView(interval.first );181 LinkedCell::LinkedCell_View view_onlower = controller->getView(interval.first, *emptyset); 176 182 CPPUNIT_ASSERT_EQUAL( (size_t)1, controller->ModelsMap.size() ); 177 183 } … … 187 193 /// obtain a view 188 194 CPPUNIT_ASSERT_EQUAL( (size_t)0, controller->ModelsMap.size() ); 189 LinkedCell::LinkedCell_View view = controller->getView(edgelength );195 LinkedCell::LinkedCell_View view = controller->getView(edgelength, *emptyset); 190 196 CPPUNIT_ASSERT_EQUAL( (size_t)1, controller->ModelsMap.size() ); 191 197 … … 194 200 { 195 201 /// ... outside lower boundary 196 LinkedCell::LinkedCell_View view_outsidelower = controller->getView(interval.first - std::numeric_limits<double>::round_error() );202 LinkedCell::LinkedCell_View view_outsidelower = controller->getView(interval.first - std::numeric_limits<double>::round_error(), *emptyset); 197 203 CPPUNIT_ASSERT_EQUAL( (size_t)2, controller->ModelsMap.size() ); 198 204 } 199 205 { 200 206 /// ... on upper boundary 201 LinkedCell::LinkedCell_View view_onupper = controller->getView(interval.last );207 LinkedCell::LinkedCell_View view_onupper = controller->getView(interval.last, *emptyset); 202 208 CPPUNIT_ASSERT_EQUAL( (size_t)3, controller->ModelsMap.size() ); 203 209 } … … 211 217 const double edgelength = 1.9*controller->lower_threshold; 212 218 CPPUNIT_ASSERT_EQUAL( (size_t)0, controller->ModelsMap.size() ); 213 LinkedCell::LinkedCell_View view = controller->getView(edgelength );219 LinkedCell::LinkedCell_View view = controller->getView(edgelength, *emptyset); 214 220 CPPUNIT_ASSERT_EQUAL( (size_t)1, controller->ModelsMap.size() ); 215 221 216 222 { 217 223 /// get a view at threshold and check that no new instance has been created 218 LinkedCell::LinkedCell_View view_onlower = controller->getView(controller->lower_threshold );224 LinkedCell::LinkedCell_View view_onlower = controller->getView(controller->lower_threshold, *emptyset); 219 225 CPPUNIT_ASSERT_EQUAL( (size_t)1, controller->ModelsMap.size() ); 220 226 } 221 227 { 222 228 /// pick a view below 1. 223 LinkedCell::LinkedCell_View view_beneathlower = controller->getView(0.1*controller->lower_threshold );229 LinkedCell::LinkedCell_View view_beneathlower = controller->getView(0.1*controller->lower_threshold, *emptyset); 224 230 CPPUNIT_ASSERT_EQUAL( (size_t)1, controller->ModelsMap.size() ); 225 231 } … … 233 239 const double edgelength = controller->upper_threshold; 234 240 CPPUNIT_ASSERT_EQUAL( (size_t)0, controller->ModelsMap.size() ); 235 LinkedCell::LinkedCell_View view = controller->getView(edgelength );241 LinkedCell::LinkedCell_View view = controller->getView(edgelength, *emptyset); 236 242 CPPUNIT_ASSERT_EQUAL( (size_t)1, controller->ModelsMap.size() ); 237 243 238 244 { 239 245 /// get a view beyond threshold and check that no new instance has been created 240 LinkedCell::LinkedCell_View view_beyondupper = controller->getView(1.1*controller->upper_threshold );246 LinkedCell::LinkedCell_View view_beyondupper = controller->getView(1.1*controller->upper_threshold, *emptyset); 241 247 CPPUNIT_ASSERT_EQUAL( (size_t)1, controller->ModelsMap.size() ); 242 248 } … … 246 252 range<double> interval = controller->getHeuristicRange(edgelength); 247 253 if ( !interval.isInRange(0.1*controller->upper_threshold) ) { 248 LinkedCell::LinkedCell_View view_beneathupper = controller->getView(0.1*controller->upper_threshold );254 LinkedCell::LinkedCell_View view_beneathupper = controller->getView(0.1*controller->upper_threshold, *emptyset); 249 255 CPPUNIT_ASSERT_EQUAL( (size_t)2, controller->ModelsMap.size() ); 250 256 } -
src/LinkedCell/unittests/LinkedCell_ControllerUnitTest.hpp
r4459fc rc80643 17 17 #include <cppunit/extensions/HelperMacros.h> 18 18 19 #include <vector> 20 21 #include "LinkedCell/PointCloudAdaptor.hpp" 22 23 class atom; 19 24 class Box; 20 25 class RealSpaceMatrix; … … 54 59 Box *domain; 55 60 RealSpaceMatrix *BoxM; 61 std::vector<atom *> emptyvector; 62 PointCloudAdaptor< std::vector<atom *> > *emptyset; 56 63 LinkedCell::LinkedCell_Controller *controller; 57 64 };
Note:
See TracChangeset
for help on using the changeset viewer.