Ignore:
Timestamp:
Nov 21, 2012, 10:14:33 AM (12 years ago)
Author:
Frederik Heber <heber@…>
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:
358ddb
Parents:
f3bc5f
git-author:
Frederik Heber <heber@…> (08/08/12 16:54:37)
git-committer:
Frederik Heber <heber@…> (11/21/12 10:14:33)
Message:

Generalized template functions Convert(MPQC)DataTo and ConvertFragmentDataTo().

  • may now deal also with VMGData.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/FragmentationAction/FragmentationAutomationAction.cpp

    rf3bc5f ra0f8d3  
    163163 * @param fragmentData on return array filled with extracted MPQCData
    164164 */
    165 void ConvertFragmentResultToMPQCData(
     165template <typename T>
     166void ConvertFragmentResultTo(
    166167    const std::vector<FragmentResult::ptr> &results,
    167     std::vector<MPQCData> &fragmentData)
     168    std::vector<T> &fragmentData)
    168169{
    169170  // extract results
     
    175176      iter != results.end(); ++iter) {
    176177    //LOG(1, "RESULT: job #"+toString((*iter)->getId())+": "+toString((*iter)->result));
    177     MPQCData extractedData;
     178    T extractedData;
    178179    std::stringstream inputstream((*iter)->result);
    179180    LOG(2, "DEBUG: First 50 characters FragmentResult's string: "+(*iter)->result.substr(0, 50));
     
    185186
    186187  ASSERT( results.size() == fragmentData.size(),
    187       "ConvertFragmentResultToMPQCData() - the number of extracted data differs from the number of results.");
     188      "ConvertFragmentResultTo() - the number of extracted data differs from the number of results.");
    188189}
    189190
     
    301302}
    302303
    303 template <typename T>
    304 void convertMPQCDataTo(
    305     const std::vector<MPQCData> &fragmentData,
    306     std::vector<T> &MPQCData_fused)
     304template <typename source, typename dest>
     305void convertDataTo(
     306    const std::vector<source> &fragmentData,
     307    std::vector<dest> &MPQCData_fused)
    307308{
    308309  MPQCData_fused.clear();
     
    310311
    311312template <>
    312 void convertMPQCDataTo<MPQCDataEnergyMap_t>(
     313void convertDataTo<MPQCData, MPQCDataEnergyMap_t>(
    313314    const std::vector<MPQCData> &fragmentData,
    314315    std::vector<MPQCDataEnergyMap_t> &MPQCData_Energy_fused)
     
    361362
    362363template <>
    363 void convertMPQCDataTo<MPQCDataGridMap_t>(
     364void convertDataTo<MPQCData, MPQCDataGridMap_t>(
    364365    const std::vector<MPQCData> &fragmentData,
    365366    std::vector<MPQCDataGridMap_t> &MPQCData_Grid_fused)
     
    379380
    380381template <>
    381 void convertMPQCDataTo<MPQCDataFragmentMap_t>(
     382void convertDataTo<MPQCData, MPQCDataFragmentMap_t>(
    382383    const std::vector<MPQCData> &fragmentData,
    383384    std::vector<MPQCDataFragmentMap_t> &MPQCData_Fragment_fused)
     
    398399
    399400template <>
    400 void convertMPQCDataTo<MPQCDataTimeMap_t>(
     401void convertDataTo<MPQCData, MPQCDataTimeMap_t>(
    401402    const std::vector<MPQCData> &fragmentData,
    402403    std::vector<MPQCDataTimeMap_t> &MPQCData_Time_fused)
     
    428429  // place data into boost::fusion::map instance
    429430  std::vector<TypeMap> MPQCData_fused;
    430   convertMPQCDataTo<TypeMap>(fragmentData, MPQCData_fused);
     431  convertDataTo<MPQCData, TypeMap>(fragmentData, MPQCData_fused);
    431432  // instantiate summator
    432433  std::vector<TypeMap> Result_fused(subsetmap->getMaximumSubsetLevel());
     
    786787  std::vector<FragmentResult::ptr> MPQCresults = controller.getReceivedResults();
    787788  std::vector<MPQCData> fragmentData;
    788   ConvertFragmentResultToMPQCData(MPQCresults, fragmentData);
     789  ConvertFragmentResultTo<MPQCData>(MPQCresults, fragmentData);
    789790
    790791#ifdef HAVE_VMG
Note: See TracChangeset for help on using the changeset viewer.