 
 		CUDA_CHECK(cudaStreamSynchronize(stream));
 
-		if (static_cast<size_t>(std::count(found.begin(), found.end(), 1)) == found.size()) break;
+		if (N == foundCount) break;
 
 		// preserve starting position for those grid points that have value
 

		ASSERT(Tparcel > 100. || IsMissingDouble(Tparcel));

		double prevTparcel = d_prevTparcel[idx];  // K
		ASSERT(prevTparcel > 100. || IsMissingDouble(Tparcel));

		double LFCP = d_LFCP[idx];  // hPa
		ASSERT(LFCP < 1200.);

#include <cuda_runtime.h>
#include <thrust/count.h>
#include <thrust/device_vector.h>
#include <thrust/system/cuda/execution_policy.h>

#include "plugin_factory.h"

