9 #ifndef IMPCORE_GAUSSIAN_H
10 #define IMPCORE_GAUSSIAN_H
13 #include <IMP/core/core_config.h>
21 #include "internal/rigid_bodies.h"
22 #include <Eigen/Dense>
24 #include <cereal/access.hpp>
25 #include <cereal/types/base_class.hpp>
27 IMPCORE_BEGIN_NAMESPACE
29 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
37 friend class cereal::access;
39 template<
class Archive>
void serialize(Archive &ar) {
40 ar(cereal::base_class<Object>(
this));
41 for (
unsigned i = 0; i < 3; ++i) {
42 for (
unsigned j = 0; j < 3; ++j) {
50 Matrix3D(Eigen::Matrix3d mat,
51 std::string name=
"Matrix3DDensityMap%1%"):Object(name),mat_(mat),
52 quaternion_(get_unknown_quaternion()) { }
55 std::string name=
"Matrix3DDensityMap%1%")
56 : Object(name), mat_(mat), quaternion_(quaternion) {}
58 Matrix3D() : IMP::Object(
""), quaternion_(get_unknown_quaternion()) {}
60 Eigen::Matrix3d get_mat()
const {
return mat_;}
63 void set_mat(
const Eigen::Matrix3d &mat,
66 quaternion_ = quaternion;
71 return quaternion_[0] == q[0] && quaternion_[1] == q[1]
72 && quaternion_[2] == q[2] && quaternion_[3] == q[3];
77 double nan = std::numeric_limits<double>::quiet_NaN();
96 static ObjectKey get_local_covariance_key();
97 static ObjectKey get_global_covariance_key();
110 return local->get_mat();
116 get_local_covariance().diagonal()[1],
117 get_local_covariance().diagonal()[2]);
126 ObjectKey k = get_global_covariance_key();
129 Matrix3D *global =
static_cast<Matrix3D*
>(m->
get_attribute(k, pi));
130 if (global->get_is_for_quaternion(get_rotation_quaternion())) {
131 return global->get_mat();
134 return get_updated_global_covariance();
147 IMP_NEW(Matrix3D,local,(covar.asDiagonal()));
151 local->set_was_used(
true);
158 set_local_covariance(Eigen::Vector3d(v.get_data()));
164 IMP_NEW(Matrix3D,global,(covar, get_rotation_quaternion()));
165 ObjectKey k = get_global_covariance_key();
167 if (!
get_model()->get_has_attribute(k, pi)) {
172 global->set_was_used(
true);
176 void update_global_covariance();
181 Eigen::Matrix3d get_updated_global_covariance();
185 return access_quaternion_data(static_cast<const Model *>(
get_model()))
198 IMPCORE_END_NAMESPACE
The base class for decorators.
void add_cache_attribute(TypeKey attribute_key, ParticleIndex particle, Type value)
ParticleIndex get_particle_index() const
Returns the particle index decorated by this decorator.
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
Model * get_model() const
Returns the Model containing the particle.
Storage of a model, its restraints, constraints and particles.
Exception definitions and assertions.
void set_global_covariance(Eigen::Matrix3d covar)
set the global-frame covariance. does NOT update local frame!
#define IMP_NEW(Typename, varname, args)
Declare a ref counted pointer to a new object.
void clear_particle_caches(ParticleIndex pi)
Clear all the cache attributes of a given particle.
Class for storing model, its restraints, constraints, and particles.
A Gaussian distribution in 3D.
Common base class for heavy weight IMP objects.
Eigen::Matrix3d get_global_covariance()
retrieve global covariance
functionality for defining rigid bodies
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
Helper macros for implementing Decorators.
void set_attribute(TypeKey attribute_key, ParticleIndex particle, Type value)
set the value of particle attribute with the specified key
#define IMP_DECORATOR_SETUP_0(Name)
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
A shared base class to help in debugging and things.
#define IMP_DECORATOR_METHODS(Name, Parent)
void set_local_covariance(const Eigen::Vector3d covar)
set the local-frame covariance.
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
algebra::Gaussian3D get_gaussian() const
create Gaussian3D from these attributes
bool get_has_attribute(TypeKey attribute_key, ParticleIndex particle) const
return true if particle has attribute with the specified key
A decorator for a rigid body.
void set_variances(const algebra::Vector3D v)
equivalent to set_local_covariance, used for backwards compatibility
Type get_attribute(TypeKey attribute_key, ParticleIndex particle)
get the value of the particle attribute with the specified key
algebra::Vector3D get_variances() const
retrieve local variances as Vector3D
Eigen::Matrix3d get_local_covariance() const
retrieve local covariance (as diagonal matrix)
IMP::algebra::ReferenceFrame3D get_reference_frame() const