1 |
mojays |
2 |
package appl.parallel.gui; |
2 |
|
|
|
3 |
|
|
import appl.parallel.ComputingResourceContainer; |
4 |
|
|
import appl.parallel.client.RemoteExecutionController; |
5 |
|
|
import appl.parallel.model.AbstractParallelStepModel; |
6 |
|
|
import appl.parallel.model.ParallelStepModel; |
7 |
|
|
import appl.parallel.spmd.SPMDClientInterface; |
8 |
|
|
import edu.bonn.xulu.XuluModellingPlatform; |
9 |
|
|
import edu.bonn.xulu.model.AbstractStepModel; |
10 |
|
|
import edu.bonn.xulu.model.XuluModel; |
11 |
|
|
import edu.bonn.xulu.plugin.gui.ModelControlContainer; |
12 |
|
|
|
13 |
|
|
/** |
14 |
|
|
* This class extends the functionality of the container to support the execution |
15 |
|
|
* of a {@link ParallelStepModel}. It retrieves the {@link RemoteExecutionController} |
16 |
|
|
* and uses it to prepare the model for parallel execution. |
17 |
|
|
* |
18 |
|
|
* @author Dominik Appl |
19 |
|
|
*/ |
20 |
|
|
public class ModelControlContainer_parallel extends ModelControlContainer { |
21 |
|
|
|
22 |
|
|
private final XuluModellingPlatform appl; |
23 |
|
|
|
24 |
|
|
private final ParallelControlPanelEngine pcpEngine; |
25 |
|
|
|
26 |
|
|
/** |
27 |
|
|
* A new instance |
28 |
|
|
* @param model the XuluModel which should be executed |
29 |
|
|
* @param pcpEngine the controlling engine for parallel execution |
30 |
|
|
* @param appl the Xulu application |
31 |
|
|
*/ |
32 |
|
|
public ModelControlContainer_parallel(XuluModel model, |
33 |
|
|
ParallelControlPanelEngine pcpEngine, XuluModellingPlatform appl) { |
34 |
|
|
super(model); |
35 |
|
|
this.pcpEngine = pcpEngine; |
36 |
|
|
// TODO Auto-generated constructor stub |
37 |
|
|
this.appl = appl; |
38 |
|
|
} |
39 |
|
|
|
40 |
|
|
@Override |
41 |
|
|
protected void createNewThread() { |
42 |
|
|
if (model instanceof ParallelStepModel) { |
43 |
|
|
// create the ClientController |
44 |
|
|
RemoteExecutionController remoteController = RemoteExecutionController |
45 |
|
|
.getRemoteExecutionController(appl); |
46 |
|
|
if (remoteController == null) |
47 |
|
|
throw new UnsupportedOperationException( |
48 |
|
|
"You must load the RemoteExecutionController-Plugin to execute parallel Models!"); |
49 |
|
|
remoteController.prepareModelForSPMDExecution( |
50 |
|
|
(ParallelStepModel) model, pcpEngine |
51 |
|
|
.getSelectedResourceContainers()); |
52 |
|
|
|
53 |
|
|
} |
54 |
|
|
super.createNewThread(); |
55 |
|
|
} |
56 |
|
|
} |