3 #include "waveguide/postprocessor/directional_receiver.h" 5 #include "core/attenuator/null.h" 7 #include "utilities/map_to_vector.h" 13 template <
typename Method>
14 auto attenuate(
const Method& method,
16 const postprocessor::directional_receiver::output& i) {
20 const auto att = attenuation(method, -i.intensity);
21 const auto intensity = glm::length(i.intensity) * pow(att, 2.0f);
22 return copysign(sqrt(intensity * Z), i.pressure);
26 inline auto attenuate(
const core::attenuator::null&,
28 const postprocessor::directional_receiver::output& i) {
32 template <
typename Method>
38 auto operator()(
const T& t)
const {
39 return attenuate(method, Z, t);
43 template <
typename Method>
44 auto make_attenuate_mapper(Method method,
float Z) {
45 if (Z < 300 || 500 <= Z) {
46 throw std::runtime_error{
"Acoustic impedance outside expected range."};
51 template <
typename It,
typename Method>
52 auto make_attenuator_iterator(It it,
const Method& method,
float Z) {
53 return make_mapping_iterator_adapter(std::move(it),
54 make_attenuate_mapper(method, Z));
Definition: capsule_base.h:9
Definition: attenuator.h:33