#include <matpackIII.h>
Public Member Functions | |
Tensor3 () | |
Default constructor. | |
Tensor3 (Index p, Index r, Index c) | |
Constructor setting size. | |
Tensor3 (Index p, Index r, Index c, Numeric fill) | |
Constructor setting size and filling with constant value. | |
Tensor3 (const ConstTensor3View &v) | |
Copy constructor from Tensor3View. | |
Tensor3 (const Tensor3 &v) | |
Copy constructor from Tensor3. | |
Tensor3 & | operator= (const Tensor3 &x) |
Assignment operator from another tensor. | |
Tensor3 & | operator= (Numeric x) |
Assignment operator from scalar. | |
void | resize (Index p, Index r, Index c) |
Resize function. | |
virtual | ~Tensor3 () |
Destructor for Tensor3. |
This is a Tensor3View that also allocates storage automatically, and deallocates it when it is destroyed. We take all the functionality from Tensor3View. Additionally defined here are:
1. Constructors and destructor. 2. Assignment operators. 3. Resize function.
Definition at line 340 of file matpackIII.h.
Tensor3::Tensor3 | ( | ) |
Constructor setting size.
This constructor has to set the strides in the page and row ranges correctly!
Definition at line 768 of file matpackIII.cc.
Constructor setting size and filling with constant value.
Definition at line 778 of file matpackIII.cc.
References ConstTensor3View::mdata.
Tensor3::Tensor3 | ( | const ConstTensor3View & | m | ) |
Copy constructor from Tensor3View.
This automatically sets the size and copies the data.
Definition at line 793 of file matpackIII.cc.
References Tensor3View::begin(), ConstTensor3View::begin(), copy(), and ConstTensor3View::end().
Tensor3::Tensor3 | ( | const Tensor3 & | m | ) |
Copy constructor from Tensor3.
This automatically sets the size and copies the data.
Definition at line 804 of file matpackIII.cc.
References Tensor3View::begin(), copy(), and Tensor3View::end().
Tensor3::~Tensor3 | ( | ) | [virtual] |
Destructor for Tensor3.
This is important, since Tensor3 uses new to allocate storage.
Definition at line 892 of file matpackIII.cc.
References ConstTensor3View::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 Tensor3View.
Definition at line 842 of file matpackIII.cc.
References Tensor3View::begin(), copy(), Tensor3View::end(), ConstTensor3View::mcr, Range::mextent, ConstTensor3View::mpr, ConstTensor3View::mrr, and resize().
Referenced by GField3::operator=().
Assignment operator from scalar.
Assignment operators are not inherited.
Reimplemented from Tensor3View.
Reimplemented in GField3.
Definition at line 854 of file matpackIII.cc.
References Tensor3View::begin(), copy(), and Tensor3View::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.
Reimplemented in GField3.
Definition at line 863 of file matpackIII.cc.
References ConstTensor3View::mcr, ConstTensor3View::mdata, Range::mextent, ConstTensor3View::mpr, ConstTensor3View::mrr, Range::mstart, and Range::mstride.
Referenced by AtmFieldsCalc(), AtmFieldsCalcExpand1D(), AtmFieldsFromCompact(), ext_matInit(), Extract(), jacobian_from_path_to_rgrids(), MCGeneral(), MCIPA(), nc_read_from_file(), operator=(), opt_prop_sptFromData(), GField3::resize(), Tensor3FillWithVector(), Tensor3Scale(), Tensor3SetConstant(), and xml_read_from_stream().