IMP  2.2.0
The Integrative Modeling Platform
Voxel.h
Go to the documentation of this file.
1 /**
2  * \file IMP/em/Voxel.h \brief voxel decorator.
3  *
4  * Copyright 2007-2014 IMP Inventors. All rights reserved.
5  *
6  */
7 
8 #ifndef IMPEM_VOXEL_H
9 #define IMPEM_VOXEL_H
10 
11 #include <IMP/em/em_config.h>
12 #include <IMP/Decorator.h>
13 #include <IMP/core/XYZ.h>
14 #include <IMP/core/XYZR.h>
15 #include <IMP/algebra/Vector3D.h>
16 #include <IMP/algebra/Sphere3D.h>
17 
18 IMPEM_BEGIN_NAMESPACE
19 
20 //! A a decorator for a particle that stores data on a density voxel , such as:
21 //! position (x,y,z) attributes and density attributes
22 /**
23  \ingroup decorators
24  */
25 class IMPEMEXPORT Voxel : public Decorator {
26  static void do_setup_particle(kernel::Model *m, kernel::ParticleIndex pi,
27  const algebra::Vector3D &position, Float radius,
28  Float density) {
29  core::XYZR::setup_particle(m, pi, algebra::Sphere3D(position, radius));
30  m->add_attribute(get_density_key(), pi, density, false);
31  }
32 
33  public:
34  static const FloatKey get_density_key();
35  static const FloatKeys get_keys();
36 
39  Float, density);
40 
41  IMP_DECORATOR_GET_SET(density, get_density_key(), Float, Float);
42 
43  static bool get_is_setup(kernel::Model *m, kernel::ParticleIndex pi) {
44  if (!core::XYZ::get_is_setup(m, pi)) return false;
45  return m->get_has_attribute(get_density_key(), pi);
46  }
47 };
48 
49 IMP_DECORATORS(Voxel, Voxels, kernel::Particles);
50 
51 IMPEM_END_NAMESPACE
52 
53 #endif /* IMPEM_VOXEL_H */
Import IMP/kernel/Decorator.h in the namespace.
#define IMP_DECORATOR_METHODS(Name, Parent)
Simple xyz decorator.
static XYZR setup_particle(kernel::Model *m, ParticleIndex pi)
Definition: XYZR.h:48
VectorD< 3 > Vector3D
Definition: VectorD.h:395
double Float
Basic floating-point value (could be float, double...)
Definition: base/types.h:20
#define IMP_DECORATOR_SETUP_3(Name, FirstArgumentType, first_argument_name,SecondArgumentType, second_argument_name,ThirdArgumentType, third_argument_name)
void add_attribute(TypeKey attribute_key, ParticleIndex particle, Type value)
Simple 3D vector class.
Simple 3D sphere class.
Decorator for a sphere-like particle.
#define IMP_DECORATOR_GET_SET(name, AttributeKey, Type, ReturnType)
Define methods for getting and setting a particular simple field.
#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