meshToPet
[p,e,t]
representation of FEMesh
data
This page describes the legacy workflow. New features might not be compatible with the
[p,e,t]
representation of FEMesh
data.
Description
Examples
Convert 2-D Mesh to [p,e,t] Form
This example shows how to convert a mesh in object form to [p,e,t]
form.
Create a 2-D PDE geometry and incorporate it into a model object. View the geometry.
model = createpde(1); R1 = [3,4,-1,1,1,-1,-.4,-.4,.4,.4]'; C1 = [1,.5,0,.2]'; % Pad C1 with zeros to enable concatenation with R1 C1 = [C1;zeros(length(R1)-length(C1),1)]; geom = [R1,C1]; ns = (char('R1','C1'))'; sf = 'R1-C1'; gd = decsg(geom,sf,ns); geometryFromEdges(model,gd); pdegplot(model,"EdgeLabels","on") xlim([-1.1 1.1]) axis equal
Create a mesh for the geometry. View the mesh.
generateMesh(model);
pdemesh(model)
axis equal
Convert the mesh to [p,e,t]
form.
[p,e,t] = meshToPet(model.Mesh);
View the sizes of the [p,e,t]
matrices.
size(p)
ans = 1×2
2 948
size(e)
ans = 1×2
7 160
size(t)
ans = 1×2
7 434
Input Arguments
mesh
— Mesh object
Mesh
property of a PDEModel
object | output of generateMesh
Mesh object, specified as the Mesh
property of a PDEModel
object or as the
output of generateMesh
.
Example: model.Mesh
Output Arguments
p
— Mesh points
2-by-Np
matrix | 3-by-Np
matrix
Mesh points, returned as a 2-by-Np
matrix (2-D
geometry) or a 3-by-Np
matrix (3-D geometry).
Np
is the number of points (nodes) in the mesh.
Column k
of p
consists of the
x-coordinate of point k
in
p(1,k)
, the y-coordinate of point
k
in p(2,k)
, and, for 3-D, the
z-coordinate of point k
in
p(3,k)
. For details, see Mesh Data.
e
— Mesh edges
7-by-Ne
matrix | mesh associativity object
Mesh edges, returned as a 7-by-Ne
matrix (2-D), or a
mesh associativity object (3-D). Ne
is the number of
edges in the mesh. An edge is a pair of points in p
containing a boundary between subdomains, or containing an outer boundary.
For details, see Mesh Data.
t
— Mesh elements
4-by-Nt
matrix | 7-by-Nt
matrix | 5-by-Nt
matrix | 11-by-Nt
matrix
Mesh elements, returned as a 4-by-Nt
matrix (2-D with
linear elements), a 7-by-Nt
matrix (2-D with quadratic
elements), a 5-by-Nt
matrix (3-D with linear elements),
or an 11-by-Nt
matrix (3-D with quadratic elements).
Nt
is the number of triangles or tetrahedra in the
mesh.
The t(i,k)
, with i
ranging from 1
through end - 1
, contain indices to the corner points and
possibly edge centers of element k
. For details, see
Mesh Data. The last row,
t(end,k)
, contains the subdomain number of the
element.
Tips
Use
meshToPet
to obtain thep
andt
data for interpolation usingpdeInterpolant
.
Version History
Introduced in R2015a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)