Skip to content

Commit 7fd333b

Browse files
committed
Rename DataFiles to TrajectoryDataFiles.
1 parent 55a1ac4 commit 7fd333b

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

include/output.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ class Output{
5555
void writeGradient(Vec grad);
5656

5757
/* Open, write and close files for fullstate and expected energy levels over time */
58-
void openDataFiles(std::string prefix, int initid);
59-
void writeDataFiles(int timestep, double time, const Vec state, MasterEq* mastereq);
60-
void closeDataFiles();
58+
void openTrajectoryDataFiles(std::string prefix, int initid);
59+
void writeTrajectoryDataFiles(int timestep, double time, const Vec state, MasterEq* mastereq);
60+
void closeTrajectoryDataFiles();
6161

6262
};

include/timestepper.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class TimeStepper{
2828
int ntime; // number of time steps
2929
double total_time; // final time
3030
double dt; // time step size
31-
bool writeDataFiles; /* Flag to determine whether or not trajectory data will be written to files during forward simulation */
31+
bool writeTrajectoryDataFiles; /* Flag to determine whether or not trajectory data will be written to files during forward simulation */
3232

3333
Vec redgrad; /* Reduced gradient */
3434

src/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ int main(int argc,char **argv)
413413
optimctx->getStartingPoint(xinit);
414414
VecCopy(xinit, optimctx->xinit); // Store the initial guess
415415
if (mpirank_world == 0 && !quietmode) printf("\nStarting primal solver... \n");
416-
optimctx->timestepper->writeDataFiles = true;
416+
optimctx->timestepper->writeTrajectoryDataFiles = true;
417417
objective = optimctx->evalF(xinit);
418418
if (mpirank_world == 0 && !quietmode) printf("\nTotal objective = %1.14e, \n", objective);
419419
optimctx->getSolution(&opt);
@@ -424,7 +424,7 @@ int main(int argc,char **argv)
424424
optimctx->getStartingPoint(xinit);
425425
VecCopy(xinit, optimctx->xinit); // Store the initial guess
426426
if (mpirank_world == 0 && !quietmode) printf("\nStarting adjoint solver...\n");
427-
optimctx->timestepper->writeDataFiles = true;
427+
optimctx->timestepper->writeTrajectoryDataFiles = true;
428428
optimctx->evalGradF(xinit, grad);
429429
VecNorm(grad, NORM_2, &gnorm);
430430
// VecView(grad, PETSC_VIEWER_STDOUT_WORLD);
@@ -440,7 +440,7 @@ int main(int argc,char **argv)
440440
optimctx->getStartingPoint(xinit);
441441
VecCopy(xinit, optimctx->xinit); // Store the initial guess
442442
if (mpirank_world == 0 && !quietmode) printf("\nStarting Optimization solver ... \n");
443-
optimctx->timestepper->writeDataFiles = false;
443+
optimctx->timestepper->writeTrajectoryDataFiles = false;
444444
optimctx->solve(xinit);
445445
optimctx->getSolution(&opt);
446446
}

src/optimproblem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ PetscErrorCode TaoMonitor(Tao tao,void*ptr){
633633
ctx->output->writeControls(params, ctx->timestepper->mastereq, ctx->timestepper->ntime, ctx->timestepper->dt);
634634

635635
// do one last forward evaluation while writing trajectory files
636-
ctx->timestepper->writeDataFiles = true;
636+
ctx->timestepper->writeTrajectoryDataFiles = true;
637637
ctx->evalF(params);
638638

639639
// Print stopping reason to screen

src/output.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void Output::writeControls(Vec params, MasterEq* mastereq, int ntime, double dt)
156156
}
157157

158158

159-
void Output::openDataFiles(std::string prefix, int initid){
159+
void Output::openTrajectoryDataFiles(std::string prefix, int initid){
160160
char filename[255];
161161

162162
// On the first petsc rank, open required files and print header information
@@ -200,7 +200,7 @@ void Output::openDataFiles(std::string prefix, int initid){
200200
}
201201
}
202202

203-
void Output::writeDataFiles(int timestep, double time, const Vec state, MasterEq* mastereq){
203+
void Output::writeTrajectoryDataFiles(int timestep, double time, const Vec state, MasterEq* mastereq){
204204

205205
/* Write output only every <num> time-steps */
206206
if (timestep % output_frequency == 0) {
@@ -272,7 +272,7 @@ void Output::writeDataFiles(int timestep, double time, const Vec state, MasterEq
272272
}
273273
}
274274

275-
void Output::closeDataFiles(){
275+
void Output::closeTrajectoryDataFiles(){
276276

277277
/* Close output data files */
278278
if (ufile != NULL) {

src/timestepper.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ TimeStepper::TimeStepper() {
99
dt = 0.0;
1010
storeFWD = false;
1111
MPI_Comm_rank(MPI_COMM_WORLD, &mpirank_world);
12-
writeDataFiles = false;
12+
writeTrajectoryDataFiles = false;
1313
}
1414

1515
TimeStepper::TimeStepper(MasterEq* mastereq_, int ntime_, double total_time_, Output* output_, bool storeFWD_) : TimeStepper() {
@@ -86,8 +86,8 @@ Vec TimeStepper::getState(size_t tindex){
8686
Vec TimeStepper::solveODE(int initid, Vec rho_t0){
8787

8888
/* Open output files */
89-
if (writeDataFiles) {
90-
output->openDataFiles("rho", initid);
89+
if (writeTrajectoryDataFiles) {
90+
output->openTrajectoryDataFiles("rho", initid);
9191
}
9292

9393
/* Set initial condition */
@@ -118,8 +118,8 @@ Vec TimeStepper::solveODE(int initid, Vec rho_t0){
118118

119119
/* store and write current state. */
120120
if (storeFWD) VecCopy(x, store_states[n]);
121-
if (writeDataFiles) {
122-
output->writeDataFiles(n, tstart, x, mastereq);
121+
if (writeTrajectoryDataFiles) {
122+
output->writeTrajectoryDataFiles(n, tstart, x, mastereq);
123123
}
124124

125125
/* Take one time step */
@@ -159,9 +159,9 @@ Vec TimeStepper::solveODE(int initid, Vec rho_t0){
159159
}
160160

161161
/* Write last time step and close files */
162-
if (writeDataFiles) {
163-
output->writeDataFiles(ntime, ntime*dt, x, mastereq);
164-
output->closeDataFiles();
162+
if (writeTrajectoryDataFiles) {
163+
output->writeTrajectoryDataFiles(ntime, ntime*dt, x, mastereq);
164+
output->closeTrajectoryDataFiles();
165165
}
166166

167167

0 commit comments

Comments
 (0)