IMP  2.3.0
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 use 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  //! Add the representation for the given resolution.
69  /** If the resolution is
70  not given it is computed using get_resolution().
71  Currently only a type of 'BALLS' is supported; eventually, other types
72  of representation may be supported, eg Gaussians or density maps.
73  \note The resolution parameter will go away, as, most likely will the type.
74  */
75  void add_representation(kernel::ParticleIndexAdaptor rep,
76  RepresentationType type = BALLS,
77  double resolution = -1);
78 
79  /** Return a list of all resolutions that are available for a specific
80  * RepresentationType. */
81  Floats get_resolutions(RepresentationType type = BALLS) const;
82 };
83 
84 IMP_DECORATORS(Representation, Representations, Hierarchies);
85 
86 /** Return an estimate of the resolution of the hierarchy as used by
87  Representation.
88 
89  It is currently the inverse average radius of the leaves. */
90 
91 IMPATOMEXPORT double get_resolution(kernel::Model *m, kernel::ParticleIndex pi);
92 
93 /** \copydoc get_resolution(kernel::Model, kernel::ParticleIndex) */
94 inline double get_resolution(Hierarchy h) {
96 }
97 
98 IMPATOM_END_NAMESPACE
99 
100 #endif /* IMPATOM_REPRESENTATION_H */
Import IMP/kernel/Decorator.h in the namespace.
ParticleIndex get_particle_index() const
Returns the particle index decorated by this decorator.
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. (Note that implementation of inline functions in in int...
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:73