Moving material utils code to the right file

parent 98449abf
#include <ITAGeo/Material/Utils.h>
#include <ITAException.h>
float ITAGeo::Material::Utils::EstimateFilterLengthSamples( std::shared_ptr< const IMaterial > pMaterial, const float fSampleRate, const float fSpeedOfSound /*= ITAConstants::DEFAULT_SPEED_OF_SOUND_F*/ )
float ITAGeo::Material::Utils::EstimateFilterLengthSamples( std::shared_ptr<const ITAGeo::Material::IMaterial> pMaterial, const float fSampleRate, const float fSpeedOfSound )
{
ITA_EXCEPT_NOT_IMPLEMENTED;
// Allow for the lowest frequency a phase shift of one cycle / return samples of one wave length
switch( pMaterial->GetType() )
{
case( ITAGeo::Material::IMaterial::THIRD_OCTAVE ) :
{
auto p = std::dynamic_pointer_cast< const ITAGeo::Material::CThirdOctaveMaterial >( pMaterial );
const float fFirstCenterFrequency = p->oAbsorptionCoefficients.GetCenterFrequencies()[ 0 ];
assert( fFirstCenterFrequency != 0.0f );
const float fLambda = fSpeedOfSound / fFirstCenterFrequency;
return fLambda * fSampleRate;
}
}
// All other cases are considered to not extend any filter length, hence have to estimate
return 0.0f;
}
......@@ -707,22 +707,3 @@ bool ITAGeoUtils::VistaRaysFromOpenMeshFaceHalfedges( CITAMesh* pMesh, CITAMesh:
}
return true;
}
float ITAGeo::Material::Utils::EstimateFilterLengthSamples(std::shared_ptr<const IMaterial> pMaterial, const float fSampleRate, const float fSpeedOfSound)
{
// Allow for the lowest frequency a phase shift of one cycle / return samples of one wave length
switch (pMaterial->GetType())
{
case(IMaterial::THIRD_OCTAVE):
{
auto p = std::dynamic_pointer_cast<const CThirdOctaveMaterial>(pMaterial);
const float fFirstCenterFrequency = p->oAbsorptionCoefficients.GetCenterFrequencies()[0];
assert(fFirstCenterFrequency != 0.0f);
const float fLambda = fSpeedOfSound / fFirstCenterFrequency;
return fLambda * fSampleRate;
}
}
// All other cases are considered to not extend any filter length, hence have to estimate
return 0.0f;
}
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