12 #ifndef IMPSAXS_DISTRIBUTION_H
13 #define IMPSAXS_DISTRIBUTION_H
15 #include <IMP/saxs/saxs_config.h>
21 IMPSAXS_BEGIN_NAMESPACE
24 static const double pr_resolution = 0.5;
30 template <
class ValueT>
42 unsigned int get_index_from_distance(
double dist)
const {
45 double get_distance_from_index(
unsigned int index)
const {
46 return index * bin_size_;
50 void init(
double bin_size) {
53 one_over_bin_size_ = 1.0 / bin_size_;
55 std::vector<ValueT>::reserve(get_index_from_distance(max_distance_) + 1);
59 double bin_size_, one_over_bin_size_;
64 %
template(FloatDistribution) Distribution<double>;
65 %
template(VectorDistribution) Distribution<algebra::Vector3D>;
88 void show(std::ostream& out = std::cout)
const;
92 const std::string& file_name =
"")
const;
99 const std::string& file_name =
"")
const;
104 void add_to_distribution(
double dist,
double value) {
105 unsigned int index = get_index_from_distance(dist);
106 if (index >= size()) {
107 if (capacity() <= index)
109 resize(index + 1, 0);
110 max_distance_ = get_distance_from_index(index + 1);
112 (*this)[index] += value;
117 void read_pr_file(
const std::string& file_name);
121 const std::string& file_name =
"")
const;
136 double max_distance = 0.0,
137 double bin_size = pr_resolution);
140 void calculate_derivative_distribution(
Particle* particle);
143 void show(std::ostream& out = std::cout, std::string prefix =
"")
const;
147 unsigned int index = get_index_from_distance(dist);
148 if (index >= size()) {
149 if (capacity() <= index)
152 max_distance_ = get_distance_from_index(index + 1);
154 (*this)[index] += value;
159 insert(begin(), get_index_from_distance(max_distance_) + 1,
164 std::vector<algebra::Vector3D> coordinates_;
168 IMPSAXS_END_NAMESPACE
double get_max_distance() const
returns maximal distance value of distribution
int get_rounded(const T &x)
Rounds a number to next integer.
double get_bin_size() const
returns bin size
Distribution(double bin_size=pr_resolution)
Constructor.
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
void show(Hierarchy h, std::ostream &out=std::cout)
Print out a molecular hierarchy.
Class to handle individual particles of a Model object.
A class for profile storing and computation.