/[xulu]/branches/1.8-gt2-2.6/src/appl/parallel/test/PartitialGridTest.java
ViewVC logotype

Annotation of /branches/1.8-gt2-2.6/src/appl/parallel/test/PartitialGridTest.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 47 - (hide annotations)
Mon Aug 31 14:23:19 2009 UTC (15 years, 3 months ago) by mojays
File size: 2585 byte(s)
Branch 1.8-gt2-2.6 (from rev 45) for geotools 2.6 migration
1 mojays 2 package appl.parallel.test;
2    
3    
4     import java.awt.Rectangle;
5     import java.io.File;
6     import java.io.FileNotFoundException;
7     import appl.parallel.spmd.split.WritableGridPartition;
8     import appl.parallel.util.PartitionUtil;
9     import appl.util.RasterUtil;
10     import schmitzm.data.WritableGridRaster;
11     import schmitzm.geotools.io.GeoExportUtil;
12     import schmitzm.geotools.io.GeoImportUtil;
13    
14     /**
15     * Simple JUnit Test
16     * @author Dominik Appl
17     */
18     public class PartitialGridTest {
19    
20     /**
21     * @throws java.lang.Exception
22     */
23     public void setUp() throws Exception {
24     }
25    
26     /**
27     * @throws java.lang.Exception
28     */
29     public void tearDown() throws Exception {
30     }
31    
32     /**
33     * Test method for {@link appl.parallel.util.PartitionUtil#getPartitialGrid2D(schmitzm.data.WritableGrid, Rectangle, int)}.
34     */
35     public void testGetPartitialGrid2D() {
36     WritableGridRaster baseGrid;
37     try {
38     baseGrid = GeoImportUtil
39     .readGridRasterFromArcInfoASCII(new File(
40     "../Xulu-Data/minigrid.arc"));
41     GeoExportUtil.writeGridRasterToArcInfoASCII(baseGrid, new File(
42     "TEST_getpartitialgrid2d_o1"));
43     RasterUtil.printGrid(baseGrid, 4, 0, "base partition");
44     //make five partitions: four quarters and one inner partition
45     RasterUtil.printGrid(PartitionUtil.getPartitialGrid2D(baseGrid, new Rectangle(0, 0, 5, 5),0),4,0, "upperleft partition");
46     RasterUtil.printGrid(PartitionUtil.getPartitialGrid2D(baseGrid,new Rectangle( 5, 0, 5, 5),0),4,0, "upperright partition");
47     RasterUtil.printGrid(PartitionUtil.getPartitialGrid2D(baseGrid, new Rectangle(0, 5, 5, 5),0),4,0, "lowerleft partition");
48     RasterUtil.printGrid(PartitionUtil.getPartitialGrid2D(baseGrid, new Rectangle(5, 5, 5, 5),0),4,0, "lowerright partition");
49     WritableGridPartition baseGrid2 = PartitionUtil.getPartitialGrid2D(baseGrid,new Rectangle( 0, 0, 10, 10),0);
50     System.out.println("********************* Starting test 2 *********************");
51     RasterUtil.printGrid(baseGrid2,5,0, "baseGrid2");
52     WritableGridPartition baseGrid2partition = PartitionUtil.getPartitialGrid2D(baseGrid, new Rectangle(0, 0, 5, 5),0);
53     RasterUtil.printGrid(baseGrid2partition,5,0, "baseGrid2 partition");
54     baseGrid2.setPartition(baseGrid2partition, new Rectangle(1,1,5,5));
55     RasterUtil.printGrid(baseGrid2,5,0, "baseGrid2 (after setting baseGrid2-partition to (1,1)");
56    
57     } catch (FileNotFoundException e) {
58     // TODO Auto-generated catch block
59     e.printStackTrace();
60     } catch (Exception e) {
61     // TODO Auto-generated catch block
62     e.printStackTrace();
63     }
64    
65     }
66     }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26