📄 gm_curvecontrol.m
字号:
function sizeval = gm_curvecontrol(realpoint, parampoint, fspec, patchind, sizefunc, user_data)%% gm_curvaturecontrol: called by gm_meshgen to control element size%% sz = gm_curvaturecontrol(realpoint, parampoint, fspec, patchind, sizefunc, user_data)%% This routine is invoked by the mesh generators to%% determine the curvature-matching function. Argument proc is the%% size control function. See the documentation for more%% information.proc = gm_strim(sizefunc);if proc(1) ~= '(' error('size control procedure must start with a parenthesis')endif proc(length(proc)) ~= ')' error('Unbalanced parentheses in size control procedure');endproc(1) = ' ';proc(length(proc)) = ' ';proc = gm_strim(proc);[first, rest] = strtok(proc);first = gm_strim(first);rest = gm_strim(rest);%% The next test could be commented out because "const" is%% caught by the mesh generators, so this function should%% never be reached in that case.if strcmpi(first, 'const') sizeval = str2num(rest);elseif strcmpi(first, 'formula') | strcmpi(first, 'vecformula') formula = gm_percentsub(rest, 'realpoint(', '+1)'); sizeval = eval(formula);elseif strcmpi(first,'pw_const') if fspec(1) ~= 1 error('pw_const used on non-dimension-1 patch'); end fmtctl = '(%d %e %e %e) '; a = sscanf(rest, fmtctl); if length(a) == 0 | rem(length(a), 4) ~= 0 error('pw const incorrectly formatted 1'); end numtuple = length(a) / 4; r = (1:length(fmtctl))' * ones(1,numtuple); bigfmtctl = [fmtctl(r(:)'),'%e']; a1 = sscanf(rest, bigfmtctl); if length(a1) ~= length(a) + 1 error('pw const incorrectly formatted 2'); end defaultval = a1(end); a = reshape(a,4,numtuple); sizeval = []; for j = 1 : numtuple if a(1,j) == patchind & parampoint >= a(2,j) & parampoint <= a(3,j) sizeval = a(4,j); break end end if length(sizeval) == 0 sizeval = defaultval; endelse error('Unknown curvaturecontrol keyword');end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -