Closed nschloe closed 3 years ago
Neat that's logical. Yea, corners could be optional as naturally some some geometries don't have them.
I'll get to work sometime today.
Okay made some progress over on #106 ....will add the intersection class in a bit. One thing that I'd like to handle is if you want to compute the intersection between say a disk (dim=2) and a cube (dim=3), it could work it out and produce a cylinder.
Maybe the latter isn't a great idea, not sure.
intersection between say a disk (dim=2) and a cube (dim=3)
Doesn't seem to make sense when first reading it.
I'd say better get union, intersection, and difference down. Perhaps a few primitive shapes like cube, ball, wedge, I don't know. With this, one should be able to do quite a lot already.
Yea, I agree. I think that's more of what you would call an extrusion.
Extrusion, yes, also a good idea. Gmsh has extrude
, revolve
, twist
. For all of these, it's possible to create a 3D model from a 2D one programmatically. That's for the future perhaps.
Another minor improvement would be to have an additional keyword argument to plot_sizing_function, such that one can visualize it when using containers etc.
def plot_sizing_function(cell_size, stride=1, comm=None, filename=None):
# ...
if filename is None:
plt.show()
else:
plt.savefig(filename)
ah yea, that's a good suggestion.
The following still fails
import SeismicMesh
points, cells = SeismicMesh.generate_mesh(
h0=0.1,
domain=SeismicMesh.geometry.Rectangle([-1.0, +1.0, -1.0, +1.0]),
edge_length=0.1,
)
ValueError: `bbox` must be a tuple
The idea here would be that you don't need to specify a bbox
explicitly; it should be taken from domain
.
The idea here would be that you don't need to specify a bbox explicitly; it should be taken from domain.
It is taken from domain.
It's failing because bbox isn't a tuple
A tuple as opposed to a list? Why so strict? (Genuine question, perhaps it does make sense.)
This should work
import SeismicMesh
points, cells = SeismicMesh.generate_mesh(
domain=SeismicMesh.geometry.Rectangle((-1.0, +1.0, -1.0, +1.0)),
edge_length=0.1,
)
A tuple as opposed to a list? Why so strict? (Genuine question, perhaps it does make sense.)
Because tuple is immutable and the idea is that the bbox shouldn't mutate.
Can perhaps also be closed.
The user interface of SM is more complicated than it needs to be when it comes to bounding boxes, corners etc. Consider the following code for the L-shape:
Suggestion: Define
Rectangle
objects likeThe unions, intersections etc. can compute their bounding boxes and corners from the bounding boxes and corners of the input arguments, e.g.,
One can check which corners are at the boundary of the union by evaluating the
eval()
for every domain.The above code would then look like
The arguments to
Rectangle
could be better organized as[0.0, 1.0], [0.0, 0.5]
.Defining a new domain would then always require writing a class with
eval
, abbox
, and (perhaps optionally)corners
.What do you think?