/*
    Copyright (C) 2012 Bartosz Broda, Jacek Bochenek, Łukasz Biłeńkij, 
    Damian Jaworski, Wojciech Mazur, Dominik Piasecki, Maciej Piasecki, 
    Radosław Ramocki
    
    This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your option)
any later version.

    This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. 

    See the LICENSE and COPYING files for more details.
*/

#include "MatrixSaverTextFile.h"


MatrixSaverTextFile::MatrixSaverTextFile()
{
}
MatrixSaverTextFile::~MatrixSaverTextFile()
{
}
void MatrixSaverTextFile::initialize()
{
	outputFile.open(Config::getInstance()->resultsFile.c_str());
	if(!outputFile)
		throw std::runtime_error("Cannot open output filen");
	std::cout<<"Text file for matrix saver initialized\n";
}
void MatrixSaverTextFile::finalize()
{
	outputFile.close();
}
bool MatrixSaverTextFile::isSimetrical(bool cmpSimetrical)
{
	return false;
}

void MatrixSaverTextFile::addValues(int rowNumber,int numOfValues,int *indexTable,double *valueTable)
{
	outputFile<<rowNumber<<std::endl;
	for(int i=0;i<numOfValues;i++)
		outputFile<<"\t"<<indexTable[i]<<"\t"<<valueTable[i]<<std::endl;
}
