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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26