OpendTect-6_4
6.4
|
A sorted set of IdxPairs and associated values. More...
Classes | |
struct | SPos |
position in IdxPairValueSet; an iterator. More... | |
Public Types | |
typedef IdxPair::IdxType | IdxType |
typedef ValueIdxPair< IdxPair, float > | PairVal |
typedef IdxPairValues< IdxPair, float > | DataRow |
Public Member Functions | |
IdxPairValueSet (int nr_vals, bool allow_duplicate_idxpairs) | |
IdxPairValueSet (const IdxPairValueSet &) | |
virtual | ~IdxPairValueSet () |
IdxPairValueSet & | operator= (const IdxPairValueSet &) |
void | allowDuplicateIdxPairs (bool yn) |
bool | allowsDuplicateIdxPairs () const |
void | setEmpty () |
bool | append (const IdxPairValueSet &) |
void | remove (const IdxPairValueSet &) |
void | copyStructureFrom (const IdxPairValueSet &) |
will also empty this set More... | |
SPos | find (const IdxPair &ip) const |
SPos | findOccurrence (const IdxPair &, int occ=0) const |
bool | next (SPos &, bool skip_duplicate_idxpairs=false) const |
bool | prev (SPos &, bool skip_duplicate_idxpairs=false) const |
bool | isValid (const IdxPair &) const |
void | get (const SPos &, IdxPair &, float *v=0, int mxnrvals=-1) const |
IdxPair | getIdxPair (const SPos &) const |
SPos | getPos (od_int64 global_idx) const |
Slow. And no check on idx in range. More... | |
SPos | add (const IdxPair &, const float *vs=0) |
Either pass sufficient data or pass null. More... | |
SPos | add (const DataRow &) |
Wrong-sized will be handled correctly. More... | |
void | set (SPos, const float *vs=0) |
int | nrVals () const |
int | nrFirst () const |
int | nrSecond (IdxType firstidx) const |
bool | isEmpty () const |
bool | includes (const IdxPair &ip) const |
bool | hasFirst (IdxType) const |
bool | hasSecond (IdxType) const |
IdxPair | firstIdxPair () const |
if empty, returns IdxPair::udf() More... | |
od_int64 | totalSize () const |
Interval< IdxType > | firstRange () const |
Interval< IdxType > | secondRange (IdxType firsidx=-1) const |
Interval< float > | valRange (int valnr) const |
void | remove (const SPos &) |
afterwards, SPos may be invalid More... | |
void | remove (const TypeSet< SPos > &) |
void | removeVal (int) |
Will remove entire 'column'. More... | |
bool | insertVal (int) |
bool | setNrVals (int, bool kp_data=true) |
int | nrDuplicateIdxPairs () const |
void | sortDuplicateIdxPairs (int value_nr, bool ascending=true) |
void | removeDuplicateIdxPairs () |
void | randomSubselect (od_int64 maxnr) |
void | extend (const IdxPairDelta &stepout, const IdxPairStep &) |
Adds only IdxPair postions not yet in set. More... | |
void | removeRange (int valnr, const Interval< float > &, bool inside=true) |
void | remove (const TrcKeySampling &hrg, bool inside) |
SPos | add (const PairVal &) |
SPos | add (const IdxPair &, float) |
SPos | add (const IdxPair &, double) |
SPos | add (const IdxPair &, float, float) |
SPos | add (const IdxPair &, const TypeSet< float > &) |
void | add (const PosInfo::CubeData &) |
void | get (const SPos &, DataRow &) const |
void | get (const SPos &, PairVal &) const |
void | get (const SPos &, IdxPair &, float &) const |
void | get (const SPos &, IdxPair &, float &, float &) const |
void | get (const SPos &, IdxPair &, TypeSet< float > &, int maxnrvals=-1) const |
max == -1 => all More... | |
void | set (const SPos &, float) |
void | set (const SPos &, float, float) |
void | set (const SPos &, const TypeSet< float > &) |
void | getColumn (int valnr, TypeSet< float > &, bool incudf) const |
void | fillPar (IOPar &, const char *key) const |
void | usePar (const IOPar &, const char *key) |
bool | getFrom (od_istream &, Pos::GeomID=mUdf(Pos::GeomID)) |
detects/converts coords if geomid passed More... | |
bool | putTo (od_ostream &) const |
bool | includes (const DataRow &) const |
int | nrPos (int lineidx) const |
nth line in the set More... | |
float * | getVals (const SPos &pos) |
Direct access to value arrays. More... | |
const float * | getVals (const SPos &pos) const |
Direct access to value arrays. More... | |
float | getVal (const SPos &pos, int valnr) const |
< Direct access to value arrays. More... | |
bool | hasDuplicateIdxPairs () const |
bool | haveDataRow (const DataRow &) const |
int | nrInls () const |
int | nrCrls (IdxType inl) const |
int | nrRows () const |
int | nrCols (IdxType row) const |
bool | hasInl (IdxType inl) const |
bool | hasCrl (IdxType crl) const |
bool | hasRow (IdxType row) const |
bool | hasCol (IdxType col) const |
Interval< int > | inlRange () const |
Interval< int > | rowRange () const |
Interval< int > | crlRange (IdxType inl=-1) const |
Interval< int > | colRange (IdxType row=-1) const |
Protected Member Functions | |
void | addNew (SPos &, IdxType, const float *) |
void | sortPart (TypeSet< IdxType > &, TypeSet< float > &, int, int, int, bool) |
void | removeLine (int idx) |
IdxType | getFrst (const SPos &pos) const |
IdxType | getScnd (const SPos &pos) const |
TypeSet< IdxType > & | getScndSet (const SPos &pos) |
const TypeSet< IdxType > & | getScndSet (const SPos &pos) const |
TypeSet< float > & | getValSet (const SPos &pos) |
const TypeSet< float > & | getValSet (const SPos &pos) const |
TypeSet< IdxType > & | getScndSet (int idx) |
const TypeSet< IdxType > & | getScndSet (int idx) const |
TypeSet< float > & | getValSet (int idx) |
const TypeSet< float > & | getValSet (int idx) const |
Protected Attributes | |
const int | nrvals_ |
TypeSet< IdxType > | frsts_ |
ObjectSet< TypeSet< IdxType > > | scndsets_ |
ObjectSet< TypeSet< float > > | valsets_ |
bool | allowdup_ |
Friends | |
class | DataPointSet |
class | PosVecDataSet |
A sorted set of IdxPairs and associated values.
The set is sorted on both first and second key (inl()/row()/lineNr() and crl()/col()/traceNr()). This has a cost when creating the set, and it will be slower than a normal TypeSet for small sets. Further, the order in which you add positions will not be preserved.
Luckily there are also advantages. It is much faster for searching when the set is large. When you have a block of N rows x N columns, the search time will be O( 2 log2(N) ) instead of O( N^2 / 2 ). Thus for 1000x1000 instead of 500000 you need 20 comparisons (probably a few more but not a lot more).
The iteration through the set should be done using the SPos iterator class. All positioning is already done with SPos, but you can in theory still use
but that will be very wasteful.
When you construct a IdxPairValueSet, you must provide the number of values (which can be changed later) and whether duplicate IdxPairs are allowed. In the set, new uninitialized values will be set to mUdf(float).
if you also want the values sorted (for the same IdxPair) use sortDuplicateIdxPairs().
Note: if one of the values is Z, make it the first value. Not that this is enforced by the set, but it will be assumed sooner or later.
typedef IdxPairValues<IdxPair,float> Pos::IdxPairValueSet::DataRow |
typedef ValueIdxPair<IdxPair,float> Pos::IdxPairValueSet::PairVal |
Pos::IdxPairValueSet::IdxPairValueSet | ( | int | nr_vals, |
bool | allow_duplicate_idxpairs | ||
) |
Pos::IdxPairValueSet::IdxPairValueSet | ( | const IdxPairValueSet & | ) |
|
virtual |
Either pass sufficient data or pass null.
void Pos::IdxPairValueSet::add | ( | const PosInfo::CubeData & | ) |
|
inline |
|
inline |
bool Pos::IdxPairValueSet::append | ( | const IdxPairValueSet & | ) |
void Pos::IdxPairValueSet::copyStructureFrom | ( | const IdxPairValueSet & | ) |
will also empty this set
void Pos::IdxPairValueSet::extend | ( | const IdxPairDelta & | stepout, |
const IdxPairStep & | |||
) |
Adds only IdxPair postions not yet in set.
void Pos::IdxPairValueSet::fillPar | ( | IOPar & | , |
const char * | key | ||
) | const |
not found: j < 0. still, i can be >= 0 , then the inline is present Then, next(pos) will return the first on that inl.
IdxPair Pos::IdxPairValueSet::firstIdxPair | ( | ) | const |
if empty, returns IdxPair::udf()
void Pos::IdxPairValueSet::get | ( | const SPos & | , |
IdxPair & | , | ||
float * | v = 0 , |
||
int | mxnrvals = -1 |
||
) | const |
void Pos::IdxPairValueSet::get | ( | const SPos & | , |
IdxPair & | , | ||
TypeSet< float > & | , | ||
int | maxnrvals = -1 |
||
) | const |
max == -1 => all
void Pos::IdxPairValueSet::getColumn | ( | int | valnr, |
TypeSet< float > & | , | ||
bool | incudf | ||
) | const |
bool Pos::IdxPairValueSet::getFrom | ( | od_istream & | , |
Pos::GeomID | = mUdf(Pos::GeomID) |
||
) |
detects/converts coords if geomid passed
|
inline |
< Direct access to value arrays.
|
inline |
Direct access to value arrays.
|
inline |
Direct access to value arrays.
|
inlineprotected |
|
inlineprotected |
|
inline |
|
inline |
bool Pos::IdxPairValueSet::hasDuplicateIdxPairs | ( | ) | const |
bool Pos::IdxPairValueSet::hasFirst | ( | IdxType | ) | const |
|
inline |
|
inline |
bool Pos::IdxPairValueSet::hasSecond | ( | IdxType | ) | const |
bool Pos::IdxPairValueSet::haveDataRow | ( | const DataRow & | ) | const |
|
inline |
bool Pos::IdxPairValueSet::includes | ( | const DataRow & | ) | const |
|
inline |
bool Pos::IdxPairValueSet::insertVal | ( | int | ) |
|
inline |
bool Pos::IdxPairValueSet::isValid | ( | const IdxPair & | ) | const |
bool Pos::IdxPairValueSet::next | ( | SPos & | , |
bool | skip_duplicate_idxpairs = false |
||
) | const |
|
inline |
|
inline |
int Pos::IdxPairValueSet::nrDuplicateIdxPairs | ( | ) | const |
|
inline |
|
inline |
int Pos::IdxPairValueSet::nrPos | ( | int | lineidx | ) | const |
nth line in the set
|
inline |
int Pos::IdxPairValueSet::nrSecond | ( | IdxType | firstidx | ) | const |
|
inline |
IdxPairValueSet& Pos::IdxPairValueSet::operator= | ( | const IdxPairValueSet & | ) |
bool Pos::IdxPairValueSet::prev | ( | SPos & | , |
bool | skip_duplicate_idxpairs = false |
||
) | const |
bool Pos::IdxPairValueSet::putTo | ( | od_ostream & | ) | const |
void Pos::IdxPairValueSet::randomSubselect | ( | od_int64 | maxnr | ) |
void Pos::IdxPairValueSet::remove | ( | const IdxPairValueSet & | ) |
You cannot remove while iterating Collect the to-be-removed and use this instead
void Pos::IdxPairValueSet::remove | ( | const TrcKeySampling & | hrg, |
bool | inside | ||
) |
void Pos::IdxPairValueSet::removeDuplicateIdxPairs | ( | ) |
|
protected |
void Pos::IdxPairValueSet::removeRange | ( | int | valnr, |
const Interval< float > & | , | ||
bool | inside = true |
||
) |
Removes vectors with value for column valnr in- or outside interval
void Pos::IdxPairValueSet::removeVal | ( | int | ) |
Will remove entire 'column'.
|
inline |
void Pos::IdxPairValueSet::set | ( | SPos | , |
const float * | vs = 0 |
||
) |
null = set to undef no checks on data size (how could there be?) and also not whether SPos is actually in set! in doubt, use isValid(SPos) .
void Pos::IdxPairValueSet::set | ( | const SPos & | , |
float | |||
) |
void Pos::IdxPairValueSet::set | ( | const SPos & | , |
float | , | ||
float | |||
) |
void Pos::IdxPairValueSet::setEmpty | ( | ) |
bool Pos::IdxPairValueSet::setNrVals | ( | int | , |
bool | kp_data = true |
||
) |
void Pos::IdxPairValueSet::sortDuplicateIdxPairs | ( | int | value_nr, |
bool | ascending = true |
||
) |
|
protected |
od_int64 Pos::IdxPairValueSet::totalSize | ( | ) | const |
void Pos::IdxPairValueSet::usePar | ( | const IOPar & | , |
const char * | key | ||
) |
Interval<float> Pos::IdxPairValueSet::valRange | ( | int | valnr | ) | const |
|
friend |
|
friend |
|
protected |
|
protected |
Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019