mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 04:20:05 +00:00 
			
		
		
		
	Optimization and minor fixes to level 3 coordinate calculation
This commit is contained in:
		
							parent
							
								
									1c84b061dc
								
							
						
					
					
						commit
						a9b425ec42
					
				
					 1 changed files with 48 additions and 37 deletions
				
			
		|  | @ -430,48 +430,59 @@ void Level3RadialViewImpl::ComputeCoordinates( | ||||||
| 
 | 
 | ||||||
|    const std::uint16_t numRadials   = radialData->number_of_radials(); |    const std::uint16_t numRadials   = radialData->number_of_radials(); | ||||||
|    const std::uint16_t numRangeBins = radialData->number_of_range_bins(); |    const std::uint16_t numRangeBins = radialData->number_of_range_bins(); | ||||||
|    const std::uint32_t numRadialGates = numRadials * numRangeBins; |  | ||||||
|    const std::uint32_t maxRadialGates = |  | ||||||
|       numRadials * common::MAX_DATA_MOMENT_GATES; |  | ||||||
| 
 | 
 | ||||||
|    auto radialGates = boost::irange<uint32_t>(0, maxRadialGates); |    auto radials = boost::irange<std::uint32_t>(0u, numRadials); | ||||||
|  |    auto gates   = boost::irange<std::uint32_t>(0u, numRangeBins); | ||||||
| 
 | 
 | ||||||
|    std::for_each( |    std::for_each(std::execution::par_unseq, | ||||||
|       std::execution::par_unseq, |                  radials.begin(), | ||||||
|       radialGates.begin(), |                  radials.end(), | ||||||
|       radialGates.end(), |                  [&](std::uint32_t radial) | ||||||
|       [&](std::uint32_t radialGate) |  | ||||||
|                  { |                  { | ||||||
|          const std::uint16_t gate = static_cast<std::uint16_t>( |                     float deltaAngle; | ||||||
|             radialGate % common::MAX_DATA_MOMENT_GATES); |                     if (radial == 0) | ||||||
| 
 |  | ||||||
|          if (gate >= numRadialGates) |  | ||||||
|                     { |                     { | ||||||
|             return; |                        // Angles are ordered clockwise, delta should be positive
 | ||||||
|  |                        deltaAngle = radialData->start_angle(0) - | ||||||
|  |                                     radialData->start_angle(numRadials - 1); | ||||||
|  |                        while (deltaAngle < 0.0f) | ||||||
|  |                        { | ||||||
|  |                           deltaAngle += 360.0f; | ||||||
|  |                        } | ||||||
|  |                     } | ||||||
|  |                     else | ||||||
|  |                     { | ||||||
|  |                        deltaAngle = radialData->delta_angle(radial); | ||||||
|                     } |                     } | ||||||
| 
 |  | ||||||
|          const std::uint16_t radial = static_cast<std::uint16_t>( |  | ||||||
|             radialGate / common::MAX_DATA_MOMENT_GATES); |  | ||||||
| 
 |  | ||||||
|          const float deltaAngle = |  | ||||||
|             (radial == 0) ? radialData->start_angle(0) - |  | ||||||
|                                radialData->start_angle(numRadials - 1) : |  | ||||||
|                             radialData->delta_angle(radial); |  | ||||||
| 
 | 
 | ||||||
|                     const float angle = |                     const float angle = | ||||||
|                        radialData->start_angle(radial) - (deltaAngle * 0.5f); |                        radialData->start_angle(radial) - (deltaAngle * 0.5f); | ||||||
|  | 
 | ||||||
|  |                     std::for_each(std::execution::par_unseq, | ||||||
|  |                                   gates.begin(), | ||||||
|  |                                   gates.end(), | ||||||
|  |                                   [&](std::uint32_t gate) | ||||||
|  |                                   { | ||||||
|  |                                      const std::uint32_t radialGate = | ||||||
|  |                                         radial * common::MAX_DATA_MOMENT_GATES + | ||||||
|  |                                         gate; | ||||||
|                                      const float range = (gate + 1) * gateSize; |                                      const float range = (gate + 1) * gateSize; | ||||||
|                                      const std::size_t offset = radialGate * 2; |                                      const std::size_t offset = radialGate * 2; | ||||||
| 
 | 
 | ||||||
|                                      double latitude; |                                      double latitude; | ||||||
|                                      double longitude; |                                      double longitude; | ||||||
| 
 | 
 | ||||||
|          geodesic.Direct( |                                      geodesic.Direct(radarLatitude, | ||||||
|             radarLatitude, radarLongitude, angle, range, latitude, longitude); |                                                      radarLongitude, | ||||||
|  |                                                      angle, | ||||||
|  |                                                      range, | ||||||
|  |                                                      latitude, | ||||||
|  |                                                      longitude); | ||||||
| 
 | 
 | ||||||
|                                      coordinates_[offset]     = latitude; |                                      coordinates_[offset]     = latitude; | ||||||
|                                      coordinates_[offset + 1] = longitude; |                                      coordinates_[offset + 1] = longitude; | ||||||
|                                   }); |                                   }); | ||||||
|  |                  }); | ||||||
|    timer.stop(); |    timer.stop(); | ||||||
|    logger_->debug("Coordinates calculated in {}", timer.format(6, "%ws")); |    logger_->debug("Coordinates calculated in {}", timer.format(6, "%ws")); | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat