亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mesh2d.m

?? 一個(gè)功能強(qiáng)大的非結(jié)構(gòu)網(wǎng)格劃分程序,可實(shí)現(xiàn)網(wǎng)格的自動(dòng)剖分,及局部加密與質(zhì)量控制
?? M
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
function [p,t] = mesh2d(node,edge,hdata,options)

%  MESH2D: 2D unstructured triangular mesh generation.
%
% A 2D unstructured triangular mesh is generated based on a piecewise-
% linear geometry input. An iterative method is implemented to optimise 
% mesh quality. General multiply connected domains and element size 
% functions can be specified.
%
% Returns the final coordinates of the nodes p, and their triangulation t
% (with a counter-clockwise node ordering).
%
%  SHORT SYNTAX:
%
%  [p,t] = mesh2d(node);
%
% NODE defines the geometry nodes via an Nx2 array:
%
%  node  = [x1 y1; x2 y2; etc], geometry nodes specified in consectutive
%                               order, such that NODE(2,:) is joined with
%                               NODE(1,:) etc.
%
% An element size function is automatically generated based on the 
% complexity of the geometry. Generally this produces meshes with the 
% fewest number of triangles.
%
%  LONG SYNTAX:
%
%  [p,t] = mesh2d(node,edge,hdata,options);
%
% Blank arguments can be passed using the empty placeholder "[]".
%
% EDGE defines the connectivity between the points in NODE as a list of
% edges:
%
%   edge = [n1 n2; n2 n3; etc], connectivity between nodes to form
%                               geometry edges. If EDGE is specified it is
%                               not required that NODE be consectutive.
%
% HDATA is a structure for user defined element size information. HDATA can 
% include the following fields:
%
%  hdata.hmax  = h0;                   Max allowable global element size.
%  hdata.edgeh = [e1,h1; e2,h2; etc];  Element size on specified geometry 
%                                      edges.
%  hdata.fun   = 'fun' or @fun;        User defined size function.
%  hdata.args  = {arg1, arg2, etc};    Additional arguments for HDATA.FUN.
%
% Calls to user specified functions must accept vectorised input of the 
% form H = FUN(X,Y,ARGS{:}), where X,Y are the xy coordinates where the
% element size will be evaluated and ARGS are optional additional arguments 
% as passed by HDATA.ARGS.
%
% An automatic size function is always generated to ensure that the
% geometry is adequately resolved. The overall size function is the minimum
% of the user specified and automatic functions.
%
% OPTIONS is a structure array that allows some of the "tuning" parameters
% used in the solver to be modified:
%
%   options.mlim   - Specifies the maximum allowable change in edge length
%                    per iteration that must be obtained [default = 0.05
%                    (5%)]. Larger values should accelerate convergence,
%                    but could decrease mesh quality.
%   options.maxit  - Specifies the maximum number of iterations the
%                    algorithm will perform [default = 20].
%   options.dhmax  - Specifies the maximum allowable (relative) gradient in
%                    the size function [default = 0.3].
%   options.output - Displays the mesh and the mesh statistics upon
%                    completion [default = true].
%
% EXAMPLE:
%
%   meshdemo                  % Will run the standard demos
%   mesh_collection(n)        % Will run some additional demos
%
% See also REFINE, SMOOTHMESH, DELAUNAYN


% Mesh2d is a delaunay based algorithm with a "Laplacian-like" smoothing
% operation built into the mesh generation process. 
% 
% An unbalanced quadtree decomposition is used to evaluate the element size 
% distribution required to resolve the geometry. The quadtree is 
% triangulated and used as a backgorund mesh to store the element size 
% data.  
%
% The main method attempts to optimise the node location and mesh topology 
% through an iterative process. In each step a constrained delaunay 
% triangulation is generated with a series of "Laplacian-like" smoothing 
% operations used to improve triangle quality. Nodes are added or removed 
% from the mesh to ensure the required element size distribution is 
% approximated.  
%
% The optimisation process generally returns well shaped meshes with no
% small angles and smooth element size variations. Mesh2d shares some 
% similarities with the Distmesh code: 
%
%   [1] P.-O. Persson, G. Strang, A Simple Mesh Generator in MATLAB.
%       SIAM Review, Volume 46 (2), pp. 329-345, June 2004
%
%   Darren Engwirda : 2005-07
%   Email           : d_engwirda@hotmail.com
%   Last updated    : 08/07/2007 with MATLAB 7.0
%
% Mesh2d is Copyright (C) 2007 Darren Engwirda. See "copyright.m" for full 
% details.
%
% Please email me any un-meshable geometries, meshing benchmarks or
% suggestions!

tic
wbar = waitbar(0,'Forming geometry faces');

% Error checks
if nargin<4
   options = [];
   if nargin<3
      hdata = [];
      if nargin<2
         edge = [];
         if nargin<1
            error('Wrong number of inputs');
         end
      end
   end
elseif nargin>4
   error('Wrong number of inputs');
end
if nargout>2
   error('Wrong number of outputs');
end

% Get user options
[mlim,maxit,dhmax,output] = getoptions(options);

% Check geometry
[node,edge,hdata] = checkgeometry(node,edge,hdata);                        % Error checking for geometry
edgexy = [node(edge(:,1),:), node(edge(:,2),:)];                           % Geometry as edge endpoints [x1,y1,x2,y2]

% QUADTREE DECOMPOSITION
%  PH    : Background mesh nodes
%  TH    : Background mesh triangles
%  HH    : Size function value at PH
[ph,th,hh] = quadtree(edgexy,hdata,dhmax,wbar);

waitbar(0,wbar,'Initialising mesh');

% INITIALISE MESH
%  P     : Initial nodes
%  T     : Initial triangulation
%  WNDX  : Closest edge for each node as indices into EDGEXY
%  TNDX  : Enclosing triangle for each node as indices into TH
%  FIX   : Indices of FIXED nodes in P
[p,t,wndx,tndx,fix,fixed] = initmesh(ph,th,node,edge,edgexy);

% MAIN LOOP
retri = false;
subit = 3;
for iter = 1:maxit

   % Re-triangulation
   if retri
      t = MyDelaunayn(p);                                                  % Delaunay triangulation via QHULL
      pc = (p(t(:,1),:)+p(t(:,2),:)+p(t(:,3),:))/3;                        % Centroids
      t = t(inpoly(pc,node,edge),:);                                       % Take triangles with internal centroids
   end
   
   [e,bnd] = getedges(t,size(p,1));                                        % Unique edges and boundary nodes
   bnd(fix) = false;                                                       % Don't flag fixed nodes
   bnd = find(bnd);

   nume = size(e,1);
   S = sparse(e(:),[1:nume,1:nume],1,size(p,1),nume);                      % Sparse node-to-edge connectivity matrix

   tndx = mytsearch(ph(:,1),ph(:,2),th,p(:,1),p(:,2),tndx);                % Find enclosing triangle in background mesh for nodes
   h = tinterp(ph,th,hh,p,tndx);                                           % Size function at nodes via linear interpolation
   h = 0.5*(h(e(:,1))+h(e(:,2)));                                          % from the background mesh. Average to edge midpoints.
   
   % Inner smoothing iterations
   L = max(sqrt(sum((p(e(:,1),:)-p(e(:,2),:)).^2,2)),eps);                 % Edge length
   done = false;
   subit = max(subit,iter);                                                % Increment sub-iters with outer iters to aid convergence
   for subiter = 1:subit   
      r = sqrt(L./h);                                                      % Ratio of actual to desired edge length

      pm = 0.5*[r,r].*( p(e(:,1),:)+p(e(:,2),:) );                         % Edge midpoints, size function weighted

      W = max(S*r,eps);                                                    % Size function weighting
      p = (S*pm)./[W,W];                                                   % Weighted Laplacian-like smoothing
      p(fix,:) = fixed;                                                    % Don't update fixed nodes

      [p,wndx] = project2poly(p,bnd,edgexy,wndx);                          % Project bnd nodes onto the closest geometry edge
      
      Lnew = max(sqrt(sum((p(e(:,1),:)-p(e(:,2),:)).^2,2)),eps);           % Edge length
      move = norm((Lnew-L)./L,inf);                                        % Percentage change
      L = Lnew;

      if move<mlim                                                         % Test convergence
         done = true;
         break
      end
   end
   
   msg = ['Generating mesh (Iteration ',num2str(iter),')'];                % Show progress
   waitbar(mlim/max(move,eps),wbar,msg);

   r = L./h;
   if done && max(r)<3                                                     % Main loop convergence
      break
   end

   % Nodal density control
   retri = false;
   if iter<maxit
      test = find(r<=0.5);                                                 % Remove both nodes for edges with r<0.5
      hang = sum(S,2)<2;                                                   % Remove nodes connected to less than 2 edges
      if ~isempty(test) || any(hang)
         prob = false(size(p,1),1);                                        % True for nodes to be removed
         prob(e(test,:)) = true;                                           % Edges with r<0.5
         prob(hang) = true;
         prob(fix) = false;                                                % Make fixed nodes work
         pnew = p(~prob,:);                                                % New node list

         tmp_wndx = wndx(~prob);
         tmp_tndx = tndx(~prob);
         
         j = zeros(size(p,1),1);                                           % Re-index fix to make fixed nodes work
         j(~prob) = 1;
         j = cumsum(j);
         fix = j(fix);
         
         retri = true;
      else
         pnew = p;                                                         % No nodes removed
         tmp_wndx = wndx;
         tmp_tndx = tndx;
      end
      test = find(r>=2);                                                   % Add node at midpoint for edges with r>=2
      if ~isempty(test)
         p = [pnew; 0.5*(p(e(test,1),:)+p(e(test,2),:))];
         wndx = [tmp_wndx; zeros(length(test),1)];
         tndx = [tmp_tndx; zeros(length(test),1)];
         retri = true;
      else
         p = pnew;                                                         % No nodes added
         wndx = tmp_wndx;
         tndx = tmp_tndx;
      end
   end

end
close(wbar)

if iter==maxit
   disp('WARNING: Maximum number of iterations reached. Solution did not converge!')
   disp('Please email the geometry and settings to d_engwirda@hotmail.com')
end

[p,t] = fixmesh(p,t);                                                      % Ensure triangulation unique and
                                                                           % CCW node ordered
tfinal = toc;
if output

   figure('Name','Mesh')
   patch('faces',t,'vertices',p,'facecolor','None','edgecolor','b')
   hold on
   patch('faces',edge,'vertices',node,'facecolor','None','edgecolor','r')
   axis equal off; hold off

   % Mesh measures
   q = quality(p,t);
   
   disp(struct('Iterations',       iter, ...
               'Time',             tfinal, ...
               'Triangles',        size(t,1), ...
               'Nodes',            size(p,1), ...
               'Mean_quality',     mean(q), ...
               'Min_quality',      min(q)) );
               %'Mean_size_ratio',  mean(r), ...
               %'Min_size_ratio',   min(r), ...
               %'Max_size_ratio',   max(r)) );
end


%% SUB-FUNCTIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [p,t,wndx,tndx,fix,fixed] = initmesh(p,t,node,edge,edgexy)

% Initialise the nodes, triangulation and data structures for the mesh 
% based on the quadtree data and geometry.

in = inpoly(p,node,edge);                                                  % True for internal nodes
tin = any(in(t),2);                                                        % True for triangles with at least one internal node
ok = false(size(p,1),1);                                                   % Nodes considered approximately internal
ok(t(tin,:)) = true;

fixed = node;
ndx = tsearch(p(:,1),p(:,2),t,fixed(:,1),fixed(:,2));                      % Find enclosing triangle for fixed nodes

% At this stage some nodes have been accepted that are not inside the 
% geometry. This is done because the quadtree triangulation will overlap 
% the geometry in some cases, so nodes invloved in the overlap are accepted 
% to get a reasonable distribution near the edges.

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
aaa亚洲精品| 亚洲天堂a在线| 中文字幕乱码久久午夜不卡| 亚洲少妇中出一区| 日本免费在线视频不卡一不卡二| 久久成人免费网| www.亚洲色图.com| 91精品国产一区二区人妖| 久久亚洲影视婷婷| 一区二区三区在线高清| 玖玖九九国产精品| 成人av网站在线| 欧美一区二区三区小说| 中文字幕制服丝袜一区二区三区 | 国内精品国产三级国产a久久| 成人国产在线观看| 欧美高清你懂得| 日本一区免费视频| 日韩av一区二区在线影视| 国产成人综合在线| 69堂国产成人免费视频| 国产亚洲综合性久久久影院| 亚洲成人资源在线| 高清beeg欧美| 这里是久久伊人| 亚洲欧美另类久久久精品2019 | 久久网这里都是精品| 亚洲免费成人av| 国模冰冰炮一区二区| 欧洲人成人精品| 国产日韩精品一区二区三区在线| 日韩国产欧美在线播放| 99re这里都是精品| 久久在线免费观看| 日本成人中文字幕在线视频| 91免费看视频| 国产午夜亚洲精品不卡| 视频在线在亚洲| 日本韩国视频一区二区| 国产日韩欧美激情| 激情成人午夜视频| 91精品国产色综合久久久蜜香臀| 亚洲视频图片小说| 成人激情校园春色| 久久久久久久久久久黄色| 免费高清在线一区| 欧美日韩国产一二三| 亚洲激情自拍偷拍| 不卡一区二区三区四区| 国产亚洲综合色| 国产伦精品一区二区三区在线观看| 亚洲成人动漫精品| 91视视频在线观看入口直接观看www | 国产欧美综合在线观看第十页| 免费成人在线影院| 91 com成人网| 日韩精品视频网站| 欧美丝袜丝nylons| 依依成人综合视频| 在线视频中文字幕一区二区| 亚洲色图一区二区| av资源网一区| 中文字幕日韩一区二区| 成人丝袜高跟foot| 国产精品日韩成人| 丁香五精品蜜臀久久久久99网站 | 99国产精品一区| 中文字幕一区二区在线播放 | 亚洲免费电影在线| 色94色欧美sute亚洲线路二| 亚洲欧美乱综合| 色成人在线视频| 一区二区三区色| 欧美日韩三级一区| 午夜免费久久看| 日韩欧美久久久| 韩国欧美国产1区| 国产亚洲欧美在线| av午夜一区麻豆| 亚洲已满18点击进入久久| 欧美性大战久久| 日本va欧美va欧美va精品| 日韩一区二区在线观看| 国产一区二区三区在线观看免费 | 成人午夜视频福利| 国产精品美女久久福利网站| 91美女片黄在线观看91美女| 亚洲精品免费在线播放| 欧美精品色一区二区三区| 麻豆国产精品一区二区三区 | 国产成人av电影在线播放| 自拍偷拍亚洲综合| 欧美在线看片a免费观看| 日本少妇一区二区| 久久在线观看免费| 91色.com| 午夜精品久久久久| 欧美刺激脚交jootjob| 国产成人夜色高潮福利影视| 亚洲免费观看在线观看| 欧美日韩不卡视频| 国产原创一区二区| **网站欧美大片在线观看| 欧美三级电影在线观看| 老司机免费视频一区二区三区| 久久久久97国产精华液好用吗| 91麻豆视频网站| 日韩av在线免费观看不卡| 中文字幕巨乱亚洲| 欧美色偷偷大香| 国内不卡的二区三区中文字幕 | 欧美色图在线观看| 久久97超碰色| 亚洲另类中文字| 精品国产一区二区三区久久影院| 成人三级伦理片| 视频在线观看国产精品| 欧美国产精品一区二区三区| 在线免费观看一区| 久久不见久久见免费视频1| 国产精品久久久久三级| 91精品国产综合久久婷婷香蕉| 国产成人午夜电影网| 亚瑟在线精品视频| 国产欧美日韩三区| 欧美剧在线免费观看网站| 国产91富婆露脸刺激对白| 午夜精品久久久久久| 国产精品美女久久久久久久久久久| 欧美久久久久中文字幕| 成人av资源在线观看| 日本少妇一区二区| 亚洲精品高清在线| 欧美大片在线观看一区二区| 色婷婷激情综合| 国产精品一区一区| 视频一区国产视频| 亚洲精品日日夜夜| 国产欧美日韩另类视频免费观看| 欧美日韩亚洲国产综合| 成人激情免费电影网址| 免费精品视频在线| 一卡二卡欧美日韩| 国产精品理伦片| 久久人人超碰精品| 7777精品伊人久久久大香线蕉最新版| 9色porny自拍视频一区二区| 精品亚洲porn| 日韩av在线播放中文字幕| 一区二区三区久久| 国产精品嫩草99a| 久久午夜色播影院免费高清| 欧美精品高清视频| 色综合久久66| 成人av手机在线观看| 国产中文字幕精品| 免费黄网站欧美| 偷窥国产亚洲免费视频| 一区二区三区成人| 一色屋精品亚洲香蕉网站| 国产日韩亚洲欧美综合| 久久综合久久综合亚洲| 日韩精品一区国产麻豆| 欧美妇女性影城| 欧美午夜不卡视频| 91免费在线视频观看| 成人av动漫网站| 成人一区二区三区视频| 国产一区二区三区精品欧美日韩一区二区三区 | 国产宾馆实践打屁股91| 九九视频精品免费| 久久av老司机精品网站导航| 蜜桃一区二区三区四区| 日本视频免费一区| 全国精品久久少妇| 青娱乐精品视频在线| 日精品一区二区| 日本视频中文字幕一区二区三区| 日日摸夜夜添夜夜添国产精品| 偷拍日韩校园综合在线| 日韩精品乱码免费| 日本不卡在线视频| 精品无人码麻豆乱码1区2区| 久久99国产精品久久99| 韩国欧美一区二区| 国产激情视频一区二区三区欧美| 国产一区二区免费视频| 国产酒店精品激情| 丁香激情综合国产| 99久久精品国产精品久久| 色综合天天天天做夜夜夜夜做| 色一情一伦一子一伦一区| 91福利视频久久久久| 欧美日韩视频一区二区| 欧美一区二区三区思思人| 欧美电影免费观看高清完整版在线观看| 精品久久人人做人人爽| 久久先锋影音av| 亚洲欧美aⅴ...| 亚洲国产另类精品专区|