axom icon indicating copy to clipboard operation
axom copied to clipboard

Create a multidimentional array inlet field

Open chapman39 opened this issue 2 years ago • 4 comments

2d matrices (and 3d) are common in physics simulations. The current way I represent a 2d array is like this in lua:

-- A struct that contains two arrays of doubles: row1 and row2
kappa = {
    row1 = [1.0, 0.0],
    row2 = [0.0, 2.0]
}

It would be more natural so allow something like this. As far as I know, this is not possible:

-- vector<vector<double>> ?
kappa =  [[1.0, 0.0], [0.0, 2.0]]

If this is somehow possible using addStruct let me know, but it seems to me we would need an extra container adder, like addDouble2DArray, addDouble3DArray?

chapman39 avatar Dec 08 '23 01:12 chapman39

or maybe is this possible with addFunction? @white238 https://axom.readthedocs.io/en/develop/axom/inlet/docs/sphinx/functions.html

In Lua, the following operations on the Vector type are supported (for Vector s u, v, and w):

    Construction of a 3D vector: u = Vector.new(1, 2, 3)
    Construction of a 2D vector: u = Vector.new(1, 2)

chapman39 avatar Dec 08 '23 01:12 chapman39

Update: i was confusing euclidean vector with std::vector ... addFunction will not work for 2D arrays

chapman39 avatar Dec 20 '23 22:12 chapman39