Skip to content

Commit

Permalink
Merge pull request #415 from DrylandEcology/feature_SeparateRunDomOutput
Browse files Browse the repository at this point in the history
Reduce the copying of domain-specific information throughout simulation runs achieved by the changes
* Rename SW_ALL to SW_RUN to clarify that the information within it is simulation-dependent (#412)
* Remove SW_OUTPUT, SW_OUTPUT_POINTERS, SW_GEN_OUT
* Create two new structs: SW_OUT_DOM and SW_OUT_RUN (#395)
  • Loading branch information
N1ckP3rsl3y authored Jul 8, 2024
2 parents 90f30c0 + 0b334f1 commit 4dfbbab
Show file tree
Hide file tree
Showing 30 changed files with 3,570 additions and 3,115 deletions.
36 changes: 15 additions & 21 deletions include/SW_Control.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define SW_CONTROL_H

#include "include/generic.h" // for Bool
#include "include/SW_datastructs.h" // for SW_ALL, LOG_INFO, SW_DOMAIN, SW_OU...
#include "include/SW_datastructs.h" // for SW_RUN, LOG_INFO, SW_DOMAIN, SW_OU...

#ifdef __cplusplus
extern "C" {
Expand All @@ -28,51 +28,45 @@ extern "C" {
/* =================================================== */
/* Global Function Declarations */
/* --------------------------------------------------- */
void SW_CTL_init_ptrs(SW_ALL *sw);
void SW_CTL_init_ptrs(SW_RUN *sw);

void SW_CTL_alloc_outptrs(SW_ALL *sw, LOG_INFO *LogInfo);
void SW_CTL_alloc_outptrs(SW_RUN *sw, LOG_INFO *LogInfo);

void SW_ALL_deepCopy(SW_ALL *source, SW_ALL *dest, LOG_INFO *LogInfo);
void SW_RUN_deepCopy(
SW_RUN *source, SW_RUN *dest, SW_OUT_DOM *DomRun, LOG_INFO *LogInfo
);

void SW_CTL_setup_domain(
unsigned long userSUID, SW_DOMAIN *SW_Domain, LOG_INFO *LogInfo
);

void SW_CTL_setup_model(
SW_ALL *sw, SW_OUTPUT_POINTERS *SW_OutputPtrs, LOG_INFO *LogInfo
);
void SW_CTL_setup_model(SW_RUN *sw, SW_OUT_DOM *OutDom, LOG_INFO *LogInfo);

void SW_CTL_clear_model(Bool full_reset, SW_ALL *sw);
void SW_CTL_clear_model(Bool full_reset, SW_RUN *sw);

void SW_CTL_init_run(SW_ALL *sw, LOG_INFO *LogInfo);
void SW_CTL_init_run(SW_RUN *sw, LOG_INFO *LogInfo);

void SW_CTL_read_inputs_from_disk(
SW_ALL *sw, PATH_INFO *PathInfo, LOG_INFO *LogInfo
SW_RUN *sw, SW_OUT_DOM *OutDom, PATH_INFO *PathInfo, LOG_INFO *LogInfo
);

void SW_CTL_main(
SW_ALL *sw, SW_OUTPUT_POINTERS *SW_OutputPtrs, LOG_INFO *LogInfo
);
void SW_CTL_main(SW_RUN *sw, SW_OUT_DOM *OutDom, LOG_INFO *LogInfo);

void SW_CTL_RunSimSet(
SW_ALL *sw_template,
SW_OUTPUT_POINTERS SW_OutputPtrs[],
SW_RUN *sw_template,
SW_DOMAIN *SW_Domain,
SW_WALLTIME *SW_WallTime,
LOG_INFO *main_LogInfo
);

void SW_CTL_run_current_year(
SW_ALL *sw, SW_OUTPUT_POINTERS *SW_OutputPtrs, LOG_INFO *LogInfo
);
void SW_CTL_run_current_year(SW_RUN *sw, SW_OUT_DOM *OutDom, LOG_INFO *LogInfo);

void SW_CTL_run_spinup(SW_ALL *sw, LOG_INFO *LogInfo);
void SW_CTL_run_spinup(SW_RUN *sw, SW_OUT_DOM *OutDom, LOG_INFO *LogInfo);

void SW_CTL_run_sw(
SW_ALL *sw_template,
SW_RUN *sw_template,
SW_DOMAIN *SW_Domain,
unsigned long ncSuid[],
SW_OUTPUT_POINTERS SW_OutputPtrs[],
LOG_INFO *LogInfo
);

Expand Down
4 changes: 2 additions & 2 deletions include/SW_Flow.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef SW_FLOW_H
#define SW_FLOW_H

#include "include/SW_datastructs.h" // for SW_ALL, SW_SOILWAT, LOG_INFO
#include "include/SW_datastructs.h" // for SW_RUN, SW_SOILWAT, LOG_INFO

#ifdef __cplusplus
extern "C" {
Expand All @@ -12,7 +12,7 @@ extern "C" {
/* --------------------------------------------------- */
void SW_FLW_init_run(SW_SOILWAT *SW_SoilWat);

void SW_Water_Flow(SW_ALL *sw, LOG_INFO *LogInfo);
void SW_Water_Flow(SW_RUN *sw, LOG_INFO *LogInfo);


#ifdef __cplusplus
Expand Down
Loading

0 comments on commit 4dfbbab

Please sign in to comment.