#include <matpackV.h>
Public Member Functions | |
Tensor5 () | |
Default constructor. | |
Tensor5 (Index s, Index b, Index p, Index r, Index c) | |
Constructor setting size. | |
Tensor5 (Index s, Index b, Index p, Index r, Index c, Numeric fill) | |
Constructor setting size and filling with constant value. | |
Tensor5 (const ConstTensor5View &v) | |
Copy constructor from Tensor5View. | |
Tensor5 (const Tensor5 &v) | |
Copy constructor from Tensor5. | |
Tensor5 & | operator= (const Tensor5 &x) |
Assignment operator from another tensor. | |
Tensor5 & | operator= (Numeric x) |
Assignment operator from scalar. | |
void | resize (Index s, Index b, Index p, Index r, Index c) |
Resize function. | |
virtual | ~Tensor5 () |
Destructor for Tensor5. |
This is a Tensor5View that also allocates storage automatically, and deallocates it when it is destroyed. We take all the functionality from Tensor5View. Additionally defined here are:
1. Constructors and destructor. 2. Assignment operators. 3. Resize function.
Definition at line 439 of file matpackV.h.
Tensor5::Tensor5 | ( | ) |
Constructor setting size.
This constructor has to set the strides in the shelf, book, page and row ranges correctly!
Definition at line 2289 of file matpackV.cc.
Constructor setting size and filling with constant value.
Definition at line 2301 of file matpackV.cc.
References ConstTensor5View::mdata.
Tensor5::Tensor5 | ( | const ConstTensor5View & | m | ) |
Copy constructor from Tensor5View.
This automatically sets the size and copies the data.
Definition at line 2318 of file matpackV.cc.
References Tensor5View::begin(), ConstTensor5View::begin(), copy(), and ConstTensor5View::end().
Tensor5::Tensor5 | ( | const Tensor5 & | m | ) |
Copy constructor from Tensor5.
This automatically sets the size and copies the data.
Definition at line 2331 of file matpackV.cc.
References Tensor5View::begin(), copy(), and Tensor5View::end().
Tensor5::~Tensor5 | ( | ) | [virtual] |
Destructor for Tensor5.
This is important, since Tensor5 uses new to allocate storage.
Definition at line 2437 of file matpackV.cc.
References ConstTensor5View::mdata.
Assignment operator from another tensor.
While dimensions of views can not be adjusted, dimensions of tensors *can* be adjusted. Hence, the behavior of the assignment operator is different.
In this case the size of the target is automatically adjusted. This is important, so that structures containing tensors are copied correctly.
This is a deviation from the old ARTS paradigm that sizes must match exactly before copying!
Note: It is sufficient to have only this one version of the assignment (Tensor = Tensor). It implicitly covers the cases Tensor=TensorView, etc, because there is a default constructor for Tensor from TensorView. (See C++ Primer Plus, page 571ff.)
m | The other tensor to assign to this one. |
Reimplemented from Tensor5View.
Definition at line 2371 of file matpackV.cc.
References Tensor5View::begin(), copy(), Tensor5View::end(), ConstTensor5View::mbr, ConstTensor5View::mcr, Range::mextent, ConstTensor5View::mpr, ConstTensor5View::mrr, ConstTensor5View::msr, and resize().
Assignment operator from scalar.
Assignment operators are not inherited.
Reimplemented from Tensor5View.
Definition at line 2387 of file matpackV.cc.
References Tensor5View::begin(), copy(), and Tensor5View::end().
Resize function.
If the size is already correct this function does nothing. All data is lost after resizing! The new tensor is not initialized, so it will contain random values.
Definition at line 2396 of file matpackV.cc.
References ConstTensor5View::mbr, ConstTensor5View::mcr, ConstTensor5View::mdata, Range::mextent, ConstTensor5View::mpr, ConstTensor5View::mrr, ConstTensor5View::msr, Range::mstart, and Range::mstride.
Referenced by abs_fieldCalc(), operator=(), Tensor5Scale(), Tensor5SetConstant(), and xml_read_from_stream().