OpendTect
7.0
|
A sorted set of IdxPairs and associated values. More...
Classes | |
struct | SPos |
position in IdxPairValueSet; an iterator. More... | |
Public Types | |
typedef IdxPairValues< IdxPair, float > | DataRow |
typedef IdxPair::IdxType | IdxType |
typedef ValueIdxPair< IdxPair, float > | PairVal |
Public Member Functions | |
IdxPairValueSet (const IdxPairValueSet &) | |
IdxPairValueSet (int nr_vals, bool allow_duplicate_idxpairs) | |
virtual | ~IdxPairValueSet () |
SPos | add (const DataRow &) |
Wrong-sized will be handled correctly. More... | |
SPos | add (const IdxPair &, const float *vs=0) |
Either pass sufficient data or pass null. More... | |
SPos | add (const IdxPair &, const TypeSet< float > &) |
SPos | add (const IdxPair &, double) |
SPos | add (const IdxPair &, float) |
SPos | add (const IdxPair &, float, float) |
SPos | add (const PairVal &) |
void | add (const PosInfo::CubeData &) |
void | allowDuplicateIdxPairs (bool yn) |
bool | allowsDuplicateIdxPairs () const |
bool | append (const IdxPairValueSet &) |
Interval< int > | colRange (IdxType row=-1) const |
void | copyStructureFrom (const IdxPairValueSet &) |
will also empty this set More... | |
Interval< int > | crlRange (IdxType inl=-1) const |
void | extend (const IdxPairDelta &stepout, const IdxPairStep &) |
Adds only IdxPair postions not yet in set. More... | |
void | fillPar (IOPar &, const char *key) const |
SPos | find (const IdxPair &ip) const |
SPos | findNearest (const IdxPair &) const |
SPos | findNearestOnFirst (int frst, int scnd) const |
SPos | findOccurrence (const IdxPair &, int occ=0) const |
int | firstAtIdx (int firstidx) const |
int | firstIdx (int) const |
IdxPair | firstIdxPair () const |
if empty, returns IdxPair::udf() More... | |
Interval< IdxType > | firstRange () const |
void | get (const SPos &, DataRow &) const |
void | get (const SPos &, IdxPair &, float &) const |
void | get (const SPos &, IdxPair &, float &, float &) const |
void | get (const SPos &, IdxPair &, float *v=0, int mxnrvals=-1) const |
void | get (const SPos &, IdxPair &, TypeSet< float > &, int maxnrvals=-1) const |
max == -1 => all More... | |
void | get (const SPos &, PairVal &) const |
void | getColumn (int valnr, TypeSet< float > &, bool incudf) const |
bool | getFrom (od_istream &, Pos::GeomID=Pos::GeomID::udf()) |
detects/converts coords if geomid passed More... | |
IdxPair | getIdxPair (const SPos &) const |
SPos | getPos (od_int64 global_idx) const |
Slow. And no check on idx in range. More... | |
void | getSecondsAtIdx (int firstidx, TypeSet< int > &) const |
float | getVal (const SPos &pos, int valnr) const |
< Direct access to value arrays. 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... | |
bool | hasCol (IdxType col) const |
bool | hasCrl (IdxType crl) const |
bool | hasDuplicateIdxPairs () const |
bool | hasFirst (IdxType) const |
bool | hasInl (IdxType inl) const |
bool | hasRow (IdxType row) const |
bool | hasSecond (IdxType) const |
bool | haveDataRow (const DataRow &) const |
bool | includes (const DataRow &) const |
bool | includes (const IdxPair &ip) const |
Interval< int > | inlRange () const |
bool | insertVal (int) |
bool | isEmpty () const |
bool | isValid (const IdxPair &) const |
bool | next (SPos &, bool skip_duplicate_idxpairs=false) const |
int | nrCols (IdxType row) const |
int | nrCrls (IdxType inl) const |
int | nrDuplicateIdxPairs () const |
int | nrFirst () const |
int | nrInls () const |
int | nrPos (int lineidx) const |
nth line in the set More... | |
int | nrRows () const |
int | nrSecond (IdxType firstidx) const |
int | nrVals () const |
IdxPairValueSet & | operator= (const IdxPairValueSet &) |
bool | prev (SPos &, bool skip_duplicate_idxpairs=false) const |
bool | putTo (od_ostream &) const |
void | randomSubselect (od_int64 maxnr) |
void | remove (const IdxPairValueSet &) |
void | remove (const SPos &) |
afterwards, SPos may be invalid More... | |
void | remove (const TrcKeySampling &hrg, bool inside) |
void | remove (const TypeSet< SPos > &) |
void | removeDuplicateIdxPairs () |
void | removeRange (int valnr, const Interval< float > &, bool inside=true) |
void | removeVal (int) |
Will remove entire 'column'. More... | |
Interval< int > | rowRange () const |
int | secondIdx (int firstidx, int) const |
Interval< IdxType > | secondRange (IdxType firsidx=-1) const |
void | set (const SPos &, const TypeSet< float > &) |
void | set (const SPos &, float) |
void | set (const SPos &, float, float) |
void | set (SPos, const float *vs=0) |
void | setEmpty () |
bool | setNrVals (int, bool kp_data=true) |
void | sortDuplicateIdxPairs (int value_nr, bool ascending=true) |
od_int64 | totalSize () const |
void | usePar (const IOPar &, const char *key) |
Interval< float > | valRange (int valnr) const |
Protected Member Functions | |
void | addNew (SPos &, IdxType, const float *) |
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< IdxType > & | getScndSet (int idx) |
const TypeSet< IdxType > & | getScndSet (int idx) const |
TypeSet< float > & | getValSet (const SPos &pos) |
const TypeSet< float > & | getValSet (const SPos &pos) const |
TypeSet< float > & | getValSet (int idx) |
const TypeSet< float > & | getValSet (int idx) const |
void | removeLine (int idx) |
void | sortPart (TypeSet< IdxType > &, TypeSet< float > &, int, int, int, bool) |
void | updNearest (const IdxPair &, const SPos &, od_int64 &, SPos &) const |
Protected Attributes | |
bool | allowdup_ |
TypeSet< IdxType > | frsts_ |
const int | nrvals_ |
ObjectSet< TypeSet< IdxType > > | scndsets_ |
ObjectSet< TypeSet< float > > | valsets_ |
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 |
SPos Pos::IdxPairValueSet::findNearestOnFirst | ( | int | frst, |
int | scnd | ||
) | 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.
int Pos::IdxPairValueSet::firstAtIdx | ( | int | firstidx | ) | const |
int Pos::IdxPairValueSet::firstIdx | ( | int | ) | const |
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 | = Pos::GeomID::udf() |
||
) |
detects/converts coords if geomid passed
SPos Pos::IdxPairValueSet::getPos | ( | od_int64 | global_idx | ) | const |
Slow. And no check on idx in range.
void Pos::IdxPairValueSet::getSecondsAtIdx | ( | int | firstidx, |
TypeSet< int > & | |||
) | const |
|
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 |
bool Pos::IdxPairValueSet::includes | ( | const DataRow & | ) | const |
|
inline |
|
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 & | ) |
void Pos::IdxPairValueSet::remove | ( | const TrcKeySampling & | hrg, |
bool | inside | ||
) |
You cannot remove while iterating Collect the to-be-removed and use this instead
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 |
int Pos::IdxPairValueSet::secondIdx | ( | int | firstidx, |
int | |||
) | const |
void Pos::IdxPairValueSet::set | ( | const SPos & | , |
float | |||
) |
void Pos::IdxPairValueSet::set | ( | const SPos & | , |
float | , | ||
float | |||
) |
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::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 |
|
protected |
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. 1995-2024