Skip to content

Commit 8052486

Browse files
authored
Merge pull request ITHACA-FV#645 from Ruansh233/cout2Info
Modify std::cout to Info
2 parents cca8426 + e3a2bb7 commit 8052486

84 files changed

Lines changed: 875 additions & 827 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

applications/POD/perform_POD.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
8989
if(pod_exist == 1)
9090
{
9191
Info << "The POD has already been performed, please delete the ITHACAoutput folder and try again." << endl;
92-
exit(0);
92+
return 0;
9393
}
9494

9595
// Initialize Variables

src/ITHACA_CORE/Containers/Modes.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ void Modes<Type, PatchField, GeoMesh>::projectSnapshots(
455455
}
456456
else
457457
{
458-
std::cout << "Inner product not defined" << endl;
458+
Foam::Info << "Inner product not defined" << Foam::endl;
459459
exit(0);
460460
}
461461

src/ITHACA_CORE/ITHACAPOD/ITHACAPOD.C

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void getModes(
160160
if (para->eigensolver == "spectra")
161161
{
162162
Spectra::SymEigsSolver<Spectra::DenseSymMatProd<double>> es(op, nmodes, ncv);
163-
std::cout << "Using Spectra EigenSolver " << std::endl;
163+
Info << "Using Spectra EigenSolver " << endl;
164164
es.init();
165165
es.compute(Spectra::SortRule::LargestAlge);
166166
M_Assert(es.info() == Spectra::CompInfo::Successful,
@@ -170,7 +170,7 @@ void getModes(
170170
}
171171
else if (para->eigensolver == "eigen")
172172
{
173-
std::cout << "Using Eigen EigenSolver " << std::endl;
173+
Info << "Using Eigen EigenSolver " << endl;
174174
esEg.compute(_corMatrix);
175175
M_Assert(esEg.info() == Eigen::Success,
176176
"The Eigenvalue Decomposition did not succeed");
@@ -250,7 +250,8 @@ void getModes(
250250
modesEigBC[i] = (SnapMatrixBC[i] * eigenVectoreig);
251251
}
252252

253-
std::cout << normFact << std::endl;
253+
Info << endl << "####### Normalized Eigenvalues of " << snapshots[0].name()
254+
<< " #######" << endl << normFact << endl << endl;
254255

255256
for (label i = 0; i < nmodes; i++)
256257
{
@@ -369,7 +370,7 @@ void getModesMemoryEfficient(
369370
fileName rootPath(".");
370371
Foam::Time runTime2(Foam::Time::controlDictName, rootPath, snapshotsPath);
371372
label nSnaps = runTime2.times().size() - 2;
372-
std::cout << "Found " << nSnaps << " time directories" << endl;
373+
Info << "Found " << nSnaps << " time directories" << endl;
373374

374375
// Verify we have at least one snapshot
375376
if (nSnaps < 1)
@@ -482,7 +483,7 @@ void getModesMemoryEfficient(
482483
if (para->eigensolver == "spectra")
483484
{
484485
// Use Spectra solver for large eigenvalue problems
485-
std::cout << "Using Spectra EigenSolver " << std::endl;
486+
Info << "Using Spectra EigenSolver " << endl;
486487
Spectra::DenseSymMatProd<double> op(_corMatrix);
487488
Spectra::SymEigsSolver<Spectra::DenseSymMatProd<double >>
488489
solver(op, nmodes, nSnaps);
@@ -496,7 +497,7 @@ void getModesMemoryEfficient(
496497
else if (para->eigensolver == "eigen")
497498
{
498499
// Use Eigen solver for smaller problems
499-
std::cout << "Using Eigen EigenSolver " << std::endl;
500+
Info << "Using Eigen EigenSolver " << endl;
500501
Eigen::SelfAdjointEigenSolver<Eigen::MatrixXd> solver(_corMatrix);
501502
M_Assert(solver.info() == Eigen::Success,
502503
"Eigenvalue decomposition failed");
@@ -666,7 +667,7 @@ void getMeanMemoryEfficient(
666667
fileName rootPath(".");
667668
Foam::Time runTime2(Foam::Time::controlDictName, rootPath, snapshotsPath);
668669
label nSnaps = runTime2.times().size() - 2;
669-
std::cout << "Found " << nSnaps << " time directories" << endl;
670+
Info << "Found " << nSnaps << " time directories" << endl;
670671

671672
// Compute mean field
672673
if (!meanex)
@@ -746,7 +747,7 @@ void getWeightedModes(
746747

747748
if (para->eigensolver == "spectra")
748749
{
749-
std::cout << "Using Spectra EigenSolver " << std::endl;
750+
Info << "Using Spectra EigenSolver " << endl;
750751
es.init();
751752
es.compute(Spectra::SortRule::LargestAlge);
752753
M_Assert(es.info() == Spectra::CompInfo::Successful,
@@ -756,7 +757,7 @@ void getWeightedModes(
756757
}
757758
else if (para->eigensolver == "eigen")
758759
{
759-
std::cout << "Using Eigen EigenSolver " << std::endl;
760+
Info << "Using Eigen EigenSolver " << endl;
760761
esEg.compute(_corMatrix);
761762
M_Assert(esEg.info() == Eigen::Success,
762763
"The Eigenvalue Decomposition did not succeed");
@@ -1179,9 +1180,9 @@ DEIMmodes(List<Eigen::SparseMatrix<double >>& A,
11791180
{
11801181
if (nmodesA > A.size() - 2 || nmodesB > A.size() - 2 )
11811182
{
1182-
std::cout <<
1183+
Info <<
11831184
"The number of requested modes cannot be bigger than the number of Snapshots - 2"
1184-
<< std::endl;
1185+
<< endl;
11851186
exit(0);
11861187
}
11871188

@@ -1433,7 +1434,7 @@ void getModes(
14331434
}
14341435
}
14351436

1436-
std::cout << std::endl;
1437+
Info << endl;
14371438

14381439
for (label i = 1; i < snapshots.size(); i++)
14391440
{
@@ -1456,7 +1457,7 @@ void getModes(
14561457
{
14571458
Spectra::SymEigsSolver< Spectra::DenseSymMatProd<double >>
14581459
es(op, nmodes, ncv);
1459-
std::cout << "Using Spectra EigenSolver " << std::endl;
1460+
Info << "Using Spectra EigenSolver " << endl;
14601461
es.init();
14611462
es.compute(Spectra::SortRule::LargestAlge);
14621463
M_Assert(es.info() == Spectra::CompInfo::Successful,
@@ -1466,7 +1467,7 @@ void getModes(
14661467
}
14671468
else if (para->eigensolver == "eigen")
14681469
{
1469-
std::cout << "Using Eigen EigenSolver " << std::endl;
1470+
Info << "Using Eigen EigenSolver " << endl;
14701471
esEg.compute(_corMatrix);
14711472
M_Assert(esEg.info() == Eigen::Success,
14721473
"The Eigenvalue Decomposition did not succeed");
@@ -1800,7 +1801,7 @@ PtrList<GeometricField<Type, PatchField, GeoMesh >> DEIMmodes(
18001801
{
18011802
Spectra::SymEigsSolver< Spectra::DenseSymMatProd<double >>
18021803
es(op, nmodes, ncv);
1803-
std::cout << "Using Spectra EigenSolver " << std::endl;
1804+
Info << "Using Spectra EigenSolver " << endl;
18041805
es.init();
18051806
es.compute(Spectra::SortRule::LargestAlge);
18061807
M_Assert(es.info() == Spectra::CompInfo::Successful,
@@ -1810,7 +1811,7 @@ PtrList<GeometricField<Type, PatchField, GeoMesh >> DEIMmodes(
18101811
}
18111812
else if (para->eigensolver == "eigen")
18121813
{
1813-
std::cout << "Using Eigen EigenSolver " << std::endl;
1814+
Info << "Using Eigen EigenSolver " << endl;
18141815
esEg.compute(_corMatrix);
18151816
M_Assert(esEg.info() == Eigen::Success,
18161817
"The Eigenvalue Decomposition did not succeed");
@@ -1874,7 +1875,7 @@ PtrList<GeometricField<Type, PatchField, GeoMesh >> DEIMmodes(
18741875
modesEigBC[i] = (SnapMatrixBC[i] * eigenVectoreig);
18751876
}
18761877

1877-
std::cout << normFact << std::endl;
1878+
Info << normFact << endl;
18781879

18791880
for (label i = 0; i < nmodes; i++)
18801881
{
@@ -1991,7 +1992,7 @@ void getModes(
19911992
{
19921993
Spectra::SymEigsSolver<Spectra::DenseSymMatProd<double >>
19931994
es(op, nmodes, ncv);
1994-
std::cout << "Using Spectra EigenSolver " << std::endl;
1995+
Info << "Using Spectra EigenSolver " << endl;
19951996
es.init();
19961997
es.compute(Spectra::SortRule::LargestAlge);
19971998
M_Assert(es.info() == Spectra::CompInfo::Successful,
@@ -2001,7 +2002,7 @@ void getModes(
20012002
}
20022003
else if (para->eigensolver == "eigen")
20032004
{
2004-
std::cout << "Using Eigen EigenSolver " << std::endl;
2005+
Info << "Using Eigen EigenSolver " << endl;
20052006
esEg.compute(_corMatrix);
20062007
M_Assert(esEg.info() == Eigen::Success,
20072008
"The Eigenvalue Decomposition did not succeed");

src/ITHACA_CORE/ITHACAPOD/incrementalPOD.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ incrementalPOD<Type, PatchField, GeoMesh>::projectSnapshot(
316316
}
317317
else
318318
{
319-
std::cout << "Inner product not defined" << endl;
319+
Foam::Info << "Inner product not defined" << Foam::endl;
320320
exit(0);
321321
}
322322

@@ -367,7 +367,7 @@ void incrementalPOD<Type, PatchField, GeoMesh>::projectSnapshots(
367367
}
368368
else
369369
{
370-
std::cout << "Inner product not defined" << endl;
370+
Foam::Info << "Inner product not defined" << Foam::endl;
371371
exit(0);
372372
}
373373

src/ITHACA_CORE/ITHACAregularization/ITHACAregularization.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ Eigen::VectorXd Tikhonov(Eigen::MatrixXd A,
115115
Eigen::MatrixXd::Identity(A.rows(), A.cols());
116116
Eigen::MatrixXd bNew = A.transpose() * b;
117117
Eigen::VectorXd x = A.inverse() * b;
118-
std::cout << "x = \n" << x.transpose() << std::endl;
118+
Info << "x = \n" << x.transpose() << endl;
119119
x = Anew.inverse() * bNew;
120-
std::cout << "xNew = \n" << x.transpose() << std::endl;
120+
Info << "xNew = \n" << x.transpose() << endl;
121121
return x;
122122
}
123123
}

src/ITHACA_CORE/ITHACAsensitivity/FiguresOfMerit/Ptot.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void Ptot::buildMO(std::string dir)
3838
}
3939
else
4040
{
41-
std::cout << "Outputs of the model are not computed yet, programm aborted" <<
42-
std::endl;
41+
Foam::Info << "Outputs of the model are not computed yet, programm aborted" <<
42+
Foam::endl;
4343
}
4444
}

src/ITHACA_CORE/ITHACAsensitivity/FiguresOfMerit/Ptot_time.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void Ptot_time::buildMO(std::string dir, label t)
4545
}
4646
else
4747
{
48-
std::cout << "Outputs of the model are not computed yet, programm aborted" <<
49-
std::endl;
48+
Foam::Info << "Outputs of the model are not computed yet, programm aborted" <<
49+
Foam::endl;
5050
}
5151
}

src/ITHACA_CORE/ITHACAsensitivity/FiguresOfMerit/Tm.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ void Tm::buildMO(std::string dir)
3838
}
3939
else
4040
{
41-
std::cout << "Outputs of the model are not computed yet, programm aborted" <<
42-
std::endl;
41+
Foam::Info << "Outputs of the model are not computed yet, programm aborted" <<
42+
Foam::endl;
4343
exit(0);
4444
}
4545
}

src/ITHACA_CORE/ITHACAsensitivity/FiguresOfMerit/Tm_time.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ void Tm_time::buildMO(std::string dir, label t)
4545
}
4646
else
4747
{
48-
std::cout << "Outputs of the model are not computed yet, programm aborted" <<
49-
std::endl;
48+
Foam::Info << "Outputs of the model are not computed yet, programm aborted" <<
49+
Foam::endl;
5050
exit(0);
5151
}
5252
}

src/ITHACA_CORE/ITHACAsensitivity/ITHACAsampling.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ Eigen::VectorXd ITHACAsampling::samplingMC(std::string pdftype, double& lowerE,
6767
}
6868
else
6969
{
70-
std::cout << "pdf '" << pdftype << "' not implemented, programm aborted" <<
71-
std::endl;
70+
Foam::Info << "pdf '" << pdftype << "' not implemented, programm aborted" <<
71+
Foam::endl;
7272
exit(0);
7373
}
7474

0 commit comments

Comments
 (0)