IMP  2.1.1
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-2013 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 {
27  static void do_setup_particle(kernel::Model *m, kernel::ParticleIndex pi,
28  const algebra::Vector3D &position,
29  Float radius,
30  Float density) {
31  core::XYZR::setup_particle(m, pi, algebra::Sphere3D(position,radius));
32  m->add_attribute(get_density_key(),pi, density,false);
33  }
34  public:
35 
36  static const FloatKey get_density_key();
37  static const FloatKeys get_keys();
38 
41  Float, radius,
42  Float, density);
43 
44  IMP_DECORATOR_GET_SET(density, get_density_key(), Float, Float);
45 
47  if (!core::XYZ::get_is_setup(m, pi)) return false;
48  return m->get_has_attribute(get_density_key(), pi);
49  }
50 };
51 
52 IMP_DECORATORS(Voxel, Voxels, kernel::Particles);
53 
54 IMPEM_END_NAMESPACE
55 
56 #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
static bool get_is_setup(Particle *p)
Return true if the particle can be cast to the decorator.
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.