IMP logo
IMP Reference Guide  develop.63b38c487d,2024/12/21
The Integrative Modeling Platform
PairModifier.h
Go to the documentation of this file.
1 // Autogenerated by ../../../../tmp/nightly-build-465/imp-20241221.develop.63b38c487d/tools/build/make_containers.py
2 // from ../../../../tmp/nightly-build-465/imp-20241221.develop.63b38c487d/tools/build/container_templates/kernel/ClassnameModifier.h
3 // Do not edit - any changes will be lost!
4 
5 /**
6  * \file IMP/PairModifier.h
7  * \brief A Modifier on ParticlePairsTemp
8  *
9  * Copyright 2007-2022 IMP Inventors. All rights reserved.
10  */
11 
12 #ifndef IMPKERNEL_PAIR_MODIFIER_H
13 #define IMPKERNEL_PAIR_MODIFIER_H
14 
15 #include <IMP/kernel_config.h>
16 #include "DerivativeAccumulator.h"
17 #include "base_types.h"
18 #include "internal/container_helpers.h"
19 #include "model_object_helpers.h"
20 
21 IMPKERNEL_BEGIN_NAMESPACE
22 
23 //! A base class for modifiers of ParticlePairsTemp
24 /** The primary function of such a class is to change
25  the passed particles.
26 
27  \see IMP::PairPredicate
28 
29  Implementers should see IMP_PAIR_MODIFIER(). Also see
30  PairDerivativeModifier.
31  */
32 class IMPKERNELEXPORT PairModifier : public ParticleInputs,
33  public ParticleOutputs,
34  public Object {
35  public:
36  typedef ParticlePair Argument;
38  PairModifier(std::string name = "PairModifier %1%");
39 
40  /** Apply the function to a single value*/
41  virtual void apply_index(Model *m, const ParticleIndexPair& v) const = 0;
42 
43  /** Apply the function to a collection of ParticlePairsTemp */
44  /** If bounds are passed, only apply to ones between the upper and
45  lower bounds.*/
46  virtual void apply_indexes(Model *m, const ParticleIndexPairs &o,
47  unsigned int lower_bound,
48  unsigned int upper_bound) const {
49  for (unsigned int i = lower_bound; i < upper_bound; ++i) {
50  apply_index(m, o[i]);
51  }
52  }
53 
54  /** Apply the function to a collection of ParticlePairsTemp */
55  /** Information on particles that moved since the last scoring function
56  evaluation is also passed, which may be used to accelerate the
57  computation. */
58  virtual void apply_indexes_moved(
59  Model *m, const ParticleIndexPairs &o,
60  unsigned int lower_bound, unsigned int upper_bound,
61  const ParticleIndexes &moved_pis,
62  const ParticleIndexes &reset_pis) const {
63  IMP_UNUSED(moved_pis);
64  IMP_UNUSED(reset_pis);
65  apply_indexes(m, o, lower_bound, upper_bound);
66  }
67 };
68 
69 IMPKERNEL_END_NAMESPACE
70 
71 #endif /* IMPKERNEL_PAIR_MODIFIER_H */
Basic types used by IMP.
A class to store a fixed array of same-typed values.
Definition: Array.h:40
Base class for objects that take particle arguments and modify them.
Class for adding derivatives from restraints to the model.
Base class for objects that take particle arguments and read from them.
A base class for modifiers of ParticlePairsTemp.
Definition: PairModifier.h:32
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
Common base class for heavy weight IMP objects.
Definition: Object.h:111
#define IMP_UNUSED(variable)
Classes used in the construction of ModelObjects.
virtual void apply_indexes_moved(Model *m, const ParticleIndexPairs &o, unsigned int lower_bound, unsigned int upper_bound, const ParticleIndexes &moved_pis, const ParticleIndexes &reset_pis) const
Definition: PairModifier.h:58
virtual void apply_indexes(Model *m, const ParticleIndexPairs &o, unsigned int lower_bound, unsigned int upper_bound) const
Definition: PairModifier.h:46