This is a static copy of a profile report

Home

DOInit (1 call, 0.000 sec)
Generated 04-Aug-2014 13:05:21 using cpu time.
script in file /gdata/projects/atl/FV_Matlab_Framework_JingPJH/trunk/Src/DOStochastic/DOInit.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
FluidsSolver2_DO3function1
Lines where the most time was spent
No measurable time spent in this function

Line NumberCodeCallsTotal Time% TimeTime Plot
6
if ~exist('ui','var') &&am...
10 s0%
All other lines  0 s0%
Totals  0 s0% 
Children (called functions)
No children
Code Analyzer results
Line numberMessage
29Use of brackets [] is unnecessary. Use parentheses to group, if needed.
30Use of brackets [] is unnecessary. Use parentheses to group, if needed.
42Terminate statement with semicolon to suppress output (within a script).
51Use of brackets [] is unnecessary. Use parentheses to group, if needed.
52Use of brackets [] is unnecessary. Use parentheses to group, if needed.
70RAND and RANDN will not accept 'seed', 'state', or 'twister' in a future release.
81Best practice is to separate output variables with commas.
81Best practice is to separate output variables with commas.
81The value assigned to variable 'Pi' might be unused.
81Best practice is to separate output variables with commas.
Coverage results
Show coverage for parent directory
Total lines in function83
Non-code lines (comments, blank lines)24
Code lines (lines that can run)59
Code lines that did run1
Code lines that did not run58
Coverage (did run/can run)1.69 %
Function listing
time 
calls 
 line
      1 
   6 
if ~exist('ui','var') && (app.S(1)>0 || length(app.S)>1) 
   7 
    %If app.S=[0 #] we set app.S=1 and start with a very small variance
   8 
    
   9 
    %Choose the number of modes for the size of the basis from which new
  10 
    %unstable modes will be chosen. 
  11 
    NUMMODESINBASIS=round(min(50,max(max(app.S)^2/2,30)));
  12 
    d0=fileparts([pwd,filesep]);
  13 
    d0=d0(1:strfind(d0,'trunk')+4);
  14 
    
  15 
    if length(app.S)>1 %adaptive
  16 
        if ~isfield(app,'PlotScript')
  17 
            PlotScript = 'DOAdaptGenericPlots';
  18 
        end
  19 
        %Need 1 extra mode to have a properly normalized basis
  20 
        [ui, vi, var] = Stoch_Initial_Perturb(XU,YU,XV,YV,Nbcs,...
  21 
            length(bcsDP)+length(bcsOP),NodeP,NUMMODESINBASIS+1);
  22 
        if isfield(app,'var')
  23 
            var = var*app.var(1);
  24 
        else
  25 
            var = var*1e-6;
  26 
        end
  27 
        %XU and YU etc. contain points that may be masked out, so we have
  28 
        %to remove these. Also remove the extra mode.
  29 
        ui = ui([[1:Nbcs]';Nbcs+idsu],1:NUMMODESINBASIS);
  30 
        vi = vi([[1:Nbcs]';Nbcs+idsv],1:NUMMODESINBASIS);
  31 
        existbasis = length(dir([d0,'/Save/DOAdaptSave/Basis/orth_basis*']));
  32 
        save([d0,sprintf('/Save/DOAdaptSave/Basis/orth_basis%0.3d.mat',existbasis)],...
  33 
            'ui','vi');
  34 
        close all
  35 
    else %non-adaptive
  36 
        if ~isfield(app,'PlotScript')
  37 
            PlotScript = 'DOAdaptGenericPlots';
  38 
        end
  39 
        %Need to have one extra mode to have a proper orthonormalization
  40 
        [ui, vi, var] = Stoch_Initial_Perturb(XU,YU,XV,YV,Nbcs,...
  41 
            length(bcsDP)+length(bcsOP),NodeP,app.S + 1);
  42 
        var
  43 
        if isfield(app,'var')
  44 
            var = var*app.var(1);
  45 
        else
  46 
            var = var*1e-6;
  47 
        end
  48 
        close all;
  49 
        %XU and YU etc. contain points that may be masked out, so we have
  50 
        %to remove these.
  51 
        ui = ui([[1:Nbcs]';Nbcs+idsu],:);
  52 
        vi = vi([[1:Nbcs]';Nbcs+idsv],:);
  53 
    end
  54 

  55 
    %If the number of Monte-Carlo samples was not set by the setup script, 
  56 
    %arbitrarily choose 10,000
  57 
    if ~isfield(app,'MC'),app.MC=10000;end
  58 
    
  59 
    if (app.S(1)==0) 
  60 
        %For app.S = [0 #] case we need to set small variance, and initialize 
  61 
        %arrays properly
  62 
        app.S(1)=1;
  63 
        var(1)=1e-6;
  64 
        fui = zeros(length(uid),app.S(1));
  65 
        fvi = zeros(length(vid),app.S(1));
  66 
        fuij= zeros(length(uid),app.S(1)^2);
  67 
        fvij= zeros(length(vid),app.S(1)^2);
  68 
    end
  69 
    j=1;
  70 
    randn('state',0);
  71 
    YYt=zeros(app.MC,app.S(1)+1);
  72 
    for i=1:app.S+1
  73 
        YYt(:,j)=normrnd(0,sqrt(var(i)),app.MC,1);
  74 
        j=j+1;
  75 
    end
  76 
    
  77 
    ui = ui(:,1:app.S(1)+1);
  78 
    vi = vi(:,1:app.S(1)+1);
  79 
    Pi=zeros(length(P),app.S(1)+1);
  80 
    %Ortho-Normalization of basis fields to avoid round-off errors
  81 
    [YYt ui vi Pi] = DOorthnorm(app, dx, dy, YYt, ui, uid, vi, vid, Pi, pid);
  82 
    
  83 
    %Only select the first S modes
  84 
    ui = ui(:,1:app.S(1));
  85 
    vi = vi(:,1:app.S(1));
  86 
    Pi=zeros(length(P),app.S(1));
  87 
    YYt = YYt(:,1:app.S(1));
  88 
end