Open santisoler opened 2 years ago
The documentation doesn't make it transparent that you can change the origin of any of the BaseRegularMesh
. I would personally be in favor of elevating this availability in the documentation with examples in the origin
docstring, and also in the TensorMesh example in its docstring.
Another thing we could consider (I know 2 years later), is support a way to say, "I want node_x/cell_center_x (or y,z) i to be at a specific location", but this syntax might need a little thought.
My first thought would be doing something like allowing the origin to be set with:
origin : Iterator[str | float | Tuple[Literal['c', 'n'], int, float]]
For the Tuple[Literal['c', 'n'], int, float]
:
'c'
would refer to cell centers in that direction and "n
" would refer to nodes in that direction.int
would refer to which item in that direction, andfloat
would be the location you want that item to have.
In some cases it's desirable to define a TensorMesh that spans through a very specific region but that it also has some padding around it. For example, if a given survey is defined on a
(300, 1500, -400, 600)
region (defined in West, East, South, North) one might want to define a TensorMesh below it with fine cells inside that region, but with a couple of larger cells around it (the padding). To do so, one need to pass ah
parameter like this one:The issue is that it's not trivial to set what the
origin
of the mesh should be before actually building it. A way to solve this problem is to create the mesh with a default origin of(0, 0, 0)
and then change theorigin
property. Nevertheless, editing theorigin
parameter is not explicitly stated on the documentation.A possible solution to this would be to add a
TensorMesh.set_origin()
method that sets theorigin
to a new given value. This method shouldn't be adding any new functionality, but exposing a clear interface on how theorigin
property could be changed.I would gladly implement it if this is something that you might want to have in
discretize
.Related to #https://github.com/simpeg/discretize/issues/21