Author: jcouteau Date: 2009-04-18 13:12:30 +0000 (Sat, 18 Apr 2009) New Revision: 113 Modified: trunk/exports/SensitivityBiomassReferenceY9.java trunk/exports/SensitivityBiomassRelativeReferenceY12.java trunk/exports/SensitivityCapturesWeightReferenceY7.java trunk/exports/SensitivityCapturesWeightRelativeReferenceY10.java trunk/exports/SensitivityGenitorBiomassReferenceY8.java trunk/exports/SensitivityGenitorBiomassRelativeReferenceY11.java Log: Fixed resultStorage bug on exports Modified: trunk/exports/SensitivityBiomassReferenceY9.java =================================================================== --- trunk/exports/SensitivityBiomassReferenceY9.java 2009-04-17 13:51:32 UTC (rev 112) +++ trunk/exports/SensitivityBiomassReferenceY9.java 2009-04-18 13:12:30 UTC (rev 113) @@ -7,6 +7,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.codelutin.math.matrix.MatrixND; +import org.codelutin.topia.TopiaContext; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; @@ -43,6 +44,8 @@ Double biomass = 0.0; Double referenceBiomass = 0.0; + System.out.println("reference simul : " + param_referenceSimulation); + for (Population pop : simulation.getParameter().getPopulations()) { if (pop.getName().equals(param_pop.getName())) { @@ -50,14 +53,26 @@ MatrixND matlastdate = resultStorage.getMatrix(lastDate, pop, ResultName.MATRIX_BIOMASS); biomass = matlastdate.sumAll(); + System.out.println("matlastdate:" + (Object) matlastdate); - //Get the reference biomass of the last time step + TopiaContext tx = referenceSimulation.getStorage() + .beginTransaction(); + MatrixND matreferencelastdate = referenceResultStorage - .getMatrix(lastDate, pop, ResultName.MATRIX_BIOMASS); + .getMatrix(lastDate, ResultName.MATRIX_BIOMASS + " " + + pop, tx); referenceBiomass = matreferencelastdate.sumAll(); + tx.commitTransaction(); + tx.closeContext(); } } + System.out.println("simulationStorage:" + simulation); + System.out.println("referenece simulation:" + referenceSimulation); + System.out.println("resultStorage:" + resultStorage); + System.out.println("referenceStroagr:" + referenceResultStorage); + System.out.println("biomass:" + biomass); + System.out.println("referenceBiomass:" + referenceBiomass); out.write(Double.toString(biomass / referenceBiomass)); Modified: trunk/exports/SensitivityBiomassRelativeReferenceY12.java =================================================================== --- trunk/exports/SensitivityBiomassRelativeReferenceY12.java 2009-04-17 13:51:32 UTC (rev 112) +++ trunk/exports/SensitivityBiomassRelativeReferenceY12.java 2009-04-18 13:12:30 UTC (rev 113) @@ -7,6 +7,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.codelutin.math.matrix.MatrixND; +import org.codelutin.topia.TopiaContext; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; @@ -30,7 +31,7 @@ public Population param_pop; @Doc("Name of the reference simulation") - public String param_referenceSimulation=""; + public String param_referenceSimulation = ""; @Override public void export(SimulationStorage simulation, Writer out) @@ -61,14 +62,23 @@ biomass = matlastdate.sumAll(); //Get the biomass on december of the first year + TopiaContext tx = referenceSimulation.getStorage() + .beginTransaction(); MatrixND matfirstdatereference = referenceResultStorage - .getMatrix(firstDate, pop, ResultName.MATRIX_BIOMASS); + .getMatrix(firstDate, ResultName.MATRIX_BIOMASS + " " + + pop, tx); firstbiomassReference = matfirstdatereference.sumAll(); + tx.commitTransaction(); + tx.closeContext(); //Get the biomass of the last time step + tx = referenceSimulation.getStorage().beginTransaction(); MatrixND matlastdatereference = referenceResultStorage - .getMatrix(lastDate, pop, ResultName.MATRIX_BIOMASS); + .getMatrix(lastDate, ResultName.MATRIX_BIOMASS + " " + + pop, tx); biomassReference = matlastdatereference.sumAll(); + tx.commitTransaction(); + tx.closeContext(); } } Modified: trunk/exports/SensitivityCapturesWeightReferenceY7.java =================================================================== --- trunk/exports/SensitivityCapturesWeightReferenceY7.java 2009-04-17 13:51:32 UTC (rev 112) +++ trunk/exports/SensitivityCapturesWeightReferenceY7.java 2009-04-18 13:12:30 UTC (rev 113) @@ -7,6 +7,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.codelutin.math.matrix.MatrixND; +import org.codelutin.topia.TopiaContext; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; @@ -29,7 +30,7 @@ public Population param_pop; @Doc("Name of the reference simulation") - public String param_referenceSimulation=""; + public String param_referenceSimulation = ""; @Override public void export(SimulationStorage simulation, Writer out) @@ -56,12 +57,16 @@ capturesWeight += matlastdate.sumAll(); //Get the reference captures Weight of each month of the last year + TopiaContext tx = referenceSimulation.getStorage() + .beginTransaction(); MatrixND matlastdatereference = referenceResultStorage .getMatrix( new Date(lastDate.getDate() - i), - pop, - ResultName.MATRIX_CATCH_WEIGHT_PER_STRATEGY_MET_PER_ZONE_POP); + ResultName.MATRIX_CATCH_WEIGHT_PER_STRATEGY_MET_PER_ZONE_POP + + " " + pop, tx); capturesWeightReference += matlastdatereference.sumAll(); + tx.commitTransaction(); + tx.closeContext(); } Modified: trunk/exports/SensitivityCapturesWeightRelativeReferenceY10.java =================================================================== --- trunk/exports/SensitivityCapturesWeightRelativeReferenceY10.java 2009-04-17 13:51:32 UTC (rev 112) +++ trunk/exports/SensitivityCapturesWeightRelativeReferenceY10.java 2009-04-18 13:12:30 UTC (rev 113) @@ -7,6 +7,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.codelutin.math.matrix.MatrixND; +import org.codelutin.topia.TopiaContext; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; @@ -67,21 +68,27 @@ capturesWeightfirst += matfirstdate.sumAll(); //Get the reference captures Weight of each month of the last year + + TopiaContext tx = referenceSimulation.getStorage() + .beginTransaction(); + MatrixND matlastdatereference = referenceResultStorage .getMatrix( new Date(lastDate.getDate() - i), - pop, - ResultName.MATRIX_CATCH_WEIGHT_PER_STRATEGY_MET_PER_ZONE_POP); + ResultName.MATRIX_CATCH_WEIGHT_PER_STRATEGY_MET_PER_ZONE_POP + + " " + pop, tx); capturesWeightreference += matlastdatereference.sumAll(); //Get the reference captures Weight of each month of the first year MatrixND matfirstdatereference = referenceResultStorage .getMatrix( new Date(i), - pop, - ResultName.MATRIX_CATCH_WEIGHT_PER_STRATEGY_MET_PER_ZONE_POP); + ResultName.MATRIX_CATCH_WEIGHT_PER_STRATEGY_MET_PER_ZONE_POP + + " " + pop, tx); capturesWeightfirstreference += matfirstdatereference .sumAll(); + tx.commitTransaction(); + tx.closeContext(); } } } Modified: trunk/exports/SensitivityGenitorBiomassReferenceY8.java =================================================================== --- trunk/exports/SensitivityGenitorBiomassReferenceY8.java 2009-04-17 13:51:32 UTC (rev 112) +++ trunk/exports/SensitivityGenitorBiomassReferenceY8.java 2009-04-18 13:12:30 UTC (rev 113) @@ -8,6 +8,7 @@ import org.apache.commons.logging.LogFactory; import org.codelutin.math.matrix.MatrixIterator; import org.codelutin.math.matrix.MatrixND; +import org.codelutin.topia.TopiaContext; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; @@ -62,8 +63,10 @@ } //Get the reference biomass of the last time step + TopiaContext tx = referenceSimulation.getStorage() + .beginTransaction(); MatrixND matlastdatereference = referenceResultStorage - .getMatrix(pop, ResultName.MATRIX_BIOMASS); + .getMatrix(ResultName.MATRIX_BIOMASS + " " + pop, tx); for (MatrixIterator i = matlastdatereference.iterator(); i .hasNext();) { i.next(); @@ -75,6 +78,8 @@ * group.getReproductionRate(); } } + tx.commitTransaction(); + tx.closeContext(); } } out.write(Double.toString(biomass / referenceBiomass)); Modified: trunk/exports/SensitivityGenitorBiomassRelativeReferenceY11.java =================================================================== --- trunk/exports/SensitivityGenitorBiomassRelativeReferenceY11.java 2009-04-17 13:51:32 UTC (rev 112) +++ trunk/exports/SensitivityGenitorBiomassRelativeReferenceY11.java 2009-04-18 13:12:30 UTC (rev 113) @@ -8,6 +8,7 @@ import org.apache.commons.logging.LogFactory; import org.codelutin.math.matrix.MatrixIterator; import org.codelutin.math.matrix.MatrixND; +import org.codelutin.topia.TopiaContext; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; @@ -81,8 +82,10 @@ } //Get the reference biomass of the first time step + TopiaContext tx = referenceSimulation.getStorage() + .beginTransaction(); MatrixND matfirstdatereference = referenceResultStorage - .getMatrix(pop, ResultName.MATRIX_BIOMASS); + .getMatrix(ResultName.MATRIX_BIOMASS + " " + pop, tx); for (MatrixIterator i = matfirstdatereference.iterator(); i .hasNext();) { i.next(); @@ -97,7 +100,7 @@ //Get the reference biomass of the last time step MatrixND matlastdatereference = referenceResultStorage - .getMatrix(pop, ResultName.MATRIX_BIOMASS); + .getMatrix(ResultName.MATRIX_BIOMASS + " " + pop, tx); for (MatrixIterator i = matlastdatereference.iterator(); i .hasNext();) { i.next(); @@ -109,6 +112,8 @@ * group.getReproductionRate(); } } + tx.commitTransaction(); + tx.closeContext(); } } out.write(Double.toString((biomass / firstbiomass)