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

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

?? mesh2d.m

?? 一個(gè)功能強(qiáng)大的非結(jié)構(gòu)網(wǎng)格劃分程序,可實(shí)現(xiàn)網(wǎng)格的自動(dòng)剖分,及局部加密與質(zhì)量控制
?? M
?? 第 1 頁 / 共 2 頁
字號(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
%    %將fix=0的值去掉
%    if(fix(1)==0)
%        fix(1)=1;
%    end
   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 

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品久久久久久久久| 欧美成人艳星乳罩| 久久99国产精品麻豆| 亚洲国产欧美日韩另类综合| 中文字幕在线观看不卡| 久久九九全国免费| 精品成人佐山爱一区二区| 日韩免费观看高清完整版| 欧美精品一二三| 在线亚洲人成电影网站色www| 99久久国产综合精品色伊| 成人毛片在线观看| 91老师片黄在线观看| 色婷婷香蕉在线一区二区| 91久久免费观看| 在线欧美日韩国产| 欧美精品tushy高清| 日韩一二三区不卡| 国产日韩成人精品| 国产精品美女视频| 夜夜嗨av一区二区三区| 天堂va蜜桃一区二区三区| 久久成人综合网| 国产a区久久久| 欧美中文字幕久久| 欧美成人精精品一区二区频| 久久精品亚洲国产奇米99| 中文字幕精品三区| 亚洲成国产人片在线观看| 免费观看成人av| 成人黄色a**站在线观看| 欧美性生交片4| 日韩欧美www| 亚洲色图欧美偷拍| 免费成人你懂的| 成熟亚洲日本毛茸茸凸凹| 欧美无砖砖区免费| 精品国产污污免费网站入口| 91精品国产综合久久福利| 久久色.com| 香蕉乱码成人久久天堂爱免费| 蜜桃视频一区二区三区在线观看| 久久成人免费电影| 欧美做爰猛烈大尺度电影无法无天| 日韩欧美一级特黄在线播放| 1024国产精品| 捆绑变态av一区二区三区| 91丝袜美腿高跟国产极品老师| 欧美一区二区三区性视频| 国产精品天天看| 日本中文字幕一区二区有限公司| 国产成人在线免费观看| 欧美军同video69gay| 中文字幕欧美一区| 精品系列免费在线观看| 欧美亚洲综合一区| 国产精品亲子伦对白| 欧美aaa在线| 在线观看日韩电影| 国产精品蜜臀在线观看| 激情丁香综合五月| 日韩一级片网站| 日韩中文字幕不卡| 91福利在线看| 国产精品久久久久久久久免费相片 | 亚洲综合色区另类av| 国产伦理精品不卡| 欧美成人a视频| 日本成人在线网站| 欧美日韩一本到| 亚洲精品写真福利| 99久久精品一区二区| 国产色综合一区| 精品一区二区在线看| 欧美一区二区国产| 日韩高清不卡在线| 欧美日韩一级视频| 亚洲午夜国产一区99re久久| 91影院在线免费观看| 欧美国产日韩a欧美在线观看| 久草中文综合在线| 欧美精品一区二区三区蜜桃| 欧美国产禁国产网站cc| 国产成人av一区二区| 久久美女艺术照精彩视频福利播放 | 色综合天天综合给合国产| 日韩欧美一级在线播放| 亚洲伊人伊色伊影伊综合网| 91热门视频在线观看| 最新中文字幕一区二区三区 | 午夜精品久久久久久久| 欧美在线一二三四区| 亚洲一区二区成人在线观看| 在线观看免费一区| 亚洲123区在线观看| 91麻豆精品国产综合久久久久久| 日韩在线一二三区| 日韩免费高清电影| 国产精品小仙女| 国产精品久久一级| 在线观看一区日韩| 日韩激情一区二区| 精品国产91亚洲一区二区三区婷婷| 免费欧美日韩国产三级电影| 精品日韩在线观看| 成人禁用看黄a在线| 亚洲在线视频免费观看| 91精品国产色综合久久ai换脸| 日韩av网站免费在线| 久久综合久久99| 91香蕉视频污在线| 午夜精品视频在线观看| 欧美一级久久久| 国产一区二区免费视频| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 日韩视频不卡中文| 国产69精品久久久久777| 《视频一区视频二区| 欧美日本乱大交xxxxx| 午夜av一区二区三区| 日韩欧美一区中文| 国产91精品一区二区麻豆网站| 综合久久国产九一剧情麻豆| 欧美在线观看一二区| 免费成人你懂的| 中文久久乱码一区二区| 97久久人人超碰| 中文字幕欧美日本乱码一线二线| voyeur盗摄精品| 亚洲日本在线a| 欧美日韩aaa| 国产**成人网毛片九色| 日韩精品午夜视频| 国产精品久久久久9999吃药| 欧美性感一类影片在线播放| 国产精品一二三四五| 亚洲一区二区av电影| 久久久91精品国产一区二区精品 | 国产精品自拍毛片| 中文字幕日本乱码精品影院| 91网站最新地址| 国产在线播放一区二区三区| 久久久久久久久久久久久夜| av网站免费线看精品| 麻豆成人91精品二区三区| 国产精品久久久久久亚洲伦 | 欧美一区中文字幕| 99在线视频精品| 久久99九九99精品| 一区二区视频在线看| 欧美成va人片在线观看| 在线精品视频一区二区| 国产成人精品亚洲午夜麻豆| 蜜臀av一区二区| 亚洲综合成人在线| 国产精品美女久久福利网站| 精品久久免费看| 91精品综合久久久久久| 欧美伊人久久久久久午夜久久久久| 日本成人在线视频网站| 亚洲午夜影视影院在线观看| 亚洲伦在线观看| 国产精品电影一区二区| 中文字幕乱码亚洲精品一区| 久久久精品国产99久久精品芒果| 日韩欧美激情在线| 欧美不卡一区二区| 精品国产乱码久久久久久蜜臀 | 有坂深雪av一区二区精品| 久久综合999| 精品sm捆绑视频| 337p粉嫩大胆噜噜噜噜噜91av| 欧美高清你懂得| 91精品国产乱| 在线观看日韩电影| 91在线播放网址| 欧美亚洲丝袜传媒另类| 欧美综合久久久| 99精品欧美一区| 欧美精品一区男女天堂| 亚洲一级电影视频| 亚洲男人的天堂一区二区| 国产一区二区三区美女| 日本一区二区三区在线不卡| 日本一区二区三区国色天香 | 欧美日韩免费高清一区色橹橹 | 欧美三级蜜桃2在线观看| 欧美日本国产一区| 欧美精品自拍偷拍| 欧美精品一区二区三区蜜桃| 久久精品亚洲精品国产欧美kt∨| 欧美高清在线精品一区| 一区二区三区四区蜜桃| 日韩不卡一二三区| 精品一区二区日韩| 99国产精品久久久久久久久久| 欧美综合一区二区| 精品国产精品一区二区夜夜嗨| 国产欧美视频在线观看| 一区二区激情视频|