Skip to content

Commit fbf0107

Browse files
committed
Merge branch 'develop'
2 parents c8e4fb0 + a1cfec2 commit fbf0107

File tree

15 files changed

+335
-80
lines changed

15 files changed

+335
-80
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,7 @@ matlab/MagTense_matlab_project.prj
198198
*.vsidx
199199

200200
*.lock
201+
202+
python/examples/micromagnetism/.idea/inspectionProfiles/
203+
204+
python/examples/micromagnetism/.idea/

buildMagTenseMEX.m

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function buildMagTenseMEX(USE_RELEASE,USE_CUDA,USE_CVODE)
5656
if (ispc)
5757
build_str_NO_CUDA_MagTenseMicroMag = [build_str '_no_CUDA'];
5858
if (USE_CUDA)
59-
CUDA_str = '''-Lc:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.6/lib/x64/'' -lcublas -lcudart -lcuda -lcusparse';
59+
CUDA_str = '''-Lc:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1/lib/x64/'' -lcublas -lcudart -lcuda -lcusparse';
6060
build_str_MagTenseMicroMag = build_str;
6161
else
6262
CUDA_str = '';
@@ -115,7 +115,7 @@ function buildMagTenseMEX(USE_RELEASE,USE_CUDA,USE_CVODE)
115115
%% MagTenseLandauLifshitzSolver_mex
116116
Source_str = 'source/MagTenseMEX/MagTenseMEX/MagTenseLandauLifshitzSolver_mex.f90';
117117
mex_str = ['mex ' compiler_str ' ' Debug_flag ' ' MagTenseMicroMag_str ' ' DemagField_str ' ' TileDemagTensor_str ' ' NumericalIntegration_str ' ' CUDA_str ' ' CVODE_str ' ' MKL_str ' ' Source_str ' ' Options_str];
118-
eval(mex_str)
118+
eval_MEX(mex_str)
119119
if ~USE_RELEASE
120120
pause(pause_time)
121121
movefile(['MagTenseLandauLifshitzSolver_mex.mex' MEX_str '64.pdb'],['matlab/MEX_files/MagTenseLandauLifshitzSolver_mex.mex' MEX_str '64.pdb']);
@@ -127,7 +127,7 @@ function buildMagTenseMEX(USE_RELEASE,USE_CUDA,USE_CVODE)
127127
MagTenseMicroMag_str = ['-Lsource/MagTenseMicroMag/' build_str_NO_CUDA_MagTenseMicroMag '/ ' MagTenseMicroMag_lib_str ' -Isource/MagTenseMicroMag/' build_str_MagTenseMicroMag '/'];
128128
Source_str = 'source/MagTenseMEX/MagTenseMEX/MagTenseLandauLifshitzSolver_mex.f90';
129129
mex_str = ['mex ' compiler_str ' ' Debug_flag ' ' MagTenseMicroMag_str ' ' DemagField_str ' ' TileDemagTensor_str ' ' NumericalIntegration_str ' ' CVODE_str ' ' MKL_str ' ' Source_str ' ' Options_str];
130-
eval(mex_str)
130+
eval_MEX(mex_str)
131131
if ~USE_RELEASE
132132
pause(pause_time)
133133
movefile(['MagTenseLandauLifshitzSolver_mex.mex' MEX_str '64.pdb'],['matlab/MEX_files/MagTenseLandauLifshitzSolverNoCUDA_mex.mex' MEX_str '64.pdb']);
@@ -139,7 +139,7 @@ function buildMagTenseMEX(USE_RELEASE,USE_CUDA,USE_CVODE)
139139
%% IterateMagnetization_mex
140140
Source_str = 'source/MagTenseMEX/MagTenseMEX/IterateMagnetization_mex.f90';
141141
mex_str = ['mex ' compiler_str ' ' Debug_flag ' ' DemagField_str ' ' TileDemagTensor_str ' ' NumericalIntegration_str ' ' Source_str ' ' Options_str];
142-
eval(mex_str)
142+
eval_MEX(mex_str)
143143
if ~USE_RELEASE
144144
pause(pause_time)
145145
movefile(['IterateMagnetization_mex.mex' MEX_str '64.pdb'],['matlab/MEX_files/IterateMagnetization_mex.mex' MEX_str '64.pdb']);
@@ -150,7 +150,7 @@ function buildMagTenseMEX(USE_RELEASE,USE_CUDA,USE_CVODE)
150150
%% getHFromTiles_mex
151151
Source_str = 'source/MagTenseMEX/MagTenseMEX/getHFromTiles_mex.f90';
152152
mex_str = ['mex ' compiler_str ' ' Debug_flag ' ' DemagField_str ' ' TileDemagTensor_str ' ' NumericalIntegration_str ' ' Source_str ' ' Options_str];
153-
eval(mex_str)
153+
eval_MEX(mex_str)
154154
if ~USE_RELEASE
155155
pause(pause_time)
156156
movefile(['getHFromTiles_mex.mex' MEX_str '64.pdb'],['matlab/MEX_files/getHFromTiles_mex.mex' MEX_str '64.pdb']);
@@ -161,7 +161,7 @@ function buildMagTenseMEX(USE_RELEASE,USE_CUDA,USE_CVODE)
161161
%% getNFromTile_mex
162162
Source_str = 'source/MagTenseMEX/MagTenseMEX/getNFromTile_mex.f90';
163163
mex_str = ['mex ' compiler_str ' ' Debug_flag ' ' DemagField_str ' ' NumericalIntegration_str ' ' TileDemagTensor_str ' ' Source_str ' ' Options_str];
164-
eval(mex_str)
164+
eval_MEX(mex_str)
165165
if ~USE_RELEASE
166166
pause(pause_time)
167167
movefile(['getNFromTile_mex.mex' MEX_str '64.pdb'],['matlab/MEX_files/getNFromTile_mex.mex' MEX_str '64.pdb']);
@@ -172,7 +172,7 @@ function buildMagTenseMEX(USE_RELEASE,USE_CUDA,USE_CVODE)
172172
%% getMagForce_mex
173173
Source_str = 'source/MagTenseMEX/MagTenseMEX/getMagForce_mex.f90';
174174
mex_str = ['mex ' compiler_str ' ' Debug_flag ' ' MagneticForceIntegrator_str ' ' DemagField_str ' ' NumericalIntegration_str ' ' TileDemagTensor_str ' ' Source_str ' ' Options_str];
175-
eval(mex_str)
175+
eval_MEX(mex_str)
176176
if ~USE_RELEASE
177177
pause(pause_time)
178178
movefile(['getMagForce_mex.mex' MEX_str '64.pdb'],['matlab/MEX_files/getMagForce_mex.mex' MEX_str '64.pdb']);
@@ -181,3 +181,26 @@ function buildMagTenseMEX(USE_RELEASE,USE_CUDA,USE_CVODE)
181181
movefile(['getMagForce_mex.mex' MEX_str '64'],['matlab/MEX_files/getMagForce_mex.mex' MEX_str '64']);
182182

183183
end
184+
185+
function eval_MEX(mex_str)
186+
187+
try
188+
eval(mex_str);
189+
catch ME
190+
if (strcmp(ME.message(91:117),'mt : general error c101008d'))
191+
fail_mex = true;
192+
while fail_mex
193+
try
194+
disp('Microsoft manifest tool error - retrying')
195+
eval(mex_str);
196+
fail_mex = false;
197+
catch
198+
continue
199+
end
200+
end
201+
else
202+
disp(ME.message)
203+
rethrow(ME)
204+
end
205+
end
206+
end

matlab/examples/Micromagnetism/mumag_micromag_Std_problem_4/Standard_problem_4_unstructured_cart.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181

8282
addpath('../../../MEX_files');
8383
addpath('../../../util');
84-
addpath('../../../micromagnetism_matlab_only_implementation');
8584

8685
%% --------------------------------------------------------------------------------------------------------------------------------------
8786
%% ------------------------------------------------------------------- MAGTENSE ---------------------------------------------------------

matlab/util/cartesianUnstructuredMeshPlot.m

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function cartesianUnstructuredMeshPlot(pos, dims, GridInfo, iIn, fnamesave,hF)
2424
%%
2525
cols = [hsv(numel(iIn)-1);[1,1,1].*0.4];
2626
iOne = sum(abs(GridInfo.TheSigns),1) == 1 ;
27+
% plot3(GridInfo.Xf(iOne),GridInfo.Yf(iOne),GridInfo.Zf(iOne),'.')
2728
iOneInd = find(iOne) ;
2829
TheLW = 1.5 ;
2930
for ik=1:numel(iOneInd)
@@ -48,21 +49,34 @@ function cartesianUnstructuredMeshPlot(pos, dims, GridInfo, iIn, fnamesave,hF)
4849
TheLS = '-' ;
4950
end
5051
end
52+
5153
if abs(GridInfo.fNormX(k))
52-
hP(ik) = patch(pos(n,1)+[1,1,1,1].*GridInfo.fNormX(k).*dims(n,1)./2,...
54+
if isfield(GridInfo,'DimsF')
55+
hP(ik) = patch(GridInfo.Xf(k)+[0,0,0,0],GridInfo.Yf(k)+([0,0,1,1]-1/2).*GridInfo.DimsF(k,2),GridInfo.Zf(k)+([0,1,1,0]-1/2).*GridInfo.DimsF(k,3),ik,ColProperty,thisCol,'linestyle',TheLS,'linewidth',TheLW) ;
56+
else
57+
hP(ik) = patch(pos(n,1)+[1,1,1,1].*GridInfo.fNormX(k).*dims(n,1)./2,...
5358
pos(n,2)+([0,0,1,1]-1/2).*dims(n,2),...
5459
pos(n,3)+([0,1,1,0]-1/2).*dims(n,3),ik,ColProperty,thisCol,'linestyle',TheLS,'linewidth',TheLW) ;
60+
end
5561
end
5662
if abs(GridInfo.fNormY(k))
57-
hP(ik) = patch(pos(n,1)+([0,0,1,1]-1/2).*dims(n,1),...
63+
if isfield(GridInfo,'DimsF')
64+
hP(ik) = patch(GridInfo.Xf(k)+([0,1,1,0]-1/2).*GridInfo.DimsF(k,1),GridInfo.Yf(k)+[0,0,0,0],GridInfo.Zf(k)+([0,0,1,1]-1/2).*GridInfo.DimsF(k,3),ik,ColProperty,thisCol,'linestyle',TheLS,'linewidth',TheLW) ;
65+
else
66+
hP(ik) = patch(pos(n,1)+([0,0,1,1]-1/2).*dims(n,1),...
5867
pos(n,2)+[1,1,1,1].*GridInfo.fNormY(k).*dims(n,2)./2,...
5968
pos(n,3)+([0,1,1,0]-1/2).*dims(n,3),ik,ColProperty,thisCol,'linestyle',TheLS,'linewidth',TheLW) ;
69+
end
6070
end
6171

6272
if abs(GridInfo.fNormZ(k))
63-
hP(ik) = patch(pos(n,1)+([0,1,1,0]-1/2).*dims(n,1),...
73+
if isfield(GridInfo,'DimsF')
74+
hP(ik) = patch(GridInfo.Xf(k)+([0,0,1,1]-1/2).*GridInfo.DimsF(k,1),GridInfo.Yf(k)+([0,1,1,0]-1/2).*GridInfo.DimsF(k,2),GridInfo.Zf(k)+[0,0,0,0],ik,ColProperty,thisCol,'linestyle',TheLS,'linewidth',TheLW) ;
75+
else
76+
hP(ik) = patch(pos(n,1)+([0,1,1,0]-1/2).*dims(n,1),...
6477
pos(n,2)+([0,0,1,1]-1/2).*dims(n,2),...
6578
pos(n,3)+[1,1,1,1].*GridInfo.fNormZ(k).*dims(n,3)./2,ik,ColProperty,thisCol,'linestyle',TheLS,'linewidth',TheLW) ;
79+
end
6680
end
6781
'' ;
6882
% drawnow ;
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
function [hs,hq] = cartesianUnstructuredMeshPlotSolution(GeomTRI,mesh,IntPlane,Mx_arr,My_arr,Mz_arr,hF)
2+
%
3+
% CartesianUnstructuredMeshPlotSolution(GeomTRI,mesh,IntPlane,Mx_arr,My_arr,Mz_arr,hF)
4+
%
5+
% Intersects the geometry with a plane, and shows a cutaway view of the
6+
% solution.
7+
%
8+
% GeomTri is the triangulation of the geometry (can be obtained using
9+
% convhulln. For this function to work, the geometry is assumed to be
10+
% convex anyway.
11+
% mesh is the Cartesian Unstructured Mesh corresponding to the solution
12+
% IntPlane is a structure with two fields (each of which is a 1 by 3
13+
% array): IntPlane.Normal is the normal to the plane
14+
% IntPlane.Point is a point passing by the plane
15+
% Mx_arr, My_arr, and Mz_arr are the arrays of the solution
16+
%
17+
% Requires the PDE toolbox (used for creating a tetrahedral mesh -
18+
% and the correponding triangular surface mesh on which
19+
% the solution is plotted)
20+
21+
%%
22+
X = [min(GeomTRI.Points(:,1)),max(GeomTRI.Points(:,1))] ;
23+
Y = [min(GeomTRI.Points(:,2)),max(GeomTRI.Points(:,2))] ;
24+
Z = [min(GeomTRI.Points(:,3)),max(GeomTRI.Points(:,3))] ;
25+
IntPlaneN = norm(IntPlane.Normal) ;
26+
IntPlane.Normal = IntPlane.Normal./IntPlaneN ;
27+
28+
%%
29+
ik = [1,2,3,1] ;
30+
31+
% keep only the points on the negative side of the plane
32+
iIn = sum((GeomTRI.Points-repmat(IntPlane.Point,size(GeomTRI.Points,1),1)).*repmat(IntPlane.Normal,size(GeomTRI.Points,1),1),2)<0 ;
33+
% Cycle over each segment
34+
jN = 0 ; clear xNew
35+
for j=1:size(GeomTRI.ConnectivityList,1)
36+
for k=1:3
37+
% find the intersection point between the segment and the
38+
% intersecting plane
39+
xA = GeomTRI.Points(GeomTRI.ConnectivityList(j,ik(k)),:) ;
40+
xB = GeomTRI.Points(GeomTRI.ConnectivityList(j,ik(k+1)),:) ;
41+
t = -sum((xA-IntPlane.Point).*IntPlane.Normal)/sum((xB-xA).*IntPlane.Normal) ;
42+
xInt = xA + t.*(xB-xA) ;
43+
if (t>=0) & (t<=1) ; plot3(xInt(1),xInt(2),xInt(3),'.') ;
44+
jN = jN + 1 ;
45+
xNew(jN,:) = xInt ;
46+
47+
48+
end
49+
end
50+
end
51+
52+
BisectGeomTRI.Points = GeomTRI.Points ;
53+
BisectGeomTRI.Points(find(~iIn),:) = [] ;
54+
BisectGeomTRI.Points = [BisectGeomTRI.Points;xNew] ;
55+
56+
BisectGeomTRI.ConnectivityList = convhulln(BisectGeomTRI.Points) ;
57+
58+
59+
BiSectVorStruct.pos = sum(BisectGeomTRI.Points,1) ;
60+
BiSectVorStruct.vorvx{1} = BisectGeomTRI.Points ;
61+
BiSectVorStruct.ThatK{1} = BisectGeomTRI.ConnectivityList ;
62+
63+
VoronoiStruct.pos = sum(GeomTRI.Points,1) ;
64+
VoronoiStruct.vorvx{1} = GeomTRI.Points ;
65+
VoronoiStruct.ThatK{1} = GeomTRI.ConnectivityList ;
66+
67+
68+
% PlotVoronoiGeometry(BiSectVorStruct,X,Y,Z,'BisectedHexagonalPlatelet01',hF,[.5,.5,.5])
69+
BisectGeomTRI = triangulation(BisectGeomTRI.ConnectivityList,BisectGeomTRI.Points) ;
70+
stlwrite(BisectGeomTRI,'BisectGeomTRI.stl')
71+
model = createpde(1);
72+
importGeometry(model,'BisectGeomTRI.stl');
73+
delete('BisectGeomTRI.stl') ;
74+
generateMesh(model,'GeometricOrder','linear','Hmax',diff(X)/50) ;
75+
hF0 = figure ;
76+
h = pdeplot3D(model) ;
77+
SurfMesh = triangulation(h.Faces,h.Vertices) ;
78+
delete(hF0)
79+
80+
%% Mesh for quiver plots
81+
generateMesh(model,'GeometricOrder','linear','Hmin',diff(X)/10) ;
82+
hF0 = figure ;
83+
h = pdeplot3D(model) ;
84+
QuiverMesh = triangulation(h.Faces,h.Vertices) ;
85+
inQuiv = sum((QuiverMesh.Points-repmat(IntPlane.Point,size(QuiverMesh.Points,1),1)).*repmat(IntPlane.Normal,size(QuiverMesh.Points,1),1),2)> (-.01*diff(X)) ;
86+
delete(hF0)
87+
%%
88+
89+
Fmx = scatteredInterpolant(mesh.pos_out(:,1),mesh.pos_out(:,2),mesh.pos_out(:,3),Mx_arr) ;
90+
Fmy = scatteredInterpolant(mesh.pos_out(:,1),mesh.pos_out(:,2),mesh.pos_out(:,3),My_arr) ;
91+
Fmz = scatteredInterpolant(mesh.pos_out(:,1),mesh.pos_out(:,2),mesh.pos_out(:,3),Mz_arr) ;
92+
93+
Mx = Fmx(SurfMesh.Points(:,1),SurfMesh.Points(:,2),SurfMesh.Points(:,3)) ;
94+
My = Fmy(SurfMesh.Points(:,1),SurfMesh.Points(:,2),SurfMesh.Points(:,3)) ;
95+
Mz = Fmz(SurfMesh.Points(:,1),SurfMesh.Points(:,2),SurfMesh.Points(:,3)) ;
96+
97+
98+
MxQ = Fmx(QuiverMesh.Points(:,1),QuiverMesh.Points(:,2),QuiverMesh.Points(:,3)) ;
99+
MyQ = Fmy(QuiverMesh.Points(:,1),QuiverMesh.Points(:,2),QuiverMesh.Points(:,3)) ;
100+
MzQ = Fmz(QuiverMesh.Points(:,1),QuiverMesh.Points(:,2),QuiverMesh.Points(:,3)) ;
101+
MxQ(~inQuiv) = 0 ; MyQ(~inQuiv) = 0 ; MzQ(~inQuiv) = 0 ;
102+
QuiverMesh2.Points = QuiverMesh.Points + (.01*diff(X)).*repmat(IntPlane.Normal,size(QuiverMesh.Points,1),1) ;
103+
ThisColTriangle = ColorFromHorPsiTheta01(Mx,My,Mz) ;
104+
%%
105+
106+
107+
if ~exist('hF','var')
108+
hF = figure('position',[0 0 600 600],'Color',[1 1 1]);
109+
ppsz = 1.*[20,19] ;
110+
ppps = 1.*[0,0,20,19] ;
111+
set(gcf,'PaperUnits','centimeters','PaperSize',ppsz,'PaperPosition',ppps) ;
112+
else
113+
ppsz=get(gcf,'PaperSize');
114+
ppps=get(gcf,'PaperPosition');
115+
if isequal(get(hF,'type'),'figure')
116+
set(hF,'PaperUnits','centimeters')
117+
118+
figure(hF)
119+
% clf(hF)
120+
else
121+
axes(hF) ;
122+
end
123+
end
124+
125+
hold on
126+
127+
axis('equal')
128+
129+
%%
130+
131+
132+
% PlotVoronoiGeometry(VoronoiStruct,X,Y,Z,'HexagonalPlatelet01',hF,[.5,.5,.5])
133+
PlotOnlyRealEdges(VoronoiStruct.pos,VoronoiStruct.vorvx,VoronoiStruct.ThatK,1)
134+
PlotOnlyRealEdges(BiSectVorStruct.pos,BiSectVorStruct.vorvx,BiSectVorStruct.ThatK,2)
135+
136+
137+
hs = trisurf(SurfMesh.ConnectivityList,SurfMesh.Points(:,1),SurfMesh.Points(:,2),SurfMesh.Points(:,3),'FaceVertexCData',ThisColTriangle,'linestyle','none','facelighting','flat','SpecularStrength',0,'facealpha',1) ;
138+
hq = quiver3(QuiverMesh2.Points(:,1),QuiverMesh2.Points(:,2),QuiverMesh2.Points(:,3),MxQ,MyQ,MzQ,'color','k','LineWidth',1.5) ;
139+
140+
view(90,30) ;
141+
light('position',[0,0,2].*[X(end),Y(end),Z(end)])
142+
light('position',[0,-2,0].*[X(end),Y(end),Z(end)],'color',.3.*[1,1,1])
143+
144+
set(gca,'xlim',[X(1),X(end)],...
145+
'ylim',[Y(1),Y(end)],...
146+
'zlim',[Z(1),Z(end)],'visible','off')
147+
148+
% xlabel('x') ; ylabel('y') ; zlabel('z') ;
149+
150+
end
151+
152+
function PlotOnlyRealEdges(pos,vorvx,ThatK,LW)
153+
154+
TotFaces = 0 ;
155+
if ~exist('col','var')
156+
col = [hsv(size(pos,1));[1,1,1].*0.4];
157+
end
158+
for i = 1:size(pos,1)
159+
K = ThatK{i} ;
160+
% K = convhulln(vorvx{i});
161+
% [K,vorvx{i}] = CleanUp(K,vorvx{i}) ;
162+
TheSharedEdges{i} = zeros(size(K,1),size(K,1)) ;
163+
% trisurf(K,vorvx{i}(:,1),vorvx{i}(:,2),vorvx{i}(:,3),'FaceColor',col(i,:),'FaceAlpha',.5,'EdgeAlpha',0,'facelighting','flat','SpecularStrength',0)
164+
hold on;
165+
% stlwrite(TR,['testSTLwrite',num2str(i),'.stl']) ;
166+
for k=1:size(K,1) % cycle over triangles
167+
nn{i}{k} = cross((vorvx{i}(K(k,2),:)-vorvx{i}(K(k,1),:)),(vorvx{i}(K(k,3),:)-vorvx{i}(K(k,1),:))) ;
168+
nn{i}{k} = nn{i}{k}./norm( nn{i}{k}) ;
169+
% line(sigma.*(vorvx{i}(K(k,:),1)-pos(i,1))+pos(i,1),sigma.*(vorvx{i}(K(k,:),2)-pos(i,2)) + pos(i,2),sigma.*(vorvx{i}(K(k,:),3)-pos(i,3)) + pos(i,3))
170+
end
171+
ThatDot = zeros(size(K,1),size(K,1)) ;
172+
for k1=1:size(K,1)
173+
for k2=(k1+1):size(K,1)
174+
ThatDot(k1,k2) = dot( nn{i}{k1}, nn{i}{k2} ) ;
175+
end
176+
end
177+
ThatDot = ThatDot+ThatDot.' ; % triangles belonging to the same planes
178+
ijk = [1,2,3,1] ;
179+
CommonEdges = zeros(size(K,1),3) ;
180+
for k1=1:size(K,1)
181+
for k2=1:size(K,1)
182+
[C,ia,ib] = intersect( K(k1,:),K(k2,:)) ;
183+
if numel(C)==2 & abs(abs(ThatDot(k1,k2))-1)<1e-9
184+
ia = sort(ia) ;
185+
ib = sort(ib) ;
186+
TheSide1 = isequal(ia,[1;2]).*1 +isequal(ia,[2;3]).*2 + isequal(ia,[1;3]).*3 ;
187+
TheSide2 = isequal(ib,[1;2]).*1 +isequal(ib,[2;3]).*2 + isequal(ib,[1;3]).*3 ;
188+
CommonEdges(k1,TheSide1) = 1 ;
189+
CommonEdges(k2,TheSide2) = 1 ;
190+
TheSharedEdges{i}(k1,k2) = 1 ; TheSharedEdges{i}(k2,k1) = 1 ;
191+
% TheSharedEdges{i}(k2,TheSide2) = k1 ;
192+
'' ;
193+
end
194+
end
195+
end
196+
197+
'' ;
198+
% FindPolygons01(TheSharedEdges{i})
199+
CCC = zeros(max(K(:)),max(K(:))) ;
200+
for k=1:size(K,1)
201+
for j= 1:3
202+
if ~CommonEdges(k,j)
203+
CCC(K(k,ijk(j)),K(k,ijk(j+1))) = 1 ;
204+
CCC(K(k,ijk(j+1)),K(k,ijk(j))) = 1 ;
205+
% line(vorvx{i}(K(k,ijk(j:j+1)),1),vorvx{i}(K(k,ijk(j:j+1)),2),vorvx{i}(K(k,ijk(j:j+1)),3),'color','k','linewidth',2)
206+
end
207+
end
208+
end
209+
bins = conncomp(graph(TheSharedEdges{i})) ;
210+
for kb = 1:max(bins)
211+
BB = bins==kb ; kB = K(BB,:) ;
212+
[ukB,ikB,ckB] = unique(kB(:)) ;
213+
214+
GG = graph(CCC(ukB,ukB)) ;
215+
nOrd = dfsearch(GG,1) ;
216+
iiord = kB(ikB(nOrd)) ;
217+
iiord = [iiord(:);iiord(1)];
218+
AllFaces{i,kb} = iiord ;
219+
TotFaces = TotFaces + 1 ;
220+
AllSingleFaces{TotFaces} = iiord ;
221+
AllSingleFacesZones(TotFaces) = i ;
222+
line(vorvx{i}(iiord,1),vorvx{i}(iiord,2),vorvx{i}(iiord,3),'color','k','linewidth',LW)
223+
end
224+
'' ;
225+
226+
227+
end
228+
end

0 commit comments

Comments
 (0)