Skip to content

Commit

Permalink
Merge pull request #202 from CHLNDDEV/plus_patch
Browse files Browse the repository at this point in the history
Patch bug-fix to the "matche" option of the msh.plus() function.
  • Loading branch information
WPringle committed Mar 23, 2021
2 parents eed66e5 + e0e0def commit 21f93a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 6 additions & 4 deletions @msh/msh.m
Original file line number Diff line number Diff line change
Expand Up @@ -2217,23 +2217,25 @@ function plotter(cmap,round_dec,yylabel,apply_pivot)
%% can be extracted and then obj1, obj2 concentated together
% extract the inner region of obj1 (inset) from obj2 (base)
% assuming that the inset fits perfectly in the base
obj1o = obj1; obj2o = obj2;
obj1o = obj1;
if extract
[p1(:,1),p1(:,2)] = m_ll2xy(p1(:,1),p1(:,2)) ;
[p2(:,1),p2(:,2)] = m_ll2xy(p2(:,1),p2(:,2)) ;
obj1.p = p1; obj2.p = p2;
bou = get_boundary_of_mesh(obj1,1);
[~,outer] = max(cellfun(@length,bou));
obj2 = extract_subdomain(obj2,bou{outer},...
[obj2,ind] = extract_subdomain(obj2,bou{outer},...
'centroid',1,'keep_inverse',1);
obj2 = map_mesh_properties(obj2,'ind',ind);
[obj2.p(:,1),obj2.p(:,2)] = m_xy2ll(obj2.p(:,1),obj2.p(:,2));
obj2 = obj2.clean(cleanargin);
clear ind
end
% concatenate
m1 = cat(obj1o,obj2);
merge = msh(); merge.p = m1.p; merge.t = m1.t;
obj1 = obj1o; obj2 = obj2o;
clear m1 obj1o obj2o
obj1 = obj1o;
clear m1 obj1o
otherwise
%% Abitrary non-matching overlapping meshes
% Project both meshes into the space of the global mesh
Expand Down
8 changes: 5 additions & 3 deletions utilities/extract_subdomain.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function [obj,ind] = extract_subdomain(obj,bou,varargin)
% [obj,ind] = extract_subdomain(obj,bou,varargin)
function [obj,ind,in] = extract_subdomain(obj,bou,varargin)
% [obj,ind,in] = extract_subdomain(obj,bou,varargin)
%
% Inputs:
% bou: a bbox, i.e.: [lon min, lon_max;
Expand All @@ -25,7 +25,9 @@
% Outputs:
% obj: the subset mesh obj (only p and t, properties untouched)
% ind: an array of indices that can be used to map the mesh properties to
% the output mesh subset with a subsequent call to "map_mesh_properties".
% the output mesh subset with a subsequent call to "map_mesh_properties".
% in: the logical array of elements within the given boundary
% used to perform the subsetting
%
keep_inverse = 0 ;
keep_numbering = 0 ;
Expand Down

0 comments on commit 21f93a4

Please sign in to comment.