Mantid
Loading...
Searching...
No Matches
JointDomain.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7//----------------------------------------------------------------------
8// Includes
9//----------------------------------------------------------------------
11#include <numeric>
12
13namespace Mantid::API {
16size_t JointDomain::size() const {
17 return std::accumulate(m_domains.begin(), m_domains.end(), size_t{0},
18 [](size_t n, const FunctionDomain_sptr &domain) { return n + domain->size(); });
19}
21size_t JointDomain::getNParts() const { return m_domains.size(); }
25const FunctionDomain &JointDomain::getDomain(size_t i) const { return *m_domains.at(i); }
26
31void JointDomain::addDomain(const FunctionDomain_sptr &domain) { m_domains.emplace_back(domain); }
32
33} // namespace Mantid::API
Base class that represents the domain of a function.
size_t size() const override
Return the number of points in the domain.
Definition: JointDomain.cpp:16
void addDomain(const FunctionDomain_sptr &domain)
Add a new domain.
Definition: JointDomain.cpp:31
const FunctionDomain & getDomain(size_t i) const override
Return i-th domain.
Definition: JointDomain.cpp:25
size_t getNParts() const override
Return the number of parts in the domain.
Definition: JointDomain.cpp:21
std::vector< FunctionDomain_sptr > m_domains
Vector with member domains.
Definition: JointDomain.h:38
std::shared_ptr< FunctionDomain > FunctionDomain_sptr
typedef for a shared pointer