-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multiscale meshing--mesh resolution transitions (#119)
* Bug fix to dpoly.m * if sum(inside) == 0 then d_l will not exist, but it seems like it sum(inside) is zero then it doesn't use the d_l anyway so can just return then. * use splitting at initial point generation to ensure mesh resolution transitions between largely disparate nests are sufficiently smooth for good mesh qualities. Co-authored-by: Keith Roberts <[email protected]>
- Loading branch information
Showing
5 changed files
with
105 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
% Example_10_Multiscale_Smoother: | ||
% An idealized test for multiscale nesting using boxes with a large min_el | ||
% ratio | ||
|
||
bbox = [0, 1; 0,1]; | ||
boubox = [0,0; 1,0; 1,1; 0,1; 0,0; NaN NaN ]; | ||
min_el = 1e3; | ||
|
||
gdat1 = geodata('pslg',boubox,'bbox',bbox,'h0',min_el); | ||
fh1 = edgefx('geodata',gdat1,'g',0.2); | ||
|
||
bbox2 = [-1, 2; -1,2]; | ||
boubox2 = [-1,-1; 2,-1; 2,2; -1,2; -1,-1; NaN NaN ]; | ||
min_el2 = min_el*10; | ||
|
||
gdat2 = geodata('pslg',boubox2,'bbox',bbox2,'h0',min_el2); | ||
fh2 = edgefx('geodata',gdat2,'g',0.2); | ||
|
||
mshopts = meshgen('ef',{fh2, fh1},'bou',{gdat2,gdat1},... | ||
'plot_on',1,'qual_tol',0.0025,'cleanup',0); | ||
mshopts = mshopts.build; | ||
|
||
m = mshopts.grd; | ||
|
||
plot(m) | ||
|
||
m = m.clean; | ||
|
||
plot(m) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
% Function for adding points to an untriangulated set of points based on | ||
% nearest distance versus the desired edgefx | ||
function [new_points]=split(points,fh) | ||
% find the point closest to each point (that isn't the *same* point) | ||
[idx, ~] = ourKNNsearch(points',points',2); | ||
% the ideal spacing between points | ||
ideal_dst = fh(points); | ||
% where the dst is 2*ideal_dist, add a point in between | ||
long = zeros(length(points)*2,1); | ||
lat = zeros(length(points)*2,1); | ||
long(1:2:end) = points(idx(:,1),1); | ||
long(2:2:end) = points(idx(:,2),1); | ||
lat(1:2:end) = points(idx(:,1),2); | ||
lat(2:2:end) = points(idx(:,2),2); | ||
L = m_lldist(long,lat); | ||
L = L(1:2:end)*1e3; % L = lengths in meters | ||
splits = L > 1.5*ideal_dst; | ||
disp(['Number of splits near multiscale nest: ' num2str(sum(splits))]) | ||
new_points = (points(idx(splits,1),:) + points(idx(splits,2),:))./2.0; | ||
end | ||
|
||
|