#include <matpackI.h>
Public Member Functions | |
Vector () | |
Default constructor. | |
Vector (Index n) | |
Constructor setting size. | |
Vector (Index n, Numeric fill) | |
Constructor setting size and filling with constant value. | |
Vector (Numeric start, Index extent, Numeric stride) | |
Constructor filling with values. | |
Vector (const ConstVectorView &v) | |
Copy constructor from VectorView. | |
Vector (const Vector &v) | |
Copy constructor from Vector. | |
Vector & | operator= (const Vector &v) |
Assignment from another Vector. | |
Vector & | operator= (const Array< Numeric > &v) |
Assignment operator from Array<Numeric>. | |
Vector & | operator= (Numeric x) |
Assignment operator from scalar. | |
void | resize (Index n) |
Assignment operator from VectorView. | |
virtual | ~Vector () |
Destructor for Vector. |
This is a subvector that also allocates storage automatically, and deallocates it when it is destroyed. We take all the functionality from VectorView. Additionally defined in this class are:
1. Constructors and destructors (allocating memory). 2. Assignment operator 3. Assignment operator from scalar. 4. Resize function.
Definition at line 546 of file matpackI.h.
Vector::Vector | ( | ) |
Vector::Vector | ( | Index | n | ) | [explicit] |
Constructor setting size and filling with constant value.
Definition at line 628 of file matpackI.cc.
References ConstVectorView::mdata.
Constructor filling with values.
Examples:
Vector v(1,5,1); // 1, 2, 3, 4, 5 Vector v(1,5,.5); // 1, 1.5, 2, 2.5, 3 Vector v(5,5,-1); // 5, 4, 3, 2, 1
Definition at line 647 of file matpackI.cc.
References VectorView::begin(), and VectorView::end().
Vector::Vector | ( | const ConstVectorView & | v | ) |
Copy constructor from VectorView.
This automatically sets the size and copies the data. The vector created will have start zero and stride 1, independent on how these parameters are set for the original. So, what is copied is the data, not the shape of the selection.
Definition at line 667 of file matpackI.cc.
References VectorView::begin(), ConstVectorView::begin(), copy(), and ConstVectorView::end().
Vector::Vector | ( | const Vector & | v | ) |
Copy constructor from Vector.
This is important to override the automatically generated shallow constructor. We want deep copies!
Definition at line 676 of file matpackI.cc.
References VectorView::begin(), copy(), and VectorView::end().
Vector::~Vector | ( | ) | [virtual] |
Destructor for Vector.
This is important, since Vector uses new to allocate storage.
Definition at line 777 of file matpackI.cc.
References ConstVectorView::mdata.
Assignment from another Vector.
While dimensions of VectorViews can not be adjusted, dimensions of Vectors *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 Vectors 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 (Vector = Vector). It implicitly covers the cases Vector=VectorView, etc, because there is a default constructor for Vector from VectorView. (See C++ Primer Plus, page 571ff.)
v | The other vector to copy to this one. |
Reimplemented from VectorView.
Definition at line 708 of file matpackI.cc.
References VectorView::begin(), copy(), VectorView::end(), ConstVectorView::nelem(), and resize().
Assignment operator from Array<Numeric>.
This copies the data from a Array<Numeric> to this VectorView. The size is adjusted automatically.
Array<Numeric> can be useful to collect things in, because there is a .push_back method for it. Then, after collecting we usually have to transfer the content to a Vector. With this assignment operator that's easy.
x | The array to assign to this. |
Reimplemented from VectorView.
Definition at line 733 of file matpackI.cc.
References Array< base >::nelem(), VectorView::operator=(), and resize().
Assignment operator from scalar.
Assignment operators are not inherited.
Reimplemented from VectorView.
Definition at line 742 of file matpackI.cc.
References VectorView::operator=().
void Vector::resize | ( | Index | n | ) |
Assignment operator from VectorView.
Assignment operators are not inherited. Resize function. If the size is already correct this function does nothing. All data is lost after resizing! The new Vector is not initialized, so it will contain random values.
Reimplemented in GField1.
Definition at line 762 of file matpackI.cc.
References ConstVectorView::mdata, Range::mextent, ConstVectorView::mrange, Range::mstart, and Range::mstride.
Referenced by abs_h2oSet(), abs_lookupCreate(), abs_lookupSetup(), abs_lookupSetupBatch(), abs_lookupSetupWide(), abs_n2Set(), AbsInputFromRteScalars(), GasAbsLookup::Adapt(), AntennaOff(), AntennaSet1D(), Append(), AtmosphereSet1D(), AtmosphereSet2D(), cloud_RT_surface(), Cloudbox_ppathCalc(), cum_l_stepCalc(), do_gridcell_3d(), emissionPlanck(), f_gridFromSensorAMSU(), f_gridSelectFIndex(), findZ11max(), geompath_from_r1_to_r2(), get_radiative_background(), get_refr_index_1d(), get_refr_index_2d(), get_refr_index_3d(), GasAbsLookup::GetFgrid(), GasAbsLookup::GetPgrid(), interpolate_raytracing_points(), iy_calc(), jacobianAddPointing(), linspace(), MCGeneral(), MCIPA(), MCSetIncomingEmpty(), mixer_matrix(), nc_read_from_file(), nlinspace(), nlogspace(), operator=(), opt_prop_sptFromData(), ArtsParser::parse_numvector(), ArtsParser::parse_numvector_from_string(), polynomial_basis_func(), ppath_calc(), ppath_copy(), ppath_end_1d(), ppath_end_2d(), ppath_end_3d(), ppath_init_structure(), ppath_start_stepping(), readppdata(), refr_index_Boudouris(), refr_index_BoudourisDryAir(), GField1::resize(), rte_losSet(), rte_pos_and_losFromTangentPressure(), rte_posSet(), rte_posShift(), RteCalc(), RteCalcMC(), ScatteringMonteCarlo(), sensor_aux_vectors(), sensor_responseBeamSwitching(), sensor_responseMultiMixerBackend(), TArrayCalc(), test1(), test_and_merge_two_channels(), VectorAddScalar(), VectorExtractFromMatrix(), VectorInsertGridPoints(), VectorMatrixMultiply(), VectorScale(), VectorSetConstant(), VectorZtanToZa1D(), VectorZtanToZaRefr1D(), xml_parse_from_stream(), xsec_species(), ybatchMetProfiles(), ybatchMetProfilesClear(), za_gridOpt(), and ZaSatOccultation().