/*-------------------------------------------------
  rsdpa_io.h
-------------------------------------------------*/

#ifndef __rsdpa_io_h__
#define __rsdpa_io_h__

#include <rsdpa_parts.h>

#define lengthOfString 256

class rIO
{
public:
  static void read(FILE* fpData, FILE* fpout, int& m, char* str);
  static void read(FILE* fpData, int& nBlock);
  static void read(FILE* fpData, int nBlock, int* blockStruct);
  static void read(FILE* fpData, rVector& b);
  static void read(FILE* fpData, rBlockDenseMatrix& xMat,
		   rVector& yVec,
		   rBlockDenseMatrix& zMat, int nBlock,
		   int* blockStruct, int inputSparse);
  static void read(FILE* fpData, rBlockSparseMatrix& C,
		   rBlockSparseMatrix* A, int m, int nBlock,
		   int* blockStruct);
  static void read(FILE* fpData, int m, int nBlock,
		   int* blockStruct, int* CNonZeroCount,
		   int* ANonZeroElement,bool isDataSparse);
  static void read(FILE* fpData, rBlockSparseMatrix& C,
		   rBlockSparseMatrix* A,int m, int nBlock,
		   int* blockStruct, long position,
		   bool isDataSparse);

  static void printHeader(FILE* fpout, FILE* Display);

  static void printOneIteration(int pIteration,
				rAverageComplementarity& mu,
				rRatioInitResCurrentRes& theta,
				rSolveInfo& solveInfo,
				rStepLength& alpha,
				rDirectionParameter& beta,
				rResiduals& currentRes,
				FILE* fpout,
				FILE* Display);
  static void printLastInfo(int pIteration,
			    rAverageComplementarity& mu,
			    rRatioInitResCurrentRes& theta,
			    rSolveInfo& solveInfo,
			    rStepLength& alpha,
			    rDirectionParameter& beta,
			    rResiduals& currentRes,
			    rPhase & phase,
			    rSolutions& currentPt,
			    double cputime,
			    int nDim,
 			    rVector& b,
 			    rBlockSparseMatrix& C,
 			    rBlockSparseMatrix* A,
			    rComputeTime& com,
			    rParameter& param,
			    FILE* fpout,
			    FILE* Display,
			    bool printTime=true);
};
#endif // __rsdpa_io_h__
