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"
10#include <string>
11#include <vector>
12
13namespace Mantid {
14namespace Kernel {
15class V3D;
16
22template <typename TYPE = double> class DLLExport VMDBase {
23public:
24 VMDBase();
25 VMDBase(size_t nd);
26 VMDBase(double val0, double val1);
27 VMDBase(double val0, double val1, double val2);
28 VMDBase(double val0, double val1, double val2, double val3);
29 VMDBase(double val0, double val1, double val2, double val3, double val4);
30 VMDBase(double val0, double val1, double val2, double val3, double val4, double val5);
31
32 VMDBase(const VMDBase &other);
33 VMDBase &operator=(const VMDBase &other);
34 VMDBase(VMDBase &&other) noexcept;
35 VMDBase &operator=(VMDBase &&other) noexcept;
36 VMDBase(size_t nd, const double *bareData);
37 VMDBase(size_t nd, const float *bareData);
38 VMDBase(const V3D &vector);
39 VMDBase(const std::vector<double> &vector);
40 VMDBase(const std::vector<float> &vector);
41 VMDBase(const std::string &str);
42 ~VMDBase();
43
44 size_t getNumDims() const;
45 size_t size() const;
46 const TYPE &operator[](const size_t index) const;
47 TYPE &operator[](const size_t index);
48 const TYPE *getBareArray() const;
49 std::string toString(const std::string &separator = " ") const;
50 bool operator==(const VMDBase &v) const;
51 bool operator!=(const VMDBase &v) const;
52 VMDBase operator+(const VMDBase &v) const;
53 VMDBase &operator+=(const VMDBase &v);
54 VMDBase operator-(const VMDBase &v) const;
55 VMDBase &operator-=(const VMDBase &v);
56 VMDBase operator*(const VMDBase &v) const;
57 VMDBase &operator*=(const VMDBase &v);
58 VMDBase operator/(const VMDBase &v) const;
59 VMDBase &operator/=(const VMDBase &v);
60 VMDBase operator*(const double scalar) const;
61 VMDBase &operator*=(const double scalar);
62 VMDBase operator/(const double scalar) const;
63 VMDBase &operator/=(const double scalar);
64 TYPE scalar_prod(const VMDBase &v) const;
65 VMDBase cross_prod(const VMDBase &v) const;
66 TYPE length() const;
67 TYPE norm() const;
68 TYPE norm2() const;
70 TYPE angle(const VMDBase &v) const;
71
72 static std::vector<VMDBase> makeVectorsOrthogonal(std::vector<VMDBase> &vectors);
73 static VMDBase getNormalVector(const std::vector<VMDBase> &vectors);
74
75protected:
77 size_t nd;
80};
81
83using VMD_t = float;
84
87
88// Overload operator <<
89MANTID_KERNEL_DLL std::ostream &operator<<(std::ostream &, const VMDBase<double> &);
90MANTID_KERNEL_DLL std::ostream &operator<<(std::ostream &, const VMDBase<float> &);
91
92} // namespace Kernel
93} // namespace Mantid
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
Definition: System.h:53
Class for 3D vectors.
Definition: V3D.h:34
Simple vector class for multiple dimensions (i.e.
Definition: VMD.h:22
size_t nd
Number of dimensions.
Definition: VMD.h:77
TYPE * data
Data, an array of size nd.
Definition: VMD.h:79
MatrixWorkspace_sptr MANTID_API_DLL operator*(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs)
Multiply two workspaces.
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)
Subtracts two workspaces.
MatrixWorkspace_sptr MANTID_API_DLL operator*=(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs)
Multiply two workspaces.
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.
MANTID_KERNEL_DLL std::ostream & operator<<(std::ostream &, CPUTimer &)
Convenience function to provide for easier debug printing.
Definition: CPUTimer.cpp:86
MANTID_KERNEL_DLL V3D normalize(V3D v)
Normalizes a V3D.
Definition: V3D.h:341
float VMD_t
Underlying data type for the VMD type.
Definition: VMD.h:83
Helper class which provides the Collimation Length for SANS instruments.
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)