public void applyCluster(String fileInput, String fileOutput) {
		try {
			BufferedReader in = new BufferedReader (new FileReader(fileInput));
			PrintWriter out = new PrintWriter(fileOutput);
			String line;
			String[] lineArray;
			int countLine = 0;
			while ( ( line=in.readLine() ) != null ) {
				countLine++;
				lineArray = line.split(",");
				// minus 1 because we have timestamp as the first column.
				int numDim = lineArray.length-2;
				// check the number of dimension
				if ( numDim != this.numDimension ) {
					System.err.println("[WARNING] Spclust.applyCluster: " +
							numDim + " dimensional values read in line " + countLine +
							", dimension expected: " + numDimension );
				}
				// put each value in an array lists 
				ArrayList<Integer> values = new ArrayList<Integer> ();
				for (int i=2; i<lineArray.length; i++) {
					values.add(Integer.parseInt(lineArray[i]));
				}
				
				// convert each value to a grid index
				ArrayList<Integer> gridIndex = intToGridIndex(values);
				
				// if there are some index outside the original coordinate space
				// we set them either to 0 or to maximum coordinate in that dimension
				indexCompaction(gridIndex);
				
				// find out which cluster it is
				int clusterId = gridLabel.get(gridIndex);
				
				// write it : keep the timestamp
				out.println(lineArray[0]+","+lineArray[1]+","+clusterId);
			}
			in.close();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}