From d6f6a2b1fa655d38cc6df9a6f7ab6afeb3184dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Asp=C3=B6ck?= <lukas.aspoeck@rwth-aachen.de> Date: Wed, 30 Aug 2017 14:05:21 +0200 Subject: [PATCH] implemented method to return surface area of walls in room model --- .../VirtualAcoustics/Raven/itaRavenProject.m | 6 +++-- .../VirtualAcoustics/Raven/load_ac3d.m | 22 ++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/applications/VirtualAcoustics/Raven/itaRavenProject.m b/applications/VirtualAcoustics/Raven/itaRavenProject.m index 22c791f4..ef005989 100644 --- a/applications/VirtualAcoustics/Raven/itaRavenProject.m +++ b/applications/VirtualAcoustics/Raven/itaRavenProject.m @@ -2656,8 +2656,10 @@ classdef itaRavenProject < handle function S = getMaterialSurfaceArea(obj, materialName) %S = getRoomSurfaceArea(roomID) % - % returns the total surface area of the current room. + % returns the surface area of the current material. % + % WARNING: NOT IMPLEMENTED! + % if nargin < 2 error('Please provide a material name.'); end @@ -2680,7 +2682,7 @@ classdef itaRavenProject < handle end end - % get all materials in room + % return surface area of given material S = roommodel.getMaterialSurface(materialName); end diff --git a/applications/VirtualAcoustics/Raven/load_ac3d.m b/applications/VirtualAcoustics/Raven/load_ac3d.m index d12558a9..a2558238 100644 --- a/applications/VirtualAcoustics/Raven/load_ac3d.m +++ b/applications/VirtualAcoustics/Raven/load_ac3d.m @@ -289,7 +289,27 @@ classdef load_ac3d function S = getSurface(obj) S = obj.totalSurface; end - + + function SMat = getMaterialSurface(obj,materialName) + + % sometimes multiple materials with the same name are defined. in this case, sum up all of them + matchingMatIDs = []; + SMat = 0; + for matID = 1:length(obj.bcGroups) + if (strcmp(obj.bcGroups{matID}.name, materialName)) + matchingMatIDs = [matchingMatIDs matID]; + SMat = SMat + obj.bcGroups{matID}.surface; + end + end + + if isempty(matchingMatIDs) + error(['Material "' materialName '" is not part of the model. Please check materialname and or your *.ac file']); + end + + + end + + function [A, S] = getEquivalentAbsorptionArea_sabine(obj, material_path, portal_surface_materials) if nargin < 2 material_path = '..\RavenDatabase\MaterialDatabase'; -- GitLab