I have been working on a buoyancy force model that requires access to the mesh vertex locations and the corresponding triangle connectivity. I have been just parsing the mesh file directly, but I know the data is available in the simulation and I think I should try to develop getting the necessary data that way.
It seems that oapi.get_meshgroup() gives me this access, but I am not sure of the form of what that returns, and it seems that I must tell it how many vertices to expect and allocate memory for that, and I'm not sure how that is done for a general mesh unless the user physically opens the mesh and looks for the GEOM data.
What I am envisioning is that the user can provide the indices of the mesh groups of the loaded mesh hmesh that correspond to hull surfaces where buoyant forces would be expected, like this:
And something like the following would pull the necessary data from those meshgroups:
The above would only need to be run once, perhaps in clbk_setclasscaps or clbk_postcreation, so the vertex data and triangle connectivity would be available before the simulation starts.
I've read the comments and documentation associated with get_meshgroup() but my understanding of what that is explaining is rather muddy.
It seems that oapi.get_meshgroup() gives me this access, but I am not sure of the form of what that returns, and it seems that I must tell it how many vertices to expect and allocate memory for that, and I'm not sure how that is done for a general mesh unless the user physically opens the mesh and looks for the GEOM data.
What I am envisioning is that the user can provide the indices of the mesh groups of the loaded mesh hmesh that correspond to hull surfaces where buoyant forces would be expected, like this:
Code:
hull_meshgroups = {1,2,3,4,5,6}
And something like the following would pull the necessary data from those meshgroups:
Code:
for i = 1, #hull_meshgroups do
structure_that_stores_vertices_and connectivity[i] = oapi.get_meshgroup(hmesh, i)
end
*extract vertex and triangle connectivity data for force calculations*
The above would only need to be run once, perhaps in clbk_setclasscaps or clbk_postcreation, so the vertex data and triangle connectivity would be available before the simulation starts.
I've read the comments and documentation associated with get_meshgroup() but my understanding of what that is explaining is rather muddy.