Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticModel9613Solver2024.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2024> <EDF-DTG> <FRANCE>
3  * This file is part of Code_TYMPAN (R).
4  * Code_TYMPAN (R) is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * Code_TYMPAN (R) is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  * You should have received a copy of the GNU General Public License along
13  * with Code_TYMPAN (R). If not, see <https://www.gnu.org/licenses/>.
14  */
15 
16 #ifndef __TYACOUSTICMODEL_9613SOLVER2024__
17 #define __TYACOUSTICMODEL_9613SOLVER2024__
18 
23 #include "TYReflectionPathFinder.h"
24 #include <gtest/gtest_prod.h>
25 
31 {
32 public:
33  TYAcousticModel9613Solver2024(TYSolver9613Solver2024& solver); //<! Constructor
34 
36  void init() override;
37 
38 protected:
39  std::unique_ptr<TYChemin9613Solver> createChemin() const override
40  {
41  return std::make_unique<TYChemin9613Solver2024>();
42  }
43 
44  OSpectreOctave calculZMin(const double C2, const OSpectreOctave& C3) const override;
45 
59  OSpectreOctave calculKmeteo(const bool vertical, const double d_SS, const double d_SR, const double d,
60  const double z, const double e, const OSpectreOctave& z_min) const override;
61 
71  OSpectreOctave calculDz(const double z, const double C2, const OSpectreOctave& C3,
72  const OSpectreOctave& Kmeteo, const OSpectreOctave& zmin) const override;
73 
74  void computeCheminReflexion(const std::deque<TYSIntersection>& tabIntersect, const OSegment3D& ray,
75  const tympan::AcousticSource& source, TYTabChemin9613Solver& TabChemins,
76  double distance) const override;
77 
89  void computeCheminReflectionImageSourceMethod(size_t multipleReflectionOrder,
90  const std::deque<TYSIntersection>& tabIntersect,
91  const OSegment3D& ray, const tympan::AcousticSource& source,
92  TYTabChemin9613Solver& TabChemins, double distance) const;
93 
108  bool getGroundfactors(const std::deque<std::deque<TYSIntersection>>& tabIntersectSegments,
109  const std::deque<OPoint3D>& pathPoints2D, double hs, double hr, double& Gs,
110  double& Gm, double& Gr) const;
111 
123  bool computeGroundFactorSourceZone(const std::deque<std::deque<TYSIntersection>>& tabIntersectSegments,
124  const std::deque<OPoint3D>& pathPoints2D, double hs, double& Gs) const;
125 
137  bool computeGroundFactorReceiverZone(const std::deque<std::deque<TYSIntersection>>& tabIntersectSegments,
138  const std::deque<OPoint3D>& pathPoints2D, double hr,
139  double& Gr) const;
140 
153  bool computeGroundFactorMiddleZone(const std::deque<std::deque<TYSIntersection>>& tabIntersectSegments,
154  const std::deque<OPoint3D>& pathPoints2D, double hs, double hr,
155  double& Gm) const;
156 
157 private:
158  // attributes
159  std::unique_ptr<TYAbstractReflectionPathFinder> _pReflectionPathFinder;
160  std::unique_ptr<TYAbstractReflectionPruningStrategy> _pReflectionPruningStrategy;
161 
162  // methods
163 
172  bool sameReflectingSegment(const TYSIntersection& lhs, const TYSIntersection& rhs) const;
173 
184  bool buildReflectionPoints(const std::vector<const TYSIntersection*>& currentCombination,
185  const std::deque<OPoint3D>& imageSourcesList, const OPoint3D& receptorPoint,
186  std::deque<OPoint3D>& reflectionPointsList) const;
187 
202  bool validateReflectionCandidate(const std::vector<const TYSIntersection*>& barrierCombination,
203  const std::deque<OPoint3D>& reflectionPointsList,
204  const std::deque<TYSIntersection>& tabIntersect,
205  const OPoint3D& sourcePoint, const OPoint3D& receptorPoint) const;
206 
220  bool buildReflectionPath(const std::vector<const TYSIntersection*>& barrierCombination,
221  const std::deque<OPoint3D>& imageSourcesList,
222  const std::deque<OPoint3D>& reflectionPointsList, const OSegment3D& directRay,
223  const tympan::AcousticSource& source, TYTabChemin9613Solver& TabChemins,
224  double distance) const;
225 
241  {
242  const TYSIntersection* barrier{nullptr};
243  double ax{0.0};
244  double ay{0.0};
245  double az{0.0};
246  double ux{0.0};
247  double uy{0.0};
248  double uz{0.0};
249  double invNorm2{0.0};
250  };
251 
252  // TODO: transform into a constructor of ReflectingSegmentCache
259  ReflectingSegmentCache makeReflectingSegmentCache(const TYSIntersection& inter) const;
260 
261  // TODO: transform into a method of ReflectingSegmentCache
269  void reflectPointAboutCachedLine(const ReflectingSegmentCache& cache, const OPoint3D& inputPoint,
270  OPoint3D& reflectedPoint) const;
271 
290  void buildReflectionPathsStreaming(size_t reflectionOrder,
291  const std::vector<ReflectingSegmentCache>& reflectingSegments,
292  std::vector<const TYSIntersection*>& currentCombination,
293  std::deque<OPoint3D>& currentImageSources,
294  const std::deque<TYSIntersection>& tabIntersect, const OSegment3D& ray,
295  const tympan::AcousticSource& source,
296  TYTabChemin9613Solver& TabChemins, double distance) const;
297 
315  bool buildReflectionPathForCombination(const std::vector<const TYSIntersection*>& currentCombination,
316  const std::deque<OPoint3D>& imageSourcesList,
317  const std::deque<TYSIntersection>& tabIntersect,
318  const OSegment3D& ray, const tympan::AcousticSource& source,
319  TYTabChemin9613Solver& TabChemins, double distance) const;
320 
321  FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculZMin);
322  FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculK_meteo_z_0);
323  FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculK_meteo_z_30);
324  FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculK_meteo_lateral_diffraction);
325  FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculK_meteo_d_500_z_1);
326  FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculDz_z_greater_than_zmin);
327  FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculDz_z_general_case);
328 
329  FRIEND_TEST(test_TYAcousticModel9613Solver2024, sameReflectingSegment_compares_segInter1_only);
330  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
331  reflectPointAboutCachedLine_order3_builds_expected_image_sources);
332  FRIEND_TEST(test_TYAcousticModel9613Solver2024, buildReflectionPoints_pointerCombination_order2);
333  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
334  buildReflectionPoints_pointerCombination_fails_when_intersection_is_outside_segment);
335  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
336  validateReflectionCandidate_pointerCombination_order2_valid);
338  test_TYAcousticModel9613Solver2024,
339  validateReflectionCandidate_pointerCombination_order2_invalid_with_intersecting_scene_segment);
340  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
341  buildReflectionPath_pointerCombination_fails_when_candidate_is_inconsistent);
342  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
343  buildReflectionPath_pointerCombination_fails_when_material_is_missing);
344  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
345  buildReflectionPath_pointerCombination_fails_when_face_geom_data_is_missing);
346 
347  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorSourceZone_order3_Segments1);
348  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorSourceZone_order3_Segments12);
349  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorSourceZone_order3_Segments123);
350  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorSourceZone_order3_Segments1234);
351  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorSourceZone_order3_FullPath);
352  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorReceiverZone_order3_Segments4);
353  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorReceiverZone_order3_Segments34);
354  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorReceiverZone_order3_Segments234);
355  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorReceiverZone_order3_Segments1234);
356  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorReceiverZone_order3_FullPath);
357  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
358  computeGroundFactorMiddleZone_order3_both_bounds_in_segment3);
359  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
360  computeGroundFactorMiddleZone_order3_spans_several_segments);
361  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
362  computeGroundFactorMiddleZone_order3_both_bounds_in_segment2);
363  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
364  computeGroundFactorMiddleZone_order3_no_middle_zone_when_lengths_touch);
365 };
366 
367 #endif // __TYACOUSTICMODEL_9613SOLVER2024__
Representation of one of the most optimal path between source and receptor: S—>R Specific derivation ...
std::deque< TYChemin9613Solver > TYTabChemin9613Solver
TYChemin collection.
The 3D point class.
Definition: 3d.h:487
Class to define a segment.
Definition: 3d.h:1141
Acoustic model for the 9613Solver version 2024.
TYAcousticModel9613Solver2024(TYSolver9613Solver2024 &solver)
bool validateReflectionCandidate(const std::vector< const TYSIntersection * > &barrierCombination, const std::deque< OPoint3D > &reflectionPointsList, const std::deque< TYSIntersection > &tabIntersect, const OPoint3D &sourcePoint, const OPoint3D &receptorPoint) const
Validate a reflection candidate against the reflecting segments of the scene. A reflection candidate ...
FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculZMin)
bool computeGroundFactorMiddleZone(const std::deque< std::deque< TYSIntersection >> &tabIntersectSegments, const std::deque< OPoint3D > &pathPoints2D, double hs, double hr, double &Gm) const
Compute the ground factor of the middle zone for a reflected path.
std::unique_ptr< TYChemin9613Solver > createChemin() const override
FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorReceiverZone_order3_FullPath)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, buildReflectionPath_pointerCombination_fails_when_candidate_is_inconsistent)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculK_meteo_d_500_z_1)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, buildReflectionPath_pointerCombination_fails_when_material_is_missing)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorReceiverZone_order3_Segments234)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorMiddleZone_order3_spans_several_segments)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, validateReflectionCandidate_pointerCombination_order2_invalid_with_intersecting_scene_segment)
bool sameReflectingSegment(const TYSIntersection &lhs, const TYSIntersection &rhs) const
Check whether two reflecting segments are identical in plane EL.
FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorSourceZone_order3_FullPath)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculDz_z_general_case)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorSourceZone_order3_Segments12)
ReflectingSegmentCache makeReflectingSegmentCache(const TYSIntersection &inter) const
Build the geometric cache associated with one reflecting segment.
void buildReflectionPathsStreaming(size_t reflectionOrder, const std::vector< ReflectingSegmentCache > &reflectingSegments, std::vector< const TYSIntersection * > &currentCombination, std::deque< OPoint3D > &currentImageSources, const std::deque< TYSIntersection > &tabIntersect, const OSegment3D &ray, const tympan::AcousticSource &source, TYTabChemin9613Solver &TabChemins, double distance) const
Recursively build and validate reflection paths in streaming mode.
OSpectreOctave calculZMin(const double C2, const OSpectreOctave &C3) const override
Compute zmin, the min value of z for which the barrier attenuation Dz is null. This minimum distance ...
void computeCheminReflexion(const std::deque< TYSIntersection > &tabIntersect, const OSegment3D &ray, const tympan::AcousticSource &source, TYTabChemin9613Solver &TabChemins, double distance) const override
Compute the list of path generated by reflection on the vertical walls.
FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorMiddleZone_order3_both_bounds_in_segment3)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculK_meteo_z_0)
void reflectPointAboutCachedLine(const ReflectingSegmentCache &cache, const OPoint3D &inputPoint, OPoint3D &reflectedPoint) const
Reflect a point about the support line stored in a reflecting segment cache.
FRIEND_TEST(test_TYAcousticModel9613Solver2024, sameReflectingSegment_compares_segInter1_only)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorSourceZone_order3_Segments1)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculDz_z_greater_than_zmin)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorReceiverZone_order3_Segments4)
bool getGroundfactors(const std::deque< std::deque< TYSIntersection >> &tabIntersectSegments, const std::deque< OPoint3D > &pathPoints2D, double hs, double hr, double &Gs, double &Gm, double &Gr) const
Get ground factors for source, middle and receptor zones for a reflected path.
bool computeGroundFactorReceiverZone(const std::deque< std::deque< TYSIntersection >> &tabIntersectSegments, const std::deque< OPoint3D > &pathPoints2D, double hr, double &Gr) const
Compute the ground factor of the receptor zone for a reflected path.
bool computeGroundFactorSourceZone(const std::deque< std::deque< TYSIntersection >> &tabIntersectSegments, const std::deque< OPoint3D > &pathPoints2D, double hs, double &Gs) const
Compute the ground factor of the source zone for a reflected path.
bool buildReflectionPathForCombination(const std::vector< const TYSIntersection * > &currentCombination, const std::deque< OPoint3D > &imageSourcesList, const std::deque< TYSIntersection > &tabIntersect, const OSegment3D &ray, const tympan::AcousticSource &source, TYTabChemin9613Solver &TabChemins, double distance) const
Build a reflection path from the current reflecting segment combination.
FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorReceiverZone_order3_Segments1234)
void init() override
Initialize the acoustic model.
OSpectreOctave calculDz(const double z, const double C2, const OSpectreOctave &C3, const OSpectreOctave &Kmeteo, const OSpectreOctave &zmin) const override
Compute Dz, the barrier attenuation for each octave band in dB.
FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculK_meteo_lateral_diffraction)
bool buildReflectionPath(const std::vector< const TYSIntersection * > &barrierCombination, const std::deque< OPoint3D > &imageSourcesList, const std::deque< OPoint3D > &reflectionPointsList, const OSegment3D &directRay, const tympan::AcousticSource &source, TYTabChemin9613Solver &TabChemins, double distance) const
Build a reflection path from a valid reflecting segment combination.
bool buildReflectionPoints(const std::vector< const TYSIntersection * > &currentCombination, const std::deque< OPoint3D > &imageSourcesList, const OPoint3D &receptorPoint, std::deque< OPoint3D > &reflectionPointsList) const
Build the list of reflection points associated with a reflecting segment combination.
FRIEND_TEST(test_TYAcousticModel9613Solver2024, reflectPointAboutCachedLine_order3_builds_expected_image_sources)
std::unique_ptr< TYAbstractReflectionPruningStrategy > _pReflectionPruningStrategy
FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorReceiverZone_order3_Segments34)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, buildReflectionPoints_pointerCombination_order2)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculK_meteo_z_30)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorMiddleZone_order3_no_middle_zone_when_lengths_touch)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorSourceZone_order3_Segments123)
OSpectreOctave calculKmeteo(const bool vertical, const double d_SS, const double d_SR, const double d, const double z, const double e, const OSpectreOctave &z_min) const override
Compute Kmeteo, the correction factor for meteorological effects.
FRIEND_TEST(test_TYAcousticModel9613Solver2024, validateReflectionCandidate_pointerCombination_order2_valid)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorMiddleZone_order3_both_bounds_in_segment2)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorSourceZone_order3_Segments1234)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, buildReflectionPath_pointerCombination_fails_when_face_geom_data_is_missing)
FRIEND_TEST(test_TYAcousticModel9613Solver2024, buildReflectionPoints_pointerCombination_fails_when_intersection_is_outside_segment)
std::unique_ptr< TYAbstractReflectionPathFinder > _pReflectionPathFinder
void computeCheminReflectionImageSourceMethod(size_t multipleReflectionOrder, const std::deque< TYSIntersection > &tabIntersect, const OSegment3D &ray, const tympan::AcousticSource &source, TYTabChemin9613Solver &TabChemins, double distance) const
Compute the list of paths generated by multiple reflections in EL-plane using the Image Source Method...
Acoustic model for the 9613Solver.
9613 Solver version 2024
Describes an acoustic source.
Definition: entities.hpp:407
Cache geometry associated with one reflecting segment.
Data structure for intersections.