/
Uncertainty.h
52 lines (40 loc) · 1.37 KB
/
Uncertainty.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* \file IMP/pmi/Uncertainty.h
* \brief A decorator for particles with Uncertainty
*
* Copyright 2007-2022 IMP Inventors. All rights reserved.
*/
#ifndef IMPPMI_UNCERTAINTY_H
#define IMPPMI_UNCERTAINTY_H
#include <IMP/pmi/pmi_config.h>
#include <IMP/PairContainer.h>
#include <IMP/SingletonContainer.h>
#include <IMP/Decorator.h>
#include <IMP/decorator_macros.h>
IMPPMI_BEGIN_NAMESPACE
//! Add uncertainty to a particle
/** The uncertainty of the particle can be assumed to be the radius
of a particle.
*/
class IMPPMIEXPORT Uncertainty : public Decorator {
static void do_setup_particle(Model *m, ParticleIndex pi, double uncertainty) {
m->add_attribute(get_uncertainty_key(), pi, uncertainty);
}
public:
static bool get_is_setup(Model *m, ParticleIndex pi) {
return m->get_has_attribute(get_uncertainty_key(), pi);
}
Float get_uncertainty() const {
return get_model()->get_attribute(get_uncertainty_key(),
get_particle_index());
}
void set_uncertainty(Float d) {
get_model()->set_attribute(get_uncertainty_key(), get_particle_index(), d);
}
IMP_DECORATOR_METHODS(Uncertainty, Decorator);
/** Add the specified Uncertainty to the particle. */
IMP_DECORATOR_SETUP_1(Uncertainty, Float, uncertainty);
static FloatKey get_uncertainty_key();
};
IMPPMI_END_NAMESPACE
#endif /* IMPPMI_UNCERTAINTY_H */