IMP  2.2.1
The Integrative Modeling Platform
Representation.h
Go to the documentation of this file.
1 /**
2  * \file IMP/atom/Representation.h \brief A decorator for Representations.
3  *
4  * Copyright 2007-2014 IMP Inventors. All rights reserved.
5  *
6  */
7 
8 #ifndef IMPATOM_REPRESENTATION_H
9 #define IMPATOM_REPRESENTATION_H
10 
11 #include <IMP/atom/atom_config.h>
12 #include "atom_macros.h"
13 #include "Hierarchy.h"
14 
15 #include <IMP/base_types.h>
16 #include <IMP/kernel/Particle.h>
17 #include <IMP/kernel/Model.h>
18 #include <IMP/Decorator.h>
19 
20 IMPATOM_BEGIN_NAMESPACE
21 
22 IMPATOMEXPORT extern const double ALL_RESOLUTIONS;
23 
24 /** Eventually, other types of representation will be supported, eg gaussians or
25  * density maps. */
27  BALLS = 0,
28  GAUSSIANS = 1
29 };
30 
31 //! A decorator for a representation.
32 /** It stores a number of copies of its sub hierarchy each with an associated
33  * resolution. You can used it to get the representation at a given resolution.
34  * \note The particle returned for a given representation should be thought of
35  * as replacing this particle (not as a child of it).
36  *
37  * \note Only one Representation node is allowed in any path up the tree as
38  * nesting them does not have a clear meaning.
39  */
40 class IMPATOMEXPORT Representation : public Hierarchy {
41  static IntsKey get_types_key();
42  static ParticleIndexesKey get_representations_key();
43  static FloatKey get_resolution_key(unsigned int index);
44  static FloatKey get_base_resolution_key();
45 
46  static void do_setup_particle(kernel::Model *m, kernel::ParticleIndex pi,
47  double resolution = -1);
48 
49  public:
51  /** For testing only. Will go away. */
52  IMP_DECORATOR_SETUP_1(Representation, double, resolution);
53 
55 
57  return m->get_has_attribute(get_base_resolution_key(), pi);
58  }
59 
60  /** Return the children at the resolution closest to `resolution` of the
61  * passed type. */
62  Hierarchy get_representation(double resolution,
63  RepresentationType type = BALLS);
64 
65  /** Return all children at all resolutions. */
66  Hierarchies get_representations(RepresentationType type = BALLS);
67 
68  /** Representation for given resolution. The resolution is computed using
69  * get_resolution().
70  * \note The resolution parameter will go away, as, most likely will the type.
71  */
72  void add_representation(kernel::ParticleIndexAdaptor rep,
73  RepresentationType type = BALLS,
74  double resolution = -1);
75 
76  /** Return a list of all resolutions that are available for a specific
77  * RepresentationType. */
78  Floats get_resolutions(RepresentationType type = BALLS) const;
79 };
80 
81 IMP_DECORATORS(Representation, Representations, Hierarchies);
82 
83 /** Return an estimate of the resolution of the hierarchy as used by
84  Representation.
85 
86  It is currently the inverse average radius of the leaves. */
87 
88 IMPATOMEXPORT double get_resolution(kernel::Model *m, kernel::ParticleIndex pi);
89 
90 /** \copydoc get_resolution(kernel::Model, kernel::particleIndex) */
91 inline double get_resolution(Hierarchy h) {
93 }
94 
95 IMPATOM_END_NAMESPACE
96 
97 #endif /* IMPATOM_REPRESENTATION_H */
Import IMP/kernel/Decorator.h in the namespace.
ParticleIndex get_particle_index() const
A base class for Keys.
Definition: kernel/Key.h:46
Import IMP/kernel/base_types.h in the namespace.
#define IMP_DECORATOR_METHODS(Name, Parent)
Model * get_model() const
Returns the Model containing the particle.
static bool get_is_setup(kernel::Model *m, kernel::ParticleIndex p)
Decorator for helping deal with a hierarchy of molecules.
A decorator for a representation.
The standard decorator for manipulating molecular structures.
#define IMP_DECORATOR_SETUP_0(Name)
Key< 5, true > IntsKey
The type used to identify int attributes in the Particles.
double get_resolution(Hierarchy h)
Storage of a model, its restraints, constraints and particles.
Classes to handle individual model particles.
Various important macros for implementing decorators.
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:72