1 #ifndef posidxpairvalset_h 2 #define posidxpairvalset_h 15 #include "generalmod.h" 20 namespace PosInfo {
class CubeData; }
26 template <
class IPT,
class FT>
class ValueIdxPair;
27 template <
class IPT,
class FT>
class IdxPairValues;
76 IdxPairValueSet(
int nr_vals,
77 bool allow_duplicate_idxpairs);
78 IdxPairValueSet(
const IdxPairValueSet&);
79 virtual ~IdxPairValueSet();
80 IdxPairValueSet& operator =(
const IdxPairValueSet&);
83 { allowdup_ = yn;
if ( !yn ) removeDuplicateIdxPairs();}
86 bool append(
const IdxPairValueSet&);
87 void remove(
const IdxPairValueSet&);
88 void copyStructureFrom(
const IdxPairValueSet&);
98 SPos(
int ii=-1,
int jj=-1 )
102 {
return i == p.
i && j == p.
j; }
104 {
return i != p.
i || j != p.
j; }
106 {
if ( i>p.
i )
return true;
return i==p.
i && j>p.
j; }
108 {
if ( i<p.
i )
return true;
return i==p.
i && j<p.
j; }
109 inline bool isValid()
const {
return i > -1 && j > -1; }
115 {
return findOccurrence( ip, 0 ); }
116 SPos findOccurrence(
const IdxPair&,
int occ=0)
const;
120 bool next(
SPos&,
bool skip_duplicate_idxpairs=
false)
const;
121 bool prev(
SPos&,
bool skip_duplicate_idxpairs=
false)
const;
122 bool isValid(
const IdxPair&)
const;
125 int mxnrvals=-1)
const;
126 IdxPair getIdxPair(
const SPos&)
const;
127 SPos getPos(
od_int64 global_idx)
const;
129 SPos add(
const IdxPair&,
const float* vs=0);
131 SPos add(
const DataRow&);
133 void set(SPos,
const float* vs=0);
140 inline int nrVals()
const {
return nrvals_; }
141 inline int nrFirst()
const {
return frsts_.size(); }
142 int nrSecond(IdxType firstidx)
const;
143 inline bool isEmpty()
const {
return nrFirst() < 1; }
145 {
return find(ip).j > -1; }
146 bool hasFirst(IdxType)
const;
147 bool hasSecond(IdxType)
const;
148 IdxPair firstIdxPair()
const;
155 void remove(
const SPos&);
162 bool setNrVals(
int,
bool kp_data=
true);
163 int nrDuplicateIdxPairs()
const;
164 void sortDuplicateIdxPairs(
int value_nr,
bool ascending=
true);
165 void removeDuplicateIdxPairs();
166 void randomSubselect(
od_int64 maxnr);
177 SPos add(
const PairVal&);
178 SPos add(
const IdxPair&,
float);
179 SPos add(
const IdxPair&,
double);
180 SPos add(
const IdxPair&,
float,
float);
183 void get(
const SPos&,DataRow&)
const;
184 void get(
const SPos&,PairVal&)
const;
185 void get(
const SPos&,IdxPair&,
float&)
const;
186 void get(
const SPos&,IdxPair&,
float&,
float&)
const;
188 int maxnrvals=-1)
const;
189 void set(
const SPos&,float);
190 void set(
const SPos&,float,float);
191 void set(
const SPos&,
const TypeSet<float>&);
192 void getColumn(
int valnr,TypeSet<float>&,
bool incudf)
const;
203 bool includes(
const DataRow&)
const;
204 int nrPos(
int lineidx)
const;
206 {
return valsets_[pos.
i]->arr() + nrvals_*pos.
j; }
208 inline const float*
getVals(
const SPos& pos )
const 209 {
return valsets_[pos.
i]->arr() + nrvals_*pos.
j; }
211 inline float getVal(
const SPos& pos,
int valnr )
const 213 {
return getVals(pos)[valnr]; }
214 bool hasDuplicateIdxPairs()
const;
215 bool haveDataRow(
const DataRow&)
const;
218 inline int nrInls()
const {
return nrFirst(); }
219 inline int nrCrls( IdxType inl )
const {
return nrSecond(inl); }
220 inline int nrRows()
const {
return nrFirst(); }
221 inline int nrCols( IdxType row )
const {
return nrSecond(row); }
222 bool hasInl( IdxType inl )
const {
return hasFirst(inl); }
223 bool hasCrl( IdxType crl )
const {
return hasSecond(crl); }
224 inline bool hasRow( IdxType row )
const {
return hasFirst(row); }
225 inline bool hasCol( IdxType col )
const {
return hasSecond(col); }
229 {
return secondRange(inl); }
231 {
return secondRange(row); }
241 void addNew(SPos&,IdxType,
const float*);
245 void removeLine(
int idx);
247 inline IdxType
getFrst(
const SPos& pos )
const 248 {
return frsts_[pos.
i]; }
249 inline IdxType
getScnd(
const SPos& pos )
const 250 {
return (*scndsets_[pos.
i])[pos.
j]; }
252 {
return *scndsets_[pos.
i]; }
254 {
return *scndsets_[pos.
i]; }
256 {
return *valsets_[pos.
i]; }
257 inline const TypeSet<float>&
getValSet(
const SPos& pos )
const 258 {
return *valsets_[pos.
i]; }
260 {
return *scndsets_[idx]; }
262 {
return *scndsets_[idx]; }
264 {
return *valsets_[idx]; }
266 {
return *valsets_[idx]; }
#define mExpClass(module)
Definition: commondefs.h:160
OD class for stream write common access to the user log file, or std::cout in batch progs...
Definition: od_ostream.h:26
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
Set of data points with group selection.
Definition: datapointset.h:48
bool isValid() const
Definition: posidxpairvalset.h:109
TypeSet< IdxType > frsts_
Definition: posidxpairvalset.h:236
bool operator<(const SPos &p) const
Definition: posidxpairvalset.h:107
IdxPair with a value.
Definition: posidxpairvalue.h:29
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
bool hasCol(IdxType col) const
Definition: posidxpairvalset.h:225
#define od_int64
Definition: plftypes.h:36
IdxPair with position indices; base class for BinID et al.
Definition: posidxpair.h:29
const TypeSet< IdxType > & getScndSet(int idx) const
Definition: posidxpairvalset.h:261
bool includes(const IdxPair &ip) const
Definition: posidxpairvalset.h:144
ValueIdxPair< IdxPair, float > PairVal
Definition: posidxpairvalset.h:73
IdxPair::IdxType IdxType
Definition: posidxpairvalset.h:72
bool allowdup_
Definition: posidxpairvalset.h:239
position in IdxPairValueSet; an iterator.
Definition: posidxpairvalset.h:96
TypeSet< IdxType > & getScndSet(const SPos &pos)
Definition: posidxpairvalset.h:251
IdxPair with 0-N values.
Definition: posidxpairvalue.h:23
Interval of values.
Definition: commontypes.h:31
OD class for stream read.
Definition: od_istream.h:24
int nrFirst() const
Definition: posidxpairvalset.h:141
void allowDuplicateIdxPairs(bool yn)
Definition: posidxpairvalset.h:82
bool append(TypeSetBase< T, I > &to, const TypeSetBase< S, J > &from)
append allowing a different type to be merged into set
Definition: typeset.h:198
Set of pointers to objects.
Definition: commontypes.h:32
int j
Definition: posidxpairvalset.h:111
int nrCrls(IdxType inl) const
Definition: posidxpairvalset.h:219
int i
Definition: posidxpairvalset.h:111
Set of (small) copyable elements.
Definition: commontypes.h:30
A sorted set of IdxPairs and associated values.
Definition: posidxpairvalset.h:68
int nrCols(IdxType row) const
Definition: posidxpairvalset.h:221
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
Horizontal sampling (inline and crossline range and steps).
Definition: trckeysampling.h:27
bool operator>(const SPos &p) const
Definition: posidxpairvalset.h:105
int nrInls() const
Definition: posidxpairvalset.h:218
Interval< int > crlRange(IdxType inl=-1) const
Definition: posidxpairvalset.h:228
ObjectSet< TypeSet< float > > valsets_
Definition: posidxpairvalset.h:238
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
ObjectSet< TypeSet< IdxType > > scndsets_
Definition: posidxpairvalset.h:237
const TypeSet< float > & getValSet(const SPos &pos) const
Definition: posidxpairvalset.h:257
Position.
Definition: commontypes.h:42
bool hasInl(IdxType inl) const
Definition: posidxpairvalset.h:222
IdxType getFrst(const SPos &pos) const
Definition: posidxpairvalset.h:247
IdxPairValues< IdxPair, float > DataRow
Definition: posidxpairvalset.h:74
bool allowsDuplicateIdxPairs() const
Definition: posidxpairvalset.h:84
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:62
bool hasRow(IdxType row) const
Definition: posidxpairvalset.h:224
void removeRange(ODSET &inst, size_type start, size_type stop)
Removes a range from the set.
Definition: odset.h:57
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
const T * find(const ObjectSet< T > &os, const S &val)
Get const object in set.
Definition: objectset.h:183
Interval< int > inlRange() const
Definition: posidxpairvalset.h:226
IdxType getScnd(const SPos &pos) const
Definition: posidxpairvalset.h:249
TypeSet< IdxType > & getScndSet(int idx)
Definition: posidxpairvalset.h:259
Index_Type GeomID
Definition: commontypes.h:52
int nrRows() const
Definition: posidxpairvalset.h:220
bool hasCrl(IdxType crl) const
Definition: posidxpairvalset.h:223
Position info, often segmented.
Definition: posinfo.h:40
bool isEmpty() const
Definition: posidxpairvalset.h:143
Interval< int > colRange(IdxType row=-1) const
Definition: posidxpairvalset.h:230
Index_Type IdxType
Definition: idxpair.h:34
TypeSet< float > & getValSet(int idx)
Definition: posidxpairvalset.h:263
const float * getVals(const SPos &pos) const
Direct access to value arrays.
Definition: posidxpairvalset.h:208
SPos find(const IdxPair &ip) const
Definition: posidxpairvalset.h:114
const int nrvals_
Definition: posidxpairvalset.h:235
TypeSet< float > & getValSet(const SPos &pos)
Definition: posidxpairvalset.h:255
const TypeSet< float > & getValSet(int idx) const
Definition: posidxpairvalset.h:265
float getVal(const SPos &pos, int valnr) const
< Direct access to value arrays.
Definition: posidxpairvalset.h:211
Interval< int > rowRange() const
Definition: posidxpairvalset.h:227
SPos(int ii=-1, int jj=-1)
Definition: posidxpairvalset.h:98
Position info for an entire 3D cube. The LineData's are not sorted.
Definition: posinfo.h:95
void reset()
Definition: posidxpairvalset.h:100
Data set consisting of data vectors.
Definition: posvecdataset.h:30
int nrVals() const
Definition: posidxpairvalset.h:140
const TypeSet< IdxType > & getScndSet(const SPos &pos) const
Definition: posidxpairvalset.h:253
float * getVals(const SPos &pos)
Direct access to value arrays.
Definition: posidxpairvalset.h:205