Changeset c67c65 for src/Shapes
- Timestamp:
- Mar 30, 2012, 9:18:25 AM (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:
- 595cfd
- Parents:
- 7672551
- git-author:
- Frederik Heber <heber@…> (01/30/12 08:18:04)
- git-committer:
- Frederik Heber <heber@…> (03/30/12 09:18:25)
- Location:
- src/Shapes
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Shapes/BaseShapes.cpp
r7672551 rc67c65 60 60 { 61 61 return 1.; 62 } 63 64 double Sphere_impl::getVolume() const 65 { 66 return (4./3.)*M_PI; // 4/3 pi r^3 67 } 68 69 double Sphere_impl::getSurfaceArea() const 70 { 71 return 2.*M_PI; // 2 pi r^2 62 72 } 63 73 … … 194 204 } 195 205 206 double Cuboid_impl::getVolume() const 207 { 208 return 1.; // l^3 209 } 210 211 double Cuboid_impl::getSurfaceArea() const 212 { 213 return 6.; // 6 * l^2 214 } 215 196 216 LineSegmentSet Cuboid_impl::getLineIntersections(const Line &line) const{ 197 217 LineSegmentSet res(line); -
src/Shapes/BaseShapes_impl.hpp
r7672551 rc67c65 28 28 virtual Vector getCenter() const; 29 29 virtual double getRadius() const; 30 virtual double getVolume() const; 31 virtual double getSurfaceArea() const; 30 32 virtual LineSegmentSet getLineIntersections(const Line&) const; 31 33 virtual std::string toString() const; … … 41 43 virtual Vector getCenter() const; 42 44 virtual double getRadius() const; 45 virtual double getVolume() const; 46 virtual double getSurfaceArea() const; 43 47 virtual LineSegmentSet getLineIntersections(const Line&) const; 44 48 virtual std::string toString() const; -
src/Shapes/Shape.cpp
r7672551 rc67c65 57 57 double Shape::getRadius() const{ 58 58 return impl->getRadius(); 59 } 60 61 /** Returns the volume of the Shape. 62 * 63 * If the underlying implementation does not have a working implementation, 64 * i.e. returns -1., then we use an approximate method to calculate the 65 * volume via a mesh of grid points and checking for isInside (basically 66 * a Monte-Carlo integration of the volume). 67 * 68 * \return volume of the shape 69 */ 70 double Shape::getVolume() const 71 { 72 const double volume = impl->getVolume(); 73 if (volume != -1.) { 74 return volume; 75 } else { 76 ASSERT(0, "Shape::getVolume() - functionality not implemented for this specific shape."); 77 } 78 } 79 80 /** Returns the surface area of the Shape. 81 * 82 * If the underlying implementation does not have a working implementation, 83 * i.e. returns -1., then we use the working filling of the shapes surface 84 * with points and subsequent tesselation and obtaining the approximate 85 * surface area therefrom. 86 * 87 * @return surface area of the Shape 88 */ 89 double Shape::getSurfaceArea() const 90 { 91 const double surfacearea = impl->getSurfaceArea(); 92 if (surfacearea != -1.) { 93 return surfacearea; 94 } else { 95 ASSERT(0, "Shape::getSurfaceArea() - functionality not implemented for this specific shape."); 96 } 59 97 } 60 98 … … 192 230 } 193 231 232 double AndShape_impl::getVolume() const 233 { 234 // TODO 235 return -1.; 236 } 237 238 double AndShape_impl::getSurfaceArea() const 239 { 240 // TODO 241 return -1.; 242 } 243 194 244 LineSegmentSet AndShape_impl::getLineIntersections(const Line &line) const{ 195 245 return intersect(lhs->getLineIntersections(line),rhs->getLineIntersections(line)); … … 304 354 } 305 355 356 double OrShape_impl::getVolume() const 357 { 358 // TODO 359 return -1.; 360 } 361 362 double OrShape_impl::getSurfaceArea() const 363 { 364 // TODO 365 return -1.; 366 } 367 306 368 LineSegmentSet OrShape_impl::getLineIntersections(const Line &line) const{ 307 369 return merge(lhs->getLineIntersections(line),rhs->getLineIntersections(line)); … … 374 436 } 375 437 438 double NotShape_impl::getVolume() const 439 { 440 // TODO 441 return -1.; //-arg->getVolume(); 442 } 443 444 double NotShape_impl::getSurfaceArea() const 445 { 446 // TODO 447 return -1.; // -arg->getSurfaceArea(); 448 } 449 376 450 LineSegmentSet NotShape_impl::getLineIntersections(const Line &line) const{ 377 451 return invert(arg->getLineIntersections(line)); -
src/Shapes/Shape.hpp
r7672551 rc67c65 44 44 Vector getCenter() const; 45 45 double getRadius() const; 46 double getVolume() const; 47 double getSurfaceArea() const; 46 48 47 49 LineSegmentSet getLineIntersections(const Line&) const; -
src/Shapes/ShapeOps.cpp
r7672551 rc67c65 111 111 Resize_impl::~Resize_impl(){} 112 112 113 double Resize_impl::getVolume() const 114 { 115 return getArg()->getVolume() * size; 116 } 117 118 double Resize_impl::getSurfaceArea() const 119 { 120 return getArg()->getSurfaceArea() * size; 121 } 122 123 113 124 bool Resize_impl::isInside(const Vector& point) const{ 114 125 return getArg()->isInside((1/size) * point); … … 175 186 } 176 187 188 double Translate_impl::getVolume() const 189 { 190 return getArg()->getVolume(); 191 } 192 193 double Translate_impl::getSurfaceArea() const 194 { 195 return getArg()->getSurfaceArea(); 196 } 177 197 178 198 Vector Translate_impl::translateIn(const Vector& point) const{ … … 225 245 226 246 Stretch_impl::~Stretch_impl(){} 247 248 double Stretch_impl::getVolume() const 249 { 250 // TODO 251 return -1.; 252 } 253 254 double Stretch_impl::getSurfaceArea() const 255 { 256 // TODO 257 return -1.; 258 } 227 259 228 260 bool Stretch_impl::isInside(const Vector& point) const{ … … 291 323 Transform_impl::~Transform_impl(){} 292 324 325 double Transform_impl::getVolume() const 326 { 327 return getArg()->getVolume(); 328 } 329 330 double Transform_impl::getSurfaceArea() const 331 { 332 return getArg()->getSurfaceArea(); 333 } 334 293 335 bool Transform_impl::isInside(const Vector& point) const{ 294 336 return getArg()->isInside(transformationInv * point); -
src/Shapes/ShapeOps_impl.hpp
r7672551 rc67c65 53 53 virtual ~Resize_impl(); 54 54 protected: 55 virtual double getVolume() const; 56 virtual double getSurfaceArea() const; 55 57 virtual Vector translateIn(const Vector &point) const; 56 58 virtual Vector translateOutPos(const Vector &point) const; … … 72 74 virtual Vector getCenter() const; 73 75 virtual double getRadius() const; 76 virtual double getVolume() const; 77 virtual double getSurfaceArea() const; 74 78 virtual Vector translateIn(const Vector &point) const; 75 79 virtual Vector translateOutPos(const Vector &point) const; … … 86 90 { 87 91 public: 88 Stretch_impl(const Shape::impl_ptr&, const Vector&); 92 93 94 Stretch_impl(const Shape::impl_ptr&, const Vector&); 89 95 virtual ~Stretch_impl(); 90 96 protected: 97 virtual double getVolume() const; 98 virtual double getSurfaceArea() const; 91 99 virtual Vector translateIn(const Vector &point) const; 92 100 virtual Vector translateOutPos(const Vector &point) const; … … 107 115 virtual ~Transform_impl(); 108 116 protected: 117 virtual double getVolume() const; 118 virtual double getSurfaceArea() const; 109 119 virtual Vector translateIn(const Vector &point) const; 110 120 virtual Vector translateOutPos(const Vector &point) const; -
src/Shapes/Shape_impl.hpp
r7672551 rc67c65 39 39 virtual Vector getCenter() const=0; 40 40 virtual double getRadius() const=0; 41 virtual double getVolume() const=0; 42 virtual double getSurfaceArea() const=0; 41 43 virtual LineSegmentSet getLineIntersections(const Line&) const=0; 42 44 virtual std::string toString() const =0; … … 63 65 return std::numeric_limits<double>::infinity(); 64 66 } 67 virtual double getVolume() const 68 { 69 // TODO 70 return 0.; 71 } 72 virtual double getSurfaceArea() const 73 { 74 // TODO 75 return 0.; 76 } 65 77 virtual LineSegmentSet getLineIntersections(const Line &line) const{ 66 78 LineSegmentSet res(line); … … 100 112 virtual double getRadius() const { 101 113 return 0.; 114 } 115 virtual double getVolume() const 116 { 117 return 0.; 118 } 119 virtual double getSurfaceArea() const 120 { 121 return 0.; 102 122 } 103 123 virtual LineSegmentSet getLineIntersections(const Line &line) const{ … … 128 148 virtual Vector getCenter() const; 129 149 virtual double getRadius() const; 150 virtual double getVolume() const; 151 virtual double getSurfaceArea() const; 130 152 virtual LineSegmentSet getLineIntersections(const Line&) const; 131 153 virtual std::string toString() const; … … 147 169 virtual Vector getCenter() const; 148 170 virtual double getRadius() const; 171 virtual double getVolume() const; 172 virtual double getSurfaceArea() const; 149 173 virtual LineSegmentSet getLineIntersections(const Line&) const; 150 174 virtual std::string toString() const; … … 166 190 virtual Vector getCenter() const; 167 191 virtual double getRadius() const; 192 virtual double getVolume() const; 193 virtual double getSurfaceArea() const; 168 194 virtual LineSegmentSet getLineIntersections(const Line&) const; 169 195 virtual std::string toString() const;
Note:
See TracChangeset
for help on using the changeset viewer.