public void writeGridInPmeshFormat ( String outPutFileName ) throws IOException { BufferedWriter writer = new BufferedWriter ( new FileWriter ( outPutFileName + ".pmesh" ) ) ; int numberOfGridPoints = grid . length * grid [ 0 ] . length * grid [ 0 ] [ 0 ] . length ; writer . write ( numberOfGridPoints + "\n" ) ; for ( int z = 0 ; z < grid [ 0 ] [ 0 ] . length ; z ++ ) { for ( int y = 0 ; y < grid [ 0 ] . length ; y ++ ) { for ( int x = 0 ; x < grid . length ; x ++ ) { Point3d coords = getCoordinatesFromGridPoint ( new Point3d ( x , y , z ) ) ; writer . write ( coords . x + "\t" + coords . y + "\t" + coords . z + "\n" ) ; } } } writer . close ( ) ; }
Method transforms the grid into pmesh format .