- Timestamp:
- Sep 12, 2016, 2:03:11 PM (8 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, 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_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
- Children:
- 6cb1cd
- Parents:
- 64cafb2
- git-author:
- Frederik Heber <heber@…> (05/10/16 20:04:47)
- git-committer:
- Frederik Heber <heber@…> (09/12/16 14:03:11)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Exporters/SphericalPointDistribution.cpp
r64cafb2 r0c42f2 39 39 #include "CodePatterns/Assert.hpp" 40 40 #include "CodePatterns/IteratorAdaptors.hpp" 41 #include "CodePatterns/Log.hpp" 41 42 #include "CodePatterns/toString.hpp" 42 43 … … 57 58 typedef std::vector<double> DistanceArray_t; 58 59 60 // static instances 61 const double SphericalPointDistribution::SQRT_3(sqrt(3.0)); 62 59 63 DistanceArray_t calculatePairwiseDistances( 60 const std::vector<Vector> &_ points,64 const std::vector<Vector> &_returnpolygon, 61 65 const IndexList_t &_indices 62 66 ) … … 69 73 if (firstiter == seconditer) 70 74 continue; 71 const double distance = (_ points[*firstiter] - _points[*seconditer]).NormSquared();75 const double distance = (_returnpolygon[*firstiter] - _returnpolygon[*seconditer]).NormSquared(); 72 76 result.push_back(distance); 73 77 } … … 89 93 * \a _new. 90 94 * 91 * \param _old first set of points(fewer or equal to \a _new)92 * \param _new second set of points95 * \param _old first set of returnpolygon (fewer or equal to \a _new) 96 * \param _new second set of returnpolygon 93 97 * \param _Matching matching between the two sets 94 98 * \return pair with L1 and squared L2 error … … 129 133 130 134 SphericalPointDistribution::Polygon_t removeMatchingPoints( 131 const SphericalPointDistribution::Polygon_t &_ points,135 const SphericalPointDistribution::Polygon_t &_returnpolygon, 132 136 const IndexList_t &_matchingindices 133 137 ) 134 138 { 135 SphericalPointDistribution::Polygon_t remaining points;139 SphericalPointDistribution::Polygon_t remainingreturnpolygon; 136 140 IndexArray_t indices(_matchingindices.begin(), _matchingindices.end()); 137 141 std::sort(indices.begin(), indices.end()); 138 142 IndexArray_t::const_iterator valueiter = indices.begin(); 139 143 SphericalPointDistribution::Polygon_t::const_iterator pointiter = 140 _ points.begin();141 for (unsigned int i=0; i< _ points.size(); ++i, ++pointiter) {144 _returnpolygon.begin(); 145 for (unsigned int i=0; i< _returnpolygon.size(); ++i, ++pointiter) { 142 146 // skip all those in values 143 147 if (*valueiter == i) 144 148 ++valueiter; 145 149 else 146 remaining points.push_back(*pointiter);147 } 148 149 return remaining points;150 remainingreturnpolygon.push_back(*pointiter); 151 } 152 153 return remainingreturnpolygon; 150 154 } 151 155 152 156 /** Rotates a given polygon around x, y, and z axis by the given angles. 153 157 * 154 * Essentially, we concentrate on the three pointsof the polygon to rotate158 * Essentially, we concentrate on the three returnpolygon of the polygon to rotate 155 159 * to the correct position. First, we rotate its center via \a angles, 156 160 * then we rotate the "triangle" around itself/\a _RotationAxis by 157 161 * \a _RotationAngle. 158 162 * 159 * \param _polygon polygon whose pointsto rotate163 * \param _polygon polygon whose returnpolygon to rotate 160 164 * \param _angles vector with rotation angles for x,y,z axis 161 165 * \param _RotationAxis … … 188 192 double bestL2; 189 193 IndexList_t bestmatching; 190 VectorArray_t old points;191 VectorArray_t new points;194 VectorArray_t oldreturnpolygon; 195 VectorArray_t newreturnpolygon; 192 196 }; 193 197 … … 229 233 // calculate errors 230 234 std::pair<double, double> errors = calculateErrorOfMatching( 231 _MCS.old points, _MCS.newpoints, _matching);235 _MCS.oldreturnpolygon, _MCS.newreturnpolygon, _matching); 232 236 if (errors.first < L1THRESHOLD) { 233 237 _MCS.bestmatching = _matching; … … 248 252 ) 249 253 { 250 SphericalPointDistribution::Polygon_t remaining points;254 SphericalPointDistribution::Polygon_t remainingreturnpolygon; 251 255 VectorArray_t remainingold(_polygon.begin(), _polygon.end()); 252 256 VectorArray_t remainingnew(_newpolygon.begin(), _newpolygon.end()); … … 256 260 MCS.foundflag = false; 257 261 MCS.bestL2 = std::numeric_limits<double>::max(); 258 MCS.old points.insert(MCS.oldpoints.begin(), _polygon.begin(),_polygon.end() );259 MCS.new points.insert(MCS.newpoints.begin(), _newpolygon.begin(),_newpolygon.end() );262 MCS.oldreturnpolygon.insert(MCS.oldreturnpolygon.begin(), _polygon.begin(),_polygon.end() ); 263 MCS.newreturnpolygon.insert(MCS.newreturnpolygon.begin(), _newpolygon.begin(),_newpolygon.end() ); 260 264 261 265 // search for bestmatching combinatorially … … 269 273 const unsigned int matchingsize = _polygon.size(); 270 274 ASSERT( matchingsize <= indices.size(), 271 "SphericalPointDistribution::matchSphericalPointDistributions() - not enough new pointsto choose for matching to old ones.");275 "SphericalPointDistribution::matchSphericalPointDistributions() - not enough new returnpolygon to choose for matching to old ones."); 272 276 recurseMatchings(MCS, matching, indices, matchingsize); 273 277 } … … 278 282 Vector newCenter; 279 283 { 280 // calculate center of triangle/line/point consisting of first pointsof matching284 // calculate center of triangle/line/point consisting of first returnpolygon of matching 281 285 Vector oldCenter; 282 286 IndexList_t::const_iterator iter = MCS.bestmatching.begin(); … … 313 317 rotatePolygon(_newpolygon, angles, RotationAxis, RotationAngle); 314 318 315 // remove all pointsin matching and return remaining ones319 // remove all returnpolygon in matching and return remaining ones 316 320 return removeMatchingPoints(rotated_newpolygon, MCS.bestmatching); 317 321 } else … … 319 323 } 320 324 321 322 325 SphericalPointDistribution::Polygon_t 326 SphericalPointDistribution::getSimplePolygon(const int _NumberOfPoints) const 327 { 328 Polygon_t returnpolygon; 329 330 switch (_NumberOfPoints) 331 { 332 case 0: 333 returnpolygon = get<0>(); 334 break; 335 case 1: 336 returnpolygon = get<1>(); 337 break; 338 case 2: 339 returnpolygon = get<2>(); 340 break; 341 case 3: 342 returnpolygon = get<3>(); 343 break; 344 case 4: 345 returnpolygon = get<4>(); 346 break; 347 case 5: 348 returnpolygon = get<5>(); 349 break; 350 case 6: 351 returnpolygon = get<6>(); 352 break; 353 case 7: 354 returnpolygon = get<7>(); 355 break; 356 case 8: 357 returnpolygon = get<8>(); 358 break; 359 case 9: 360 returnpolygon = get<9>(); 361 break; 362 case 10: 363 returnpolygon = get<10>(); 364 break; 365 case 11: 366 returnpolygon = get<11>(); 367 break; 368 case 12: 369 returnpolygon = get<12>(); 370 break; 371 case 14: 372 returnpolygon = get<14>(); 373 break; 374 default: 375 ASSERT(0, "SphericalPointDistribution::initSelf() - cannot deal with the case " 376 +toString(_NumberOfPoints)+"."); 377 } 378 379 return returnpolygon; 380 } 381
Note:
See TracChangeset
for help on using the changeset viewer.