Changeset e09b70


Ignore:
Timestamp:
Jun 18, 2010, 10:44:04 AM (15 years ago)
Author:
Tillmann Crueger <crueger@…>
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:
394529
Parents:
e38447
Message:

Added basic operations on shapes

Location:
src
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • src/Makefile.am

    re38447 re09b70  
    105105SHAPESOURCE = \
    106106  Shapes/BaseShapes.cpp \
    107   Shapes/Shape.cpp
     107  Shapes/Shape.cpp \
     108  Shapes/ShapeOps.cpp
    108109SHAPEHEADER = \
    109110  Shapes/BaseShapes.hpp \
    110   Shapes/Shape.hpp
     111  Shapes/Shape.hpp \
     112  Shapes/ShapeOps.hpp
    111113 
    112114
  • src/Shapes/Shape.cpp

    re38447 re09b70  
    3434}
    3535
     36// allows arbitrary friendship, but only if implementation is known
     37Shape::impl_ptr getShapeImpl(const Shape &shape){
     38  return shape.getImpl();
     39}
     40
    3641/***************************** Some simple Shapes ***************************/
    3742
     
    6166
    6267Shape operator&&(const Shape &lhs,const Shape &rhs){
    63   Shape::impl_ptr newImpl = Shape::impl_ptr(new AndShape_impl(lhs.getImpl(),rhs.getImpl()));
     68  Shape::impl_ptr newImpl = Shape::impl_ptr(new AndShape_impl(getShapeImpl(lhs),getShapeImpl(rhs)));
    6469  return Shape(newImpl);
    6570}
     
    7883
    7984Shape operator||(const Shape &lhs,const Shape &rhs){
    80   Shape::impl_ptr newImpl = Shape::impl_ptr(new OrShape_impl(lhs.getImpl(),rhs.getImpl()));
     85  Shape::impl_ptr newImpl = Shape::impl_ptr(new OrShape_impl(getShapeImpl(lhs),getShapeImpl(rhs)));
    8186  return Shape(newImpl);
    8287}
     
    95100
    96101Shape operator!(const Shape &arg){
    97   Shape::impl_ptr newImpl = Shape::impl_ptr(new NotShape_impl(arg.getImpl()));
     102  Shape::impl_ptr newImpl = Shape::impl_ptr(new NotShape_impl(getShapeImpl(arg)));
    98103  return Shape(newImpl);
    99104}
  • src/Shapes/Shape.hpp

    re38447 re09b70  
    1616class Shape
    1717{
    18 friend Shape operator&&(const Shape&,const Shape&);
    19 friend Shape operator||(const Shape&,const Shape&);
    20 friend Shape operator!(const Shape&);
    2118public:
    2219  typedef boost::shared_ptr<Shape_impl> impl_ptr;
     20  friend impl_ptr getShapeImpl(const Shape&);
    2321
    2422  Shape(impl_ptr);
  • src/Shapes/Shape_impl.hpp

    re38447 re09b70  
    1313class Shape_impl {
    1414public:
     15  Shape_impl(){};
     16  virtual ~Shape_impl(){};
    1517  virtual bool isInside(const Vector &point)=0;
    1618};
     
    5860};
    5961
     62Shape::impl_ptr getShapeImpl(const Shape&);
     63
    6064#endif /* SHAPE_IMPL_HPP_ */
Note: See TracChangeset for help on using the changeset viewer.