This is a static copy of a profile report

Home

translate_Node (4 calls, 0.052 sec)
Generated 04-Aug-2014 13:05:16 using cpu time.
function in file /gdata/projects/atl/FV_Matlab_Framework_JingPJH/trunk/Src/Util/translate_Node.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
set_bcsfunction4
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
55
Nodeu(~ids) = -Nodeu(~ids);
40.019 s37.5%
53
ids = (Nodeu > 0);
40.006 s12.5%
46
ids = (Nodeu == id2type(i));
130.006 s12.5%
40
Nodeu(ids) = nextid: -1:(nexti...
40.006 s12.5%
19
ids = (Nodeu == id2type(i));
50.006 s12.5%
All other lines  0.006 s12.5%
Totals  0.052 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function57
Non-code lines (comments, blank lines)17
Code lines (lines that can run)40
Code lines that did run36
Code lines that did not run4
Coverage (did run/can run)90.00 %
Function listing
time 
calls 
 line
   1 
function [Nodeu, maxbcid, bc] = translate_Node(Nodeu, bc_u, Nbcids)
   2 
%function [Nodeu, maxbcid, bc] = translate_Node(Nodeu, bc_u, Nbcids)
   3 

   4 
% We initially set all boundary IDs to negative numbers so as not to lose information.
      4 
   5 
nextid = -1; 
   6 

   7 
% 1: Deal with multi-valued Dirichlet BCs ('dmv')
      4 
   8 
id2type = find(bc_u == 1); 
      4 
   9 
ids = false(size(Nodeu)); 
      4 
  10 
for i=1:length(id2type) 
  11 
    ids = ids | (Nodeu == id2type(i));
  12 
end;
      4 
  13 
Nodeu(ids) = nextid: -1:(nextid + 1 - sum(ids(:))); 
< 0.01 
      4 
  14 
nextid = nextid - sum(ids(:)); 
  15 

  16 
% 2: Deal with single-valued Dirichlet BCs ('d')
      4 
  17 
id2type = find(bc_u == 2); 
      4 
  18 
for i=1:length(id2type) 
< 0.01 
      5 
  19 
    ids = (Nodeu == id2type(i)); 
      5 
  20 
    Nodeu(ids) = nextid; 
      5 
  21 
    nextid = nextid - 1; 
      5 
  22 
end; 
      4 
  23 
bc(1) = -nextid - 1; 
  24 

  25 
% 3: Deal with open BCs ('o')
      4 
  26 
id2type = find(bc_u == 3); 
      4 
  27 
for i=1:length(id2type) 
      2 
  28 
    ids = (Nodeu == id2type(i)); 
      2 
  29 
    Nodeu(ids) = nextid; 
      2 
  30 
    nextid = nextid - 1; 
      2 
  31 
end; 
      4 
  32 
bc(2) = -nextid - 1; 
  33 

  34 
% 4: Deal with multi-valued Neumann BCs ('nmv')
      4 
  35 
id2type = find(bc_u == 4); 
      4 
  36 
ids = false(size(Nodeu)); 
      4 
  37 
for i=1:length(id2type) 
  38 
    ids = ids | (Nodeu == id2type(i));
  39 
end;
< 0.01 
      4 
  40 
Nodeu(ids) = nextid: -1:(nextid + 1 - sum(ids(:))); 
      4 
  41 
nextid = nextid - sum(ids(:)); 
  42 

  43 
% 5: Deal with single-valued Neumann BCs ('n')
      4 
  44 
id2type = find(bc_u == 5); 
      4 
  45 
for i=1:length(id2type) 
< 0.01 
     13 
  46 
    ids = (Nodeu == id2type(i)); 
     13 
  47 
    Nodeu(ids) = nextid; 
     13 
  48 
    nextid = nextid - 1; 
     13 
  49 
end; 
      4 
  50 
bc(3) = -nextid - 1; 
  51 

  52 
% Finally, we set the interior node IDs and set boundary IDs back to positive numbers.
< 0.01 
      4 
  53 
ids = (Nodeu > 0); 
      4 
  54 
Nodeu(ids) = Nodeu(ids) - Nbcids + (-nextid - 1); 
  0.02 
      4 
  55 
Nodeu(~ids) = -Nodeu(~ids); 
  56 

      4 
  57 
maxbcid = -nextid - 1;