tetMeshBox

Below is a demonstration of the features of the tetMeshBox function

Contents

clear; close all; clc;

Syntax

[meshStruct]=tetMeshBox(boxDim,pointSpacing);

Description

This function generates a mesh structure containing element and node data for a tetrahedral element meshed box. The box dimensions in each of the 3 directions are based on the boxDim input (1x3 vector). The number of elements in each direction is based on the pointSpacing input.

Examples

Plot settings

fontSize=20;
faceAlpha1=0.8;

CREATING A MESHED BOX

boxDim=[5 6 7]; % Box dimenstions
pointSpacing=1;

[meshStruct]=tetMeshBox(boxDim,pointSpacing);
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--- TETGEN Tetrahedral meshing --- 20-Jun-2019 15:10:54
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--- Writing SMESH file --- 20-Jun-2019 15:10:54
----> Adding node field
----> Adding facet field
----> Adding holes specification
----> Adding region specification
--- Done --- 20-Jun-2019 15:10:54
--- Running TetGen to mesh input boundary--- 20-Jun-2019 15:10:54
Opening /mnt/data/MATLAB/GIBBON/data/temp/temp.smesh.
Delaunizing vertices...
Delaunay seconds:  0.003384
Creating surface mesh ...
Surface mesh seconds:  0.000683
Recovering boundaries...
Boundary recovery seconds:  0.000769
Removing exterior tetrahedra ...
Spreading region attributes.
Exterior tets removal seconds:  0.000107
Recovering Delaunayness...
Delaunay recovery seconds:  0.000687
Refining mesh...
Refinement seconds:  0.005816
Optimizing mesh...
Optimization seconds:  0.000509

Writing /mnt/data/MATLAB/GIBBON/data/temp/temp.1.node.
Writing /mnt/data/MATLAB/GIBBON/data/temp/temp.1.ele.
Writing /mnt/data/MATLAB/GIBBON/data/temp/temp.1.face.
Writing /mnt/data/MATLAB/GIBBON/data/temp/temp.1.edge.

Output seconds:  0.005421
Total running seconds:  0.017465

Statistics:

  Input points: 264
  Input facets: 524
  Input segments: 786
  Input holes: 0
  Input regions: 1

  Mesh points: 603
  Mesh tetrahedra: 2899
  Mesh faces: 6060
  Mesh faces on exterior boundary: 524
  Mesh faces on input facets: 524
  Mesh edges on input segments: 786
  Steiner points inside domain: 339

--- Done --- 20-Jun-2019 15:10:54
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--- Importing TetGen files --- 20-Jun-2019 15:10:54
--- Done --- 20-Jun-2019 15:10:54

Acces output fields

E=meshStruct.elements;
V=meshStruct.nodes;
F=meshStruct.faces;
Fb=meshStruct.facesBoundary;
faceBoundaryMarker=meshStruct.boundaryMarker;

Plotting model

cFigure;
title('Box boundaries faces','FontSize',fontSize);
hold on;

gpatch(Fb,V,faceBoundaryMarker,'k',faceAlpha1);
% patchNormPlot(Fb,V);

axisGeom(gca,fontSize);
colormap(gjet(6)); icolorbar;
drawnow;

Visualizing model internal mesh with meshView

meshView(meshStruct);

GIBBON www.gibboncode.org

Kevin Mattheus Moerman, [email protected]

GIBBON footer text

License: https://github.com/gibbonCode/GIBBON/blob/master/LICENSE

GIBBON: The Geometry and Image-based Bioengineering add-On. A toolbox for image segmentation, image-based modeling, meshing, and finite element analysis.

Copyright (C) 2019 Kevin Mattheus Moerman

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.