| 85 | } |
| 86 | |
| 87 | Expected<void> FastWindingNumber::calcFromVector( std::vector<float>& res, const std::vector<Vector3f>& points, float beta, FaceId skipFace, const ProgressCallback& cb ) |
| 88 | { |
| 89 | MR_TIMER; |
| 90 | return prepareData_( subprogress( cb, 0.0, 0.5f ) ).and_then( [&]() -> Expected<void> |
| 91 | { |
| 92 | const auto totalSize = points.size(); |
| 93 | const auto bufferSize = maxBufferSize( getCudaSafeMemoryLimit(), totalSize, sizeof( float ) + sizeof( float3 ) ); |
| 94 | |
| 95 | DynamicArray<float3> cudaPoints; |
| 96 | CUDA_LOGE_RETURN_UNEXPECTED( cudaPoints.resize( bufferSize ) ); |
| 97 | if ( !reportProgress( cb, 0.6f ) ) |
| 98 | return unexpectedOperationCanceled(); |
| 99 | |
| 100 | DynamicArrayF cudaResult; |
| 101 | CUDA_LOGE_RETURN_UNEXPECTED( cudaResult.resize( bufferSize ) ); |
| 102 | |
| 103 | res.resize( points.size() ); |
| 104 | |
| 105 | const auto cb1 = subprogress( cb, 0.60f, 1.00f ); |
| 106 | const auto iterCount = chunkCount( totalSize, bufferSize ); |
| 107 | size_t iterIndex = 0; |
| 108 | |
| 109 | for ( const auto [offset, size] : splitByChunks( totalSize, bufferSize ) ) |
| 110 | { |
| 111 | const auto cb2 = subprogress( cb1, iterIndex++, iterCount ); |
| 112 | |
| 113 | CUDA_LOGE_RETURN_UNEXPECTED( cudaPoints.copyFrom( points.data() + offset, size ) ); |
| 114 | |
| 115 | fastWindingNumberFromVector( cudaPoints.data(), data_->toData(), cudaResult.data(), beta, int( skipFace ), size ); |
| 116 | CUDA_LOGE_RETURN_UNEXPECTED( cudaGetLastError() ); |
| 117 | if ( !reportProgress( cb2, 0.25f ) ) |
| 118 | return unexpectedOperationCanceled(); |
| 119 | |
| 120 | CUDA_LOGE_RETURN_UNEXPECTED( cudaResult.copyTo( res.data() + offset, size ) ); |
| 121 | if ( !reportProgress( cb2, 1.00f ) ) |
| 122 | return unexpectedOperationCanceled(); |
| 123 | } |
| 124 | |
| 125 | return {}; |
| 126 | } ); |
| 127 | } |
| 128 | |
| 129 | Expected<void> FastWindingNumber::calcSelfIntersections( FaceBitSet& res, float beta, const ProgressCallback& cb ) |
| 130 | { |
nothing calls this directly
no test coverage detected