|Message: Preferred N-D array in Geant4||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
[...no exact forum match, scoring matches only partially...]
A couple of times, I had to use a 3D matrix (or 2D, or, in general, an ND-one) of different quantities (for voxel parameters, for field maps, for scoring). Sometimes the matrix item was a G4double, sometimes a G4ThreeVector, but in principle, it can be any other type. In Python world, I would immediately use numpy arrays and would not think a single second.
However, when I tried to find a recommended (or at least frequently used) approach to work with N-D data in Geant4 source code (or perhaps CLHEP), I haven't found any. Different components (e.g. scoring meshes, physics tables, ...) use different approaches and many methods repeat the same (
So my question is...
Is there a generic n-dimensional array/matrix class (ideally templated, accepting any type, efficiently in-lining access) and if not, shouldn't there be? There are many implementations in external libraries (like multi_array in boost, libdynd, ...) and it's not that difficult to write one's own (in fact, an implementation is even described in Stroustrup's C++ book) but perhaps such tool should be a standard part of Geant4/CLHEP for anyone to use without custom coding and external dependencies, like e.g.
Or is it just that I was not looking carefully? Or that there really is no need? I am sorry, if this is the case :-)
P.S. Once such standard representation exists, more tools (like interpolation, arithmetic operations, geometry-related stuff for 2D/3D case, ...) can be implemented upon it, which, I believe, would save a lot of time for everybody.
P.P.S. If there is such interest, I can contribute with some code.