Changeset f61f61 for src/Filling


Ignore:
Timestamp:
Mar 30, 2012, 9:18:26 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:
68abe5
Parents:
901d87
git-author:
Frederik Heber <heber@…> (02/21/12 13:55:58)
git-committer:
Frederik Heber <heber@…> (03/30/12 09:18:26)
Message:

Refactored implementation of Inserter into pimpl pattern.

  • this is then much more similar to Predicate.
Location:
src/Filling
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • src/Filling/Inserter/Inserter.hpp

    r901d87 rf61f61  
    1515#endif
    1616
     17#include <boost/shared_ptr.hpp>
     18
    1719#include "Filling/ClusterInterface.hpp"
    1820
     
    2022class Vector;
    2123
    22 /** Inserter defines the interface to all classes that handle insertion of \a
    23  * Cluster into the World at a specific position.
     24class InserterBase;
     25
     26/** This class defines the interface for all derived classes.
     27 *
     28 * This is just a functor of an inserter function.
     29 *
    2430 */
    2531class Inserter
    2632{
    2733public:
    28   virtual void operator()(CopyAtomsInterface &copyMethod, ClusterInterface::Cluster_impl cluster, const Vector &offset) const = 0;
     34  typedef boost::shared_ptr<InserterBase> impl_ptr;
     35  friend impl_ptr getInserterImpl(const Inserter&);
    2936
    30   virtual ~Inserter() {}
     37  Inserter(const Inserter &ptr);
     38  Inserter(impl_ptr);
     39  ~Inserter();
     40  void operator()(CopyAtomsInterface &copyMethod, ClusterInterface::Cluster_impl cluster, const Vector &offset) const;
     41
     42protected:
     43  impl_ptr getImpl() const;
     44
     45private:
     46  impl_ptr impl;
    3147};
     48
     49Inserter::impl_ptr getInserterImpl(const Inserter &f);
    3250
    3351
  • src/Filling/Inserter/SimpleInserter.hpp

    r901d87 rf61f61  
    1515#endif
    1616
    17 #include "Filling/Inserter/Inserter.hpp"
     17#include "Filling/Inserter/InserterBase.hpp"
    1818
    1919/** SimpleInserter implements Inserter interface such that the given \a Cluster
    2020 * is simply inserted at the given position.
    2121 */
    22 class SimpleInserter : public Inserter
     22class SimpleInserter : public InserterBase
    2323{
    2424public:
  • src/Filling/Makefile.am

    r901d87 rf61f61  
    88        Filling/Filler.cpp \
    99        Filling/Generators/NodeGenerator.cpp \
     10        Filling/Inserter/Inserter.cpp \
    1011        Filling/Inserter/SimpleInserter.cpp \
    1112        Filling/Predicates/AnyFillPredicate.cpp \
     
    2425        Filling/Generators/NodeGenerator.hpp \
    2526        Filling/Inserter/Inserter.hpp \
     27        Filling/Inserter/InserterBase.hpp \
    2628        Filling/Inserter/SimpleInserter.hpp \
    2729        Filling/NodeTypes.hpp \
  • src/Filling/unittests/FillerUnitTest.cpp

    r901d87 rf61f61  
    3030#include "Filling/Cluster.hpp"
    3131#include "Filling/Filler.hpp"
     32#include "Filling/Inserter/Inserter.hpp"
    3233#include "Filling/Inserter/SimpleInserter.hpp"
    3334#include "Filling/Mesh/Mesh.hpp"
     
    7172  predicate = new FillPredicate(AlwaysFillPredicate());
    7273  mesh = new MeshStub();
    73   inserter = new SimpleInserter();
     74  inserter = new Inserter(Inserter::impl_ptr(new SimpleInserter()));
    7475  CPPUNIT_ASSERT_EQUAL( (size_t)5, mesh->getNodes().size() );
    7576  filler = new Filler(*mesh, *predicate, *inserter);
Note: See TracChangeset for help on using the changeset viewer.