mesh refinement similar to MeshLab directly in Matlab?

10 views (last 30 days)
Is there a Mesh-Refinement function in Matlab/FEX to refine triangulated mesh data?
MeshLab has this function "Remeshing, Simplification and Reconstruction --> Refine User-Defined: Refine current mesh with user defined parameters".
This increases the number of edges in the triangulated surface pretty easy and quick.
I want to get rid of the workaround via MeshLab and do this directly in Matlab. Any ideas?
Or is there a way to access MeshLab from the Matlab code?

Answers (2)

Aditya Patil
Aditya Patil on 27 Mar 2020
Currently this feature is not supported in MATLAB. It might be considered in any future release.
Following are possible workarounds:
  • Use the ‘Hmax’, ‘Hmin’ and ‘Hgard’ options of generateMesh as such,
mesh_Hgrad = generateMesh(model,'Hmax',20,'Hmin',0.5,'Hgrad',1.9)
  • Use the legacy [p, e, t] format and manually refine the mesh using any algorithm of your choice.

Ian Jentz
Ian Jentz on 2 Oct 2020
Edited: Ian Jentz on 2 Oct 2020
There is now a port of refinemesh() available for PDEModel. Like refinemesh(), it works for 2D linear triangular geometries only.
The new PDEModel compatible function is refinePDEMmesh().
This is likely how would run your problem:
create your model as a pde model
model=createpde;
proceed with your geometry definitions.
When you get to meshing, you instantiate your mesh as usuall, but then can refine the mesh on a particular face using refinePDEMmesh().
generateMesh(model);
model = refinePDEMmesh(model); % this will refine all elements within the model
FaceID = 1;
model = refinePDEMmesh(model,FaceID); % this will refine only elements within Face 1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!