swh:1:snp:6d9b0a7121ef7aee4569095d3304fd3c77f27314
Raw File
Tip revision: 04a7cf3445bc390bc8dfaf93341a1f8f2008072c authored by Software Heritage on 10 April 2020, 08:52:33 UTC
hal: Deposit 544 in collection hal
Tip revision: 04a7cf3
mesh_stars_volume.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 [volume] = mesh_stars_volume(MESH)

	% INPUT
	% MESH			An incomplete mesh metadata
	%
	% OUTPUT
	% volume		Control Volume surface for density with P1

	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	%%%%      VOLUME quantity                            %%%%%%

	volume  = zeros(1,MESH.np1);

	for ke = 1:MESH.nt1
	    De = [MESH.p1(2,MESH.t1(3,ke))-MESH.p1(2,MESH.t1(1,ke)), ...
						MESH.p1(2,MESH.t1(1,ke))-MESH.p1(2,MESH.t1(2,ke)); ...
	          MESH.p1(1,MESH.t1(1,ke))-MESH.p1(1,MESH.t1(3,ke)), ...
						MESH.p1(1,MESH.t1(2,ke))-MESH.p1(1,MESH.t1(1,ke))];
		for j = 1:3
			volume (MESH.t1(j,ke)) = volume(MESH.t1(j,ke)) + abs(det(De))/6;
		end
	end

end

back to top