Ignore:
Timestamp:
Sep 14, 2016, 6:43:45 PM (8 years ago)
Author:
Frederik Heber <heber@…>
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, 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:
409a05
Parents:
3d444a
git-author:
Frederik Heber <heber@…> (06/12/16 07:46:35)
git-committer:
Frederik Heber <heber@…> (09/14/16 18:43:45)
Message:

..Summators and AllLevel..Summators pass through ZeroInstance, added ZeroInstanceInitializer.

  • ZeroInstanceInitializer fills the boost::fusion::map with default values.
  • this is handed to AllLevel..Summators that use ..Summators::setZeroInstance() if the present entry in the fusion map is unequal to ZeroInstance<T>.
  • ..SumUpPerLevel instantiate a default set of zero instances and pass it on for the moment.
Location:
src/Fragmentation/Summation
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Summation/AllLevelOrthogonalSummator.hpp

    r3d444a rda098d2  
    2121#include "Fragmentation/Summation/SubsetMap.hpp"
    2222#include "Fragmentation/Summation/OrthogonalSummator.hpp"
     23#include "Fragmentation/Summation/ZeroInstance.hpp"
    2324
    2425#include "Fragmentation/Summation/printKeyNames.hpp"
     
    3940   * \param _MatrixNrLookup lookup from job id to ordering in above vectors, if
    4041   *        out of range this value is set to zero, hence ignored.
    41    * \param _results vector place results into
     42   * \param _levelresults vector place levelresults into
     43   * \param _keysetresults results per index set, set by operator()
     44   * \param _ZeroInstances zero instance to use in summation for each type
    4245   */
    4346  AllLevelOrthogonalSummator(
     
    4750      const std::map< JobId_t, size_t > &_MatrixNrLookup,
    4851      std::vector<MapType> &_levelresults,
    49       std::map<IndexSet::ptr, std::pair<MapType, MapType> > &_keysetresults) :
     52      std::map<IndexSet::ptr, std::pair<MapType, MapType> > &_keysetresults,
     53      MapType &_ZeroInstances) :
    5054    subsetmap(_subsetmap),
    5155    data(_data),
     
    5357    MatrixNrLookup(_MatrixNrLookup),
    5458    levelresults(_levelresults),
    55     keysetresults(_keysetresults)
     59    keysetresults(_keysetresults),
     60    ZeroInstances(_ZeroInstances)
    5661  {
    5762    ASSERT( levelresults.size() >= subsetmap->getMaximumSetLevel(),
     
    7378        subsetmap, data, container, MatrixNrLookup
    7479        );
     80
     81    // set zero instance
     82    const MapValue &DesiredZeroInstance = boost::fusion::at_key<MapKey>(ZeroInstances);
     83    if (DesiredZeroInstance != ZeroInstance<MapValue>())
     84      sum_value.setZeroInstance(DesiredZeroInstance);
    7585
    7686    // fill levelresults
     
    113123  //!> map for IndexSet and its associated contribution
    114124  keysetresults_t &keysetresults;
     125  //!> map per type to sum of base/zero instances to enforce specific parameters in summation
     126  MapType &ZeroInstances;
    115127};
    116128
  • src/Fragmentation/Summation/AllLevelSummator.hpp

    r3d444a rda098d2  
    2121#include "Fragmentation/Summation/SubsetMap.hpp"
    2222#include "Fragmentation/Summation/Summator.hpp"
     23#include "Fragmentation/Summation/ZeroInstance.hpp"
    2324
    2425#include "Fragmentation/Summation/printKeyNames.hpp"
     
    4041   *        out of range this value is set to zero, hence ignored.
    4142   * \param _levelresults vector place levelresults into
     43   * \param _keysetresults results per index set, set by operator()
     44   * \param _ZeroInstances zero instance to use in summation for each type
    4245   */
    4346  AllLevelSummator(
     
    4750      const std::map< JobId_t, size_t > &_MatrixNrLookup,
    4851      std::vector<MapType> &_levelresults,
    49       std::map<IndexSet::ptr, std::pair<MapType, MapType> > &_keysetresults) :
     52      std::map<IndexSet::ptr, std::pair<MapType, MapType> > &_keysetresults,
     53      MapType &_ZeroInstances) :
    5054    subsetmap(_subsetmap),
    5155    data(_data),
     
    5357    MatrixNrLookup(_MatrixNrLookup),
    5458    levelresults(_levelresults),
    55     keysetresults(_keysetresults)
     59    keysetresults(_keysetresults),
     60    ZeroInstances(_ZeroInstances)
    5661  {
    5762    ASSERT( levelresults.size() >= subsetmap->getMaximumSetLevel(),
     
    7378        subsetmap, data, container, MatrixNrLookup
    7479        );
     80
     81    // set zero instance
     82    const MapValue &DesiredZeroInstance = boost::fusion::at_key<MapKey>(ZeroInstances);
     83    if (DesiredZeroInstance != ZeroInstance<MapValue>())
     84      sum_value.setZeroInstance(DesiredZeroInstance);
    7585
    7686    // fill levelresults
     
    113123  //!> map for IndexSet and its associated contribution
    114124  keysetresults_t &keysetresults;
     125  //!> map per type to sum of base/zero instances to enforce specific parameters in summation
     126  MapType &ZeroInstances;
    115127};
    116128
  • src/Fragmentation/Summation/Containers/FragmentationLongRangeResults.cpp

    r3d444a rda098d2  
    130130    IndexedVectors::indices_t fullindices;
    131131    if (hasLongRangeForces()) {
     132      // initialize zero instance map
     133      VMGDataForceMap_t ZeroInstances;
     134      ZeroInstanceInitializer<VMGDataForceMap_t> initZeroInstance(ZeroInstances);
     135      boost::mpl::for_each<VMGDataForceVector_t>(boost::ref(initZeroInstance));
     136
    132137      // force has extra data converter (this is similar to MPQCData's forces
    133138      std::map<JobId_t, VMGDataForceMap_t> VMGData_Force_fused;
     
    141146                  VMGMatrixNrLookup,
    142147                  Result_ForceLongRange_fused,
    143                   Result_perIndexSet_LongRange_Force);
     148                  Result_perIndexSet_LongRange_Force,
     149                  ZeroInstances);
    144150      boost::mpl::for_each<VMGDataForceVector_t>(boost::ref(forceSummer));
    145151      // build full force index set
  • src/Fragmentation/Summation/Containers/FragmentationShortRangeResults.cpp

    r3d444a rda098d2  
    107107        Result_Time_fused, Result_perIndexSet_Time);
    108108
     109    // initialize zero instance map
     110    MPQCDataForceMap_t ZeroInstances;
     111    ZeroInstanceInitializer<MPQCDataForceMap_t> initZeroInstance(ZeroInstances);
     112    boost::mpl::for_each<MPQCDataForceVector_t>(boost::ref(initZeroInstance));
     113
    109114    // force has extra data converter
    110115    std::map<JobId_t, MPQCDataForceMap_t> MPQCData_Force_fused;
     
    117122                MPQCMatrixNrLookup,
    118123                Result_Force_fused,
    119                 Result_perIndexSet_Force);
     124                Result_perIndexSet_Force,
     125                ZeroInstances);
    120126    boost::mpl::for_each<MPQCDataForceVector_t>(boost::ref(forceSummer));
    121127  }
  • src/Fragmentation/Summation/Makefile.am

    r3d444a rda098d2  
    2929        Fragmentation/Summation/writeIndexedTable.hpp \
    3030        Fragmentation/Summation/writeTable.hpp \
    31         Fragmentation/Summation/ZeroInstance.hpp
     31        Fragmentation/Summation/ZeroInstance.hpp \
     32        Fragmentation/Summation/ZeroInstanceInitializer.hpp
    3233
    3334
  • src/Fragmentation/Summation/OrthogonalSumUpPerLevel.hpp

    r3d444a rda098d2  
    2323#include "Fragmentation/Summation/IndexSet.hpp"
    2424#include "Fragmentation/Summation/IndexSetContainer.hpp"
     25#include "Fragmentation/Summation/ZeroInstanceInitializer.hpp"
    2526
    2627#include "Fragmentation/Summation/Containers/MPQCData.hpp"
     
    4142  std::map<JobId_t, TypeMap> Data_fused;
    4243  convertDataTo<TypeData, TypeMap>(fragmentData, Data_fused);
     44
     45  // initialize zero instance map
     46  TypeMap ZeroInstances;
     47  ZeroInstanceInitializer<TypeMap> initZeroInstance(ZeroInstances);
     48  boost::mpl::for_each<TypeVector>(boost::ref(initZeroInstance));
     49
    4350  // instantiate summator
    4451  levelresults.resize(subsetmap->getMaximumSetLevel());
     
    4956              MatrixNrLookup,
    5057              levelresults,
    51               keysetresults);
     58              keysetresults,
     59              ZeroInstances);
    5260  // sum up for each type key in TypeVector
    5361  boost::mpl::for_each<TypeVector>(boost::ref(Summer));
  • src/Fragmentation/Summation/OrthogonalSummator.hpp

    r3d444a rda098d2  
    103103  }
    104104
     105  /** Setter for the zero instance to use as the base in orthogonal summation.
     106   *
     107   * \sa OrthogonalSummation::setZeroInstance() for explanations.
     108   *
     109   * \param _zeroinstance
     110   */
     111  void setZeroInstance(const MapValue &_zeroinstance)
     112  {
     113    OS.setZeroInstance(_zeroinstance);
     114  }
     115
    105116  /** Getter for the contribution of the SetValue<> to a specific \a index.
    106117   *
  • src/Fragmentation/Summation/SumUpPerLevel.hpp

    r3d444a rda098d2  
    4040  std::map<JobId_t, TypeMap> Data_fused;
    4141  convertDataTo<TypeData, TypeMap>(fragmentData, Data_fused);
     42
     43  // initialize zero instance map
     44  TypeMap ZeroInstances;
     45  ZeroInstanceInitializer<TypeMap> initZeroInstance(ZeroInstances);
     46  boost::mpl::for_each<TypeVector>(boost::ref(initZeroInstance));
     47
    4248  // instantiate summator
    4349  levelresults.resize(subsetmap->getMaximumSetLevel());
     
    4854              MatrixNrLookup,
    4955              levelresults,
    50               keysetresults);
     56              keysetresults,
     57              ZeroInstances);
    5158  // sum up for each type key in TypeVector
    5259  boost::mpl::for_each<TypeVector>(boost::ref(Summer));
  • src/Fragmentation/Summation/Summator.hpp

    r3d444a rda098d2  
    103103  }
    104104
     105  /** Setter for the zero instance to use as the base in summation.
     106   *
     107   * \sa Summation::setZeroInstance() for explanations.
     108   *
     109   * \param _zeroinstance
     110   */
     111  void setZeroInstance(const MapValue &_zeroinstance)
     112  {
     113    OS.setZeroInstance(_zeroinstance);
     114  }
    105115
    106116  /** Getter for the contribution of the SetValue<> to a specific \a index.
Note: See TracChangeset for help on using the changeset viewer.