feat: refactor precalculateAverageSpeed functions, remove redudent args
This commit is contained in:
@@ -45,21 +45,15 @@ texture<float4, cudaTextureType3D, cudaReadModeElementType> texTableVoxelToRecei
|
|||||||
texture<float4, cudaTextureType3D, cudaReadModeElementType> texTableVoxelToReceiverPathSosBoth1_preprocess;
|
texture<float4, cudaTextureType3D, cudaReadModeElementType> texTableVoxelToReceiverPathSosBoth1_preprocess;
|
||||||
texture<float4, cudaTextureType3D, cudaReadModeElementType> texTableVoxelToReceiverPathSosBoth2_preprocess;
|
texture<float4, cudaTextureType3D, cudaReadModeElementType> texTableVoxelToReceiverPathSosBoth2_preprocess;
|
||||||
|
|
||||||
__global__ void precalculateAverageSpeedOfSoundKernel(cudaArray *deviceSosAttFieldCuArray, ///< CuArray fuer SosAttFieldTextur
|
__global__ void precalculateAverageSpeedOfSoundKernel(int firstZLayer, ///< First z-layer in the speed of sound grid the
|
||||||
int firstZLayer, ///< First z-layer in the speed of sound grid the
|
///< pre-calculation is performed for.
|
||||||
///< pre-calculation is performed for.
|
int sosZLayerCount, ///< Number of z-layers in the speed of sound grid the
|
||||||
int sosZLayerCount, ///< Number of z-layers in the speed of sound grid the
|
///< pre-calculation is performed for.
|
||||||
///< pre-calculation is performed for.
|
int geometry, ///< emitters=0 or receivers=1.
|
||||||
int geometry, ///< emitters=0 or receivers=1.
|
int geometryElementCount, ///< Number of elements in the geometry array.
|
||||||
int geometryElementCount, ///< Number of elements in the geometry array.
|
int maxSoSReceiverArrayForTexture, ///< max amount of elements in the
|
||||||
int maxSoSReceiverArrayForTexture, ///< max amount of elements in the
|
///< receiver CUDA array.
|
||||||
///< receiver CUDA array.
|
float3 sosOffset, float3 regionOfInterestOffset, float IMAGE_RESOLUTION, float SOS_RESOLUTION, float debugMode, float debugModeParameter)
|
||||||
float *deviceVoxelCountOutputFloat, ///< fuer Count im Floatformat gedacht
|
|
||||||
///< fuer Texturmemory.
|
|
||||||
float *speedOfSoundSumOutput, ///< fuer SoS im Floatformat gedacht fuer
|
|
||||||
///< Texturmemory.
|
|
||||||
int3 SOSGrid_XYZ, float3 sosOffset, float3 regionOfInterestOffset, float IMAGE_RESOLUTION, float SOS_RESOLUTION, float debugMode,
|
|
||||||
float debugModeParameter)
|
|
||||||
{
|
{
|
||||||
dim3 SosVoxel(threadIdx.x, // SoS-Voxel X ? Threads fangen bei 0 an
|
dim3 SosVoxel(threadIdx.x, // SoS-Voxel X ? Threads fangen bei 0 an
|
||||||
blockIdx.x, // SoS-Voxel Y
|
blockIdx.x, // SoS-Voxel Y
|
||||||
@@ -123,12 +117,10 @@ __global__ void precalculateAverageSpeedOfSoundKernel(cudaArray *deviceSosAttFie
|
|||||||
|
|
||||||
// Bestimmen der SoS-Koordinaten fuer die Sender/Empfuenger-Koordinaten
|
// Bestimmen der SoS-Koordinaten fuer die Sender/Empfuenger-Koordinaten
|
||||||
determineSpeedOfSoundFieldVoxelFloat(currentGeometry, SosGeometryVoxelFloat, sosOffset,
|
determineSpeedOfSoundFieldVoxelFloat(currentGeometry, SosGeometryVoxelFloat, sosOffset,
|
||||||
SOS_RESOLUTION_FACTOR); // SoSVoxel von E/R bestimmen //
|
SOS_RESOLUTION_FACTOR); // SoSVoxel von E/R bestimmen //
|
||||||
// currentGeometry --> SosGeometryVoxel Float
|
// currentGeometry --> SosGeometryVoxel Float
|
||||||
performRayTracedSpeedAdditionTexture(voxelCount, averageSpeed, totalAttenuation, SosGeometryVoxelFloat, SosVoxel, deviceSosAttFieldCuArray, SOSGrid_XYZ, sosOffset, SOS_RESOLUTION,
|
performRayTracedSpeedAdditionTexture(voxelCount, averageSpeed, totalAttenuation, SosGeometryVoxelFloat, SosVoxel, sosOffset); // SosGeometryVoxelFloat im Floatformat,
|
||||||
IMAGE_RESOLUTION, regionOfInterestOffset,
|
// SoSVoxel als Integer
|
||||||
geometry); // SosGeometryVoxelFloat im Floatformat, SoSVoxel als
|
|
||||||
// Integer
|
|
||||||
|
|
||||||
if (geometry == 0) // Emitter
|
if (geometry == 0) // Emitter
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,15 +30,12 @@ extern texture<float4, cudaTextureType3D, cudaReadModeElementType> texTableVoxel
|
|||||||
extern texture<float4, cudaTextureType3D, cudaReadModeElementType> texTableVoxelToReceiverPathSosBoth1_preprocess;
|
extern texture<float4, cudaTextureType3D, cudaReadModeElementType> texTableVoxelToReceiverPathSosBoth1_preprocess;
|
||||||
extern texture<float4, cudaTextureType3D, cudaReadModeElementType> texTableVoxelToReceiverPathSosBoth2_preprocess;
|
extern texture<float4, cudaTextureType3D, cudaReadModeElementType> texTableVoxelToReceiverPathSosBoth2_preprocess;
|
||||||
|
|
||||||
__global__ void precalculateAverageSpeedOfSoundKernel(cudaArray *deviceSosAttFieldCuArray,
|
__global__ void precalculateAverageSpeedOfSoundKernel(int firstZLayer,
|
||||||
int firstZLayer,
|
|
||||||
int sosZLayerCount,
|
int sosZLayerCount,
|
||||||
int geometry,
|
int geometry,
|
||||||
int geometryElementCount,
|
int geometryElementCount,
|
||||||
int maxSoSReceiverArrayForTexture,
|
int maxSoSReceiverArrayForTexture,
|
||||||
float *deviceVoxelCountOutputFloat,
|
float3 sosOffset, float3 regionOfInterestOffset, float IMAGE_RESOLUTION, float SOS_RESOLUTION, float debugMode,
|
||||||
float *speedOfSoundSumOutput,
|
|
||||||
int3 SOSGrid_XYZ, float3 sosOffset, float3 regionOfInterestOffset, float IMAGE_RESOLUTION, float SOS_RESOLUTION, float debugMode,
|
|
||||||
float debugModeParameter);
|
float debugModeParameter);
|
||||||
|
|
||||||
__global__ void precalculateAscanIndex_usePathsKernel(int ascanIndexBatchOffset,
|
__global__ void precalculateAscanIndex_usePathsKernel(int ascanIndexBatchOffset,
|
||||||
|
|||||||
@@ -45,9 +45,7 @@ __device__ __forceinline__ void processRayTracedVoxelTextureSosAtt(
|
|||||||
float const *currentVoxelFloat, ///< SOS-coordinates of current Voxel for Bresenham in float[3].
|
float const *currentVoxelFloat, ///< SOS-coordinates of current Voxel for Bresenham in float[3].
|
||||||
float &voxelCount, ///< This argument is written to. Number of voxels in the path so far. // TODO: not necessary here to sum up because it is already known from Bresenham length
|
float &voxelCount, ///< This argument is written to. Number of voxels in the path so far. // TODO: not necessary here to sum up because it is already known from Bresenham length
|
||||||
float &totalSpeed, ///< This argument is written to. Sum Up total SOS
|
float &totalSpeed, ///< This argument is written to. Sum Up total SOS
|
||||||
float &totalAttenuation, ///< This argument is written to. Sum Up total Attenuation
|
float &totalAttenuation ///< This argument is written to. Sum Up total Attenuation
|
||||||
cudaArray *deviceSosAttFieldCuArray, ///< Pointer to cudaArray for SoSATTFieldData // TODO: not necessary if access is used with texture memory
|
|
||||||
int3 const &SOSGrid_XYZ ///< Size of SOS-Grid in XYZ // TODO: only necessary for boundary-check.
|
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -59,19 +57,11 @@ __device__ __forceinline__ void processRayTracedVoxelTextureSosAtt(
|
|||||||
|
|
||||||
|
|
||||||
__device__ __forceinline__ void performRayTracedSpeedAdditionTexture(float &voxelCount, ///< This argument is written to. Number of voxels within the path traced.
|
__device__ __forceinline__ void performRayTracedSpeedAdditionTexture(float &voxelCount, ///< This argument is written to. Number of voxels within the path traced.
|
||||||
|
|
||||||
float &totalSpeed, ///< This argument is written to. Sum of the speed of sound samples in the path traced.
|
float &totalSpeed, ///< This argument is written to. Sum of the speed of sound samples in the path traced.
|
||||||
float &totalAttenuation,
|
float &totalAttenuation,
|
||||||
|
|
||||||
float3 const &point1f, ///< Vector array describing the Voxelcoordinates of emitters or receivers.
|
float3 const &point1f, ///< Vector array describing the Voxelcoordinates of emitters or receivers.
|
||||||
dim3 const &point2, ///< Vector array describing the Voxelcoordinates of Voxels.
|
dim3 const &point2, ///< Vector array describing the Voxelcoordinates of Voxels.
|
||||||
|
float3 &sosOffset)
|
||||||
cudaArray *deviceSpeedOfSoundFieldCuArray, ///< CuArray fuer SOSFieldTextur
|
|
||||||
|
|
||||||
int3 const &SOSGrid_XYZ, ///< Size of SOS-Grid in XYZ
|
|
||||||
float3 &sosOffset, float &SOS_RESOLUTION, float &IMAGE_RESOLUTION, float3 regionOfInterestOffset,
|
|
||||||
int geometry ///< emitters=0 or receivers=1.
|
|
||||||
)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
voxelCount = 0.0f;
|
voxelCount = 0.0f;
|
||||||
@@ -156,7 +146,7 @@ __device__ __forceinline__ void performRayTracedSpeedAdditionTexture(float &voxe
|
|||||||
int j = 0;
|
int j = 0;
|
||||||
for (j = fastDirectionSteps; j > 0; j--) //(Alle Punkte innerhalb der Schleife berechnen)
|
for (j = fastDirectionSteps; j > 0; j--) //(Alle Punkte innerhalb der Schleife berechnen)
|
||||||
{
|
{
|
||||||
processRayTracedVoxelTextureSosAtt(pathPoint, voxelCount, totalSpeed, totalAttenuation, deviceSpeedOfSoundFieldCuArray, SOSGrid_XYZ);
|
processRayTracedVoxelTextureSosAtt(pathPoint, voxelCount, totalSpeed, totalAttenuation);
|
||||||
pathPoint[greatestDistanceDim] = pathPoint[greatestDistanceDim] + m_XYZ[greatestDistanceDim];
|
pathPoint[greatestDistanceDim] = pathPoint[greatestDistanceDim] + m_XYZ[greatestDistanceDim];
|
||||||
pathPoint[slowDim1] = pathPoint[slowDim1] + m_XYZ[slowDim1];
|
pathPoint[slowDim1] = pathPoint[slowDim1] + m_XYZ[slowDim1];
|
||||||
pathPoint[slowDim2] = pathPoint[slowDim2] + m_XYZ[slowDim2];
|
pathPoint[slowDim2] = pathPoint[slowDim2] + m_XYZ[slowDim2];
|
||||||
|
|||||||
@@ -228,8 +228,7 @@ void SAFTHandler::precalculateAscanIndex_usePaths(int ascanIndex_i, int aScanWin
|
|||||||
CUDA_CHECK(cudaUnbindTexture(&texTableVoxelToReceiverPathSosBoth2_preprocess));
|
CUDA_CHECK(cudaUnbindTexture(&texTableVoxelToReceiverPathSosBoth2_preprocess));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAFTHandler::precalculateAverageSpeedOfSound(int firstZLayer, int sosZLayerCount, int deviceListGeometry, int geometryElementCount, float *deviceVoxelCountOutputFloat,
|
void SAFTHandler::precalculateAverageSpeedOfSound(int firstZLayer, int sosZLayerCount, int deviceListGeometry, int geometryElementCount)
|
||||||
float *deviceSpeedOfSoundSumOutput)
|
|
||||||
{
|
{
|
||||||
dim3 threadsPerBlock(SOSGrid_XYZ.x, 1,
|
dim3 threadsPerBlock(SOSGrid_XYZ.x, 1,
|
||||||
1); // max. 512 oder 1024 Threads werden vorgegeben und
|
1); // max. 512 oder 1024 Threads werden vorgegeben und
|
||||||
@@ -284,14 +283,9 @@ void SAFTHandler::precalculateAverageSpeedOfSound(int firstZLayer, int sosZLayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
precalculateAverageSpeedOfSoundKernel<<<blocksPerGrid, threadsPerBlock>>>(deviceSosAttFieldCuArray, firstZLayer, sosZLayerCount, deviceListGeometry, geometryElementCount,
|
precalculateAverageSpeedOfSoundKernel<<<blocksPerGrid, threadsPerBlock>>>(firstZLayer, sosZLayerCount, deviceListGeometry, geometryElementCount,
|
||||||
maxSoSReceiverArrayForTexture, // maximale Anzahl an Receivern in einem
|
maxSoSReceiverArrayForTexture,
|
||||||
// CUDA Array
|
sosOffset, regionOfInterestOffset, IMAGE_RESOLUTION, SOS_RESOLUTION, debugMode, debugModeParameter);
|
||||||
|
|
||||||
// deviceVoxelCountOutput,
|
|
||||||
deviceVoxelCountOutputFloat, deviceSpeedOfSoundSumOutput,
|
|
||||||
// regionOfInterestOffset,
|
|
||||||
SOSGrid_XYZ, sosOffset, regionOfInterestOffset, IMAGE_RESOLUTION, SOS_RESOLUTION, debugMode, debugModeParameter);
|
|
||||||
CUDA_CHECK(cudaGetLastError());
|
CUDA_CHECK(cudaGetLastError());
|
||||||
|
|
||||||
CUDA_CHECK(cudaUnbindTexture(&texRefSosAttField));
|
CUDA_CHECK(cudaUnbindTexture(&texRefSosAttField));
|
||||||
|
|||||||
@@ -130,12 +130,11 @@ void SAFTHandler::performCoreReconstruction()
|
|||||||
// SoS-Pfade für Z-Layer vorberechnen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// SoS-Pfade für Z-Layer vorberechnen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
// Emitter ----------------------------------------------------------------------- Emitter
|
// Emitter ----------------------------------------------------------------------- Emitter
|
||||||
precalculateAverageSpeedOfSound(currentSpeedOfSoundZLayer, maxFeasibleSosZLayerCount, 0, emitter_list_Size, deviceTableVoxelToEmitterPathCountFloat, deviceTableVoxelToEmitterPathSosSum);
|
precalculateAverageSpeedOfSound(currentSpeedOfSoundZLayer, maxFeasibleSosZLayerCount, 0, emitter_list_Size);
|
||||||
|
|
||||||
// Receiver ----------------------------------------------------------------------- Receiver
|
// Receiver ----------------------------------------------------------------------- Receiver
|
||||||
|
|
||||||
precalculateAverageSpeedOfSound(currentSpeedOfSoundZLayer, maxFeasibleSosZLayerCount, 1, receiver_list_Size, deviceTableVoxelToReceiverPathCountFloat,
|
precalculateAverageSpeedOfSound(currentSpeedOfSoundZLayer, maxFeasibleSosZLayerCount, 1, receiver_list_Size);
|
||||||
deviceTableVoxelToReceiverPathSosSum);
|
|
||||||
}
|
}
|
||||||
// Go overall A-Scanblocks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// Go overall A-Scanblocks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// PrecalAndPerformSAFTAllAscans - Berechne Performanz fuer Durchlauf von allen Ascans ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// PrecalAndPerformSAFTAllAscans - Berechne Performanz fuer Durchlauf von allen Ascans ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ class SAFTHandler
|
|||||||
|
|
||||||
// Pre-calculation kernels
|
// Pre-calculation kernels
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
void precalculateAverageSpeedOfSound(int firstZLayer, int sosZLayerCount, int deviceGeometry, int geometryElementCount, float *deviceVoxelCountOutputFloat, float *deviceSpeedOfSoundSumOutput);
|
void precalculateAverageSpeedOfSound(int firstZLayer, int sosZLayerCount, int deviceGeometry, int geometryElementCount);
|
||||||
|
|
||||||
void precalculateAscanIndex(int currentSpeedOfSoundZLayer, ///< First z-layer in the speed of sound grid the pre-calculation is performed for.
|
void precalculateAscanIndex(int currentSpeedOfSoundZLayer, ///< First z-layer in the speed of sound grid the pre-calculation is performed for.
|
||||||
int maxFeasibleSosZLayerCount ///< Number of z-layers in the speed of sound grid the pre-calculation is performed for.
|
int maxFeasibleSosZLayerCount ///< Number of z-layers in the speed of sound grid the pre-calculation is performed for.
|
||||||
|
|||||||
Reference in New Issue
Block a user