Skip to content

Commit

Permalink
Zeffiro developer: A regular push adding the changes made in the curr…
Browse files Browse the repository at this point in the history
…ent local repository to the remote origin. Contents of the folders ./data/ and ./profile/ are ignored. The update necessitates creating a personal access token.
  • Loading branch information
sampsapursiainen committed Aug 14, 2024
1 parent bdf0218 commit 90d893c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 77 deletions.
21 changes: 9 additions & 12 deletions m/zef_mesh_relabeling.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
domain_labels_original = domain_labels;

if use_labeling_priority
[~, labeling_priority_vec] = zef_choose_domain_labels(zef, [], use_labeling_priority)
[~, labeling_priority_vec] = zef_choose_domain_labels(zef, [], use_labeling_priority);
[~, labeling_priority_vec_aux] = sort(labeling_priority_vec,'descend');
end

compartment_counter = 0;
Expand All @@ -33,19 +34,19 @@

test_ind = -ones(size(nodes,1),1);

for i_labeling = 1 : length(zef.reuna_p)-1
for i_labeling = 1 : length(zef.reuna_p)
for k_labeling = 1 : length(zef.reuna_submesh_ind{i_labeling})

if use_labeling_priority
label_counter = label_counter + 1;
compartment_counter = labeling_priority_vec(label_counter);
compartment_counter_next = labeling_priority_vec(label_counter+1);
compartment_counter = labeling_priority_vec_aux(label_counter);
compartment_counter_next = labeling_priority_vec_aux(label_counter+1);
else
compartment_counter = compartment_counter + 1;
compartment_counter_next = compartment_counter + 1;
end

%if domain_label_ind
if not(isequal(compartment_counter,n_compartments))

if k_labeling == 1
reuna_t_aux = zef.reuna_t{i_labeling}(1:zef.reuna_submesh_ind{i_labeling},:);
Expand Down Expand Up @@ -125,7 +126,8 @@
else
I_3 = [];
end
end
end
end
end

end
Expand All @@ -134,9 +136,4 @@
domain_labels(I_8) = domain_labels_original(I_8);
domain_labels = min(n_compartments, domain_labels);

end





end
70 changes: 5 additions & 65 deletions m/zef_smoothing_step.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

if eval('zef.mesh_smoothing_on')
if zef.mesh_smoothing_on

length_waitbar = 4+length(priority_vec);

%nodes = eval('zef.nodes_raw');
sensors = eval('zef.sensors');
sensors = zef.sensors;

smoothing_param = zef.smoothing_strength;
smoothing_steps_surf = zef.smoothing_steps_surf;
Expand Down Expand Up @@ -69,8 +68,6 @@

zef_waitbar((2+length(priority_vec))/length_waitbar,h,'Smoothing operators.');

%eval('zef.tetra_raw');

smoothing_ok = 0;

A = sparse(N, N, 0);
Expand Down Expand Up @@ -132,23 +129,6 @@
taubin_lambda = 1;
taubin_mu = -1;

%if eval('zef.use_gpu')==1 && eval('zef.gpu_count') > 0
%if mod(smoothing_repetition_ind,2)==0
%%A = gpuArray(A);
%A_K = gpuArray(A_K);
%sum_A = gpuArray(sum_A);
%K = gpuArray(K);
%end
%if smoothing_steps_vol(smoothing_repetition_ind) > 0
%B = gpuArray(B);
%sum_B = gpuArray(sum_B);
%end
%end

%if eval('zef.use_gpu')==1 && eval('zef.gpu_count') > 0
%nodes = gpuArray(nodes);
%end

if smoothing_steps_surf(smoothing_repetition_ind) > 0
if smoothing_steps_surf(smoothing_repetition_ind) < 1
convergence_criterion = Inf;
Expand All @@ -157,7 +137,6 @@
end
iter_ind_aux = 0;
while convergence_criterion > smoothing_steps_surf(smoothing_repetition_ind)
%nodes_old = nodes;
iter_ind_aux = iter_ind_aux + 1;
nodes_aux = A_K*nodes(K,:);
nodes_aux = nodes_aux./sum_A;
Expand Down Expand Up @@ -288,44 +267,14 @@
optimizer_flag = -1;
while optimizer_flag < 0 && optimizer_counter <= zef.mesh_optimization_repetitions
optimizer_counter = optimizer_counter + 1;

[nodes,optimizer_flag] = zef_fix_negatives(zef,nodes, tetra);
if optimizer_flag == 1
[tetra, optimizer_flag] = zef_tetra_turn(zef,nodes, tetra, thresh_val);
[tetra, optimizer_flag] = zef_tetra_turn(zef,nodes, tetra, thresh_val);
end
% if optimizer_flag == -1
% if smoothing_steps_vol(smoothing_repetition_ind) > 0
% if smoothing_steps_vol(smoothing_repetition_ind) < 1
% convergence_criterion = Inf;
% else
% convergence_criterion = smoothing_steps_vol(smoothing_repetition_ind).^2;
% end
% iter_ind_aux = 0;
% while convergence_criterion > smoothing_steps_vol(smoothing_repetition_ind)
% iter_ind_aux = iter_ind_aux + 1;
% nodes_aux = B*nodes;
% nodes_aux = nodes_aux./sum_B;
% nodes_aux_1 = (nodes_aux -nodes);
% nodes = nodes + smoothing_param*taubin_lambda*nodes_aux_1;
% nodes_aux = B*nodes;
% nodes_aux = nodes_aux./sum_B;
% nodes_aux_2 = (nodes_aux -nodes);
% if not(isempty(outer_surface_nodes_aux))
% nodes_aux(outer_surface_nodes_aux,:) = 0;
% end
% nodes = nodes + smoothing_param*taubin_mu*nodes_aux_2;
% if smoothing_steps_vol(smoothing_repetition_ind) < 1
% convergence_criterion = norm(nodes_aux_2-nodes_aux_1,'fro')/norm(nodes_aux_1);
% else
% convergence_criterion = smoothing_steps_vol(smoothing_repetition_ind).^2/iter_ind_aux;
% end
% zef_waitbar(smoothing_steps_vol(smoothing_repetition_ind)/convergence_criterion,h,'Volume smoothing.');
% end
% end
% end

end

if optimizer_flag == -1;
if optimizer_flag == -1
smoothing_ok = 0;
else
smoothing_ok = 1;
Expand All @@ -335,15 +284,6 @@
error('Mesh smoothing failed.');
end

% if eval('zef.mesh_relabeling')
%
% pml_ind = [];
% label_ind = uint32(tetra);
% labeling_flag = 2;
% zef_mesh_labeling_step;
%
% end

tetra_aux = tetra;

end
Expand Down

0 comments on commit 90d893c

Please sign in to comment.