IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
SingletonModifier.h
Go to the documentation of this file.
1// Autogenerated by tools/build/make_containers.py
2// from tools/build/container_templates/kernel/ClassnameModifier.h
3// Do not edit - any changes will be lost!
4
5/**
6 * \file IMP/SingletonModifier.h
7 * \brief A Modifier on ParticlesTemp
8 *
9 * Copyright 2007-2026 IMP Inventors. All rights reserved.
10 */
11
12#ifndef IMPKERNEL_SINGLETON_MODIFIER_H
13#define IMPKERNEL_SINGLETON_MODIFIER_H
14
15#include <IMP/kernel_config.h>
17#include "base_types.h"
18#include "internal/container_helpers.h"
20
21IMPKERNEL_BEGIN_NAMESPACE
22
23//! A base class for modifiers of ParticlesTemp
24/** The primary function of such a class is to change
25 the passed particles.
26
27 \see IMP::SingletonPredicate
28
29 Implementers should see IMP_SINGLETON_MODIFIER().
30 */
31class IMPKERNELEXPORT SingletonModifier : public ParticleInputs,
32 public ParticleOutputs,
33 public Object {
34 public:
35 typedef Particle* Argument;
36 typedef ParticleIndex IndexArgument;
37 SingletonModifier(std::string name = "SingletonModifier %1%");
38
39 /** Apply the function to a single value*/
40 virtual void apply_index(Model *m, ParticleIndex v) const = 0;
41
42 /** Apply the function to a collection of ParticlesTemp */
43 /** If bounds are passed, only apply to ones between the upper and
44 lower bounds.*/
45 virtual void apply_indexes(Model *m, const ParticleIndexes &o,
46 unsigned int lower_bound,
47 unsigned int upper_bound) const {
48 for (unsigned int i = lower_bound; i < upper_bound; ++i) {
49 apply_index(m, o[i]);
50 }
51 }
52
53 /** Apply the function to a collection of ParticlesTemp */
54 /** Information on particles that moved since the last scoring function
55 evaluation is also passed, which may be used to accelerate the
56 computation. */
57 virtual void apply_indexes_moved(
58 Model *m, const ParticleIndexes &o,
59 unsigned int lower_bound, unsigned int upper_bound,
60 const ParticleIndexes &moved_pis,
61 const ParticleIndexes &reset_pis) const {
62 IMP_UNUSED(moved_pis);
63 IMP_UNUSED(reset_pis);
64 apply_indexes(m, o, lower_bound, upper_bound);
65 }
66};
67
68IMPKERNEL_END_NAMESPACE
69
70#endif /* IMPKERNEL_SINGLETON_MODIFIER_H */
Class for adding derivatives from restraints to the model.
Basic types used by IMP.
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
Object(std::string name)
Construct an object with the given name.
Base class for objects that take particle arguments and read from them.
Base class for objects that take particle arguments and modify them.
Class to handle individual particles of a Model object.
Definition Particle.h:45
virtual void apply_index(Model *m, ParticleIndex v) const =0
virtual void apply_indexes(Model *m, const ParticleIndexes &o, unsigned int lower_bound, unsigned int upper_bound) const
virtual void apply_indexes_moved(Model *m, const ParticleIndexes &o, unsigned int lower_bound, unsigned int upper_bound, const ParticleIndexes &moved_pis, const ParticleIndexes &reset_pis) const
Classes used in the construction of ModelObjects.
Index< ParticleIndexTag > ParticleIndex
Definition base_types.h:196
Vector< ParticleIndex, std::allocator< ParticleIndex > > ParticleIndexes
A list of particles, each identified by its ParticleIndex.
Definition base_types.h:199
#define IMP_UNUSED(variable)