8#ifndef IMPKERNEL_REFINER_H
9#define IMPKERNEL_REFINER_H
11#include <IMP/kernel_config.h>
14#include "internal/IndexingIterator.h"
18#include <cereal/access.hpp>
19#include <cereal/types/base_class.hpp>
21IMPKERNEL_BEGIN_NAMESPACE
24class DerivativeAccumulator;
40 friend class cereal::access;
41 template<
class Archive>
void serialize(Archive &ar) {
43 ar(cereal::base_class<Object>(
this), is_by_ref_);
55 Refiner(std::string name =
"Refiner %1%",
bool is_by_ref =
false);
93 "This refiner does not support"
94 " get_refined_indexes_by_ref()",
124 typedef internal::IndexingIterator<Accessor> RefinedIterator;
125 RefinedIterator refined_begin(
Particle *a)
const;
126 RefinedIterator refined_end(
Particle *a)
const;
133#if !defined(SWIG) && !defined(IMP_DOXYGEN)
134struct Refiner::Accessor {
140 typedef Particle *result_type;
141 Particle *operator()(
unsigned int i)
const {
return r_->
get_refined(p_, i); }
142 bool operator==(
const Accessor &o)
const {
return p_ == o.p_ && r_ == o.r_; }
146inline Refiner::RefinedIterator Refiner::refined_begin(Particle *a)
const {
147 return RefinedIterator(Accessor(a,
this), 0);
149inline Refiner::RefinedIterator Refiner::refined_end(Particle *a)
const {
150 return RefinedIterator(Accessor(a,
this), get_number_of_refined(a));
153IMPKERNEL_END_NAMESPACE
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
Helper macros for throwing and handling exceptions.
#define IMP_ALWAYS_CHECK(condition, message, exception_name)
Throw an exception if a check fails.
Class for storing model, its restraints, constraints, and particles.
Object(std::string name)
Construct an object with the given name.
Base class for objects that take particle arguments and read from them.
Class to handle individual particles of a Model object.
Abstract class to implement hierarchical methods.
virtual ParticleIndexes const & get_refined_indexes_by_ref(Model *m, ParticleIndex pi) const
Return the indexes of the particles returned by get_refined().
virtual ParticleIndexes get_refined_indexes(Model *m, ParticleIndex pi) const
Return the indexes of the particles returned by get_refined().
virtual unsigned int get_number_of_refined(Particle *a) const
bool get_is_by_ref_supported()
virtual const ParticlesTemp get_refined(Particle *a) const =0
Refine the passed particle into a set of particles.
Refiner(std::string name="Refiner %1%", bool is_by_ref=false)
Constructs the refiner.
virtual Particle * get_refined(Particle *a, unsigned int i) const
Get the ith refined particle.
virtual bool get_can_refine(Particle *) const
Return true if this refiner can refine that particle.
An exception for an invalid value being passed to IMP.
Control display of deprecation information.
Classes used in the construction of ModelObjects.
Index< ParticleIndexTag > ParticleIndex
Vector< ParticleIndex, std::allocator< ParticleIndex > > ParticleIndexes
A list of particles, each identified by its ParticleIndex.
IMP::Vector< IMP::Pointer< Refiner > > Refiners
a collection of Refiner objects
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
#define IMP_UNUSED(variable)