Re: [MeshPy] Meshpy Gmsh interface
by Andreas Kloeckner

Ander Biguri <a.biguri(a)bath.ac.uk> writes:
> Hi,
> Thanks, that was actually quite useful.
> So as far as I can see, one has to create the mesh geometric file somehow
> else (in the example the GMSH_SPHERE).
Well, yes, you can. The docs for that are here:
http://geuz.org/gmsh/doc/texinfo/gmsh.html
(Chapters 4 and 5 mainly)
But I generally prefer to create a .step geometry in, say, FreeCAD and
mesh that, because I don't find the Gmsh language easy to deal with.
> I am guessing that creating this files for user specified complex
> geometries ( e.g. a volumetric indexed image, or a surface) is not
> implemented.
> Am I right?
No, meshpy does not help with that, and Gmsh AFAIK does not have
anything built in. But if you mean to describe a (triangular or
quadrilateral) surface mesh, that should be quite doable with the Gmsh
language.
Andreas
3 years, 8 months

Meshpy Gmsh interface
by Ander Biguri

Hello all,
I was wondering if there is any Gmsh interface example to start with in
meshpy.
I intend to use the whole library for a library I am creating with some
co-workers and we need some powerful 3D meshing tools that Gmsh provides.
If we use meshpy's gmsh interface, we could also help improve meshpy, or at
least expand the documentation.
Thank you in advance for the help.
Ander Biguri
PhD Student in University of Bath.
3 years, 8 months

Question about MeshPy
by Dmitry Grebennikov

Hi there!
I want to ask if it is considered to be proper way to pass mesh object
as an argument to the functions?
Does there any copy occur in memory?
The same question is for mesh.points and mesh.elements...
I'm passing these objects to global namespace of the module, but I guess
it's not the best option.
Also, I wonder, what is the best way to manipulate with
mesh.elements/points structure of mesh?
As I found out, they are iterable.
For example, to find the vertices of certain tetrahedron I wrote the
following function:
from itertools import islice
import numpy as np
def get_vertices_of_tetrahedron(mesh, element):
p1 = np.array(
next(islice(mesh.points, element[0]-1, element[0]))
)
p2 = np.array(
next(islice(mesh.points, element[1]-1, element[1]))
)
p3 = np.array(
next(islice(mesh.points, element[2]-1, element[2]))
)
p4 = np.array(
next(islice(mesh.points, element[3]-1, element[3]))
)
return p1, p2, p3, p4
May be you could suggest a better way for doing this?
May be it is OK to convert these iterables into lists? I guess it would
occupy more space in memory?
Thanks in advance!
Dmitry
3 years, 9 months

Re: [MeshPy] Weighted Delaunay tessellation
by Andreas Kloeckner

Hi Evangelos,
Ευάγγελος Βογιατζής <evoyiatzis(a)gmail.com> writes:
> I am trying to perform a weighted Delaunay tessellation on a given set of
> points. I have tried to modify the example that has been earlier provided
> to perform a Delaunay tessellation on a group of points (
> https://github.com/inducer/meshpy/commit/c398e5bec38636f7d2f0966b6d348c88...).
> According to the tetgen manual, the user should specify the -w switch and
> provide a fourth column which is the weights of each point. Therefore I
> have modified the example which now reads as follows:
>
> from meshpy.tet import MeshInfo, build, Options
>
> # prepare the coordinates for the delaunay tessellation
> DelaunayXCoordinates = self.PeriodicSolidXCoordinates +
> self.PeriodicFluidXCoordinates
> DelaunayYCoordinates = self.PeriodicSolidYCoordinates +
> self.PeriodicFluidYCoordinates
> DelaunayZCoordinates = self.PeriodicSolidZCoordinates +
> self.PeriodicFluidZCoordinates
>
> DelaunayWeight = self.SigmaSolid + self.SigmaFluid # set the weight
> for the Delaunay tessellation
>
> DelaunayPoints =
> numpy.column_stack((DelaunayXCoordinates,DelaunayYCoordinates,DelaunayZCoordinates,DelaunayWeight))
>
> # call the MeshPy to perform the Delaunay tessellation
> mesh_info = MeshInfo()
> mesh_info.set_points(DelaunayPoints)
> options = Options(switches='parse_switches(-w)') # for weighted
> delaunay
>
> mesh = build(mesh_info, options=options)
>
> Nevetheless, I am not successful and the code crushes at the line
> "mesh_info.set_points(DelaunayPoints)" with the error message:
>
> File "RevisedGeometricApproachLineTension.py", line 323, in MeshPyDelaunay
> mesh_info.set_points(DelaunayPoints)
> File "build/bdist.linux-x86_64/egg/meshpy/common.py", line 62, in
> set_points
> ValueError: value must be a sequence of length self.unit
>
> I am wondering if someone could provide some assistance in this problem.
> Any help is greatly appreciated.
Check what you're passing to set_points. It should be an iterable of
3-long iterables. (E.g. an n x 3 numpy array) I don't believe that the
issue you're seeing is related to the '-w' switch.
HTH,
Andreas
3 years, 9 months

Weighted Delaunay tessellation
by Ευάγγελος Βογιατζής

Hello all,
I am trying to perform a weighted Delaunay tessellation on a given set of
points. I have tried to modify the example that has been earlier provided
to perform a Delaunay tessellation on a group of points (
https://github.com/inducer/meshpy/commit/c398e5bec38636f7d2f0966b6d348c88...).
According to the tetgen manual, the user should specify the -w switch and
provide a fourth column which is the weights of each point. Therefore I
have modified the example which now reads as follows:
from meshpy.tet import MeshInfo, build, Options
# prepare the coordinates for the delaunay tessellation
DelaunayXCoordinates = self.PeriodicSolidXCoordinates +
self.PeriodicFluidXCoordinates
DelaunayYCoordinates = self.PeriodicSolidYCoordinates +
self.PeriodicFluidYCoordinates
DelaunayZCoordinates = self.PeriodicSolidZCoordinates +
self.PeriodicFluidZCoordinates
DelaunayWeight = self.SigmaSolid + self.SigmaFluid # set the weight
for the Delaunay tessellation
DelaunayPoints =
numpy.column_stack((DelaunayXCoordinates,DelaunayYCoordinates,DelaunayZCoordinates,DelaunayWeight))
# call the MeshPy to perform the Delaunay tessellation
mesh_info = MeshInfo()
mesh_info.set_points(DelaunayPoints)
options = Options(switches='parse_switches(-w)') # for weighted
delaunay
mesh = build(mesh_info, options=options)
Nevetheless, I am not successful and the code crushes at the line
"mesh_info.set_points(DelaunayPoints)" with the error message:
File "RevisedGeometricApproachLineTension.py", line 323, in MeshPyDelaunay
mesh_info.set_points(DelaunayPoints)
File "build/bdist.linux-x86_64/egg/meshpy/common.py", line 62, in
set_points
ValueError: value must be a sequence of length self.unit
I am wondering if someone could provide some assistance in this problem.
Any help is greatly appreciated.
Evangelos
3 years, 9 months