Geophysical Inversion and Modelling Library
v1.5.2-5-g042d7f36
|
One dimensional array aka Vector of limited size. More...
Public Types | |
typedef ValueType | ValType |
typedef VectorIterator< ValueType > | iterator |
Public Member Functions | |
Vector () | |
Vector (Index n) | |
Vector (Index n, const ValueType &val) | |
Vector (const std::string &filename, IOFormat format=Ascii) | |
Vector (const Vector< ValueType > &v) | |
Vector (const Vector< ValueType > &v, Index start, Index end) | |
template<class A > | |
Vector (const __VectorExpr< ValueType, A > &v) | |
Vector (const std::vector< ValueType > &v) | |
template<class ValueType2 > | |
Vector (const Vector< ValueType2 > &v) | |
~Vector () | |
Vector< ValueType > & | operator= (const Vector< ValueType > &v) |
template<class A > | |
Vector< ValueType > & | operator= (const __VectorExpr< ValueType, A > &v) |
Vector< ValueType > & | operator= (const ValueType &val) |
Vector< ValueType > | copy () const |
const ValueType & | operator[] (const Index i) const |
ValueType & | operator[] (const Index i) |
const Vector< ValueType > | operator[] (const IndexArray &i) const |
Vector< ValueType > | operator[] (const IndexArray &i) |
Vector< ValueType > | operator[] (const BVector &b) |
Vector< ValueType > | operator() (Index start, SIndex end) const |
Vector< ValueType > | operator() (const std::pair< Index, SIndex > &pair) const |
Vector< ValueType > | operator() (const IndexArray &iArray) const |
Vector< ValueType > | operator() (const SIndexArray &siArray) const |
Vector< ValueType > | operator() (const IVector &iVec) const |
template<class IndexContainer > | |
Vector< ValueType > | get_ (const IndexContainer &idx) const |
Vector< ValueType > | get_ (const BVector &bv) const |
Vector< ValueType > | getVUI_ (const IndexArray &iA) const |
Vector< ValueType > | getVSI_ (const IVector &iA) const |
template<class T > | |
operator std::vector< T > () | |
Vector< ValueType > & | setVal (const ValueType &val) |
Vector< ValueType > & | setVal (const ValueType &val, const BVector &bv) |
Vector< ValueType > & | setVal (const ValueType &val, Index i) |
Vector< ValueType > & | setVal (const ValueType &val, Index start, SIndex end) |
Vector< ValueType > & | setVal (const ValueType &val, const std::pair< Index, SIndex > &pair) |
Vector< ValueType > & | setVal (const ValueType &val, const IndexArray &ids) |
Vector< ValueType > & | setVal (const Vector< ValueType > &vals, const IndexArray &ids) |
Vector< ValueType > & | setVal (const Vector< ValueType > &vals, Index start) |
Vector< ValueType > & | setVal (const Vector< ValueType > &vals, Index start, Index end) |
Vector< ValueType > & | setVal (const Vector< ValueType > &vals, const std::pair< Index, SIndex > &pair) |
Vector< ValueType > & | push_back (const ValueType &v) |
Vector< ValueType > & | addVal (const Vector< ValueType > &vals, Index start, Index end) |
Vector< ValueType > & | addVal (const Vector< ValueType > &vals, const std::pair< Index, SIndex > &pair) |
Vector< ValueType > & | addVal (const Vector< ValueType > &vals, const IndexArray &idx) |
Vector< ValueType > & | addVal (const ValueType &val, Index i) |
void | add (const ElementMatrix< double > &A) |
void | add (const ElementMatrix< double > &A, const double &scale) |
void | add (const ElementMatrix< double > &A, const Pos &scale) |
void | add (const ElementMatrix< double > &A, const RMatrix &scale) |
void | add (const ElementMatrix< double > &A, const Vector< double > &scale) |
const ValueType & | getVal (Index i) const |
Vector< ValueType > | getVal (Index start, SIndex end) const |
Vector< ValueType > | getVal (const std::pair< Index, SIndex > &pair) const |
BVector | operator< (const Vector< ValueType > &v) const |
Vector< ValueType > | operator- () const |
void | resize (Index n, ValueType fill) |
void | resize (Index n) |
void | reserve (Index n) |
template<class V > | |
Vector< ValueType > & | fill (V *val) |
Vector< ValueType > & | fill (const ValueType &val) |
template<class Ex > | |
Vector< ValueType > & | fill (Expr< Ex > expr) |
void | assign (const Vector< ValueType > &v) |
template<class ExprOP > | |
void | assign (const ExprOP &v) |
void | clean () |
void | clear () |
Vector< ValueType > & | round (const ValueType &tolerance) |
bool | empty () const |
Index | size () const |
Index | capacity () const |
Index | nThreads () const |
Index | singleCalcCount () const |
ValueType * | data () |
bool | save (const std::string &filename, IOFormat format=Ascii) const |
bool | load (const std::string &filename, IOFormat format=Ascii) |
VectorIterator< ValueType > | beginPyIter () const |
VectorIterator< ValueType > | begin () const |
VectorIterator< ValueType > | end () const |
Index | hash () const |
void | add (const ElementMatrix< double > &A) |
void | add (const ElementMatrix< double > &A, const double &scale) |
void | add (const ElementMatrix< double > &A, const RVector3 &scale) |
void | add (const ElementMatrix< double > &A, const RMatrix &scale) |
void | add (const ElementMatrix< double > &A, const RVector &scale) |
void | clean () |
DLLEXPORT void | clean () |
Protected Member Functions | |
void | free_ () |
void | copy_ (const Vector< ValueType > &v) |
template<class ExprOP > | |
void | assign_ (const ExprOP &v) |
Protected Attributes | |
Index | size_ |
ValueType * | data_ |
Index | capacity_ |
int | nThreads_ |
Index | singleCalcCount_ |
Static Protected Attributes | |
static const Index | minSizePerThread = 10000 |
static const int | maxThreads = 8 |
One dimensional array aka Vector of limited size.
One dimensional array aka Vector of limited size. Size limit depends on platform (32bit system maxsize = 2^32, 64bit system, maxsize=2^64)
|
inline |
Construct one-dimensional array of size n. The vector is cleaned (filled with zero)
|
inline |
Construct one-dimensional array of size n, and fill it with val
|
inline |
Construct vector from file. Shortcut for Vector::load
References GIMLI::load().
|
inline |
Copy constructor. Create new vector as a deep copy of v.
|
inline |
Copy constructor. Create new vector as a deep copy of the slice v[start, end)
|
inline |
Copy constructor. Create new vector from expression
|
inline |
Copy constructor. Create new vector as a deep copy of std::vector(Valuetype)
|
inline |
Default destructor.
void GIMLI::Vector< ValueType >::add | ( | const ElementMatrix< double > & | A | ) |
Add Values from an ElementMatrix.
void GIMLI::Vector< ValueType >::add | ( | const ElementMatrix< double > & | A, |
const double & | scale | ||
) |
Add Values from an ElementMatrix. Optional scale with constant scalar.
void GIMLI::Vector< ValueType >::add | ( | const ElementMatrix< double > & | A, |
const Pos & | scale | ||
) |
Add Values from an ElementMatrix. Optional scale constant Pos.
void GIMLI::Vector< ValueType >::add | ( | const ElementMatrix< double > & | A, |
const RMatrix & | scale | ||
) |
Add Values from an ElementMatrix. Optional scale constant RMatrix.
void GIMLI::Vector< double >::add | ( | const ElementMatrix< double > & | A, |
const RVector< ValueType > & | scale | ||
) |
! warning this will lead to incorrect results with non constant scale ! use new fea style for correct integration
References GIMLI::ElementMatrix< ValueType >::col(), GIMLI::ElementMatrix< ValueType >::ids(), GIMLI::ElementMatrix< ValueType >::integrate(), GIMLI::ElementMatrix< ValueType >::row(), and GIMLI::ElementMatrix< ValueType >::rowIDs().
void GIMLI::Vector< ValueType >::add | ( | const ElementMatrix< double > & | A, |
const Vector< double > & | scale | ||
) |
DEPRECATED Bad design (Per node values need to be interpolated to quadrature points first.)
|
inline |
Add val to index idx.
|
inline |
Add values from vals at IndexArray idx. Throws length exception if sizes of vals and idx mismatch.
|
inline |
Like setVal(vals, start, end) instead copy use +=
Referenced by GIMLI::BlockMatrix< ValueType >::mult(), and GIMLI::BlockMatrix< ValueType >::transMult().
|
inline |
Fill the whole vector with function expr(i) */ template< class V > void fill(const V & val){ for (Index i = 0; i < size_; i ++) data_[i] = ValueType(val); }
/*! Fill Vector with 0.0. Don't change size.
|
inline |
Empty the vector. Frees memory and resize to 0.
Referenced by GIMLI::BlockMatrix< ValueType >::clear(), GIMLI::DataContainer::clear(), GIMLI::Mesh::findCell(), GIMLI::Mesh::findCellsAlongRay(), GIMLI::DataContainer::removeUnusedSensors(), and GIMLI::Dijkstra::shortestPathTo().
|
inline |
Return a deep copy. For numpy compatibility.
|
inline |
Fill the whole vector with val.
|
inline |
Fill the whole vector with function expr(i)
|
inline |
Fill the whole vector from the pointer of val. CAUTION!! There is no boundary check. Val must be properly ([val, val+this->size()))assigned.
Referenced by GIMLI::DCMultiElectrodeModelling::createDefaultStartModel(), GIMLI::increasingRange(), GIMLI::increasingRange2(), GIMLI::DC1dModelling::init_(), and GIMLI::loadMatrixSingleBin_T().
|
inline |
Get value for index i. Throws out of range exception if index check fails.
Referenced by GIMLI::BlockMatrix< ValueType >::mult(), and GIMLI::BlockMatrix< ValueType >::transMult().
|
inline |
Load the object from file. Returns true on success and in case of trouble an exception is thrown. The IOFormat flag will be overwritten if the filename have a proper file suffix. Ascii format is forced if VECTORASCSUFFIX is given. Binary format is forced if VECTORBINSUFFIX is set. See Vector< ValueType >::save for file format.
References GIMLI::load().
Referenced by GIMLI::loadVec().
|
inline |
Implicit converter for Vector< T > = Vector< ValueType >
Implicit converter for std::vector < T > = Vector< ValueType >
|
inline |
Return a new vector that based on indices's. Throws exception if indices's are out of bound
|
inline |
Return a new vector that based on indices's. Throws exception if indices's are out of bound.
|
inline |
Return a new vector that match the slice [start, end). end == -1 or larger size() sets end = size. Throws exception on violating boundaries.
|
inline |
Negation operator thats return a copy of this with negative values.
|
inline |
Assignment operator. Creates a new vector as from expression.
|
inline |
Assignment operator. Fill the existing vector with val. Shortcut for fill.
|
inline |
Assignment operator. Creates a new vector as copy of v
|
inline |
Reserve memory. Old data are preserved
Referenced by GIMLI::find().
|
inline |
Resize if n differs size() and fill new with val. Old data are preserved.
Referenced by GIMLI::Region::_createConstraintWeights(), GIMLI::Mesh::boundarySizedNormals(), GIMLI::Mesh::boundarySizes(), GIMLI::Mesh::cellSizes(), GIMLI::RInversion::checkConstraints(), GIMLI::evaluateQuadraturePoints(), GIMLI::SparseMapMatrix< ValueType, IndexType >::fillArrays(), GIMLI::RegionManager::fillConstraints(), GIMLI::RegionManager::fillModelControl(), GIMLI::RegionManager::fillStartModel(), GIMLI::GaussLaguerre(), GIMLI::GaussLegendre(), GIMLI::DC1dModelling::init_(), GIMLI::Mesh::interpolationMatrix(), GIMLI::RInversion::oneStep(), GIMLI::DataContainer::setSensorPosition(), GIMLI::Dijkstra::shortestPathTo(), and GIMLI::TravelTimeDijkstraModelling::updateMeshDependency_().
|
inline |
Round all values of this array to a given tolerance.
|
inline |
Save the object to file. Returns true on success and in case of trouble an exception is thrown. The IOFormat flag will be overwritten if the filename have a proper file suffix. Ascii format is forced if VECTORASCSUFFIX is given. Binary format is forced if VECTORBINSUFFIX is set. If no suffix is provided VECTORASCSUFFIX or VECTORBINSUFFIX will be append.
Binary format is:
Unsigned int64 [8Byte] - length of the Array [0.. length)
ValueType [sizeof(ValueType)] - 0th value
...
ValueType [sizeof(ValueType)] - length -1 value
Ascii format is a simple list of the values
filename | string of the file name |
IOFormat | enum, either Ascii for human readable format, or Binary for fast save and load. |
Referenced by GIMLI::DCMultiElectrodeModelling::response(), and GIMLI::saveVec().
|
inline |
Set the value to the whole array. Same as fill(val)
Referenced by GIMLI::DataContainer::add(), GIMLI::ElectrodeShapeEntity::assembleRHS(), GIMLI::TransCumulative< Vec >::deriv(), GIMLI::Region::fillConstraintWeights(), GIMLI::TransCumulative< Vec >::invTrans(), GIMLI::logDropTol(), GIMLI::RInversion::run(), GIMLI::PolynomialModelling::startModel(), and GIMLI::TransCumulative< Vec >::trans().
|
inline |
Set the val where bv is true. Throws out of length exception if sizes dismatch. Same as setVal(val, find(bv)) but faster.
|
inline |
Set multiple values. Throws out of range exception if index check fails.
|
inline |
Set value val from pair.start to pair.end
|
inline |
Set the value val at index i. Throws out of range exception if index is not in [0, size).
|
inline |
Set a value at slice range from [start, end). end will set to this->size() for < 0 or greater size(). start will set to end for < 0 or greater end
|
inline |
Set multiple values from vals at index position iArray. Throws out of range exception if index check fails.
|
inline |
Set all vals from pair.start to pair.end
|
inline |
Insert vals from start index. Resize if necessary.
|
inline |
Set values from slice. If vals.size() == this.size() copy vals[start, end) -> this[start, end) else assume vals is a slice itsself, so copy vals[0, end-start] -> this[start, end) if end larger than this size() sets end = size. Throws exception on violating boundaries.