Ignore:
Timestamp:
Mar 30, 2012, 9:18:25 AM (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:
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)
Message:

Added preliminary getVolume() and getSurfaceArea() implementation to all Shapes.

  • only BaseShapes are truely usable, the rest is mostly marked as TODO.
  • the problem is that intersections are not so easy to handle. Probably, we have to use polygonal intersections there and approximate volume calculations.
  • the functions return -1 when not implemented yet. this is preparatory to start approximate calculations at the top node of the Shape "graph" if -1. is returned from the implementation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Shapes/Shape.cpp

    r7672551 rc67c65  
    5757double Shape::getRadius() const{
    5858  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 */
     70double 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 */
     89double 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        }
    5997}
    6098
     
    192230}
    193231
     232double AndShape_impl::getVolume() const
     233{
     234        // TODO
     235        return -1.;
     236}
     237
     238double AndShape_impl::getSurfaceArea() const
     239{
     240        // TODO
     241        return -1.;
     242}
     243
    194244LineSegmentSet AndShape_impl::getLineIntersections(const Line &line) const{
    195245  return intersect(lhs->getLineIntersections(line),rhs->getLineIntersections(line));
     
    304354}
    305355
     356double OrShape_impl::getVolume() const
     357{
     358        // TODO
     359        return -1.;
     360}
     361
     362double OrShape_impl::getSurfaceArea() const
     363{
     364        // TODO
     365        return -1.;
     366}
     367
    306368LineSegmentSet OrShape_impl::getLineIntersections(const Line &line) const{
    307369  return merge(lhs->getLineIntersections(line),rhs->getLineIntersections(line));
     
    374436}
    375437
     438double NotShape_impl::getVolume() const
     439{
     440        // TODO
     441        return -1.; //-arg->getVolume();
     442}
     443
     444double NotShape_impl::getSurfaceArea() const
     445{
     446        // TODO
     447        return -1.; // -arg->getSurfaceArea();
     448}
     449
    376450LineSegmentSet NotShape_impl::getLineIntersections(const Line &line) const{
    377451  return invert(arg->getLineIntersections(line));
Note: See TracChangeset for help on using the changeset viewer.