votca
2024.2-dev
Loading...
Searching...
No Matches
tools
include
votca
tools
histogram.h
Go to the documentation of this file.
1
/*
2
* Copyright 2009-2020 The VOTCA Development Team (http://www.votca.org)
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
*/
17
18
#ifndef VOTCA_TOOLS_HISTOGRAM_H
19
#define VOTCA_TOOLS_HISTOGRAM_H
20
21
// Standard includes
22
#include <cmath>
23
#include <limits>
24
#include <vector>
25
26
// Local VOTCA includes
27
#include "
datacollection.h
"
28
29
namespace
votca
{
30
namespace
tools {
31
38
class
Histogram
{
39
public
:
40
struct
options_t
;
41
43
Histogram
(
const
options_t
&op);
44
Histogram
();
46
~Histogram
();
47
51
void
ProcessData
(
DataCollection<double>::selection
*data);
52
54
double
getMin
()
const
{
return
min_
; }
56
double
getMax
()
const
{
return
max_
; }
58
Index
getN
()
const
{
return
options_
.
n_
; }
59
std::vector<double> &
getPdf
() {
return
pdf_
; }
60
double
getInterval
()
const
{
return
interval_
; }
61
62
void
Normalize
(
void
);
63
64
struct
options_t
{
65
Index
n_
= 101;
66
bool
auto_interval_
=
true
;
67
bool
extend_interval_
=
false
;
68
double
min_
= 0;
69
double
max_
= 1.;
70
bool
periodic_
=
false
;
71
bool
normalize_
=
true
;
72
std::string
scale_
=
"no"
;
73
};
74
75
private
:
76
std::vector<double>
pdf_
;
77
double
min_
= 0;
78
double
max_
= 0;
79
double
interval_
;
80
81
options_t
options_
;
82
};
83
84
inline
std::ostream &
operator<<
(std::ostream &out,
Histogram
&h) {
85
for
(
Index
i = 0; i < h.
getN
(); i++) {
86
out << h.
getMin
() + h.
getInterval
() * ((double)i + 0.0) <<
" "
87
<< h.
getPdf
()[i] << std::endl;
88
}
89
return
out;
90
}
91
92
}
// namespace tools
93
}
// namespace votca
94
95
#endif
// VOTCA_TOOLS_HISTOGRAM_H
votca::tools::DataCollection::selection
class for array selection
Definition
datacollection.h:63
votca::tools::Histogram
class to generate histograms
Definition
histogram.h:38
votca::tools::Histogram::max_
double max_
Definition
histogram.h:78
votca::tools::Histogram::interval_
double interval_
Definition
histogram.h:79
votca::tools::Histogram::getMax
double getMax() const
return the maximum value
Definition
histogram.h:56
votca::tools::Histogram::getMin
double getMin() const
returns the minimum value
Definition
histogram.h:54
votca::tools::Histogram::ProcessData
void ProcessData(DataCollection< double >::selection *data)
Definition
histogram.cc:36
votca::tools::Histogram::pdf_
std::vector< double > pdf_
Definition
histogram.h:76
votca::tools::Histogram::getInterval
double getInterval() const
Definition
histogram.h:60
votca::tools::Histogram::getPdf
std::vector< double > & getPdf()
Definition
histogram.h:59
votca::tools::Histogram::Normalize
void Normalize(void)
Definition
histogram.cc:116
votca::tools::Histogram::options_
options_t options_
Definition
histogram.h:81
votca::tools::Histogram::min_
double min_
Definition
histogram.h:77
votca::tools::Histogram::getN
Index getN() const
return the number of grid points
Definition
histogram.h:58
votca::tools::Histogram::~Histogram
~Histogram()
destructor
votca::tools::Histogram::Histogram
Histogram()
datacollection.h
votca::tools::operator<<
std::ostream & operator<<(std::ostream &out, const Correlate &c)
Definition
correlate.h:53
votca
base class for all analysis tools
Definition
basebead.h:33
votca::Index
Eigen::Index Index
Definition
types.h:26
votca::tools::Histogram::options_t
Definition
histogram.h:64
votca::tools::Histogram::options_t::normalize_
bool normalize_
Definition
histogram.h:71
votca::tools::Histogram::options_t::auto_interval_
bool auto_interval_
Definition
histogram.h:66
votca::tools::Histogram::options_t::periodic_
bool periodic_
Definition
histogram.h:70
votca::tools::Histogram::options_t::n_
Index n_
Definition
histogram.h:65
votca::tools::Histogram::options_t::min_
double min_
Definition
histogram.h:68
votca::tools::Histogram::options_t::max_
double max_
Definition
histogram.h:69
votca::tools::Histogram::options_t::scale_
std::string scale_
Definition
histogram.h:72
votca::tools::Histogram::options_t::extend_interval_
bool extend_interval_
Definition
histogram.h:67
Generated by
1.12.0