Skip to content

Commit

Permalink
Fix issue with Database class (#276)
Browse files Browse the repository at this point in the history
* Add test for writeSnapshot/endSamples in CI

* Fix test return value

* Remove unused status variable

* Fix bug with assert statements in BasisReader

* Remove unused function
  • Loading branch information
ckendrick authored May 16, 2024
1 parent f1e15d8 commit d7b275e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/run_tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ runs:
./tests/test_Vector
./tests/test_Matrix
mpirun -n 3 --oversubscribe ./tests/test_Matrix
./tests/smoke_static
./tests/test_DEIM
./tests/test_GNAT
./tests/test_QDEIM
Expand Down
6 changes: 3 additions & 3 deletions lib/linalg/BasisReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ BasisReader::getSpatialBasis(
int num_cols = getNumSamples("basis");

char tmp[100];
CAROM_VERIFY(0 < start_col <= num_cols);
CAROM_VERIFY(0 < start_col && start_col <= num_cols);
CAROM_VERIFY(start_col <= end_col && end_col <= num_cols);
int num_cols_to_read = end_col - start_col + 1;

Expand Down Expand Up @@ -177,7 +177,7 @@ BasisReader::getTemporalBasis(
int num_cols = getNumSamples("temporal_basis");

char tmp[100];
CAROM_VERIFY(0 < start_col <= num_cols);
CAROM_VERIFY(0 < start_col && start_col <= num_cols);
CAROM_VERIFY(start_col <= end_col && end_col <= num_cols);
int num_cols_to_read = end_col - start_col + 1;

Expand Down Expand Up @@ -351,7 +351,7 @@ BasisReader::getSnapshotMatrix(
int num_rows = getDim("snapshot");
int num_cols = getNumSamples("snapshot");

CAROM_VERIFY(0 < start_col <= num_cols);
CAROM_VERIFY(0 < start_col && start_col <= num_cols);
CAROM_VERIFY(start_col <= end_col && end_col <= num_cols);
int num_cols_to_read = end_col - start_col + 1;

Expand Down
6 changes: 0 additions & 6 deletions lib/utils/Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@

namespace CAROM {

bool fileExists(const std::string& name)
{
std::ifstream f(name.c_str());
return f.good();
// ifstream f will be closed upon the end of the function.
}

Database::Database()
{
Expand Down
1 change: 0 additions & 1 deletion lib/utils/Database.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

namespace CAROM {

bool fileExists(const std::string& name);

/**
* Class Database is an abstract base class that provides basic ability to
Expand Down
4 changes: 1 addition & 3 deletions unit_tests/smoke_static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ main(
return 1;
}

bool status = false;

// Define the values for the first sample.
double vals0[6] = {1.0, 6.0, 3.0, 8.0, 17.0, 9.0};

Expand Down Expand Up @@ -144,5 +142,5 @@ main(

// Finalize MPI and return.
MPI_Finalize();
return !status;
return 0;
}

0 comments on commit d7b275e

Please sign in to comment.