home
about
news
download
doc
source
systems
tests
bugs
contact
IMP Reference Guide
2.5.0
The Integrative Modeling Platform
IMP Manual
Reference Guide
Modules
Classes
Examples
include
IMP
atom
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-2015 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/Particle.h
>
17
#include <
IMP/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 */
25
enum
RepresentationType
{
26
BALLS = 0,
27
DENSITIES = 1
28
};
29
30
//! A decorator for a representation.
31
/** It stores a number of copies of its sub hierarchy each with an associated
32
* resolution. You can use it to get the representation at a given resolution.
33
* \note The particle returned for a given representation should be thought of
34
* as replacing this particle (not as a child of it).
35
*
36
* \note Only one Representation node is allowed in any path up the tree as
37
* nesting them does not have a clear meaning.
38
*/
39
class
IMPATOMEXPORT
Representation
:
public
Hierarchy
{
40
static
IntsKey
get_types_key();
41
static
ParticleIndexesKey
get_representations_key();
42
static
FloatKey
get_resolution_key(
unsigned
int
index);
43
static
FloatKey
get_base_resolution_key();
44
45
static
void
do_setup_particle(
Model
*m,
ParticleIndex
pi,
46
double
resolution = -1);
47
48
public
:
49
IMP_DECORATOR_SETUP_0
(
Representation
);
50
IMP_DECORATOR_SETUP_1
(
Representation
,
double
, resolution);
51
52
IMP_DECORATOR_METHODS
(
Representation
,
Hierarchy
);
53
54
static
bool
get_is_setup
(
Model
*m,
ParticleIndex
pi) {
55
return
m->get_has_attribute(get_base_resolution_key(), pi);
56
}
57
58
//! Get children at the resolution closest to `resolution` of the passed type.
59
Hierarchy
get_representation(
double
resolution,
60
RepresentationType
type = BALLS);
61
62
//! Return all children at all resolutions.
63
Hierarchies
get_representations(
RepresentationType
type = BALLS);
64
65
//! Add the representation for the given resolution.
66
/** If the resolution is
67
not given it is computed using get_resolution().
68
Currently only 'BALLS' and 'DENSITIES' are supported; eventually,
69
other types of representation may be supported.
70
*/
71
void
add_representation(
ParticleIndexAdaptor
rep,
72
RepresentationType
type = BALLS,
73
double
resolution = -1);
74
75
//! Get all resolutions that are available for a specific RepresentationType.
76
Floats
get_resolutions(
RepresentationType
type = BALLS)
const
;
77
};
78
79
IMP_DECORATORS
(Representation, Representations, Hierarchies);
80
81
//! Estimate the resolution of the hierarchy as used by Representation.
82
/** It is currently the inverse average radius of the leaves.
83
*/
84
IMPATOMEXPORT
double
get_resolution
(
Model
*m,
ParticleIndex
pi);
85
86
/** \copydoc get_resolution(Model, ParticleIndex) */
87
inline
double
get_resolution
(
Hierarchy
h) {
88
return
get_resolution
(h.
get_model
(), h.
get_particle_index
());
89
}
90
91
IMPATOM_END_NAMESPACE
92
93
#endif
/* IMPATOM_REPRESENTATION_H */
Decorator.h
The base class for decorators.
IMP::Decorator::get_particle_index
ParticleIndex get_particle_index() const
Returns the particle index decorated by this decorator.
Definition:
Decorator.h:186
base_types.h
Basic types used by IMP.
IMP::atom::RepresentationType
RepresentationType
Definition:
Representation.h:25
IMP_DECORATOR_SETUP_1
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
Definition:
decorator_macros.h:125
IMP::ParticleIndexAdaptor
Definition:
particle_index.h:32
IMP::Decorator::get_model
Model * get_model() const
Returns the Model containing the particle.
Definition:
Decorator.h:189
Model.h
Storage of a model, its restraints, constraints and particles.
IMP::Index< ParticleIndexTag >
IMP::Vector< Hierarchy >
IMP::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
Model.h:72
Hierarchy.h
Decorator for helping deal with a hierarchy of molecules.
IMP::atom::Representation
A decorator for a representation.
Definition:
Representation.h:39
IMP::atom::Hierarchy
The standard decorator for manipulating molecular structures.
Definition:
atom/Hierarchy.h:203
IMP::atom::get_resolution
double get_resolution(Hierarchy h)
Definition:
Representation.h:87
IMP::Key
A base class for Keys.
Definition:
Key.h:46
IMP_DECORATOR_SETUP_0
#define IMP_DECORATOR_SETUP_0(Name)
Definition:
decorator_macros.h:111
Particle.h
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
atom_macros.h
Various important macros for implementing decorators.
IMP::atom::Hierarchy::get_is_setup
static bool get_is_setup(Model *m, ParticleIndex p)
Check if the particle has the needed attributes for a cast to succeed.
Definition:
atom/Hierarchy.h:276
IMP_DECORATOR_METHODS
#define IMP_DECORATOR_METHODS(Name, Parent)
Definition:
decorator_macros.h:27
IMP_DECORATORS
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
Definition:
decorator_macros.h:377