Blame view

src/preypredator/PPRuntimeGPU.java 1.21 KB
89f70c1ec   glaville   import current mc...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  package preypredator;
  
  import mcmas.api.ContextType;
  import mcmas.api.MCMASContext;
  import mcmas.core.MCMCommandQueueProperty;
  import mcmas.plugins.axb.AXBPlugin;
  import mcmas.plugins.gridsearch.GridSearchPlugin;
  
  
  public class PPRuntimeGPU implements PPRuntime {
  	
  	private final MCMASContext context;
  	private final AXBPlugin axbPlugin;
  	private final GridSearchPlugin searchPlugin;
  	
  	public PPRuntimeGPU(ContextType type) {
  		this.context = new MCMASContext(type, MCMCommandQueueProperty.ENABLE_PROFILING);
  		this.axbPlugin = new AXBPlugin(context);
  		this.searchPlugin = new GridSearchPlugin(context);
  	}
  	
  	@Override
  	public void growGrass(PPGrid grass, float factor, int growth, int min, int max) {
  		axbPlugin.clampedTransform(grass.getStorage(), factor, growth, min, max);
  	}
  	
  	@Override
  	public void selectMaxTarget(PPGrid grid, int radius, int[] xPositions,
  			int[] yPositions, int[] newXPositions,
  			int[] newYPositions) {
  		searchPlugin.findMaxCell(grid, radius, xPositions, yPositions, newXPositions, newYPositions);
  	}
  	
  	@Override
  	public void selectNearestNonZeroTarget(PPGrid grid, int radius,
  			int[] xPositions, int[] yPositions, int[] newXPositions,
  			int[] newYPositions) {
  		// TODO Auto-generated method stub
  	}
  
  }