 		float elapsedTime2;
 		cudaEventElapsedTime(&elapsedTime2, start2, stop2);
 
-		spike::Stats stats = mySolver->getStats();
 		spikeSolveTime[it-1] = stats.timeSolve;
 		spikeNumIter[it-1] = stats.numIterations;
 

//        }
//};

ANCFSystem::ANCFSystem() {

	tol = 1e-7;
	maxNewtonIterations = 20;

	// spike stuff
	partitions = 1;
	solverOptions.safeFactorization = true;
	solverOptions.trackReordering = true;
	solverOptions.relTol = 1e-2 * tol;
	solverOptions.absTol = 1e-10;
	solverOptions.maxNumIterations = 10000;
	solverOptions.precondType = spike::None;
	//solverOptions.solverType = spike::CG;

		cudaEventRecord(start2, 0);

		bool success = mySolver->solve(*m_spmv, eAll, delta);
		spike::Stats stats = mySolver->getStats();

		if(!success) {
			isHealthy = 0;

			char filename[100];
			
			sprintf(filename, "./data/lhs%d.mtx", timeIndex);
			cusp::io::write_matrix_market_file(lhs, filename);

			sprintf(filename, "./data/rhs%d.mtx", timeIndex);
			cusp::io::write_matrix_market_file(eAll, filename);

			sprintf(filename, "./data/stats%d.txt", timeIndex);
			ofstream file(filename);
			file << "Code: " << mySolver->getMonitorCode();
			file << "  " << mySolver->getMonitorMessage() << std::endl;
			file << "Number of iterations = " << stats.numIterations << std::endl;
			file << "RHS norm             = " << stats.rhsNorm << std::endl;
			file << "Residual norm        = " << stats.residualNorm << std::endl;
			file << "Rel. residual norm   = " << stats.relResidualNorm << std::endl;
			file.close();

			int code = mySolver->getMonitorCode();
			if (code == -1 || code == -2) {
				std::cout << "STOP" << std::endl;
				exit(0);
			}
		}

		cudaEventRecord(stop2, 0);
