source: src/Descriptors/AtomDescriptor.hpp@ 47d041

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
Last change on this file since 47d041 was 56f73b, checked in by Frederik Heber <heber@…>, 14 years ago

Added config.h also to all header files, code check test ascertain this in the future.

  • as we want to use config.h to pass stuff such as MEMDEBUG, NDEBUG, LOG_OBSERVER, we have to make sure that it is present in each and every file.
  • split up CodeChecks/testsuite.at: each test has its own .at file.
  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*
2 * AtomDescriptor.hpp
3 *
4 * Created on: Feb 5, 2010
5 * Author: crueger
6 */
7
8#ifndef ATOMDESCRIPTOR_HPP_
9#define ATOMDESCRIPTOR_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16
17
18#include <vector>
19#include <map>
20#include <boost/shared_ptr.hpp>
21#include "World.hpp"
22
23class World;
24class atom;
25
26// internal implementation, allows assignment, copying etc
27class AtomDescripter_impl;
28
29/**
30 * An AtomDescriptor describes a Set of Atoms from the World. Can be used for any method that needs to work on
31 * a specific set of Atoms.
32 *
33 * This Class is implemented using the PIMPL-Idion, i.e. this class only contains an abstract structure
34 * that forwards any request to a wrapped pointer-to-implementation. This way operators and calculations
35 * on Descriptors are possible.
36 *
37 * Concrete Implementation Objects can be shared between multiple Wrappers, so make sure that
38 * any Implementation remainst constant during lifetime.
39 */
40class AtomDescriptor {
41 // close coupling to the world to allow access
42 friend atom* World::getAtom(AtomDescriptor descriptor);
43 friend World::AtomComposite World::getAllAtoms(AtomDescriptor descriptor);
44 template <class,class,class> friend class SelectiveIterator;
45
46 friend AtomDescriptor operator&&(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
47 friend AtomDescriptor operator||(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
48 friend AtomDescriptor operator!(const AtomDescriptor &arg);
49
50public:
51 typedef boost::shared_ptr<AtomDescriptor_impl> impl_ptr; //!< Allow easy changes of the pointer-to-implementation type
52
53 AtomDescriptor(impl_ptr);
54
55 /**
56 * Copy constructor.
57 * Takes the Implementation from the copied object and sets it's own pointer to link there.
58 * This way the actuall implementation object is shared between copy and original
59 */
60 AtomDescriptor(const AtomDescriptor&);
61 ~AtomDescriptor();
62
63 /**
64 * Assignment Operator.
65 *
66 * Implemented by setting the pointer to the new Implementation.
67 */
68 AtomDescriptor &operator=(AtomDescriptor &);
69
70protected:
71 /**
72 * forward Method to implementation
73 */
74 atom* find();
75
76 /**
77 * forward Method to implementation
78 */
79 std::vector<atom*> findAll();
80
81 /**
82 * Return the implementation this Wrapper currently points to.
83 * Used for copying, assignment and in Iterators over subsets of the World.
84 */
85 impl_ptr get_impl() const;
86
87private:
88 impl_ptr impl;
89};
90
91/**
92 * produce an Atomdescriptor that at the point of construction contains an implementation that matches all Atoms
93 */
94AtomDescriptor AllAtoms();
95
96/**
97 * produce an Atomdescriptor that at the point of construction contains an implementation that matches no Atoms
98 */
99AtomDescriptor NoAtoms();
100
101/**
102 * Set Intersection for two Atomdescriptors. The resulting Atomdescriptor will only match an Atom if both
103 * given Atomdescriptors also match. Uses short circuit inside, so the second predicate wont be called
104 * when the first one failed.
105 */
106AtomDescriptor operator&&(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
107
108/**
109 * Set Union for two AtomDescriptors. The resulting AtomDescriptor will match an Atom if at least one of
110 * the two given AtomDescriptors does match. Used short circuit inside, so the second predicate wont
111 * be called when the first one failed.
112 */
113AtomDescriptor operator||(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
114
115/**
116 * Set inversion for an AtomDescriptor. Matches an Atom if the given AtomDescriptor did not match.
117 */
118AtomDescriptor operator!(const AtomDescriptor &arg);
119
120#endif /* ATOMDESCRIPTOR_HPP_ */
Note: See TracBrowser for help on using the repository browser.