From d51206b3d4687c6e8ddbb0f9183455cf6843026a Mon Sep 17 00:00:00 2001 From: "antonio.fabio" Date: Thu, 25 Jan 2007 15:55:25 +0000 Subject: [PATCH] fixed native basins algorithm support --- .../org/tsho/dmc2/core/algorithms/NativeBasinsAlgorithm.java | 8 +++++--- src/java/org/tsho/dmc2/core/chart/BasinRenderer.java | 10 +++++++++- src/java/org/tsho/dmc2/ui/basin/BasinComponent.java | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/java/org/tsho/dmc2/core/algorithms/NativeBasinsAlgorithm.java b/src/java/org/tsho/dmc2/core/algorithms/NativeBasinsAlgorithm.java index 419e203..1495438 100644 --- a/src/java/org/tsho/dmc2/core/algorithms/NativeBasinsAlgorithm.java +++ b/src/java/org/tsho/dmc2/core/algorithms/NativeBasinsAlgorithm.java @@ -27,7 +27,6 @@ package org.tsho.dmc2.core.algorithms; import java.util.Vector; - import org.tsho.dmc2.core.chart.BasinRenderer; import org.tsho.dmc2.core.model.SimpleMap; import org.tsho.jidmclib.*; @@ -48,7 +47,7 @@ public class NativeBasinsAlgorithm implements BasinsAlgorithm { Grid grid = br.getGrid(); double ranges[] = grid.getRanges(); SimpleMap map = br.getMap(); - SWIGTYPE_p_double parameters = idmc.new_doubleArray(map.getNPar()); + double parameters[] = br.getParameters(); basin = new Basin((Model) map, parameters, ranges[0], ranges[1], grid.nc, ranges[2], ranges[3], grid.nr, @@ -63,7 +62,7 @@ public class NativeBasinsAlgorithm implements BasinsAlgorithm { int br_data[] = br.getGrid().getData(); int len = br_data.length; index=0; - while (!(basin.finished()!=0)) { + while (basin.finished()==0) { basin.step_n(rate); index+=rate; /*Fill raster data as wanted by BasinRenderer*/ @@ -73,6 +72,9 @@ public class NativeBasinsAlgorithm implements BasinsAlgorithm { if (br.isStopped()) return; } + /*Fill raster data as wanted by BasinRenderer*/ + for(int i=0; i. * Extended by Alexei Grigoriev . @@ -303,4 +303,12 @@ public class BasinRenderer implements DmcPlotRenderer { public SimpleMap getMap() { return map; } + + public double[] getParameters() { + return parameters; + } + + public void setParameters(double[] parameters) { + this.parameters = parameters; + } } diff --git a/src/java/org/tsho/dmc2/ui/basin/BasinComponent.java b/src/java/org/tsho/dmc2/ui/basin/BasinComponent.java index 9b660e7..5178993 100644 --- a/src/java/org/tsho/dmc2/ui/basin/BasinComponent.java +++ b/src/java/org/tsho/dmc2/ui/basin/BasinComponent.java @@ -3,7 +3,7 @@ * graphical and numerical analysis of systems of differential and * difference equations. * - * Copyright (C) 2004 Marji Lines and Alfredo Medio. + * Copyright (C) 2004,2007 Marji Lines and Alfredo Medio. * * Written by Daniele Pizzoni . * Extended by Alexei Grigoriev . @@ -144,7 +144,7 @@ public class BasinComponent extends AbstractPlotComponent controlForm.updateSamplesMenu(); } }); - menuItem.setSelected(true); + menuItem.setSelected(false); menu.addSeparator(); -- 2.11.4.GIT