OpendTect
6.6
|
A sorted set of IdxPairs and associated data buffer. More...
Classes | |
class | ObjData |
struct | SPos |
Set Position: position in IdxPairDataSet. More... | |
Public Types | |
typedef TypeSet< IdxType >::size_type | ArrIdxType |
typedef od_int64 | GlobIdxType |
typedef IdxPair::IdxType | IdxType |
typedef od_int64 | ObjSzType |
Public Member Functions | |
IdxPairDataSet (const IdxPairDataSet &) | |
IdxPairDataSet (ObjSzType, bool allow_duplicate_idxs, bool manage_data=true) | |
virtual | ~IdxPairDataSet () |
SPos | add (const IdxPair &, const void *obj=0) |
If returned SPos is not valid memory was full. More... | |
void | add (const PosInfo::CubeData &, EntryCreatedFn fn=0) |
Adds only IdxPair postions not yet in set. More... | |
void | allowDuplicateIdxPairs (bool) |
bool | allowsDuplicateIdxPairs () const |
bool | append (const IdxPairDataSet &) |
Interval< IdxType > | colRange (IdxType row=-1) const |
void | copyStructureFrom (const IdxPairDataSet &) |
will also empty this set More... | |
Interval< IdxType > | crlRange (IdxType inl=-1) const |
void | decrObjSize (ObjSzType, ObjSzType offs=-1) |
bool | dump (od_ostream &, bool binary) const |
void | extend (const IdxPairDelta &stepout, const IdxPairStep &, EntryCreatedFn fn=0) |
Adds only IdxPair postions not yet in set. More... | |
SPos | find (const IdxPair &ip) const |
SPos | findFirst (const IdxPair &ip) const |
SPos | findOccurrence (const IdxPair &, int occ=0) const |
IdxPair | firstIdxPair () const |
when empty returns udf() More... | |
Interval< IdxType > | firstRange () const |
const void * | get (SPos, IdxPair &) const |
IdxPair | getIdxPair (SPos) const |
const void * | getObj (SPos) const |
SPos | getPos (GlobIdxType) const |
Very slow. 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 | includes (const IdxPair &ip) const |
bool | incrObjSize (ObjSzType, ObjSzType offs=-1, const void *=0) |
Interval< IdxType > | inlRange () const |
bool | isEmpty () const |
bool | isValid (const IdxPair &) const |
bool | managesData () const |
bool | next (SPos &, bool skip_duplicate_idxpairs=false) const |
ArrIdxType | nrCols (IdxType row) const |
ArrIdxType | nrCrls (IdxType inl) const |
ArrIdxType | nrDuplicateIdxPairs () const |
ArrIdxType | nrFirst () const |
ArrIdxType | nrInls () const |
ArrIdxType | nrPos (ArrIdxType lineidx) const |
ArrIdxType | nrRows () const |
ArrIdxType | nrSecond (IdxType firstidx) const |
ObjSzType | objSize () const |
IdxPairDataSet & | operator= (const IdxPairDataSet &) |
bool | prev (SPos &, bool skip_duplicate_idxpairs=false) const |
void | randomSubselect (GlobIdxType maxsz) |
void | remove (const IdxPairDataSet &) |
void | remove (const TrcKeySampling &hrg, bool inside) |
void | remove (const TypeSet< SPos > &) |
void | remove (SPos) |
afterwards, input SPos may be invalid More... | |
void | removeDuplicateIdxPairs () |
Interval< IdxType > | rowRange () const |
Interval< IdxType > | secondRange (IdxType firsidx=-1) const |
void | set (const IdxPair &ip, const void *obj=0) |
May do the wrong thing if you have duplicates. More... | |
void | set (SPos, const void *obj=0) |
void | setEmpty () |
bool | setObjSize (ObjSzType sz, ObjSzType offs_in_objs=-1, const void *initwith=0) |
bool | slurp (od_istream &, bool binary) |
GlobIdxType | totalSize () const |
SPos | update (const IdxPair &, const void *obj=0) |
Protected Types | |
typedef od_int64 | BufSzType |
typedef TypeSet< IdxType > | IdxSet |
Protected Member Functions | |
void | addEntry (const Pos::IdxPair &, const void *, SPos &) |
bool | addObj (SPos &, IdxType, const void *) |
IdxType | gtFrst (const SPos &pos) const |
IdxPair | gtIdxPair (const SPos &pos) const |
const void * | gtObj (const SPos &) const |
ObjData & | gtObjData (ArrIdxType idx) |
const ObjData & | gtObjData (ArrIdxType idx) const |
ObjData & | gtObjData (const SPos &pos) |
const ObjData & | gtObjData (const SPos &pos) const |
IdxType | gtScnd (const SPos &pos) const |
IdxSet & | gtScndSet (ArrIdxType idx) |
const IdxSet & | gtScndSet (ArrIdxType idx) const |
IdxSet & | gtScndSet (const SPos &pos) |
const IdxSet & | gtScndSet (const SPos &pos) const |
void | putObj (const SPos &, const void *) |
Static Protected Member Functions | |
static ArrIdxType | findIndexFor (const IdxSet &, IdxType, bool *found=0) |
Protected Attributes | |
bool | allowdup_ |
IdxSet | frsts_ |
const bool | mandata_ |
ObjectSet< ObjData > | objdatas_ |
const ObjSzType | objsz_ |
ObjectSet< IdxSet > | scndsets_ |
A sorted set of IdxPairs and associated data buffer.
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 inefficient.
Note that you can use null pointers to add or set 'empty' slots. Note also: ObjSz is od_int64. Keep it like that as it ensures good index arithmetic for the buffers.
<>
typedef TypeSet<IdxType>::size_type Pos::IdxPairDataSet::ArrIdxType |
|
protected |
typedef od_int64 Pos::IdxPairDataSet::GlobIdxType |
|
protected |
typedef od_int64 Pos::IdxPairDataSet::ObjSzType |
Pos::IdxPairDataSet::IdxPairDataSet | ( | ObjSzType | , |
bool | allow_duplicate_idxs, | ||
bool | manage_data = true |
||
) |
Pos::IdxPairDataSet::IdxPairDataSet | ( | const IdxPairDataSet & | ) |
|
virtual |
If returned SPos is not valid memory was full.
void Pos::IdxPairDataSet::add | ( | const PosInfo::CubeData & | , |
EntryCreatedFn | fn = 0 |
||
) |
Adds only IdxPair postions not yet in set.
|
protected |
void Pos::IdxPairDataSet::allowDuplicateIdxPairs | ( | bool | ) |
|
inline |
bool Pos::IdxPairDataSet::append | ( | const IdxPairDataSet & | ) |
void Pos::IdxPairDataSet::copyStructureFrom | ( | const IdxPairDataSet & | ) |
will also empty this set
bool Pos::IdxPairDataSet::dump | ( | od_ostream & | , |
bool | binary | ||
) | const |
void Pos::IdxPairDataSet::extend | ( | const IdxPairDelta & | stepout, |
const IdxPairStep & | , | ||
EntryCreatedFn | fn = 0 |
||
) |
Adds only IdxPair postions not yet in set.
|
staticprotected |
IdxPair Pos::IdxPairDataSet::firstIdxPair | ( | ) | const |
when empty returns udf()
const void* Pos::IdxPairDataSet::getObj | ( | SPos | ) | const |
SPos Pos::IdxPairDataSet::getPos | ( | GlobIdxType | ) | const |
Very slow.
|
protected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inline |
|
inline |
bool Pos::IdxPairDataSet::hasDuplicateIdxPairs | ( | ) | const |
bool Pos::IdxPairDataSet::hasFirst | ( | IdxType | ) | const |
|
inline |
|
inline |
bool Pos::IdxPairDataSet::hasSecond | ( | IdxType | ) | const |
|
inline |
|
inline |
bool Pos::IdxPairDataSet::isValid | ( | const IdxPair & | ) | const |
|
inline |
bool Pos::IdxPairDataSet::next | ( | SPos & | , |
bool | skip_duplicate_idxpairs = false |
||
) | const |
|
inline |
|
inline |
ArrIdxType Pos::IdxPairDataSet::nrDuplicateIdxPairs | ( | ) | const |
|
inline |
|
inline |
ArrIdxType Pos::IdxPairDataSet::nrPos | ( | ArrIdxType | lineidx | ) | const |
|
inline |
ArrIdxType Pos::IdxPairDataSet::nrSecond | ( | IdxType | firstidx | ) | const |
|
inline |
IdxPairDataSet& Pos::IdxPairDataSet::operator= | ( | const IdxPairDataSet & | ) |
bool Pos::IdxPairDataSet::prev | ( | SPos & | , |
bool | skip_duplicate_idxpairs = false |
||
) | const |
|
protected |
void Pos::IdxPairDataSet::randomSubselect | ( | GlobIdxType | maxsz | ) |
void Pos::IdxPairDataSet::remove | ( | const IdxPairDataSet & | ) |
void Pos::IdxPairDataSet::remove | ( | const TrcKeySampling & | hrg, |
bool | inside | ||
) |
You cannot remove while iterating, so ... collect the to-be-removed and use this instead
void Pos::IdxPairDataSet::removeDuplicateIdxPairs | ( | ) |
|
inline |
May do the wrong thing if you have duplicates.
void Pos::IdxPairDataSet::set | ( | SPos | , |
const void * | obj = 0 |
||
) |
Will not check whether SPos is in set When iterating, this is not an issue If unsure, check isValid(SPos)
void Pos::IdxPairDataSet::setEmpty | ( | ) |
bool Pos::IdxPairDataSet::setObjSize | ( | ObjSzType | sz, |
ObjSzType | offs_in_objs = -1 , |
||
const void * | initwith = 0 |
||
) |
bool Pos::IdxPairDataSet::slurp | ( | od_istream & | , |
bool | binary | ||
) |
GlobIdxType Pos::IdxPairDataSet::totalSize | ( | ) | const |
May do the wrong thing if you have duplicates Will add if necessary If returned SPos is not valid memory was full
|
protected |
|
protected |
|
protected |
|
protected |
Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2022