Changeset 68abe5 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:
e32fa6
Parents:
f61f61
git-author:
Frederik Heber <heber@…> (02/21/12 14:27:21)
git-committer:
Frederik Heber <heber@…> (03/30/12 09:18:26)
Message:

Made Inserter::operator(), Filler::operator() return bool, used by FillRegularGridAction.

  • true if at least one node is filled.
  • this is preparatory for allowing Inserter to insert and not clone only.
Location:
src/Filling
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/Filling/Filler.cpp

    rf61f61 r68abe5  
    7070 * @param copyMethod functor that knows how to copy atoms.
    7171 * @param cluster set of atomic ids contained in a specific Shape to fill each Node with
     72 * @return true - at least one node has been filled, false - no node filled
    7273 */
    73 void Filler::operator()(
     74bool Filler::operator()(
    7475    CopyAtomsInterface &copyMethod,
    7576    ClusterInterface::Cluster_impl cluster) const
     
    7980  std::for_each( nodes.begin(), nodes.end(), output << boost::lambda::_1 << " ");
    8081  LOG(3, "DEBUG: Listing nodes to check: " << output.str());
    81   if (nodes.size() == 0) {
    82     ASSERT(false,
    83       "Filler::operator() - Mesh contains no nodes.");
    84     return;
    85   }
     82  if (nodes.size() == 0)
     83    return false;
    8684  NodeSet FillNodes(nodes.size(), zeroVec);
    8785
     
    9391  if (FillNodes.size() == 0) {
    9492    ELOG(2, "For none of the nodes did the predicate return true.");
    95     return;
     93    return false;
    9694  } else {
    9795    LOG(1, "INFO: " << FillNodes.size() << " out of " << nodes.size() << " returned true from predicate.");
     
    105103      boost::bind(&Inserter::operator(), boost::cref(inserter), boost::ref(copyMethod), boost::cref(cluster), _1) );
    106104
     105  // give statment whether at least \a cluster was placed
     106  if ( FillNodes.size() != 0)
     107    return true;
     108  else
     109    return false;
     110
    107111  // move cluster to first node
    108112  cluster->translate(*FillNodes.begin());
  • src/Filling/Filler.hpp

    rf61f61 r68abe5  
    3535  ~Filler();
    3636
    37   void operator()(CopyAtomsInterface &copyMethod, ClusterInterface::Cluster_impl cluster) const;
     37  bool operator()(CopyAtomsInterface &copyMethod, ClusterInterface::Cluster_impl cluster) const;
    3838
    3939private:
  • src/Filling/Inserter/Inserter.cpp

    rf61f61 r68abe5  
    4646{}
    4747
    48 void Inserter::operator()(CopyAtomsInterface &copyMethod, ClusterInterface::Cluster_impl cluster, const Vector &offset) const
     48bool Inserter::operator()(CopyAtomsInterface &copyMethod, ClusterInterface::Cluster_impl cluster, const Vector &offset) const
    4949{
    5050  return impl->operator()(copyMethod, cluster, offset);
  • src/Filling/Inserter/Inserter.hpp

    rf61f61 r68abe5  
    3838  Inserter(impl_ptr);
    3939  ~Inserter();
    40   void operator()(CopyAtomsInterface &copyMethod, ClusterInterface::Cluster_impl cluster, const Vector &offset) const;
     40  bool operator()(CopyAtomsInterface &copyMethod, ClusterInterface::Cluster_impl cluster, const Vector &offset) const;
    4141
    4242protected:
  • src/Filling/Inserter/InserterBase.hpp

    rf61f61 r68abe5  
    2929  virtual ~InserterBase() {}
    3030
    31   virtual void operator()(CopyAtomsInterface &copyMethod, ClusterInterface::Cluster_impl cluster, const Vector &offset) const = 0;
     31  virtual bool operator()(CopyAtomsInterface &copyMethod, ClusterInterface::Cluster_impl cluster, const Vector &offset) const = 0;
    3232
    3333};
  • src/Filling/Inserter/SimpleInserter.cpp

    rf61f61 r68abe5  
    4141 * @param copyMethod functor for copying atoms
    4242 * @param offset
     43 * @return always true
    4344 */
    44 void SimpleInserter::operator()(CopyAtomsInterface &copyMethod, ClusterInterface::Cluster_impl cluster, const Vector &offset) const
     45bool SimpleInserter::operator()(CopyAtomsInterface &copyMethod, ClusterInterface::Cluster_impl cluster, const Vector &offset) const
    4546{
    46   cluster->clone(copyMethod, offset);
     47  ClusterInterface::Cluster_impl newcluster(cluster->clone(copyMethod, offset));
     48
     49  return (newcluster != NULL);
    4750}
  • src/Filling/Inserter/SimpleInserter.hpp

    rf61f61 r68abe5  
    2626  ~SimpleInserter();
    2727
    28   void operator()(CopyAtomsInterface &copyMethod, ClusterInterface::Cluster_impl cluster, const Vector &offset) const;
     28  bool operator()(CopyAtomsInterface &copyMethod, ClusterInterface::Cluster_impl cluster, const Vector &offset) const;
    2929};
    3030
Note: See TracChangeset for help on using the changeset viewer.