Mantid
Loading...
Searching...
No Matches
ILatticeFunction.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 +
8
9namespace Mantid::API {
10
11using namespace Geometry;
12
14
24void ILatticeFunction::function(const FunctionDomain &domain, FunctionValues &values) const {
25 try {
26 const auto &latticeDomain = dynamic_cast<const LatticeDomain &>(domain);
27
28 functionLattice(latticeDomain, values);
29 } catch (const std::bad_cast &) {
30 throw std::invalid_argument("ILatticeFunction expects domain of type LatticeDomain.");
31 }
32}
33
45 try {
46 const auto &latticeDomain = dynamic_cast<const LatticeDomain &>(domain);
47
48 functionDerivLattice(latticeDomain, jacobian);
49 } catch (const std::bad_cast &) {
50 throw std::invalid_argument("ILatticeFunction expects domain of type LatticeDomain.");
52 calNumericalDeriv(domain, jacobian);
53 }
54}
55
57void ILatticeFunction::functionDerivLattice(const LatticeDomain &latticeDomain, Jacobian &jacobian) {
58 UNUSED_ARG(latticeDomain);
59 UNUSED_ARG(jacobian);
60
61 throw Kernel::Exception::NotImplementedError("FunctionLatticeDeriv is not implemented for this function.");
62}
63
64} // namespace Mantid::API
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Definition: System.h:64
Base class that represents the domain of a function.
A class to store values calculated by a function.
void calNumericalDeriv(const FunctionDomain &domain, Jacobian &jacobian)
Calculate numerical derivatives.
Definition: IFunction.cpp:1031
void functionDeriv(const FunctionDomain &domain, Jacobian &jacobian) override
Implementation of IFunction::functionDeriv.
virtual void functionDerivLattice(const LatticeDomain &latticeDomain, Jacobian &jacobian)
Default implementation, throws NotImplementedError.
void function(const FunctionDomain &domain, FunctionValues &values) const override
Implementation of IFunction::function.
virtual void functionLattice(const LatticeDomain &latticeDomain, FunctionValues &values) const =0
Function that should calculate d-values for the HKLs provided in the domain.
Represents the Jacobian in IFitFunction::functionDeriv.
Definition: Jacobian.h:22
Marks code as not implemented yet.
Definition: Exception.h:138