3 % lexicographic unit cube
23 % linear transformation
26 X = T*X0+rand(3,1)*ones(1,8);
29 [K, F, Jg] = hexa(A,X,u);
30 eig(K) % one eigenvalue zero
33 % for linear field mu with values V at nodes V*F should be -integral (grad mu) * u
37 exact = - gradmu*u*vol;
40 if exist('vrrotvec2mat')
41 % invariariant to random isometry
42 S=vrrotvec2mat(vrrotvec(randn(3,1),randn(3,1)))*diag(sign(randn(3,1)));
43 [K0, ~, ~] = hexa(A,X,u);
44 [K1, ~, ~] = hexa(A,S*X,u);
45 err_iso=norm(K0-K1,'fro')
47 warning('No vrrotvec2mat, cannot test rotation invariance. Install Simulink 3D Animation.')
51 X3 = diag([1 1 2])*X0;
52 [K3, ~, ~] = hexa(A,X3,u);
54 % test same results from matlab and fortran
55 if exist('fortran/hexa_test.exe')
56 disp('testing if same result in fortran')
57 err=hexa_fortran(A,X3,u)
59 fprintf('error %g OK\n',err)
61 error(sprintf('error %g too large',err))
64 warning('fortran/hexa_test.exe not available')