Skip to content

Commit 076222e

Browse files
author
kerim aydin
committed
roughed in full W@age, N@age
1 parent bdd65f9 commit 076222e

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

R/ecosim.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ rsim.run <- function(Rsim.scenario, method = 'RK4', years = 1:100, spname = NULL
189189

190190
colnames(rout$out_SSB) <- scene$stanzas$Oldest
191191
colnames(rout$out_eggs) <- scene$stanzas$Oldest
192-
colnames(rout$out_Ninf) <- scene$stanzas$Oldest
193-
colnames(rout$out_Winf) <- scene$stanzas$Oldest
192+
#colnames(rout$out_Ninf) <- scene$stanzas$Oldest
193+
#colnames(rout$out_Winf) <- scene$stanzas$Oldest
194194
colnames(rout$out_Nrec) <- scene$stanzas$Groups
195195
colnames(rout$out_Wrec) <- scene$stanzas$Groups
196196
# drop the last row (should be always 0; negative index is entry to drop)
@@ -807,6 +807,7 @@ rsim.stanzas <- function(Rpath.params, state, params){
807807
rstan$baseWageS <- matrix(NA, max(juvfile$stindiv$Last) + 1, rstan$Nsplit + 1)
808808
rstan$baseNageS <- matrix(NA, max(juvfile$stindiv$Last) + 1, rstan$Nsplit + 1)
809809
rstan$baseQageS <- matrix(NA, max(juvfile$stindiv$Last) + 1, rstan$Nsplit + 1)
810+
rstan$laststanza <- max(juvfile$stindiv$Last) + 1
810811

811812
sPred <- rep(0, params$NUM_GROUPS + 1) #rstan$stanzaPred <- rep(0, params$NUM_GROUPS + 1)
812813

@@ -928,6 +929,7 @@ rsim.stanzas <- function(Rpath.params, state, params){
928929
rstan$baseWageS <- matrix(rep(0, 4), 2, 2)
929930
rstan$baseNageS <- matrix(rep(0, 4), 2, 2)
930931
rstan$baseQageS <- matrix(rep(0, 4), 2, 2)
932+
rstan$laststanza <- 1
931933
rstan$Wmat <- c(0, 0)
932934
#rstan$Wmat001 <- c(0, 0)
933935
#rstan$Wmat50 <- c(0, 0)

src/ecosim.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ int y, m, dd;
255255
// Parameters from stanzas
256256
const int Nsplit = as<int>(stanzas["Nsplit"]);
257257
const int Totstanzas = as<int>(stanzas["Totstanzas"]);
258+
const int laststanza = as<int>(stanzas["laststanza"]);
258259
const NumericVector Nstanzas = as<NumericVector>(stanzas["Nstanzas"]);
259260
const NumericVector MaxAge = as<NumericVector>(stanzas["MaxAge"]);
260261
NumericMatrix Age1 = as<NumericMatrix>(stanzas["Age1"]);
@@ -267,6 +268,12 @@ int y, m, dd;
267268
NumericMatrix out_Wrec(EndYear * 12, Totstanzas + 1);
268269
NumericMatrix out_Nrec(EndYear * 12, Totstanzas + 1);
269270

271+
NumericMatrix out_WageS(EndYear*12, laststanza);
272+
NumericMatrix out_NageS(EndYear*12, laststanza);
273+
NumericMatrix out_QageS(EndYear*12, laststanza);
274+
275+
276+
270277
// Species diagnostic outputs
271278
NumericMatrix out_species_rates(EndYear * 12, 10);
272279

@@ -293,6 +300,7 @@ int y, m, dd;
293300
//std::cout << " x1c ";
294301
NumericMatrix NageS = as<NumericMatrix>(state["NageS"]);
295302
NumericMatrix WageS = as<NumericMatrix>(state["WageS"]);
303+
NumericMatrix QageS = as<NumericMatrix>(state["QageS"]);
296304
NumericVector SpawnBio = as<NumericVector>(state["SpawnBio"]);
297305
NumericVector EggsStanza = as<NumericVector>(state["EggsStanza"]);
298306
//std::cout << " x1d ";
@@ -452,6 +460,12 @@ int y, m, dd;
452460
}
453461
}
454462

463+
if(spstanza>0){
464+
out_WageS(dd, _ ) = WageS( _ , spstanza);
465+
out_NageS(dd, _ ) = NageS( _ , spstanza);
466+
out_QageS(dd, _ ) = QageS( _ , spstanza);
467+
}
468+
455469
// Write diagnostic species outputs
456470
//FoodGain, DetritalGain, FishingGain, FoodLoss, UnAssimLoss, ActiveRespLoss,
457471
//MzeroLoss, FishingLoss, DetritalLoss, MigrateLoss
@@ -494,10 +508,13 @@ int y, m, dd;
494508
_["out_species_rates"]=out_species_rates,
495509
_["out_SSB"]=out_SSB,
496510
_["out_eggs"]=out_eggs,
497-
_["out_Winf"]=out_Winf,
498-
_["out_Ninf"]=out_Ninf,
511+
//_["out_Winf"]=out_Winf,
512+
//_["out_Ninf"]=out_Ninf,
499513
_["out_Nrec"]=out_Nrec,
500514
_["out_Wrec"]=out_Wrec,
515+
_["out_WageS"]=out_WageS,
516+
_["out_NageS"]=out_NageS,
517+
_["out_QageS"]=out_QageS,
501518
_["end_state"]=state,
502519
_["crash_year"]=CRASH_YEAR,
503520
_["dyt"]=dyt);

0 commit comments

Comments
 (0)