#include <matpackIV.h>
Public Member Functions | |
Tensor4 () | |
Default constructor. | |
Tensor4 (Index b, Index p, Index r, Index c) | |
Constructor setting size. | |
Tensor4 (Index b, Index p, Index r, Index c, Numeric fill) | |
Constructor setting size and filling with constant value. | |
Tensor4 (const ConstTensor4View &v) | |
Copy constructor from Tensor4View. | |
Tensor4 (const Tensor4 &v) | |
Copy constructor from Tensor4. | |
Tensor4 & | operator= (const Tensor4 &x) |
Assignment operator from another tensor. | |
Tensor4 & | operator= (Numeric x) |
Assignment operator from scalar. | |
void | resize (Index b, Index p, Index r, Index c) |
Resize function. | |
virtual | ~Tensor4 () |
Destructor for Tensor4. |
This is a Tensor4View that also allocates storage automatically, and deallocates it when it is destroyed. We take all the functionality from Tensor4View. Additionally defined here are:
1. Constructors and destructor. 2. Assignment operators. 3. Resize function.
Definition at line 375 of file matpackIV.h.
Tensor4::Tensor4 | ( | ) |
Constructor setting size.
This constructor has to set the strides in the book, page and row ranges correctly!
Definition at line 1305 of file matpackIV.cc.
Constructor setting size and filling with constant value.
Definition at line 1316 of file matpackIV.cc.
References ConstTensor4View::mdata.
Tensor4::Tensor4 | ( | const ConstTensor4View & | m | ) |
Copy constructor from Tensor4View.
This automatically sets the size and copies the data.
Definition at line 1332 of file matpackIV.cc.
References Tensor4View::begin(), ConstTensor4View::begin(), copy(), and ConstTensor4View::end().
Tensor4::Tensor4 | ( | const Tensor4 & | m | ) |
Copy constructor from Tensor4.
This automatically sets the size and copies the data.
Definition at line 1344 of file matpackIV.cc.
References Tensor4View::begin(), copy(), and Tensor4View::end().
Tensor4::~Tensor4 | ( | ) | [virtual] |
Destructor for Tensor4.
This is important, since Tensor4 uses new to allocate storage.
Definition at line 1439 of file matpackIV.cc.
References ConstTensor4View::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 Tensor4View.
Definition at line 1383 of file matpackIV.cc.
References Tensor4View::begin(), copy(), Tensor4View::end(), ConstTensor4View::mbr, ConstTensor4View::mcr, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, and resize().
Assignment operator from scalar.
Assignment operators are not inherited.
Reimplemented from Tensor4View.
Definition at line 1395 of file matpackIV.cc.
References Tensor4View::begin(), copy(), and Tensor4View::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 GField4.
Definition at line 1404 of file matpackIV.cc.
References ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, and Range::mstride.
Referenced by abs_lookupCreate(), GasAbsLookup::Adapt(), AtmFieldsCalc(), AtmFieldsCalcExpand1D(), AtmFieldsFromCompact(), cloudboxSetEmpty(), DoitCloudboxFieldPut(), Extract(), nc_read_from_file(), operator=(), pha_matCalc(), pnd_fieldCalc(), refr_indexFieldAndGradients(), GField4::resize(), rte_std(), surfaceBlackbody(), surfaceFlatRefractiveIndex(), surfaceFlatVaryingEmissivity(), Tensor4Scale(), Tensor4SetConstant(), and xml_read_from_stream().