Skip to content

Commit

Permalink
Fixed Ticket #23: If using multiple evaluations grids, they are now w…
Browse files Browse the repository at this point in the history
…ritten to NC.inp in alphabetical order

fbrinkmann 2020-05-05
  • Loading branch information
f-brinkmann committed Sep 23, 2020
1 parent 86bddd1 commit 0490daf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Mesh2Input/EvaluationGrids/Custom/readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This is the place for user generated evaluation grids.

They can for example be generated with the Matlab tools under
PreProcessing/WriteReadEvaluationGrid/demo.m
PreProcessing/EvaluationGrid(Matlab)/demo.m
35 changes: 15 additions & 20 deletions Mesh2Input/exportMesh2HRTF.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,16 +1006,23 @@ def calculateReceiverProperties(obj, obj_data, unitFactor):
if nearFieldCalculation:
fw("../../EvaluationGrids/NF_Sphere/Nodes.txt\n")
else:
# alphabetically sorted list of used evaluation grids
evaluationGrids = []
if not evaluationGrid1 == 'None':
fw("../../EvaluationGrids/%s/Nodes.txt\n" % evaluationGrid1)
evaluationGrids.append(evaluationGrid1)
if not evaluationGrid2 == 'None':
fw("../../EvaluationGrids/%s/Nodes.txt\n" % evaluationGrid2)
evaluationGrids.append(evaluationGrid2)
if not evaluationGrid3 == 'None':
fw("../../EvaluationGrids/%s/Nodes.txt\n" % evaluationGrid3)
evaluationGrids.append(evaluationGrid3)
if not evaluationGrid4 == 'None':
fw("../../EvaluationGrids/%s/Nodes.txt\n" % evaluationGrid4)
evaluationGrids.append(evaluationGrid4)
if not evaluationGrid5 == 'None':
fw("../../EvaluationGrids/%s/Nodes.txt\n" % evaluationGrid5)
evaluationGrids.append(evaluationGrid5)
evaluationGrids.sort()

# write file path of nodes to input file
for grid in evaluationGrids:
fw("../../EvaluationGrids/%s/Nodes.txt\n" % grid)
fw("##\n")
fw("ELEMENTS\n")
if not frequencyDependency:
Expand All @@ -1025,16 +1032,9 @@ def calculateReceiverProperties(obj, obj_data, unitFactor):
if nearFieldCalculation:
fw("../../EvaluationGrids/NF_Sphere/Elements.txt\n")
else:
if not evaluationGrid1 == 'None':
fw("../../EvaluationGrids/%s/Elements.txt\n" % evaluationGrid1)
if not evaluationGrid2 == 'None':
fw("../../EvaluationGrids/%s/Elements.txt\n" % evaluationGrid2)
if not evaluationGrid3 == 'None':
fw("../../EvaluationGrids/%s/Elements.txt\n" % evaluationGrid3)
if not evaluationGrid4 == 'None':
fw("../../EvaluationGrids/%s/Elements.txt\n" % evaluationGrid4)
if not evaluationGrid5 == 'None':
fw("../../EvaluationGrids/%s/Elements.txt\n" % evaluationGrid5)
# write file path of elements to input file
for grid in evaluationGrids:
fw("../../EvaluationGrids/%s/Elements.txt\n" % grid)
fw("##\n")
fw("# SYMMETRY\n")
fw("# 0 0 0\n")
Expand All @@ -1046,11 +1046,6 @@ def calculateReceiverProperties(obj, obj_data, unitFactor):
else:
tmpEar='Right ear'

#changed tmpEar to ear
#if ear=='Right ear':
# tmpEar='Right ear'
#if ear=='Left ear':
# tmpEar='Left ear'
fw("BOUNDARY\n")
for ii in range(len(obj_data.polygons[:])):
if obj.material_slots[obj_data.polygons[ii].material_index].name == obj.material_slots[tmpEar].name:
Expand Down

0 comments on commit 0490daf

Please sign in to comment.