IMP
2.3.1
The Integrative Modeling Platform
IMP Mainpage
Modules
Applications
Related Pages
Groups
Classes
Files
Examples
Indexes
File List
File Members
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. */
26
enum
RepresentationType
{
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
:
50
IMP_DECORATOR_SETUP_0
(
Representation
);
51
/** For testing only. Will go away. */
52
IMP_DECORATOR_SETUP_1
(
Representation
,
double
, resolution);
53
54
IMP_DECORATOR_METHODS
(
Representation
,
Hierarchy
);
55
56
static
bool
get_is_setup
(
kernel::Model
*m,
kernel::ParticleIndex
pi) {
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) {
95
return
get_resolution
(h.
get_model
(), h.
get_particle_index
());
96
}
97
98
IMPATOM_END_NAMESPACE
99
100
#endif
/* IMPATOM_REPRESENTATION_H */
Decorator.h
Import IMP/kernel/Decorator.h in the namespace.
IMP::kernel::Decorator::get_particle_index
ParticleIndex get_particle_index() const
Returns the particle index decorated by this decorator.
Definition:
kernel/Decorator.h:186
IMP::kernel::Key
A base class for Keys.
Definition:
kernel/Key.h:46
base_types.h
Import IMP/kernel/base_types.h in the namespace.
IMP::atom::RepresentationType
RepresentationType
Definition:
Representation.h:26
IMP_DECORATOR_METHODS
#define IMP_DECORATOR_METHODS(Name, Parent)
Definition:
kernel/decorator_macros.h:27
IMP::kernel::Decorator::get_model
Model * get_model() const
Returns the Model containing the particle.
Definition:
kernel/Decorator.h:189
IMP::atom::Hierarchy::get_is_setup
static bool get_is_setup(kernel::Model *m, kernel::ParticleIndex p)
Definition:
atom/Hierarchy.h:286
IMP::base::Vector< Hierarchy >
Hierarchy.h
Decorator for helping deal with a hierarchy of molecules.
IMP::atom::Representation
A decorator for a representation.
Definition:
Representation.h:40
IMP::atom::Hierarchy
The standard decorator for manipulating molecular structures.
Definition:
atom/Hierarchy.h:203
IMP_DECORATOR_SETUP_0
#define IMP_DECORATOR_SETUP_0(Name)
Definition:
kernel/decorator_macros.h:111
IMP::kernel::IntsKey
Key< 5, true > IntsKey
The type used to identify int attributes in the Particles.
Definition:
kernel/base_types.h:56
IMP::atom::get_resolution
double get_resolution(Hierarchy h)
Definition:
Representation.h:94
IMP::base::Index< ParticleIndexTag >
Model.h
Storage of a model, its restraints, constraints and particles.
Particle.h
Classes to handle individual model particles. (Note that implementation of inline functions in in int...
atom_macros.h
Various important macros for implementing decorators.
IMP_DECORATOR_SETUP_1
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
Definition:
kernel/decorator_macros.h:125
IMP_DECORATORS
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
Definition:
kernel/decorator_macros.h:377
IMP::kernel::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
kernel/Model.h:73
IMP::kernel::ParticleIndexAdaptor
Definition:
kernel/particle_index.h:32