IMP
2.2.0
The Integrative Modeling Platform
IMP Mainpage
All IMP Modules
Related Pages
Modules
Namespaces
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 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
:
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
/** 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) {
92
return
get_resolution
(h.
get_model
(), h.
get_particle_index
());
93
}
94
95
IMPATOM_END_NAMESPACE
96
97
#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
Definition:
kernel/Decorator.h:183
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:186
IMP::atom::Hierarchy::get_is_setup
static bool get_is_setup(kernel::Model *m, kernel::ParticleIndex p)
Definition:
atom/Hierarchy.h:279
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:198
IMP_DECORATOR_SETUP_0
#define IMP_DECORATOR_SETUP_0(Name)
Definition:
kernel/decorator_macros.h:126
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:91
IMP::base::Index< ParticleIndexTag >
Model.h
Storage of a model, its restraints, constraints and particles.
Particle.h
Classes to handle individual model particles.
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:140
IMP_DECORATORS
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
Definition:
kernel/decorator_macros.h:391
IMP::kernel::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
kernel/Model.h:72
IMP::kernel::ParticleIndexAdaptor
Definition:
kernel/particle_index.h:32