Changeset 409a05 for src/Fragmentation/Summation/SumUpPerLevel.hpp
- Timestamp:
- Sep 14, 2016, 6:43:45 PM (9 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, Candidate_v1.7.0, 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, 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_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, 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:
- b5134a
- Parents:
- da098d2
- git-author:
- Frederik Heber <heber@…> (06/12/16 08:18:50)
- git-committer:
- Frederik Heber <heber@…> (09/14/16 18:43:45)
- File:
-
- 1 edited
-
src/Fragmentation/Summation/SumUpPerLevel.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Summation/SumUpPerLevel.hpp
rda098d2 r409a05 28 28 29 29 template <typename TypeMap, typename TypeData, typename TypeVector> 30 void SumUpPerLevel( 31 const std::map<JobId_t, TypeData> &fragmentData, 32 const std::map< JobId_t, size_t > &MatrixNrLookup, 33 const IndexSetContainer::ptr &container, 34 SubsetMap::ptr &subsetmap, 35 std::vector<TypeMap> &levelresults, 36 std::map<IndexSet::ptr, std::pair<TypeMap, TypeMap> > &keysetresults 37 ) 30 struct SumUpPerLevel 38 31 { 39 // place data into boost::fusion::map instance 32 SumUpPerLevel(const std::map<JobId_t, TypeData> &fragmentData) 33 { 34 // place data into boost::fusion::map instance 35 convertDataTo<TypeData, TypeMap>(fragmentData, Data_fused); 36 37 // initialize zero instance map 38 ZeroInstanceInitializer<TypeMap> initZeroInstance(ZeroInstances); 39 boost::mpl::for_each<TypeVector>(boost::ref(initZeroInstance)); 40 } 41 42 /** Setter for a specific zero value for the given \a MapValue type. 43 * 44 * \param _zeroinstance zero instance to set for type \a MapValue 45 */ 46 template <typename MapKey> 47 void setZeroInstance( 48 const typename boost::fusion::result_of::value_at_key<TypeMap, MapKey>::type &_zeroinstance) 49 { 50 boost::fusion::at_key<MapKey>(ZeroInstances) = _zeroinstance; 51 } 52 53 /** Perform the actual summation for each type in \a TypeMap, given by 54 * \a TypeVector. 55 * 56 * i.e. we boost::fusion::for_each over each type in \a TypeVector and perform 57 * an AllLevelSummator on the type. 58 * 59 * \param MatrixNrLookup lookup from job number to a consecutive index in a vector, starting at 0 60 * \param container container of all indexsets 61 * \param subsetmap map with all subsets for each indexset 62 * \param levelresults after summation contains results for each level 63 * \param keysetresults after summation contains results for each keyset 64 */ 65 void operator()( 66 const std::map< JobId_t, size_t > &MatrixNrLookup, 67 const IndexSetContainer::ptr &container, 68 SubsetMap::ptr &subsetmap, 69 std::vector<TypeMap> &levelresults, 70 std::map<IndexSet::ptr, std::pair<TypeMap, TypeMap> > &keysetresults 71 ) 72 { 73 // instantiate summator 74 levelresults.resize(subsetmap->getMaximumSetLevel()); 75 AllLevelSummator<TypeMap> Summer( 76 subsetmap, 77 Data_fused, 78 container->getContainer(), 79 MatrixNrLookup, 80 levelresults, 81 keysetresults, 82 ZeroInstances); 83 // sum up for each type key in TypeVector 84 boost::mpl::for_each<TypeVector>(boost::ref(Summer)); 85 } 86 87 //!> map with all jobs placed into boost::fusion::maps 40 88 std::map<JobId_t, TypeMap> Data_fused; 41 convertDataTo<TypeData, TypeMap>(fragmentData, Data_fused); 42 43 // initialize zero instance map 89 //!> zero instances to use in summation 44 90 TypeMap ZeroInstances; 45 ZeroInstanceInitializer<TypeMap> initZeroInstance(ZeroInstances); 46 boost::mpl::for_each<TypeVector>(boost::ref(initZeroInstance)); 47 48 // instantiate summator 49 levelresults.resize(subsetmap->getMaximumSetLevel()); 50 AllLevelSummator<TypeMap> Summer( 51 subsetmap, 52 Data_fused, 53 container->getContainer(), 54 MatrixNrLookup, 55 levelresults, 56 keysetresults, 57 ZeroInstances); 58 // sum up for each type key in TypeVector 59 boost::mpl::for_each<TypeVector>(boost::ref(Summer)); 60 } 61 91 }; 62 92 63 93 #endif /* SUMUPPERLEVEL_HPP_ */
Note:
See TracChangeset
for help on using the changeset viewer.
