diff --git a/m/zef_attach_sensors_volume.m b/m/zef_attach_sensors_volume.m index a17d118c8..9d32b8a73 100644 --- a/m/zef_attach_sensors_volume.m +++ b/m/zef_attach_sensors_volume.m @@ -46,7 +46,7 @@ if isfield(zef,[zef.current_sensors '_get_functions']) I_get_functions = find(cellfun(@isempty,zef.([zef.current_sensors '_get_functions']))==0); for i_ind = 1 : length(I_get_functions) - sensors_attached_volume_functions{i_ind} = feval(zef.([zef.current_sensors '_get_functions']){I_get_functions(i_ind)},attach_type); + sensors_attached_volume_functions{i_ind} = zef_sensor_get_function_eval(zef.([zef.current_sensors '_get_functions']){I_get_functions(i_ind)},zef,attach_type); end end end @@ -90,6 +90,8 @@ else surface_ind = find(not(ismember(sensors(:,5),0))); deep_ind = setdiff(find(ismember(sensors(:,4),0)),surface_ind); + surface_ind = setdiff(surface_ind, I_get_functions); + deep_ind = setdiff(deep_ind, I_get_functions); end sensors_attached_volume = sensors; for i = 1 : length(deep_ind) diff --git a/m/zef_plot_meshes.m b/m/zef_plot_meshes.m index 9ee629ed2..d671c4ae4 100644 --- a/m/zef_plot_meshes.m +++ b/m/zef_plot_meshes.m @@ -555,7 +555,7 @@ if isfield(zef,[zef.current_sensors '_get_functions']) if length(zef.([zef.current_sensors '_get_functions'])) >= unique_sensors_aux_1(i) if not(isempty(zef.([zef.current_sensors '_get_functions']){unique_sensors_aux_1(i)})) - [~, sensor_info] = zef.([zef.current_sensors '_get_functions']){unique_sensors_aux_1(i)}('sensor_info'); + [~, sensor_info] = zef_sensor_get_function_eval(zef.([zef.current_sensors '_get_functions']){unique_sensors_aux_1(i)}, zef,'sensor_info'); surface_index_aux = sensor_info.compartment_index; end end diff --git a/m/zef_print_meshes.m b/m/zef_print_meshes.m index 52da0841b..76c349b05 100644 --- a/m/zef_print_meshes.m +++ b/m/zef_print_meshes.m @@ -1692,7 +1692,7 @@ if isfield(zef,[zef.current_sensors '_get_functions']) if length(zef.([zef.current_sensors '_get_functions'])) >= unique_sensors_aux_1(i) if not(isempty(zef.([zef.current_sensors '_get_functions']){unique_sensors_aux_1(i)})) - [~, sensor_info] = zef.([zef.current_sensors '_get_functions']){unique_sensors_aux_1(i)}('sensor_info'); + [~, sensor_info] = zef_sensor_get_function_eval(zef.([zef.current_sensors '_get_functions']){unique_sensors_aux_1(i)}, zef,'sensor_info'); surface_index_aux = sensor_info.compartment_index; end end diff --git a/m/zef_sensor_get_function_eval.m b/m/zef_sensor_get_function_eval.m new file mode 100644 index 000000000..e1b2230b2 --- /dev/null +++ b/m/zef_sensor_get_function_eval.m @@ -0,0 +1,5 @@ +function [contacts, sensor_info, triangle_index] = zef_sensor_get_function_eval(function_string, project_struct, domain_type) + +[contacts, sensor_info, triangle_index] = feval(@(project_struct, domain_type)evalin('caller',function_string),project_struct, domain_type); + +end \ No newline at end of file diff --git a/plugins/StripTool/zef_get_strip_contacts.m b/plugins/StripTool/zef_get_strip_contacts.m index 6917060b0..afe57bf9e 100644 --- a/plugins/StripTool/zef_get_strip_contacts.m +++ b/plugins/StripTool/zef_get_strip_contacts.m @@ -9,6 +9,8 @@ end contacts = []; +sensor_info = struct; +triangle_ind = []; sensor_info.strip_id = strip_struct.strip_id; sensor_info.compartment_index = []; if isfield(strip_struct,'compartment_tag') diff --git a/plugins/StripTool/zef_strip_tool_add_contacts.m b/plugins/StripTool/zef_strip_tool_add_contacts.m index 1fc808737..4627a6f01 100644 --- a/plugins/StripTool/zef_strip_tool_add_contacts.m +++ b/plugins/StripTool/zef_strip_tool_add_contacts.m @@ -30,7 +30,7 @@ current_strip_string = num2str(zef.strip_tool.current_strip); for i = 1 : size(points_2,1) -zef.([zef.current_sensors '_get_functions']){i+size(points_1,1)} = @(domain_type)evalin('caller',['zef_get_strip_contacts(' num2str(i) ',zef.' zef.current_sensors '_strip_cell{' current_strip_string '},zef,''' domain_type ''',' num2str(size(points_1,1)+1) ');']); +zef.([zef.current_sensors '_get_functions']){i+size(points_1,1)} = ['zef_get_strip_contacts(' num2str(i) ',project_struct.' zef.current_sensors '_strip_cell{' current_strip_string '}, project_struct, domain_type,' num2str(size(points_1,1)+1) ');']; end end \ No newline at end of file diff --git a/plugins/StripTool/zef_strip_tool_delete.m b/plugins/StripTool/zef_strip_tool_delete.m index 1c768ad94..beff4cf92 100644 --- a/plugins/StripTool/zef_strip_tool_delete.m +++ b/plugins/StripTool/zef_strip_tool_delete.m @@ -9,7 +9,7 @@ if isfield(zef, zef.([zef.current_sensors '_get_functions'])) for i_ind = 1 : length(zef.([zef.current_sensors '_get_functions'])) h_function_aux = zef.([zef.current_sensors '_get_functions']){i_ind}; - [~, sensor_info] = feval(h_function_aux, domain_type); + [~, sensor_info] = zef_sensor_get_function_eval(h_function_aux, zef, domain_type); if isequal(strip_id, sensor_info.strip_id) zef.([zef.current_sensors '_get_functions'])(i_ind) = cell(1); end