ReceiverType

-renamed type DummyHead to ITADummyHead

itaComsolGeometry
-renamed function CreateDummyHeadGeometry() to ImportReceiverGeometry()
   -now it works with all ReceiverTypes that are based on geometry files
parent 61943583
......@@ -66,13 +66,13 @@ classdef itaComsolReceiver < handle
% comsolModel Comsol model, the receiver is created for [itaComsolModel]
% receiver Object with receiver data [single itaReceiver]
%
% Supported receiver types: Monaural, DummyHead
% Supported receiver types: Monaural, ITADummyHead
assert(isa(comsolModel, 'itaComsolModel') && isscalar(comsolModel), 'First input must be a single itaComsolModel')
itaComsolReceiver.checkInputForValidItaReceiver(receiver);
switch receiver.type
case ReceiverType.Monaural
obj = itaComsolReceiver();
case ReceiverType.DummyHead
case ReceiverType.ITADummyHead
obj = itaComsolReceiver.CreateDummyHead(comsolModel, receiver);
otherwise
error('Unknown receiver type. No receiver was created')
......@@ -89,14 +89,14 @@ classdef itaComsolReceiver < handle
% receiver Object with receiver data [single itaReceiver]
assert(isa(comsolModel, 'itaComsolModel') && isscalar(comsolModel), 'First input must be a single itaComsolModel')
itaComsolReceiver.checkInputForValidItaReceiver(receiver);
assert(receiver.type == ReceiverType.DummyHead,'ReceiverType of given source must be DummyHead')
assert(receiver.type == ReceiverType.ITADummyHead, 'ReceiverType of given source must be DummyHead')
baseTag = strrep(receiver.name, ' ', '_');
receiverGeometryBaseTag = [baseTag itaComsolReceiver.dummyHeadGeometryTagSuffix];
meshSizeTag = [baseTag itaComsolReceiver.dummyHeadMeshTagSuffix];
geometry = comsolModel.geometry;
[dummyHeadGeometryNodes, selectionTag] = geometry.CreateDummyHeadGeometry(receiverGeometryBaseTag, receiver);
[dummyHeadGeometryNodes, selectionTag] = geometry.ImportReceiverGeometry(receiverGeometryBaseTag, receiver);
meshNode = comsolModel.mesh;
sizeNode = meshNode.CreateSize(meshSizeTag, selectionTag);
......
......@@ -108,14 +108,14 @@ classdef itaComsolGeometry < itaComsolNode
%% 3D - Volumes
methods
function [geometryNodes, selectionTag] = CreateDummyHeadGeometry(obj, geometryBaseTag, receiver)
%Creates a geometry for a dummy head based on an itaReceiver object
function [geometryNodes, selectionTag] = ImportReceiverGeometry(obj, geometryBaseTag, receiver)
%Creates a geometry for a receiver based on an itaReceiver object
% Inputs:
% geometryBaseTag: Base tag for naming created elements
% receiver: itaReceiver object of type DummyHead
% receiver: itaReceiver object of a type that works with a geometry file
assert(ischar(geometryBaseTag) && isrow(geometryBaseTag), 'First input must be a char row vector')
assert(isa(receiver, 'itaReceiver') && isscalar(receiver), 'Second input must be a single itaReceiver object')
assert(receiver.type == ReceiverType.DummyHead,'ReceiverType of given receiver must be DummyHead')
assert(receiver.type.NeedsGeometryFile(),'ReceiverType of given receiver must work with geometry files')
%---Import---
importTag = [geometryBaseTag '_import'];
......
......@@ -26,7 +26,7 @@ classdef itaReceiver < itaSpatialSimulationInputItem
methods
function this = set.type(this, type)
assert(isa(type, 'ReceiverType') && isscalar(type), 'Can only assign a single object of type ReceiverType');
if type == ReceiverType.DummyHead
if type == ReceiverType.ITADummyHead
this = this.readItaDummyHeadGeometryFile();
end
this.mType = type;
......@@ -64,7 +64,7 @@ classdef itaReceiver < itaSpatialSimulationInputItem
switch(this.mType)
case ReceiverType.Monaural
out = '';
case ReceiverType.DummyHead
case ReceiverType.ITADummyHead
out = this.mGeometryFilename;
case ReceiverType.UserDefined
out = this.mGeometryFilename;
......@@ -75,7 +75,7 @@ classdef itaReceiver < itaSpatialSimulationInputItem
switch(this.mType)
case ReceiverType.Monaural
out = itaCoordinates([0 0 0]);
case ReceiverType.DummyHead
case ReceiverType.ITADummyHead
%out = itaCoordinates([0 0.07022 0]);
out = itaCoordinates([0 0.071 0]);
case ReceiverType.UserDefined
......@@ -86,7 +86,7 @@ classdef itaReceiver < itaSpatialSimulationInputItem
switch(this.mType)
case ReceiverType.Monaural
out = itaCoordinates([0 0 0]);
case ReceiverType.DummyHead
case ReceiverType.ITADummyHead
%out = itaCoordinates([0 -0.07147 0]);
out = itaCoordinates([0 -0.072 0]);
case ReceiverType.UserDefined
......
......@@ -4,7 +4,7 @@ classdef ReceiverType
% ...
enumeration
Monaural, DummyHead, UserDefined
Monaural, ITADummyHead, UserDefined
end
methods
......@@ -14,6 +14,10 @@ classdef ReceiverType
function bool = IsBinaural(this)
bool = ~this.IsMonaural();
end
function bool = NeedsGeometryFile(this)
bool = this == ReceiverType.ITADummyHead ||...
this == ReceiverType.UserDefined;
end
end
end
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment