Changeset 5a8d61
- Timestamp:
- Mar 28, 2012, 3:17:38 PM (13 years ago)
- 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)
- Location:
- src/Shapes
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Shapes/BaseShapes.cpp
r6acc2f3 r5a8d61 131 131 } 132 132 133 std::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 } 133 138 134 139 Shape Sphere(){ … … 237 242 } 238 243 244 std::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 239 250 Shape Cuboid(){ 240 251 Shape::impl_ptr impl = Shape::impl_ptr(new Cuboid_impl()); -
src/Shapes/BaseShapes_impl.hpp
r6acc2f3 r5a8d61 32 32 virtual enum ShapeType getType() const; 33 33 virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; 34 virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const; 34 35 }; 35 36 … … 44 45 virtual enum ShapeType getType() const; 45 46 virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; 47 virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const; 46 48 }; 47 49 -
src/Shapes/Shape.cpp
r6acc2f3 r5a8d61 65 65 std::vector<Vector> Shape::getHomogeneousPointsOnSurface(const size_t N) const { 66 66 return impl->getHomogeneousPointsOnSurface(N); 67 } 68 69 std::vector<Vector> Shape::getHomogeneousPointsInVolume(const size_t N) const { 70 return impl->getHomogeneousPointsInVolume(N); 67 71 } 68 72 … … 217 221 } 218 222 223 std::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 219 229 220 230 Shape operator&&(const Shape &lhs,const Shape &rhs){ … … 323 333 } 324 334 335 std::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 325 341 Shape operator||(const Shape &lhs,const Shape &rhs){ 326 342 Shape::impl_ptr newImpl = Shape::impl_ptr(new OrShape_impl(getShapeImpl(lhs),getShapeImpl(rhs))); … … 373 389 // surfaces are the same, only normal direction is different 374 390 return arg->getHomogeneousPointsOnSurface(N); 391 } 392 393 std::vector<Vector> NotShape_impl::getHomogeneousPointsInVolume(const size_t N) const { 394 ASSERT(0, 395 "NotShape_impl::getHomogeneousPointsInVolume() - not implemented."); 396 return std::vector<Vector>(); 375 397 } 376 398 -
src/Shapes/Shape.hpp
r6acc2f3 r5a8d61 47 47 LineSegmentSet getLineIntersections(const Line&) const; 48 48 std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; 49 std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const; 49 50 50 51 Shape &operator=(const Shape& rhs); -
src/Shapes/ShapeOps.cpp
r6acc2f3 r5a8d61 19 19 20 20 #include "CodePatterns/MemDebug.hpp" 21 22 #include <algorithm> 23 #include <boost/bind.hpp> 21 24 22 25 #include "Shapes/ShapeExceptions.hpp" … … 87 90 88 91 std::vector<Vector> ShapeOpsBase_impl::getHomogeneousPointsOnSurface(const size_t N) const { 89 return getArg()->getHomogeneousPointsOnSurface(N);; 92 return getArg()->getHomogeneousPointsOnSurface(N); 93 } 94 95 std::vector<Vector> ShapeOpsBase_impl::getHomogeneousPointsInVolume(const size_t N) const { 96 return getArg()->getHomogeneousPointsInVolume(N); 90 97 } 91 98 … … 128 135 std::vector<Vector> Resize_impl::getHomogeneousPointsOnSurface(const size_t N) const { 129 136 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 142 std::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>(); 134 147 } 135 148 … … 183 196 std::vector<Vector> Translate_impl::getHomogeneousPointsOnSurface(const size_t N) const { 184 197 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 203 std::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) ); 188 207 return PointsOnSurface; 189 208 } … … 245 264 std::vector<Vector> Stretch_impl::getHomogeneousPointsOnSurface(const size_t N) const { 246 265 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 271 std::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) ); 250 275 return PointsOnSurface; 251 276 } … … 292 317 std::vector<Vector> Transform_impl::getHomogeneousPointsOnSurface(const size_t N) const { 293 318 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 324 std::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)); 297 328 return PointsOnSurface; 298 329 } -
src/Shapes/ShapeOps_impl.hpp
r6acc2f3 r5a8d61 37 37 virtual enum ShapeType getType() const; 38 38 virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; 39 virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const; 39 40 protected: 40 41 virtual Vector translateIn(const Vector &point) const=0; … … 58 59 virtual bool isInside(const Vector& point) const; 59 60 virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; 61 virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const; 60 62 private: 61 63 double size; … … 76 78 virtual bool isInside(const Vector& point) const; 77 79 virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; 80 virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const; 78 81 private: 79 82 Vector offset; … … 92 95 virtual bool isInside(const Vector& point) const; 93 96 virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; 97 virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const; 94 98 private: 95 99 Vector factors; … … 109 113 virtual bool isInside(const Vector& point) const; 110 114 virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; 115 virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const; 111 116 private: 112 117 RealSpaceMatrix transformation; -
src/Shapes/Shape_impl.hpp
r6acc2f3 r5a8d61 17 17 #include <limits> 18 18 #include <vector> 19 20 #include "CodePatterns/Assert.hpp" 19 21 20 22 #include "Shapes/Shape.hpp" … … 40 42 virtual enum ShapeType getType() const =0; 41 43 virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const=0; 44 virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const=0; 42 45 }; 43 46 … … 74 77 return PointsOnSurface; 75 78 } 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 } 76 84 }; 77 85 … … 105 113 return PointsOnSurface; 106 114 } 115 std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const { 116 return std::vector<Vector>(); 117 } 107 118 }; 108 119 … … 120 131 virtual enum ShapeType getType() const; 121 132 virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; 133 virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const; 122 134 private: 123 135 Shape::impl_ptr lhs; … … 138 150 virtual enum ShapeType getType() const; 139 151 virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; 152 virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const; 140 153 private: 141 154 Shape::impl_ptr lhs; … … 156 169 virtual enum ShapeType getType() const; 157 170 virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; 171 virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const; 158 172 private: 159 173 Shape::impl_ptr arg; -
src/Shapes/unittests/Makefile.am
r6acc2f3 r5a8d61 5 5 SHAPETESTSSOURCES = \ 6 6 ../Shapes/unittests/BaseShapesUnitTest.cpp \ 7 ../Shapes/unittests/ShapeOpsUnitTest.cpp 7 ../Shapes/unittests/ShapeOpsUnitTest.cpp \ 8 ../Shapes/unittests/Shape_HomogeneousPointsUnitTest.cpp 8 9 9 10 SHAPETESTSHEADERS= \ 10 11 ../Shapes/unittests/BaseShapesUnitTest.hpp \ 11 ../Shapes/unittests/ShapeOpsUnitTest.hpp 12 ../Shapes/unittests/ShapeOpsUnitTest.hpp \ 13 ../Shapes/unittests/Shape_HomogeneousPointsUnitTest.cpp 12 14 13 15 SHAPETESTS = \ 14 16 BaseShapesUnitTest \ 15 ShapeOpsUnitTest 17 ShapeOpsUnitTest \ 18 Shape_HomogeneousPointsUnitTest 16 19 17 20 TESTS += $(SHAPETESTS) … … 41 44 ShapeOpsUnitTest_LDADD = $(SHAPELIBS) 42 45 46 Shape_HomogeneousPointsUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \ 47 ../Shapes/unittests/Shape_HomogeneousPointsUnitTest.cpp \ 48 ../Shapes/unittests/Shape_HomogeneousPointsUnitTest.hpp 49 nodist_Shape_HomogeneousPointsUnitTest_SOURCES = \ 50 ../Helpers/defs.hpp \ 51 ../Helpers/defs.cpp 52 Shape_HomogeneousPointsUnitTest_LDADD = $(SHAPELIBS) 53 43 54 44 55 #AUTOMAKE_OPTIONS = parallel-tests
Note:
See TracChangeset
for help on using the changeset viewer.