Changeset 42b6de for src/Filling/Filler.cpp
- Timestamp:
- Apr 6, 2012, 11:44:50 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:
- cc9119
- Parents:
- 57dd40
- git-author:
- Frederik Heber <heber@…> (04/05/12 09:38:33)
- git-committer:
- Frederik Heber <heber@…> (04/06/12 11:44:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Filling/Filler.cpp
r57dd40 r42b6de 46 46 47 47 48 /** Constructor for class Filler.49 *50 * \note We store inverted \a _predicate because we need it only for51 * remove_copy_if which works in this inverted way as desired.52 *53 * @param _mesh Mesh with a NodeSet that fills its Shape54 * @param _predicate predicate construct to check at each Node55 * @param _inserter inserter which places the cloned cluster56 */57 48 Filler::Filler(const Mesh &_mesh, const FillPredicate &_predicate, const Inserter &_inserter) : 58 49 mesh(_mesh), … … 61 52 {} 62 53 63 /** Destructor for class Filler.64 *65 */66 54 Filler::~Filler() 67 55 {} 68 56 69 /** Fill in the desired Cluster at each remaining node.70 *71 * \note The cluster is non-const because it is moved to the first vacant node.72 *73 * @param copyMethod functor that knows how to copy atoms.74 * @param cluster set of atomic ids contained in a specific Shape to fill each Node with75 * @return true - at least one node has been filled, false - no node filled76 */77 57 bool Filler::operator()( 78 58 CopyAtomsInterface ©Method, 79 ClusterInterface::Cluster_impl cluster) const 59 ClusterInterface::Cluster_impl cluster, 60 ClusterVector_t &ClonedClusters) const 80 61 { 81 62 const NodeSet &nodes = mesh.getNodes(); … … 126 107 127 108 // clone clusters 128 std::vector<ClusterInterface::Cluster_impl> clusters(FillNodes.size());109 ClonedClusters.resize(FillNodes.size()); 129 110 { 130 std::vector<ClusterInterface::Cluster_impl>::iterator clusteriter = clusters.begin();111 std::vector<ClusterInterface::Cluster_impl>::iterator clusteriter = ClonedClusters.begin(); 131 112 *clusteriter = cluster; 132 113 clusteriter++; … … 140 121 // returns true, we'll have the iterator pointing at first cluster 141 122 std::vector<ClusterInterface::Cluster_impl>::const_iterator inserteriter = 142 std::search( clusters.begin(), clusters.end(), FillNodes.begin(), FillNodes.end(),123 std::search(ClonedClusters.begin(), ClonedClusters.end(), FillNodes.begin(), FillNodes.end(), 143 124 boost::bind(&Inserter::operator(), boost::cref(inserter), _1, _2)); 144 if( inserteriter != clusters.begin()) {125 if( inserteriter != ClonedClusters.begin()) { 145 126 ELOG(1, "Not all cloned clusters could be successfully inserted."); 146 127 return false; … … 150 131 // create molecules for each cluster and fill in atoms 151 132 { 152 std::vector<molecule *> molecules( clusters.size()-1, NULL);133 std::vector<molecule *> molecules(ClonedClusters.size()-1, NULL); 153 134 std::generate_n(molecules.begin(), FillNodes.size()-1, 154 135 boost::bind(&World::createMolecule, World::getPointer()) ); 155 std::vector<ClusterInterface::Cluster_impl>::const_iterator clusteriter = clusters.begin();136 std::vector<ClusterInterface::Cluster_impl>::const_iterator clusteriter = ClonedClusters.begin(); 156 137 ++clusteriter; 157 138 std::vector<molecule *>::iterator moliter = molecules.begin(); … … 164 145 165 146 // give final statment on whether at least \a single cluster has been placed 166 if ( FillNodes.size() != 0) 167 return true; 168 else 169 return false; 147 return ( FillNodes.size() != 0); 170 148 } 171 149
Note:
See TracChangeset
for help on using the changeset viewer.