# HG changeset patch # User cdf # Date 1396196084 0 # Node ID d3da1a3fda79fdb13bd74af76a88823fc11cc941 # Parent b7bdd690c6b639de683c73c21531c1e3b1852e4b do not assume vector direction diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim1a_advection_upwind.m --- a/extra/bim/inst/bim1a_advection_upwind.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim1a_advection_upwind.m Sun Mar 30 16:14:44 2014 +0000 @@ -49,16 +49,16 @@ error("bim1a_advection_upwind: wrong number of input parameters."); endif - nnodes = length(x); + nnodes = numel (x); nelem = nnodes-1; areak = reshape(diff(x),[],1); - if (length(beta) == 1) + if (numel (beta) == 1) vk = 0; - elseif (length(beta) == nelem) + elseif (numel (beta) == nelem) vk = beta .* areak; - elseif (length(beta) == nnodes) + elseif (numel (beta) == nnodes) vk = diff(beta); else error("bim1a_advection_upwind: coefficient beta has wrong dimensions."); diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim1a_laplacian.m --- a/extra/bim/inst/bim1a_laplacian.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim1a_laplacian.m Sun Mar 30 16:14:44 2014 +0000 @@ -48,9 +48,9 @@ endif ## Input-type check inside bim1a_advection_diffusion - nnodes = length(mesh); + nnodes = numel (mesh); nelem = nnodes - 1; A = bim1a_advection_diffusion (mesh, epsilon, kappa, ones(nnodes,1), 0); -endfunction \ No newline at end of file +endfunction diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim1a_reaction.m --- a/extra/bim/inst/bim1a_reaction.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim1a_reaction.m Sun Mar 30 16:14:44 2014 +0000 @@ -46,9 +46,9 @@ error("bim1a_reaction: first argument is not a valid vector."); endif - mesh = reshape(mesh,[],1); - nnodes = length(mesh); - nelems = nnodes-1; + mesh = reshape (mesh, [], 1); + nnodes = numel (mesh); + nelems = nnodes - 1; ## Turn scalar input to a vector of appropriate size if isscalar(delta) @@ -60,9 +60,9 @@ if !( isvector(delta) && isvector(zeta) ) error("bim1a_reaction: coefficients are not valid vectors."); - elseif length(delta) != nelems + elseif numel (delta) != nelems error("bim1a_reaction: length of delta is not equal to the number of elements."); - elseif length(zeta) != nnodes + elseif numel (zeta) != nnodes error("bim1a_reaction: length of zeta is not equal to the number of nodes."); endif @@ -78,4 +78,4 @@ %! delta = ones(100,1); %! zeta = ones(101,1); %! B = bim1a_reaction(x,delta,zeta); -%! assert(A,B) \ No newline at end of file +%! assert(A,B) diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim1a_rhs.m --- a/extra/bim/inst/bim1a_rhs.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim1a_rhs.m Sun Mar 30 16:14:44 2014 +0000 @@ -47,7 +47,7 @@ endif mesh = reshape(mesh,[],1); - nnodes = length(mesh); + nnodes = numel (mesh); nelem = nnodes-1; ## Turn scalar input to a vector of appropriate size @@ -60,9 +60,9 @@ if !( isvector(f) && isvector(g) ) error("bim1a_rhs: coefficients are not valid vectors."); - elseif (length(f) != nelem && length(f) != 1) + elseif (numel (f) != nelem && numel (f) != 1) error("bim1a_rhs: length of f is not equal to the number of elements."); - elseif (length(g) != nnodes && length(g) != 1) + elseif (numel (g) != nnodes && numel (g) != 1) error("bim1a_rhs: length of g is not equal to the number of nodes."); endif @@ -77,4 +77,4 @@ %! delta = ones(100,1); %! zeta = ones(101,1); %! B = bim1a_rhs(x,delta,zeta); -%! assert(A,B) \ No newline at end of file +%! assert(A,B) diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim1c_norm.m --- a/extra/bim/inst/bim1c_norm.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim1c_norm.m Sun Mar 30 16:14:44 2014 +0000 @@ -71,7 +71,7 @@ if (strcmp (norm_type,'inf')) norm_u = max (abs (u)); else - if (length (u) == nnodes) + if (numel (u) == nnodes) M = __mass_matrix__ (m); diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim2a_advection_diffusion.m --- a/extra/bim/inst/bim2a_advection_diffusion.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim2a_advection_diffusion.m Sun Mar 30 16:14:44 2014 +0000 @@ -98,11 +98,11 @@ if !( isvector(alpha) && isvector(gamma) && isvector(eta) ) error("bim2a_advection_diffusion: coefficients are not valid vectors."); - elseif length(alpha) != nelem + elseif (numel (alpha) != nelem) error("bim2a_advection_diffusion: length of alpha is not equal to the number of elements."); - elseif length(gamma) != nnodes + elseif (numel (gamma) != nnodes) error("bim2a_advection_diffusion: length of gamma is not equal to the number of nodes."); - elseif length(eta) != nnodes + elseif (numel (eta) != nnodes) error("bim2a_advection_diffusion: length of eta is not equal to the number of nodes."); endif diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim2a_boundary_mass.m --- a/extra/bim/inst/bim2a_boundary_mass.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim2a_boundary_mass.m Sun Mar 30 16:14:44 2014 +0000 @@ -61,10 +61,10 @@ dd = zeros(size(nodelist)); - for in = 1:length(nodelist) + for in = 1:numel (nodelist) dd (in) = (sum(l(edges(1,:)==nodelist(in)))+sum(l(edges(2,:)==nodelist(in))))/2; endfor M = sparse(diag(dd)); -endfunction \ No newline at end of file +endfunction diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim2a_reaction.m --- a/extra/bim/inst/bim2a_reaction.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim2a_reaction.m Sun Mar 30 16:14:44 2014 +0000 @@ -60,9 +60,9 @@ if !( isvector(delta) && isvector(zeta) ) error("bim2a_reaction: coefficients are not valid vectors."); - elseif length(delta) != nelem + elseif (numel (delta) != nelem) error("bim2a_: length of alpha is not equal to the number of elements."); - elseif length(zeta) != nnodes + elseif (numel (zeta) != nnodes) error("bim2a_: length of gamma is not equal to the number of nodes."); endif @@ -101,4 +101,4 @@ %!test % [C1] = bim2a_reaction(mesh,3*delta,zeta); % [C2] = bim2a_reaction(mesh,3,1); -% assert(C1,C2); \ No newline at end of file +% assert(C1,C2); diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim2a_rhs.m --- a/extra/bim/inst/bim2a_rhs.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim2a_rhs.m Sun Mar 30 16:14:44 2014 +0000 @@ -60,9 +60,9 @@ if !( isvector(f) && isvector(g) ) error("bim2a_rhs: coefficients are not valid vectors."); - elseif length(f) != nelem + elseif (numel (f) != nelem) error("bim2a_rhs: length of f is not equal to the number of elements."); - elseif length(g) != nnodes + elseif (numel (g) != nnodes) error("bim2a_rhs: length of g is not equal to the number of nodes."); endif @@ -100,4 +100,4 @@ %!test % [b1] = bim2a_rhs(mesh,3*f,g); % [b2] = bim2a_rhs(mesh,3,1); -% assert(b1,b2); \ No newline at end of file +% assert(b1,b2); diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim2c_global_flux.m --- a/extra/bim/inst/bim2c_global_flux.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim2c_global_flux.m Sun Mar 30 16:14:44 2014 +0000 @@ -61,13 +61,13 @@ if !( isvector(u) && isvector(alpha) && isvector(gamma) && isvector(eta) ) error("bim2c_global_flux: coefficients are not valid vectors."); - elseif length(u) != nnodes + elseif (numel (u) != nnodes) error("bim2c_global_flux: length of u is not equal to the number of nodes."); - elseif length(alpha) != nelem + elseif (numel (alpha) != nelem) error("bim2c_global_flux: length of alpha is not equal to the number of elements."); - elseif length(gamma) != nnodes + elseif (numel (gamma) != nnodes) error("bim2c_global_flux: length of gamma is not equal to the number of nodes."); - elseif length(eta) != nnodes + elseif (numel (eta) != nnodes) error("bim2c_global_flux: length of eta is not equal to the number of nodes."); endif @@ -156,4 +156,4 @@ (bp12 .* uloc(2,:)./etaloc(2,:) -... bm12 .* uloc(1,:)./etaloc(1,:)) ... %% 3 ); -endfunction \ No newline at end of file +endfunction diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim2c_norm.m --- a/extra/bim/inst/bim2c_norm.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim2c_norm.m Sun Mar 30 16:14:44 2014 +0000 @@ -60,8 +60,8 @@ u = u'; endif - if ((length (u) != nnodes) && (rows (u) != nel)) - error ("bim2c_norm: length(u) != nnodes and rows(u) != nel."); + if ((numel (u) != nnodes) && (rows (u) != nel)) + error ("bim2c_norm: numel(u) != nnodes and rows(u) != nel."); endif if (! (strcmp (norm_type,'L2') @@ -73,7 +73,7 @@ if (strcmp (norm_type,'inf')) norm_u = max (abs (u(:))); else - if (length (u) == nnodes) + if (numel (u) == nnodes) M = __mass_matrix__ (m); diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim2c_pde_gradient.m --- a/extra/bim/inst/bim2c_pde_gradient.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim2c_pde_gradient.m Sun Mar 30 16:14:44 2014 +0000 @@ -42,7 +42,7 @@ nnodes = columns(mesh.p); - if length(u) != nnodes + if (numel (u) != nnodes) error("bim2c_pde_gradient: length(u) != nnodes."); endif diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim3a_boundary_mass.m --- a/extra/bim/inst/bim3a_boundary_mass.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim3a_boundary_mass.m Sun Mar 30 16:14:44 2014 +0000 @@ -66,7 +66,7 @@ dd = zeros (size (nodelist)); - for in = 1:length (nodelist) + for in = 1:numel (nodelist) dd (in) = 1/3 * sum (area (any (t(1:3,:) == nodelist(in)))); endfor diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim3a_laplacian.m --- a/extra/bim/inst/bim3a_laplacian.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim3a_laplacian.m Sun Mar 30 16:14:44 2014 +0000 @@ -61,9 +61,9 @@ if !( isvector(epsilon) && isvector(kappa) ) error("bim3a_laplacian: coefficients are not valid vectors."); - elseif length(epsilon) != nelem + elseif (numel (epsilon) != nelem) error("bim3a_laplacian: length of epsilon is not equal to the number of elements."); - elseif length(kappa) != nnodes + elseif (numel (kappa) != nnodes) error("bim2a_laplacian: length of kappa is not equal to the number of nodes."); endif @@ -105,4 +105,4 @@ %!test % [A1] = bim3a_laplacian(mesh,epsilon,kappa); % [A2] = bim3a_laplacian(mesh,1,1); -% assert(A1,A2); \ No newline at end of file +% assert(A1,A2); diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim3a_reaction.m --- a/extra/bim/inst/bim3a_reaction.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim3a_reaction.m Sun Mar 30 16:14:44 2014 +0000 @@ -59,9 +59,9 @@ if !( isvector(delta) && isvector(zeta) ) error("bim3a_reaction: coefficients are not valid vectors."); - elseif length(delta) != nelem + elseif (numel (delta) != nelem) error("bim3a_: length of alpha is not equal to the number of elements."); - elseif length(zeta) != nnodes + elseif (numel (zeta) != nnodes) error("bim3a_: length of gamma is not equal to the number of nodes."); endif diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim3a_rhs.m --- a/extra/bim/inst/bim3a_rhs.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim3a_rhs.m Sun Mar 30 16:14:44 2014 +0000 @@ -48,7 +48,7 @@ endif nnodes = columns (mesh.p); - nelem = length (mesh.t); + nelem = columns (mesh.t); ## Turn scalar input to a vector of appropriate size if isscalar(f) @@ -60,9 +60,9 @@ if !( isvector(f) && isvector(g) ) error("bim3a_rhs: coefficients are not valid vectors."); - elseif length(f) != nelem + elseif (numel (f) != nelem) error("bim3a_rhs: length of f is not equal to the number of elements."); - elseif length(g) != nnodes + elseif (numel (g) != nnodes) error("bim3a_rhs: length of g is not equal to the number of nodes."); endif @@ -100,4 +100,4 @@ %!test % [b1] = bim2a_rhs(mesh,3*f,g); % [b2] = bim2a_rhs(mesh,3,1); -% assert(b1,b2); \ No newline at end of file +% assert(b1,b2); diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim3c_norm.m --- a/extra/bim/inst/bim3c_norm.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim3c_norm.m Sun Mar 30 16:14:44 2014 +0000 @@ -60,7 +60,7 @@ u = u'; endif - if ((length (u) != nnodes) && (rows (u) != nel)) + if ((numel (u) != nnodes) && (rows (u) != nel)) error ("bim3c_norm: length(u) != nnodes and rows(u) != nel."); endif @@ -73,7 +73,7 @@ if (strcmp (norm_type,'inf')) norm_u = max (abs (u(:))); else - if (length (u) == nnodes) + if (numel (u) == nnodes) M = __mass_matrix__ (m); diff -r b7bdd690c6b6 -r d3da1a3fda79 extra/bim/inst/bim3c_pde_gradient.m --- a/extra/bim/inst/bim3c_pde_gradient.m Sun Mar 30 15:59:00 2014 +0000 +++ b/extra/bim/inst/bim3c_pde_gradient.m Sun Mar 30 16:14:44 2014 +0000 @@ -42,7 +42,7 @@ nnodes = columns (mesh.p); - if (length (u) != nnodes) + if (numel (u) != nnodes) error ("bim3c_pde_gradient: length(u) != nnodes."); endif