in current project dealing multidimensional datastructure. underlying file stored sequentially (i.e. 1 huge array, no vector of vectors). algorithms use these datastructures need know size of individual dimensions.
i wondering if multidimensional iterator class has been definied somewhere in generic way , if there standards or preferred ways on how tackle this.
at moment using linear iterator additional methods return size of each dimension , how many dimensions there in first part. reason don't because can't use std:: distance in reasonable way example (i.e. returns distance of whole structure, not each dimension separately).
for part access datastructure in linear fashion (first dimension start finish -> next dimension+...and on), know when 1 dimension "ends". don't know how operator*(), operator+() , operator==() in such approach.
a vector of vectors approach disfavored, because don't want split file. algorithms must operate on structure different dimensionality , therefore hard generalize (or maybe there way?).
boost multi_array has same problems (multiple "levels" of iterators).
i hope not vague or abstract. hint in right direction appreciated.
i looking solution myself again , revisited boost:: multi_array. turns out possible generate sub views on data them, @ same time take direct iterator @ top level , implicitely "flatten" data structure. implemented versions of multi_array not suit needs, therefore implement 1 myself (that handles caching of files in background) compatible other multi_arrays.
i update again once implementation done.
i have decided open public repository on github : multidim grid might needs. ongoing project glad if can try , tell me miss / need.
i have started working on this topic on codereview.
put :
multidim grid proposes flat uni-dimensional array offer generic fast access between multi-dimension coordinates , flatten index.
you container behaviour have access iterators.
Comments
Post a Comment