⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mg_cycle.m

📁 五点差分型多重网格方法:各种插值算子的比较)
💻 M
字号:
%MG_CYCLE Multigrid cycle algorithm
%
%       U_OUT = MG_CYCLE(LEVEL, B, U_IN) uses the multigrid cycle defined
%       by the global variable "cycle_flag" to recursively solve the linear 
%       system AX=B at the given level.  If the optional starting value U_IN 
%       is not passed then U_IN is set to 0's.
%
%       Accesses global variables in "include_flags"

% James Bordner and Faisal Saied
% Department of Computer Science
% University of Illinois at Urbana-Champaign
% 10 April 1995

% Modified for Matlab Version 6 Compatability
% Ryan McKenzie
% University of Kentucky Center for Computational Sciences
% May 2004
%
% For some reason, locally generated variables cannot be seen outside the scope of a
% particular function in version 6 unless they have a global reference. This seems to 
% only occur when the newly generated variable is passed as a parameter. I have taken
% locally generated variables throughout MGLab and "bridged" them to their destination
% routines using global references. It's an ugly fix, so maybe someone should come up
% with a more centralized solution.

function u_out = mg_cycle(level, b, u_in)

include_flags

% Use the zero vector for u_in as the default
if nargin == 2,   
   u_in = zeros(size(b));
end

if (cycle_flag == V_CYCLE)
    u_out = vmg_cycle(level, b, u_in);
elseif (cycle_flag == W_CYCLE)
    u_out = wmg_cycle(level, b, u_in);
elseif (cycle_flag == HALF_V_CYCLE)
    u_out = halfvmg_cycle(level, b, u_in);
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -