Changeset 19c50e for src/Fragmentation/Summation/SubsetMap.cpp
- Timestamp:
- Dec 10, 2012, 10:10:58 AM (12 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:
- d4f31f
- Parents:
- 4f056e
- git-author:
- Frederik Heber <heber@…> (09/04/12 08:26:23)
- git-committer:
- Frederik Heber <heber@…> (12/10/12 10:10:58)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Summation/SubsetMap.cpp
r4f056e r19c50e 40 40 #include <boost/bind.hpp> 41 41 #include <boost/foreach.hpp> 42 #include <boost/lambda/lambda.hpp> 42 43 #include <algorithm> 43 44 #include <bitset> 44 45 #include <set> 45 46 47 #include "CodePatterns/Assert.hpp" 46 48 #include "CodePatterns/Log.hpp" 47 49 … … 49 51 tempset(new IndexSet()) 50 52 { 53 /// go through all IndexSets 51 54 const IndexSetContainer::Container_t &container = _container.getContainer(); 52 53 // we don't need this level-wise sorting as this is automatically achieved by specific sorting 54 // /// place in level-wise multimap 55 // typedef size_t level_t; 56 // // note: We use an IndexSetContainer as it is not accessed while filling it 57 // // also, as insert uses push_back, the IndexSetContainer is actually created 58 // // as sorted. Hence, the call to sort() just needs linear time (and does 59 // // nothing) 60 // typedef std::map<level_t, IndexSetContainer > IndexSetPerLevel_t; 61 // IndexSetPerLevel_t IndexSetPerLevel; 62 // for(IndexSetContainer::Container_t::const_iterator iter = container.begin(); 63 // iter != container.end(); ++iter) { 64 // // key present in map? 65 // const size_t level = (*iter)->size(); 66 // LOG(1, "INFO: Current set is " << **iter << " with size " << level << "."); 67 // IndexSetPerLevel_t::iterator leveliter = IndexSetPerLevel.find(level); 68 // // we have to explicitly copy the shared_ptr for insertion due to const container 69 // IndexSet_ptr ptr(*iter); 70 // if (leveliter == IndexSetPerLevel.end()) { 71 // LOG(2, "DEBUG: Level not present in Lookup, creating new container"); 72 // IndexSetPerLevel.insert( std::make_pair( level, IndexSetContainer(ptr)) ); 73 // } else { 74 // LOG(2, "DEBUG: Level present in Lookup, appending to container"); 75 // leveliter->second.insert(ptr); 76 // } 77 // } 78 79 /// go through all IndexSets 80 std::for_each( container.begin(), container.end(), 81 boost::bind(&SubsetMap::gatherSubsets, this, _1)); 55 for (IndexSetContainer::Container_t::const_iterator iter = container.begin(); 56 iter != container.end(); ++iter) { 57 // check whether its the super set 58 if (*iter == _container.getSuperSet()) { 59 // place all other sets as its subsets 60 std::vector<IndexSet> returnsets; 61 returnsets.reserve(container.size()); 62 for (IndexSetContainer::Container_t::const_iterator insertiter = container.begin(); 63 insertiter != container.end(); ++insertiter) 64 if (iter != insertiter) { 65 LOG(2, "INFO: Current subset is " << **insertiter << " for super set."); 66 ASSERT( _container.getSuperSet()->contains(**insertiter), 67 "SubsetMap::SubsetMap() - "+toString(**insertiter)+" is not contained in super set " 68 +toString(*_container.getSuperSet())+"."); 69 returnsets.push_back(**insertiter); 70 } 71 Lookup.insert( std::make_pair(*iter, IndexSetContainer::ptr(new IndexSetContainer(returnsets))) ); 72 } else { 73 gatherSubsets(*iter); 74 } 75 } 82 76 } 83 77 … … 184 178 } 185 179 186 size_t SubsetMap::getMaximumSubsetLevel() const187 {188 // last one is super set, hence, the one before has largest subset size189 Lookup_t::const_iterator iter = --Lookup.end();190 --iter;191 return iter->first->size();192 }193 194 180 size_t SubsetMap::getMaximumSetLevel() const 195 181 {
Note:
See TracChangeset
for help on using the changeset viewer.