Code covered by the BSD License  

Highlights from
FELICITY

image thumbnail

FELICITY

by

 

21 Apr 2011 (Updated )

Finite ELement Implementation and Computational Interface Tool for You

test_L1_Integral()
function status = test_L1_Integral()
%test_L1_Integral
%
%   Test code for FELICITY class.

% Copyright (c) 08-01-2011,  Shawn W. Walker

status = 0;

% define some domains
Omega = Domain('triangle');
Sigma = Domain('interval') < Omega;
% define FEM spaces
W1 = Element(Omega,lagrange_deg1_dim2,1);
V1 = Element(Sigma,lagrange_deg1_dim1,2);

w = Test(W1,Sigma); % need to restrict this function!
ww = Test(W1);
zz = Trial(W1);

v = Test(V1);
u = Trial(V1);
f = Coef(V1);

% just test Integral
I1 = Integral(Sigma,f.val(1) * v.val' * u.val);
I2 = Integral(Sigma,v.val' * [1; 1]);
I3 = Integral(Sigma,sum(u.grad' * w.grad));
I4 = Integral(Omega,sum(ww.grad' * zz.grad));

if ~strcmp(I1.TestF.Name,'v')
    status = 1;
end
if ~strcmp(I1.TrialF.Name,'u')
    status = 1;
end
if ~strcmp(I1.CoefF.Name,'f')
    status = 1;
end

if ~(I4.Integrand==sym('ww_v1_t1_grad1*zz_v1_t1_grad1 + ww_v1_t1_grad2*zz_v1_t1_grad2'))
    status = 1;
end
if ~strcmp(I3.Domain.Name,'Sigma')
    status = 1;
end
if ~strcmp(I2.Domain.Subset_Of,'Omega')
    status = 1;
end

%%%%%%%%%%%%%
if (status==0)
    disp('Test passed!');
else
    disp('Test failed!');
end

end

Contact us