You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compute trajectory output only if requested in the config.
Previously, trajectory output for the expected energy level and the
population were computed even though they were not written to files,
which increases compute time because this is done at each time step.
Now, the values are only computed if the user had requested this output
in the configuration file.
The configuration string is parsed in the constructor of the Output
class, which stores booleans to determine which output was requested by
the user. If booleans are true, the 0-th petsc rank opens the files,
writes the data per timestep, and closes the files.
Note that computing reduced output values per oscillator require an MPI
allreduce over all petsc ranks. Hence, all petsc ranks need to compute
the output whereas only the 0-th rank writes them to the open file.
Copy file name to clipboardExpand all lines: include/output.hpp
+10-4Lines changed: 10 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -19,13 +19,19 @@ class Output{
19
19
int output_frequency; /* Output frequency in time domain: write output at every <num> time step. */
20
20
std::vector<std::vector<std::string> > outputstr; // List of outputs for each oscillator
21
21
22
-
boolwritefullstate; /* Flag to determin if full state vector should be written to file */
22
+
boolwriteFullState; /* Flag to determine if full state vector should be written to file */
23
23
FILE *ufile; /* File for writing real part of solution vector */
24
24
FILE *vfile; /* File for writing imaginary part of solution vector */
25
-
std::vector<FILE *>expectedfile; /* Files for writing the evolution of the expected energy levels per oscillator */
26
-
FILE *expectedfile_comp; /* File for writing the evolution of the expected energy level of the composite system */
27
-
FILE *populationfile_comp; /* File for writing the evolution of the population of the composite system */
25
+
26
+
std::vector<bool> writeExpectedEnergy; ///< Flag to determine if the evolution of the expected energy per oscillator should be written to files.
27
+
bool writeExpectedEnergy_comp; ///< Flag to determine if the evolution of the expected energy of the full composite system should be written to file
28
+
std::vector<FILE *>expectedfile; /* Files for writing the evolution of the expected energy per oscillator */
29
+
FILE *expectedfile_comp; /* File for writing the evolution of the expected energy level of the full composite system */
30
+
31
+
std::vector<bool> writePopulation; ///< Flag to determine if the evolution of the energy level occupations per oscillator should be written to files.
32
+
bool writePopulation_comp; ///< Flag to determine if the evolution of the energy level occupations of the full composite system should be written to file
28
33
std::vector<FILE *>populationfile; /* Files for writing population over time */
34
+
FILE *populationfile_comp; /* File for writing the evolution of the population of the composite system */
29
35
30
36
// VecScatter scat; /* Petsc's scatter context to communicate a state across petsc's cores */
0 commit comments