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 
22 #include <gtest/gtest_prod.h>
23 
29 {
30 public:
31  TYAcousticModel9613Solver2024(TYSolver9613Solver2024& solver); //<! Constructor
32 
33 protected:
34  std::unique_ptr<TYChemin9613Solver> createChemin() const override
35  {
36  return std::make_unique<TYChemin9613Solver2024>();
37  }
38 
39  OSpectreOctave calculZMin(const double C2, const OSpectreOctave& C3) const override;
40 
54  OSpectreOctave calculKmeteo(const bool vertical, const double d_SS, const double d_SR, const double d,
55  const double z, const double e, const OSpectreOctave& z_min) const override;
56 
66  OSpectreOctave calculDz(const double z, const double C2, const OSpectreOctave& C3,
67  const OSpectreOctave& Kmeteo, const OSpectreOctave& zmin) const override;
68 
69  void computeCheminReflexion(const std::deque<TYSIntersection>& tabIntersect, const OSegment3D& ray,
70  const tympan::AcousticSource& source, TYTabChemin9613Solver& TabChemins,
71  double distance) const override;
72 
87  bool getGroundfactors(const std::deque<std::deque<TYSIntersection>>& tabIntersectSegments,
88  const std::deque<OPoint3D>& pathPoints2D, double hs, double hr, double& Gs,
89  double& Gm, double& Gr) const;
90 
102  bool computeGroundFactorSourceZone(const std::deque<std::deque<TYSIntersection>>& tabIntersectSegments,
103  const std::deque<OPoint3D>& pathPoints2D, double hs, double& Gs) const;
104 
116  bool computeGroundFactorReceiverZone(const std::deque<std::deque<TYSIntersection>>& tabIntersectSegments,
117  const std::deque<OPoint3D>& pathPoints2D, double hr,
118  double& Gr) const;
119 
132  bool computeGroundFactorMiddleZone(const std::deque<std::deque<TYSIntersection>>& tabIntersectSegments,
133  const std::deque<OPoint3D>& pathPoints2D, double hs, double hr,
134  double& Gm) const;
135 
136 private:
137  // attributes
138 
139  // methods
140 
149  bool sameReflectingSegment(const TYSIntersection& lhs, const TYSIntersection& rhs) const;
150 
161  bool buildReflectionPoints(const std::vector<const TYSIntersection*>& currentCombination,
162  const std::deque<OPoint3D>& imageSourcesList, const OPoint3D& receptorPoint,
163  std::deque<OPoint3D>& reflectionPointsList) const;
164 
179  bool validateReflectionCandidate(const std::vector<const TYSIntersection*>& barrierCombination,
180  const std::deque<OPoint3D>& reflectionPointsList,
181  const std::deque<TYSIntersection>& tabIntersect,
182  const OPoint3D& sourcePoint, const OPoint3D& receptorPoint) const;
183 
197  bool buildReflectionPath(const std::vector<const TYSIntersection*>& barrierCombination,
198  const std::deque<OPoint3D>& imageSourcesList,
199  const std::deque<OPoint3D>& reflectionPointsList, const OSegment3D& directRay,
200  const tympan::AcousticSource& source, TYTabChemin9613Solver& TabChemins,
201  double distance) const;
202 
218  {
219  const TYSIntersection* barrier{nullptr};
220  double ax{0.0};
221  double ay{0.0};
222  double az{0.0};
223  double ux{0.0};
224  double uy{0.0};
225  double uz{0.0};
226  double invNorm2{0.0};
227  };
228 
229  // TODO: transform into a constructor of ReflectingSegmentCache
236  ReflectingSegmentCache makeReflectingSegmentCache(const TYSIntersection& inter) const;
237 
238  // TODO: transform into a method of ReflectingSegmentCache
246  void reflectPointAboutCachedLine(const ReflectingSegmentCache& cache, const OPoint3D& inputPoint,
247  OPoint3D& reflectedPoint) const;
248 
267  void buildReflectionPathsStreaming(size_t reflectionOrder,
268  const std::vector<ReflectingSegmentCache>& reflectingSegments,
269  std::vector<const TYSIntersection*>& currentCombination,
270  std::deque<OPoint3D>& currentImageSources,
271  const std::deque<TYSIntersection>& tabIntersect, const OSegment3D& ray,
272  const tympan::AcousticSource& source,
273  TYTabChemin9613Solver& TabChemins, double distance) const;
274 
292  bool buildReflectionPathForCombination(const std::vector<const TYSIntersection*>& currentCombination,
293  const std::deque<OPoint3D>& imageSourcesList,
294  const std::deque<TYSIntersection>& tabIntersect,
295  const OSegment3D& ray, const tympan::AcousticSource& source,
296  TYTabChemin9613Solver& TabChemins, double distance) const;
297 
298  FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculZMin);
299  FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculK_meteo_z_0);
300  FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculK_meteo_z_30);
301  FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculK_meteo_lateral_diffraction);
302  FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculK_meteo_d_500_z_1);
303  FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculDz_z_greater_than_zmin);
304  FRIEND_TEST(test_TYAcousticModel9613Solver2024, calculDz_z_general_case);
305 
306  FRIEND_TEST(test_TYAcousticModel9613Solver2024, sameReflectingSegment_compares_segInter1_only);
307  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
308  reflectPointAboutCachedLine_order3_builds_expected_image_sources);
309  FRIEND_TEST(test_TYAcousticModel9613Solver2024, buildReflectionPoints_pointerCombination_order2);
310  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
311  buildReflectionPoints_pointerCombination_fails_when_intersection_is_outside_segment);
312  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
313  validateReflectionCandidate_pointerCombination_order2_valid);
315  test_TYAcousticModel9613Solver2024,
316  validateReflectionCandidate_pointerCombination_order2_invalid_with_intersecting_scene_segment);
317  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
318  buildReflectionPath_pointerCombination_fails_when_candidate_is_inconsistent);
319  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
320  buildReflectionPath_pointerCombination_fails_when_material_is_missing);
321  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
322  buildReflectionPath_pointerCombination_fails_when_face_geom_data_is_missing);
323 
324  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorSourceZone_order3_Segments1);
325  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorSourceZone_order3_Segments12);
326  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorSourceZone_order3_Segments123);
327  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorSourceZone_order3_Segments1234);
328  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorSourceZone_order3_FullPath);
329  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorReceiverZone_order3_Segments4);
330  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorReceiverZone_order3_Segments34);
331  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorReceiverZone_order3_Segments234);
332  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorReceiverZone_order3_Segments1234);
333  FRIEND_TEST(test_TYAcousticModel9613Solver2024, computeGroundFactorReceiverZone_order3_FullPath);
334  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
335  computeGroundFactorMiddleZone_order3_both_bounds_in_segment3);
336  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
337  computeGroundFactorMiddleZone_order3_spans_several_segments);
338  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
339  computeGroundFactorMiddleZone_order3_both_bounds_in_segment2);
340  FRIEND_TEST(test_TYAcousticModel9613Solver2024,
341  computeGroundFactorMiddleZone_order3_no_middle_zone_when_lengths_touch);
342 };
343 
344 #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)
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)
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)
Acoustic model for the 9613Solver.
9613 Solver version 2024
Describes an acoustic source.
Definition: entities.hpp:394
Cache geometry associated with one reflecting segment.
Data structure for intersections.