📄 show_params.m
字号:
%SHOW_PARAMS Display the currently set parameters in a text window.
%
% This M-File displays a summary of the currently defined global
% parameters in the figure with handle "param_fig".
%
% Accesses global variables in "include_globals"
% Accesses global variables in "include_flags"
% Accesses global variables in "include_figs"
% 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
% April 2004
%
% All lines containing bracket concatenation using a semicolon for newline like this:
% my_string = [my_string ; 'new text'];
% needed to be modified to use the comma concatenation and newline character like this:
% my_string = [my_string , '\nnew text'];
% The version 6 release of Matlab does not allow the semicolon form.
%
% Color for parameter window changed to white. Blue was difficult to read on.
%
% Position of text and window size altered to reduce need for manual resizing.
include_globals
include_flags
include_figs
% == Problem ============================================
p =[sprintf(' Problem ')];
if (problem_flag==POISSON)
p=[p,sprintf('\n Poisson Equation ')];
elseif (problem_flag==HELMHOLTZ)
p=[p,sprintf('\n Helmholtz Equation ')];
if imag(prob_args(1)) == 0
p=[p,sprintf('\n k = %6.2f ',prob_args(1))];
else
p=[p,sprintf('\n k = %6.2f + %6.2f * i ',real(prob_args(1)), imag(prob_args(1)))];
end
elseif (problem_flag==CONVECT_DIFFUSE)
p=[p,sprintf('\n Convection-Diffusion Equation ')];
p=[p,sprintf('\n lambda = %6d ',prob_args(1))];
p=[p,sprintf('\n sigma = %6d ',prob_args(2))];
elseif (problem_flag==CUT_SQUARE)
p=[p,sprintf('\n Cut Square Equation ')];
p=[p,sprintf('\n alpha = %8.3f ',prob_args(1))];
end
p=[p,sprintf('\n Problem size = (%3d,%3d) ',nx1,ny1)];
% == Solver Menu Item ==============================================
s =[sprintf(' Solver ')];
if (solver_flag==VMG_SOLVE & cycle_flag==V_CYCLE)
s=[s,sprintf('\n V-Cycle ')];
elseif (solver_flag==VMG_SOLVE & cycle_flag==W_CYCLE)
s=[s,sprintf('\n W-Cycle ')];
elseif (solver_flag==PCG_SOLVE)
s=[s,sprintf('\n PCG ')];
elseif (solver_flag==BICG_STAB_SOLVE)
s=[s,sprintf('\n Bi-CG(Stab) ')];
elseif (solver_flag==CGS_SOLVE)
s=[s,sprintf('\n CGS ')];
elseif (solver_flag==GMRES_SOLVE)
s=[s,sprintf('\n GMRES (%3d) ',restart)];
elseif (solver_flag==FMG_SOLVE)
s=[s,sprintf('\n FMG ')];
elseif (solver_flag==SOR_SOLVE)
if SOR_omega == 1
s=[s,sprintf('\n Gauss-Seidel ')];
else
s=[s,sprintf('\n SOR, omega = %8.2f ', SOR_omega)];
end
end
% == Preconditoner ==============================================
r =[sprintf(' Preconditioner ')];
if (precon_flag==MG_CYCLE_FLAG & cycle_flag==V_CYCLE)
r=[r,sprintf('\n V-Cycle ')];
elseif (precon_flag==MG_CYCLE_FLAG & cycle_flag==W_CYCLE)
r=[r,sprintf('\n W-Cycle ')];
elseif (precon_flag==JACOBI)
r=[r,sprintf('\n Jacobi ')];
elseif (precon_flag==BLOCK_JACOBI)
r=[r,sprintf('\n Block-Jacobi ')];
elseif (precon_flag==GAUSS_SEIDEL)
r=[r,sprintf('\n Gauss-Seidel ')];
elseif (precon_flag==ILU)
r=[r,sprintf('\n ILU ')];
elseif (precon_flag==SSOR)
r=[r,sprintf('\n SSOR ')];
elseif (precon_flag==NONE)
r=[r,sprintf('\n NONE ')];
end
% == Stopping-Criteria ===========================================
t =[sprintf(' Stopping Criteria ')];
if (prtol==0)
t=[t,sprintf('\n (precon) Residual Tolerence = NONE ')];
else
t=[t,sprintf('\n (precon) Residual Tolerance = %4.0e ',prtol)];
end
if (max_it==0)
t=[t,sprintf('\n Iteration Limit = NONE ')];
else
t=[t,sprintf('\n Iteration Limit = %4d ',max_it)];
end
% == MG Parameters ===========================================
m =[sprintf(' MG Parameters ')];
m=[m,sprintf('\n Number of Levels = %1d ',coarse_level)];
if (smooth_flag==WEIGHTED_JACOBI)
m=[m,sprintf('\n Smoother = Weighted Jacobi (w=%4.2f) ',wt)];
elseif (smooth_flag==GAUSS_SEIDEL)
m=[m,sprintf('\n Smoother = Gauss-Seidel ')];
elseif (precon_flag==RB_GAUSS_SEIDEL)
m=[m,sprintf('\n Red/Black Gauss-Seidel ')];
end
m=[m,sprintf('\n Pre-smoothings =%3d ',nu1)];
m=[m,sprintf('\n Post-smoothings =%3d ',nu2)];
if (restrict_flag==INJECTION)
m=[m,sprintf('\n Restriction = Injection ')];
elseif (restrict_flag==HALF_WEIGHTING)
m=[m,sprintf('\n Restriction = Half Weighting ')];
elseif (restrict_flag==FULL_WEIGHTING)
m=[m,sprintf('\n Restriction = Full Weighting ')];
elseif (restrict_flag==BILINEAR_ADJOINT)
m=[m,sprintf('\n Restriction = Bilinear Adjoint ')];
end
if (interp_flag==LINEAR)
m=[m,sprintf('\n Prolongation = Linear ')];
elseif (interp_flag==CUBIC)
m=[m,sprintf('\n Prolongation = Cubic ')];
elseif (interp_flag==OPERATOR_BASED)
m=[m,sprintf('\n Prolongation = Operator-Based ')];
elseif (interp_flag==EXPLICIT_BILINEAR)
m=[m,sprintf('\n Prolongation = Explicit Bilinear ')];
end
if (coarse_solver_flag==DIRECT_SOLVE)
m=[m,sprintf('\n Coarse-grid Solver = Sparse GE ')];
elseif (coarse_solver_flag==SMOOTHER_SOLVE)
m=[m,sprintf('\n Prolongation = Smoother (30) ')];
elseif (coarse_solver_flag==PCG_SOLVE)
m=[m,sprintf('\n Prolongation = PCG ')];
elseif (coarse_solver_flag==BICG_STAB_SOLVE)
m=[m,sprintf('\n Prolongation = Bi-CG(Stab) ')];
elseif (coarse_solver_flag==GMRES_SOLVE)
m=[m,sprintf('\n Prolongation = GMRES(%3d) ',restart)];
end
if (coarsening_flag==STANDARD)
m=[m,sprintf('\n Coarsener = Standard 5-point ')];
elseif (coarsening_flag==GALERKIN)
m=[m,sprintf('\n Coarsener = Galerkin ')];
elseif (coarsening_flag==AVERAGING)
m=[m,sprintf('\n Coarsener = Coeff. Averaging ')];
end
if (cycle_flag==V_CYCLE)
m=[m,sprintf('\n MG Cycle Type = V-Cycle ')];
elseif (cycle_flag==W_CYCLE)
m=[m,sprintf('\n MG Cycle Type = W-Cycle ')];
elseif (cycle_flag==HALF_V_CYCLE)
m=[m,sprintf('\n MG Cycle Type = Half V-Cycle ')];
end
page= sprintf('%s\n%s\n%s\n%s\n%s\n',p,s,r,t,m);
if (param_fig==0)
param_fig = figure('Position', param_position,...
'Name', 'Parameters',...
'NumberTitle', 'off', ...
'Color','white');
end
figure(param_fig);
[mm,nn] = size(page);
subplot(1,1,1)
hold off
cla
ht = 0.45;
for j = 1:mm
text(0.05, ht, page(j,:))
axis('off')
ht = ht - 0.05;
end
figure(main_fig);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -