Changeset 5a8d61


Ignore:
Timestamp:
Mar 28, 2012, 3:17:38 PM (13 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:
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.
Location:
src/Shapes
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • src/Shapes/BaseShapes.cpp

    r6acc2f3 r5a8d61  
    131131}
    132132
     133std::vector<Vector> Sphere_impl::getHomogeneousPointsInVolume(const size_t N) const {
     134        ASSERT(0,
     135                        "Sphere_impl::getHomogeneousPointsInVolume() - not implemented.");
     136        return std::vector<Vector>();
     137}
    133138
    134139Shape Sphere(){
     
    237242}
    238243
     244std::vector<Vector> Cuboid_impl::getHomogeneousPointsInVolume(const size_t N) const {
     245        ASSERT(0,
     246                        "Cuboid_impl::getHomogeneousPointsInVolume() - not implemented.");
     247        return std::vector<Vector>();
     248}
     249
    239250Shape Cuboid(){
    240251  Shape::impl_ptr impl = Shape::impl_ptr(new Cuboid_impl());
  • src/Shapes/BaseShapes_impl.hpp

    r6acc2f3 r5a8d61  
    3232  virtual enum ShapeType getType() const;
    3333  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
     34  virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    3435};
    3536
     
    4445  virtual enum ShapeType getType() const;
    4546  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
     47  virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    4648};
    4749
  • src/Shapes/Shape.cpp

    r6acc2f3 r5a8d61  
    6565std::vector<Vector> Shape::getHomogeneousPointsOnSurface(const size_t N) const {
    6666  return impl->getHomogeneousPointsOnSurface(N);
     67}
     68
     69std::vector<Vector> Shape::getHomogeneousPointsInVolume(const size_t N) const {
     70        return impl->getHomogeneousPointsInVolume(N);
    6771}
    6872
     
    217221}
    218222
     223std::vector<Vector> AndShape_impl::getHomogeneousPointsInVolume(const size_t N) const {
     224        ASSERT(0,
     225                        "AndShape_impl::getHomogeneousPointsInVolume() - not implemented.");
     226        return std::vector<Vector>();
     227}
     228
    219229
    220230Shape operator&&(const Shape &lhs,const Shape &rhs){
     
    323333}
    324334
     335std::vector<Vector> OrShape_impl::getHomogeneousPointsInVolume(const size_t N) const {
     336        ASSERT(0,
     337                        "OrShape_impl::getHomogeneousPointsInVolume() - not implemented.");
     338        return std::vector<Vector>();
     339}
     340
    325341Shape operator||(const Shape &lhs,const Shape &rhs){
    326342  Shape::impl_ptr newImpl = Shape::impl_ptr(new OrShape_impl(getShapeImpl(lhs),getShapeImpl(rhs)));
     
    373389  // surfaces are the same, only normal direction is different
    374390  return arg->getHomogeneousPointsOnSurface(N);
     391}
     392
     393std::vector<Vector> NotShape_impl::getHomogeneousPointsInVolume(const size_t N) const {
     394        ASSERT(0,
     395                        "NotShape_impl::getHomogeneousPointsInVolume() - not implemented.");
     396        return std::vector<Vector>();
    375397}
    376398
  • src/Shapes/Shape.hpp

    r6acc2f3 r5a8d61  
    4747  LineSegmentSet getLineIntersections(const Line&) const;
    4848  std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
     49  std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    4950
    5051  Shape &operator=(const Shape& rhs);
  • 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}
  • src/Shapes/ShapeOps_impl.hpp

    r6acc2f3 r5a8d61  
    3737  virtual enum ShapeType getType() const;
    3838  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
     39  virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    3940protected:
    4041  virtual Vector translateIn(const Vector &point) const=0;
     
    5859  virtual bool isInside(const Vector& point) const;
    5960  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
     61  virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    6062private:
    6163  double size;
     
    7678  virtual bool isInside(const Vector& point) const;
    7779  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
     80  virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    7881private:
    7982  Vector offset;
     
    9295  virtual bool isInside(const Vector& point) const;
    9396  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
     97  virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    9498private:
    9599  Vector factors;
     
    109113  virtual bool isInside(const Vector& point) const;
    110114  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
     115  virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    111116private:
    112117  RealSpaceMatrix transformation;
  • src/Shapes/Shape_impl.hpp

    r6acc2f3 r5a8d61  
    1717#include <limits>
    1818#include <vector>
     19
     20#include "CodePatterns/Assert.hpp"
    1921
    2022#include "Shapes/Shape.hpp"
     
    4042  virtual enum ShapeType getType() const =0;
    4143  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const=0;
     44  virtual   std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const=0;
    4245};
    4346
     
    7477    return PointsOnSurface;
    7578  }
     79  std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const {
     80        ASSERT(0,
     81                        "Everywhere_impl::getHomogeneousPointsInVolume() - not implemented.");
     82        return std::vector<Vector>();
     83  }
    7684};
    7785
     
    105113    return PointsOnSurface;
    106114  }
     115  std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const {
     116        return std::vector<Vector>();
     117  }
    107118};
    108119
     
    120131  virtual enum ShapeType getType() const;
    121132  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
     133  virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    122134private:
    123135  Shape::impl_ptr lhs;
     
    138150  virtual enum ShapeType getType() const;
    139151  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
     152  virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    140153private:
    141154  Shape::impl_ptr lhs;
     
    156169  virtual enum ShapeType getType() const;
    157170  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
     171  virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const;
    158172private:
    159173  Shape::impl_ptr arg;
  • src/Shapes/unittests/Makefile.am

    r6acc2f3 r5a8d61  
    55SHAPETESTSSOURCES = \
    66        ../Shapes/unittests/BaseShapesUnitTest.cpp \
    7         ../Shapes/unittests/ShapeOpsUnitTest.cpp
     7        ../Shapes/unittests/ShapeOpsUnitTest.cpp \
     8        ../Shapes/unittests/Shape_HomogeneousPointsUnitTest.cpp
    89
    910SHAPETESTSHEADERS= \
    1011        ../Shapes/unittests/BaseShapesUnitTest.hpp \
    11         ../Shapes/unittests/ShapeOpsUnitTest.hpp
     12        ../Shapes/unittests/ShapeOpsUnitTest.hpp \
     13        ../Shapes/unittests/Shape_HomogeneousPointsUnitTest.cpp
    1214
    1315SHAPETESTS = \
    1416  BaseShapesUnitTest \
    15   ShapeOpsUnitTest
     17  ShapeOpsUnitTest \
     18  Shape_HomogeneousPointsUnitTest
    1619 
    1720TESTS += $(SHAPETESTS)
     
    4144ShapeOpsUnitTest_LDADD = $(SHAPELIBS)
    4245
     46Shape_HomogeneousPointsUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     47        ../Shapes/unittests/Shape_HomogeneousPointsUnitTest.cpp \
     48        ../Shapes/unittests/Shape_HomogeneousPointsUnitTest.hpp
     49nodist_Shape_HomogeneousPointsUnitTest_SOURCES = \
     50        ../Helpers/defs.hpp \
     51        ../Helpers/defs.cpp
     52Shape_HomogeneousPointsUnitTest_LDADD = $(SHAPELIBS)
     53
    4354
    4455#AUTOMAKE_OPTIONS = parallel-tests
Note: See TracChangeset for help on using the changeset viewer.