add_subtri_FE_P2.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This file is part of NS2DDV. %
% %
% Copyright(C) 2011-2018 C. Calgaro (caterina.calgaro@math.univ-lille1.fr) %
% E. Creusé (emmanuel.creuse@math.univ-lille1.fr) %
% T. Goudon (thierry.goudon@inria.fr) %
% A. Mouton (alexandre.mouton@math.univ-lille1.fr) %
% %
% NS2DDV is free software: you can redistribute it and/or modify it under the terms %
% of the GNU General Public License as published by the Free Software Foundation, %
% either version 3 of the License, or (at your option) any later version. %
% %
% NS2DDV is distributed in the hope that it will be useful, but WITHOUT ANY %
% WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A %
% PARTICULAR PURPOSE. See the GNU General Public License for more details. %
% %
% You should have received a copy of the GNU General Public License along with %
% NS2DDV. If not, see <http://www.gnu.org/licenses/>. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function[st2] = add_subtri_FE_P2(MESH)
% INPUT
% MESH An mesh with at least P1 and P2 nodes and triangles
%
% OUTPUTS
% st2 The descriptor of P2 subtriangles by P2 nodes
% Define P2 subtriangles
%%%%%%%%%%%%%%%%%%%%%%%%
st2 = zeros(3,4*MESH.nt1);
for ke=1:MESH.nt1
st2(1,4*(ke-1)+1) = MESH.t2(1,ke);
st2(2,4*(ke-1)+1) = MESH.t2(6,ke);
st2(3,4*(ke-1)+1) = MESH.t2(5,ke);
st2(1,4*(ke-1)+2) = MESH.t2(6,ke);
st2(2,4*(ke-1)+2) = MESH.t2(2,ke);
st2(3,4*(ke-1)+2) = MESH.t2(4,ke);
st2(1,4*(ke-1)+3) = MESH.t2(3,ke);
st2(2,4*(ke-1)+3) = MESH.t2(5,ke);
st2(3,4*(ke-1)+3) = MESH.t2(4,ke);
st2(1,4*(ke-1)+4) = MESH.t2(4,ke);
st2(2,4*(ke-1)+4) = MESH.t2(5,ke);
st2(3,4*(ke-1)+4) = MESH.t2(6,ke);
end
end