IMP logo
IMP Reference Guide  develop.63b38c487d,2024/12/21
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-2022 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(Model *m, 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(Model *m, 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, Particles);
50 
51 IMPEM_END_NAMESPACE
52 
53 #endif /* IMPEM_VOXEL_H */
The base class for decorators.
#define IMP_DECORATOR_GET_SET(name, AttributeKey, Type, ReturnType)
Define methods for getting and setting a particular simple field.
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition: XYZR.h:48
Simple XYZ decorator.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
void add_attribute(TypeKey attribute_key, ParticleIndex particle, Type value)
add particle attribute with the specified key and initial value
Interface to specialized Particle types (e.g. atoms)
Definition: Decorator.h:119
#define IMP_DECORATOR_METHODS(Name, Parent)
VectorD< 3 > Vector3D
Definition: VectorD.h:408
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:19
Simple 3D vector class.
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
bool get_has_attribute(TypeKey attribute_key, ParticleIndex particle) const
return true if particle has attribute with the specified key
#define IMP_DECORATOR_SETUP_3(Name, FirstArgumentType, first_argument_name,SecondArgumentType, second_argument_name,ThirdArgumentType, third_argument_name)
Simple 3D sphere class.
Decorator for a sphere-like particle.