フィルターのクリア

delaunaytriangulation function: How to associate triangles with edges?

6 ビュー (過去 30 日間)
Burak Pehlivan
Burak Pehlivan 2017 年 10 月 16 日
コメント済み: Precise Simulation 2017 年 10 月 21 日
Hi, I'm trying to perform finite volume method (CFD) calculations based on Matlab's built in "delaunaytriangulation" function. The function lists each triangle as a set of vertices or points. Similarly, the function lists each edge/face a set of vertices or points.
But I need each triangle information as a set of faces/edges to be able to loop over all edges for flux.
I get from dt.ConnectivityList command:
dt.ConnectivityList output
Point id_1 Point id_2 Point id_3 (Triangle no 1)
Point id_4 Point id_5 Point id_6 (Triangle no 2)
.... (And so on)
dt.Edge output
Point id_1 Point id_2 (Edge no 1)
POint id_3 Point id_4 (Edge no 2)
... (And so on)
What I need
Edge id_1 Edge id_2 Edge id_3 (Triangle no 1)
Edge id_4 Edge id_5 Edge id_6 (Triangle no 2)
.... (And so on)
Thank you very much.

回答 (2 件)

KSSV
KSSV 2017 年 10 月 16 日
DelaunayTriangulation supports lot of functions....check this documentation for the functions it supports. I think edges should work for you.
  1 件のコメント
KSSV
KSSV 2017 年 10 月 17 日
Burak Pehlivan commented: Hi, edges command gives the vertex (id) sets of edges. I want the edge (id) sets of triangles.

サインインしてコメントする。


Precise Simulation
Precise Simulation 2017 年 10 月 16 日
編集済み: Precise Simulation 2017 年 10 月 17 日
With the gridedge function included with the Matlab FEA Toolbox you can reconstruct and recover the grid edge numbering like this:
p = rand(10,2);
t = delaunay(p);
[e,ev] = gridedge(t',2);
help gridedge, e'
where e contains the edge numbering for each cell, and ev the vertices for each edge. Alternativley, the following code snippet should work with a different edge numbering:
p = rand(10,2);
t = delaunay(p);
e = []; e2c = [];
for i=1:3
e = [e; t(:,[i mod(i,3)+1])];
e2c = [e2c; [i*ones(size(t,1),1) [1:size(t,1)]']];
end
[~,~,ei] = unique(sort(e,2),'rows');
e = zeros(3,size(t,1));
e(e2c(:,1)+3*(e2c(:,2)-1)) = ei;
e'
Similarly, the gridface function can be used to reconstruct grid cell faces from 3D triangulations.
  5 件のコメント
Burak Pehlivan
Burak Pehlivan 2017 年 10 月 20 日
編集済み: Burak Pehlivan 2017 年 10 月 20 日
Hi, As far as I understand, since delaunay returns the set of point ids, e also contains the set of point ids.
Precise Simulation
Precise Simulation 2017 年 10 月 21 日
The last lines reindexes e to give edge numbers. Try it on a small grid to see.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDelaunay Triangulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by