Ignore:
Timestamp:
Mar 28, 2012, 3:17:38 PM (14 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, Candidate_v1.7.0, 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:
3e1b7b
Parents:
6acc2f3
git-author:
Frederik Heber <heber@…> (01/19/12 00:55:04)
git-committer:
Frederik Heber <heber@…> (03/28/12 15:17:38)
Message:

Added new function to all Shape: getHomogeneousPointsInVolume().

  • basically it is not implemented except for ShapeOps, yet.
  • there is an initial unit test Shape_HomogeneousPointsUnitTest.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Shapes/ShapeOps.cpp

    r6acc2f3 r5a8d61  
    1919
    2020#include "CodePatterns/MemDebug.hpp"
     21
     22#include <algorithm>
     23#include <boost/bind.hpp>
    2124
    2225#include "Shapes/ShapeExceptions.hpp"
     
    8790
    8891std::vector<Vector> ShapeOpsBase_impl::getHomogeneousPointsOnSurface(const size_t N) const {
    89   return getArg()->getHomogeneousPointsOnSurface(N);;
     92  return getArg()->getHomogeneousPointsOnSurface(N);
     93}
     94
     95std::vector<Vector> ShapeOpsBase_impl::getHomogeneousPointsInVolume(const size_t N) const {
     96  return getArg()->getHomogeneousPointsInVolume(N);
    9097}
    9198
     
    128135std::vector<Vector> Resize_impl::getHomogeneousPointsOnSurface(const size_t N) const {
    129136  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N);
    130   for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
    131     *iter *= size;
    132   }
    133   return PointsOnSurface;
     137  std::for_each(PointsOnSurface.begin(), PointsOnSurface.end(),
     138                boost::bind(&Vector::operator*, _1, size) );
     139  return PointsOnSurface;
     140}
     141
     142std::vector<Vector> Resize_impl::getHomogeneousPointsInVolume(const size_t N) const {
     143  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsInVolume(N);
     144  std::for_each(PointsOnSurface.begin(), PointsOnSurface.end(),
     145                boost::bind(&Vector::operator*, _1, size) );
     146        return std::vector<Vector>();
    134147}
    135148
     
    183196std::vector<Vector> Translate_impl::getHomogeneousPointsOnSurface(const size_t N) const {
    184197  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N);
    185   for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
    186     *iter += offset;
    187   }
     198  std::for_each(PointsOnSurface.begin(), PointsOnSurface.end(),
     199                boost::bind(&Vector::operator+, _1, offset) );
     200  return PointsOnSurface;
     201}
     202
     203std::vector<Vector> Translate_impl::getHomogeneousPointsInVolume(const size_t N) const {
     204  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsInVolume(N);
     205  std::for_each(PointsOnSurface.begin(), PointsOnSurface.end(),
     206                boost::bind(&Vector::operator+, _1, offset) );
    188207  return PointsOnSurface;
    189208}
     
    245264std::vector<Vector> Stretch_impl::getHomogeneousPointsOnSurface(const size_t N) const {
    246265  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N);
    247   for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
    248     (*iter).ScaleAll(reciFactors);
    249   }
     266  std::for_each(PointsOnSurface.begin(), PointsOnSurface.end(),
     267                boost::bind( static_cast<void (Vector::*)(const Vector&)>(&Vector::ScaleAll), _1, reciFactors) );
     268  return PointsOnSurface;
     269}
     270
     271std::vector<Vector> Stretch_impl::getHomogeneousPointsInVolume(const size_t N) const {
     272  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsInVolume(N);
     273  std::for_each(PointsOnSurface.begin(), PointsOnSurface.end(),
     274      boost::bind( static_cast<void (Vector::*)(const Vector&)>(&Vector::ScaleAll), _1, reciFactors) );
    250275  return PointsOnSurface;
    251276}
     
    292317std::vector<Vector> Transform_impl::getHomogeneousPointsOnSurface(const size_t N) const {
    293318  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N);
    294   for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
    295     *iter = transformation * (*iter);
    296   }
     319  std::transform( PointsOnSurface.begin(), PointsOnSurface.end(), PointsOnSurface.begin(),
     320      boost::bind(static_cast<Vector(*)(const RealSpaceMatrix&,const Vector&)>(operator*), transformation, _1));
     321  return PointsOnSurface;
     322}
     323
     324std::vector<Vector> Transform_impl::getHomogeneousPointsInVolume(const size_t N) const {
     325  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsInVolume(N);
     326  std::transform( PointsOnSurface.begin(), PointsOnSurface.end(), PointsOnSurface.begin(),
     327      boost::bind(static_cast<Vector(*)(const RealSpaceMatrix&,const Vector&)>(operator*), transformation, _1));
    297328  return PointsOnSurface;
    298329}
Note: See TracChangeset for help on using the changeset viewer.