IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
FloatIndex.h
Go to the documentation of this file.
1/**
2 * \file IMP/FloatIndex.h
3 * \brief A FloatIndex identifies an optimized attribute in a model.
4 *
5 * Copyright 2007-2026 IMP Inventors. All rights reserved.
6 *
7 */
8
9#ifndef IMPKERNEL_FLOAT_INDEX_H
10#define IMPKERNEL_FLOAT_INDEX_H
11
12#include <IMP/kernel_config.h>
13#include "base_types.h"
14#include "particle_index.h"
15#include <IMP/tuple_macros.h>
16
17IMPKERNEL_BEGIN_NAMESPACE
18
19class Model;
20
21//! A FloatIndex identifies an optimized attribute in a model.
22/** This can be a single Float attribute, or a single element in an
23 optimized Vector3D or Vector4D, depending on the constructor used.
24 */
25class IMPKERNELEXPORT FloatIndex : public Value {
26 FloatKey fk_;
29 int dim_;
30 int index_;
31 ParticleIndex pi_;
32public:
33 FloatIndex(IMP::ParticleIndex pi, IMP::FloatKey k)
34 : fk_(k), dim_(0), pi_(pi) {}
35
36 FloatIndex(IMP::ParticleIndex pi, IMP::Vector3DDerivKey k, int index)
37 : v3k_(k), dim_(3), index_(index), pi_(pi) {}
38
39 FloatIndex(IMP::ParticleIndex pi, IMP::Vector4DDerivKey k, int index)
40 : v4k_(k), dim_(4), index_(index), pi_(pi) {}
41
42 FloatKey get_float_key() const { return fk_; }
43
44 void set_value(Model *m, Float v) const;
45
46 Float get_value(Model *m) const;
47
48 Float get_derivative(Model *m) const;
49
50 IMP_SHOWABLE_INLINE(FloatIndex, out << "(" << pi_ << ")");
51};
52
54
55IMPKERNEL_END_NAMESPACE
56
57#endif /* IMPKERNEL_FLOAT_INDEX_H */
Basic types used by IMP.
A FloatIndex identifies an optimized attribute in a model.
Definition FloatIndex.h:25
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
Index< ParticleIndexTag > ParticleIndex
Definition base_types.h:196
Key< 17 > Vector3DDerivKey
The type used to identify 3D vector attributes&derivatives in the Particles.
Definition base_types.h:106
double Float
Basic floating-point value (could be float, double...).
Definition types.h:19
Key< 19 > Vector4DDerivKey
The type used to identify 4D vector attributes&derivatives in the Particles.
Definition base_types.h:114
Key< 0 > FloatKey
The type used to identify float attributes in the Particles.
Definition base_types.h:32
IMP::Vector< FloatIndex > FloatIndexes
Definition FloatIndex.h:53
Functions and adaptors for dealing with particle indexes.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
Macros to help in defining tuple classes.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.