IMP logo
IMP Reference Guide  develop.d97d4ead1f,2024/11/21
The Integrative Modeling Platform
FixedRefiner.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/FixedRefiner.h
3  * \brief A particle refiner which returns a fixed set of particles
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPCORE_FIXED_REFINER_H
9 #define IMPCORE_FIXED_REFINER_H
10 
11 #include <IMP/core/core_config.h>
12 
13 #include <IMP/PairContainer.h>
14 #include <IMP/SingletonContainer.h>
15 #include <IMP/Refiner.h>
16 
17 IMPCORE_BEGIN_NAMESPACE
18 
19 //! The refiner can refine any particle by returning a fixed set
20 /**
21  */
22 class IMPCOREEXPORT FixedRefiner : public Refiner {
23  Model* m_;
24  ParticleIndexes pis_;
25 
26  public:
27  //! Store the set of particles
28  FixedRefiner(const ParticlesTemp &ps);
29 
30  //! Store the set of particle indexes from passed model
31  FixedRefiner(Model* m, const ParticleIndexes &pis);
32 
33  virtual bool get_can_refine(Particle *) const override
34  { return true; }
35 
36  //! Returns the fixed set of particles.
37  /** \note the passed Particle is ignored.
38  */
39  virtual const ParticlesTemp get_refined(Particle *p) const
40  override;
41 
42  //! Returns the fixed set of particles, as indexes.
43  /** @note the passed ParticleIndex is ignored.
44 
45  @note For FixedRefiner, this is a faster operation than
46  get_refined()
47 
48  @note It is assumed that the refined particles are also in model m.
49 
50  */
52  (Model* m, ParticleIndex) const override
53  {
54  IMP_USAGE_CHECK(m == m_,
55  "mismatching models for refined and coarse particles");
56  IMP_UNUSED(m);
57  return pis_;
58  }
59 
61  (Model *m, ParticleIndex pi) const override
62  {
63  IMP_USAGE_CHECK(m == m_,
64  "mismatching models for refined and coarse particles");
65  IMP_UNUSED(m);
66  IMP_UNUSED(pi);
67  return pis_;
68  }
69 
70 
71 #ifndef SWIG
73 #endif
75  Model *m, const ParticleIndexes &pis) const override;
77 };
78 
79 IMPCORE_END_NAMESPACE
80 
81 #endif /* IMPCORE_FIXED_REFINER_H */
The refiner can refine any particle by returning a fixed set.
Definition: FixedRefiner.h:22
A container for Singletons.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
A container for Pairs.
Refine a particle into a list of particles.
#define IMP_UNUSED(variable)
virtual ModelObjectsTemp do_get_inputs(Model *m, const ParticleIndexes &pis) const =0
Overload this method to specify the inputs.
virtual ParticleIndexes get_refined_indexes(Model *m, ParticleIndex pi) const
Return the indexes of the particles returned by get_refined()
virtual ParticleIndexes const & get_refined_indexes_by_ref(Model *m, ParticleIndex pi) const
Return the indexes of the particles returned by get_refined()
Definition: Refiner.h:82
virtual const ParticlesTemp get_refined(Particle *a) const =0
Refine the passed particle into a set of particles.
Abstract class to implement hierarchical methods.
Definition: Refiner.h:34
Class to handle individual particles of a Model object.
Definition: Particle.h:43
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Definition: check_macros.h:168
virtual bool get_can_refine(Particle *) const override
Return true if this refiner can refine that particle.
Definition: FixedRefiner.h:33