Mantid
Loading...
Searching...
No Matches
VMD.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2011 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#pragma once
8
9#include "MantidKernel/DllConfig.h"
11#include <string>
12#include <vector>
13
14namespace Mantid {
15namespace Kernel {
21template <typename TYPE = double> class MANTID_KERNEL_DLL VMDBase {
22public:
23 VMDBase();
24 VMDBase(size_t nd);
25 VMDBase(double val0, double val1);
26 VMDBase(double val0, double val1, double val2);
27 VMDBase(double val0, double val1, double val2, double val3);
28 VMDBase(double val0, double val1, double val2, double val3, double val4);
29 VMDBase(double val0, double val1, double val2, double val3, double val4, double val5);
30
31 VMDBase(const VMDBase &other);
32 VMDBase &operator=(const VMDBase &other);
33 VMDBase(VMDBase &&other) noexcept;
34 VMDBase &operator=(VMDBase &&other) noexcept;
35 VMDBase(size_t nd, const double *bareData);
36 VMDBase(size_t nd, const float *bareData);
37 VMDBase(const V3D &vector);
38 VMDBase(const std::vector<double> &vector);
39 VMDBase(const std::vector<float> &vector);
40 VMDBase(const std::string &str);
41 ~VMDBase();
42
43 size_t getNumDims() const;
44 size_t size() const;
45 const TYPE &operator[](const size_t index) const;
46 TYPE &operator[](const size_t index);
47 const TYPE *getBareArray() const;
48 std::string toString(const std::string &separator = " ") const;
49 bool operator==(const VMDBase &v) const;
50 bool operator!=(const VMDBase &v) const;
51 VMDBase operator+(const VMDBase &v) const;
52 VMDBase &operator+=(const VMDBase &v);
53 VMDBase operator-(const VMDBase &v) const;
54 VMDBase &operator-=(const VMDBase &v);
55 VMDBase operator*(const VMDBase &v) const;
56 VMDBase &operator*=(const VMDBase &v);
57 VMDBase operator/(const VMDBase &v) const;
58 VMDBase &operator/=(const VMDBase &v);
59 VMDBase operator*(const double scalar) const;
60 VMDBase &operator*=(const double scalar);
61 VMDBase operator/(const double scalar) const;
62 VMDBase &operator/=(const double scalar);
63 TYPE scalar_prod(const VMDBase &v) const;
64 VMDBase cross_prod(const VMDBase &v) const;
65 TYPE length() const;
66 TYPE norm() const;
67 TYPE norm2() const;
69 TYPE angle(const VMDBase &v) const;
70
71 static std::vector<VMDBase> makeVectorsOrthogonal(std::vector<VMDBase> &vectors);
72 static VMDBase getNormalVector(const std::vector<VMDBase> &vectors);
73
74protected:
76 size_t nd;
79};
80
82using VMD_t = float;
83
86
87// Overload operator <<
88MANTID_KERNEL_DLL std::ostream &operator<<(std::ostream &, const VMDBase<double> &);
89MANTID_KERNEL_DLL std::ostream &operator<<(std::ostream &, const VMDBase<float> &);
90
91} // namespace Kernel
92} // namespace Mantid
std::map< DeltaEMode::Type, std::string > index
Class for 3D vectors.
Definition V3D.h:35
Simple vector class for multiple dimensions (i.e.
Definition VMD.h:21
size_t nd
Number of dimensions.
Definition VMD.h:76
TYPE * data
Data, an array of size nd.
Definition VMD.h:78
MatrixWorkspace_sptr MANTID_API_DLL operator/=(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs)
Divide two workspaces.
MatrixWorkspace_sptr MANTID_API_DLL operator+=(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs)
Adds two workspaces.
MatrixWorkspace_sptr MANTID_API_DLL operator-=(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs)
Subtracts two workspaces.
MatrixWorkspace_sptr MANTID_API_DLL operator*=(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs)
Multiply two workspaces.
MANTID_KERNEL_DLL std::ostream & operator<<(std::ostream &, CPUTimer &)
Convenience function to provide for easier debug printing.
Definition CPUTimer.cpp:86
std::string toString(const T &value)
Convert values to strings.
MANTID_KERNEL_DLL V3D normalize(V3D v)
Normalizes a V3D.
Definition V3D.h:353
float VMD_t
Underlying data type for the VMD type.
Definition VMD.h:82
Helper class which provides the Collimation Length for SANS instruments.
constexpr wide_integer< Bits, Signed > operator-(const wide_integer< Bits, Signed > &lhs) noexcept(is_same< Signed, unsigned >::value)
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
constexpr bool operator!=(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
std::common_type_t< wide_integer< Bits, Signed >, wide_integer< Bits2, Signed2 > > constexpr operator*(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
constexpr wide_integer< Bits, Signed > operator+(const wide_integer< Bits, Signed > &lhs) noexcept(is_same< Signed, unsigned >::value)
std::common_type_t< wide_integer< Bits, Signed >, wide_integer< Bits2, Signed2 > > constexpr operator/(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)