@@ -224,7 +224,7 @@ List Adams_run (List params, List instate, List forcing, List fishing, List stan
224224 int StartYear, int EndYear, List InitDeriv){
225225
226226int y, m, dd;
227-
227+ // std::cout << " x1 ";
228228// Get some basic needed numbers from the params List
229229 const int NUM_BIO = as<int >(params[" NUM_LIVING" ]) + as<int >(params[" NUM_DEAD" ]);
230230 const int NumPredPreyLinks = as<int >(params[" NumPredPreyLinks" ]);
@@ -254,15 +254,27 @@ int y, m, dd;
254254
255255// Parameters from stanzas
256256 const int Nsplit = as<int >(stanzas[" Nsplit" ]);
257-
257+ const int Totstanzas = as<int >(stanzas[" Totstanzas" ]);
258+ const NumericVector Nstanzas = as<NumericVector>(stanzas[" Nstanzas" ]);
259+ const NumericVector MaxAge = as<NumericVector>(stanzas[" MaxAge" ]);
260+ NumericMatrix Age1 = as<NumericMatrix>(stanzas[" Age1" ]);
261+ // std::cout << " x1a ";
262+ // stanza outputs
263+ NumericMatrix out_SSB (EndYear * 12 , Nsplit + 1 );
264+ NumericMatrix out_eggs (EndYear * 12 , Nsplit + 1 );
265+ NumericMatrix out_Winf (EndYear * 12 , Nsplit + 1 );
266+ NumericMatrix out_Ninf (EndYear * 12 , Nsplit + 1 );
267+ NumericMatrix out_Wrec (EndYear * 12 , Totstanzas + 1 );
268+ NumericMatrix out_Nrec (EndYear * 12 , Totstanzas + 1 );
269+ // std::cout << " x1b ";
258270// Parameter need to track catch by Gear
259271 const NumericVector FishFrom = as<NumericVector>(params[" FishFrom" ]);
260272
261273// Monthly output matrices
262274 NumericMatrix out_Biomass ( EndYear * 12 , NUM_BIO + 1 );
263275 NumericMatrix out_Catch ( EndYear * 12 , NUM_BIO + 1 );
264- NumericMatrix out_SSB (EndYear * 12 , NUM_BIO + 1 );
265- NumericMatrix out_rec (EndYear * 12 , NUM_BIO + 1 );
276+ // NumericMatrix out_SSB(EndYear * 12, NUM_BIO + 1);
277+ // NumericMatrix out_rec(EndYear * 12, NUM_BIO + 1);
266278 NumericMatrix out_Gear_Catch (EndYear*12 , NumFishingLinks+1 );
267279// Annual output matrices
268280 NumericMatrix annual_Catch (EndYear, NUM_BIO+1 );
@@ -274,7 +286,12 @@ int y, m, dd;
274286// Use Clone to make sure state/stanzas are copies of instate/instanzas, not pointers
275287 List state = clone (instate);
276288 // List stanzas = clone(instanzas);
277-
289+ // std::cout << " x1c ";
290+ NumericMatrix NageS = as<NumericMatrix>(state[" NageS" ]);
291+ NumericMatrix WageS = as<NumericMatrix>(state[" WageS" ]);
292+ NumericVector SpawnBio = as<NumericVector>(state[" SpawnBio" ]);
293+ NumericVector EggsStanza = as<NumericVector>(state[" EggsStanza" ]);
294+ // std::cout << " x1d ";
278295 // Update sums of split groups to total biomass for derivative calcs
279296 if (Nsplit > 0 ){
280297 SplitSetPred (stanzas, state);
@@ -284,7 +301,7 @@ int y, m, dd;
284301 List dyt = InitDeriv;
285302
286303 dd = StartYear * STEPS_PER_YEAR;
287-
304+ // std::cout << "x2";
288305// MAIN LOOP STARTS HERE
289306// ASSUMES STEPS_PER_MONTH will always be 1.0, took out divisions
290307 for (y = StartYear; y <= EndYear; y++){
@@ -392,8 +409,8 @@ int y, m, dd;
392409
393410 // Write to output matricies
394411 out_Biomass ( dd, _) = old_Biomass;
395- out_SSB (dd, _) = old_Biomass;
396- out_rec (dd, _) = old_Biomass;
412+ // out_SSB(dd, _) = old_Biomass;
413+ // out_rec(dd, _) = old_Biomass;
397414 out_Catch ( dd, _) = new_Catch;
398415 out_Gear_Catch (dd, _) = new_Gear_Catch;
399416 annual_Catch (y-1 , _) = annual_Catch (y-1 , _) + new_Catch;
@@ -402,12 +419,22 @@ int y, m, dd;
402419 annual_QB (y-1 , _) = FoodGain/old_Biomass;
403420 annual_Qlink (y-1 , _) = Qlink;
404421 }
405-
406- // NOJUV for (i = 1; i <= juv_N; i++){
407- // NOJUV out_SSB(dd, JuvNum[i]) = 0.0;
408- // NOJUV out_SSB(dd, AduNum[i]) = SpawnBio[i];
409- // NOJUV out_rec(dd, AduNum[i]) = NageS(firstMoAdu[i], i) * WageS(firstMoAdu[i], i);
410-
422+ // std::cout << "x3";
423+ // Write stanza outputs
424+ int sind, isp, ist;
425+ sind = 0 ;
426+ for (isp=1 ; isp<=Nsplit; isp++){
427+ out_Winf (dd,isp) = WageS (MaxAge[isp], isp);
428+ out_Ninf (dd,isp) = NageS (MaxAge[isp], isp);
429+ out_SSB (dd,isp) = SpawnBio[isp];
430+ out_eggs (dd,isp) = EggsStanza[isp];
431+ for (ist=1 ; ist<=Nstanzas[isp]; ist++){
432+ sind++;
433+ out_Nrec (dd,sind) = NageS (Age1 (isp,ist), isp);
434+ out_Wrec (dd,sind) = WageS (Age1 (isp,ist), isp);
435+ }
436+ }
437+ // std::cout << "x4";
411438 } // End of main months loop
412439
413440 }// End of years loop
@@ -432,7 +459,13 @@ int y, m, dd;
432459 _[" annual_Catch" ]=annual_Catch,
433460 _[" annual_Biomass" ]=annual_Biomass,
434461 _[" annual_QB" ]=annual_QB,
435- _[" annual_Qlink" ]=annual_Qlink,
462+ _[" annual_Qlink" ]=annual_Qlink,
463+ _[" out_SSB" ]=out_SSB,
464+ _[" out_eggs" ]=out_eggs,
465+ _[" out_Winf" ]=out_Winf,
466+ _[" out_Ninf" ]=out_Ninf,
467+ _[" out_Nrec" ]=out_Nrec,
468+ _[" out_Wrec" ]=out_Wrec,
436469 _[" end_state" ]=state,
437470 _[" crash_year" ]=CRASH_YEAR,
438471 _[" dyt" ]=dyt);
0 commit comments