diff --git a/CMakeLists.txt b/CMakeLists.txt index 71d0a2d71..6dd2f8bdb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,133 +110,45 @@ set(CAROM_HAVE_LAPACK ${LAPACK_FOUND}) set(CAROM_HAVE_HDF5 ${HDF5_FOUND}) if (USE_MFEM) - find_library(MFEM mfem "${CMAKE_SOURCE_DIR}/dependencies/mfem" "${MFEM_DIR}/lib") - find_library(HYPRE HYPRE "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/lib" "${HYPRE_DIR}/lib") - find_library(PARMETIS parmetis "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libparmetis" "${PARMETIS_DIR}/lib") - find_library(METIS metis "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libmetis" "${METIS_DIR}/lib") - find_path(MFEM_INCLUDES mfem.hpp "${CMAKE_SOURCE_DIR}/dependencies/mfem" "${MFEM_DIR}/include") - find_path(HYPRE_INCLUDES HYPRE.h "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/include" "${HYPRE_DIR}/include") - find_path(PARMETIS_INCLUDES metis.h "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/metis/include" "${PARMETIS_DIR}/metis/include") + # Try to find MFEM installed using cmake + find_package(mfem NAMES MFEM HINTS "${MFEM_DIR}" + "${MFEM_DIR}/lib/cmake/mfem" "${CMAKE_SOURCE_DIR}/dependencies/mfem/lib/cmake/mfem" NO_DEFAULT_PATH QUIET) + if (mfem_FOUND) + message(STATUS "Found mfem config in: ${mfem_DIR} (version ${MFEM_VERSION})") + else() + # Try to find MFEM installed using configure + find_library(MFEM mfem HINTS "${MFEM_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/mfem") + find_library(HYPRE HYPRE HINTS "${HYPRE_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/lib") + find_library(PARMETIS parmetis HINTS "${PARMETIS_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libparmetis") + find_library(METIS metis HINTS "${METIS_DIR}/lib" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/build/lib/libmetis") + find_path(MFEM_INCLUDES mfem.hpp HINTS "${MFEM_DIR}/include" "${CMAKE_SOURCE_DIR}/dependencies/mfem") + find_path(HYPRE_INCLUDES HYPRE.h HINTS "${HYPRE_DIR}/include" "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/include") + find_path(PARMETIS_INCLUDES metis.h "${PARMETIS_DIR}/metis/include" "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/metis/include") + + if (${MFEM} STREQUAL "MFEM-NOTFOUND") + error( "MFEM not found" ) + else() + message(STATUS "MFEM library:" ${MFEM}) + message(STATUS "MFEM includes:" ${MFEM_INCLUDES}) + endif() + endif() endif() -add_subdirectory(lib) +set(CAROM_LIBS ${MPI_C_LINK_FLAGS} ${MPI_C_LIBRARIES} ${MPI_CXX_LIBRARIES} MPI::MPI_C ${MPI_FORTRAN_LINK_FLAGS} ${MPI_FORTRAN_LIBRARIES} MPI::MPI_Fortran) +set(CAROM_INCS ${CMAKE_CURRENT_SOURCE_DIR} ${MPI_C_INCLUDE_DIRS}) -# Use the C++11 standard as an entire feature instead of -# enumerating individual compiler features for simplicity -target_compile_features(ROM PRIVATE cxx_std_11) +add_subdirectory(lib) if (ENABLE_EXAMPLES) + add_subdirectory(examples/misc) if (USE_MFEM) - set(examples - poisson_global_rom - poisson_local_rom_greedy - dg_advection_global_rom - dg_advection_local_rom_matrix_interp - mixed_nonlinear_diffusion - nonlinear_elasticity_global_rom - linear_elasticity_global_rom - maxwell_global_rom - de_parametric_maxwell_greedy - maxwell_local_rom_greedy - grad_div_global_rom - elliptic_eigenproblem_global_rom - dg_advection - nonlinear_elasticity - heat_conduction - heat_conduction_dmdc - parametric_heat_conduction - de_parametric_heat_conduction_greedy - de_dg_advection_greedy - wave_equation - dg_euler - local_dw_csv - parametric_tw_csv - parametric_dw_csv - parametric_dmdc_heat_conduction) - set(example_directories - prom - prom - prom - prom - prom - prom - prom - prom - prom - prom - prom - prom - dmd - dmd - dmd - dmd - dmd - dmd - dmd - dmd - dmd - dmd - dmd - dmd - dmd) - - list(LENGTH examples len1) - math(EXPR len2 "${len1} - 1") - - foreach(val RANGE ${len2}) - list(GET examples ${val} name) - list(GET example_directories ${val} example_dir) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/examples/${example_dir}) - add_executable(${name} examples/${example_dir}/${name}.cpp) - - target_link_libraries(${name} - PRIVATE ROM ${MPI_C_LINK_FLAGS} ${MPI_C_LIBRARIES} MPI::MPI_C ${MPI_FORTRAN_LINK_FLAGS} ${MPI_FORTRAN_LIBRARIES} MPI::MPI_Fortran) - target_include_directories(${name} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - ${MPI_C_INCLUDE_DIRS}) - target_compile_features(${name} PRIVATE cxx_std_11) - endforeach() # IN LISTS examples + add_subdirectory(examples/prom) + add_subdirectory(examples/dmd) file(COPY examples/data DESTINATION ${CMAKE_BINARY_DIR}/examples) file(COPY examples/merlin DESTINATION ${CMAKE_BINARY_DIR}/examples) file(COPY examples/dmd/heat_conduction_csv.sh DESTINATION ${CMAKE_BINARY_DIR}/examples/dmd) file(COPY examples/dmd/heat_conduction_hdf.sh DESTINATION ${CMAKE_BINARY_DIR}/examples/dmd) - endif() - - set(misc_example_names - combine_samples) - - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/examples/misc) - - foreach(name IN LISTS misc_example_names) - add_executable(${name} examples/misc/${name}.cpp) - - target_link_libraries(${name} - PRIVATE ROM ${MPI_C_LINK_FLAGS} ${MPI_C_LIBRARIES} MPI::MPI_C ${MPI_FORTRAN_LINK_FLAGS} ${MPI_FORTRAN_LIBRARIES} MPI::MPI_Fortran) - target_include_directories(${name} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - ${MPI_C_INCLUDE_DIRS}) - target_compile_features(${name} PRIVATE cxx_std_11) - endforeach(name) # IN LISTS misc_exmaple_names - - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests) - - if (USE_MFEM) - set(regression_test_names - basisComparator - checkError - computeSpeedup - solutionComparator - fileComparator) - - foreach(name IN LISTS regression_test_names) - add_executable(${name} regression_tests/${name}.cpp) - target_link_libraries(${name} - PRIVATE ROM ${MPI_C_LINK_FLAGS} ${MPI_C_LIBRARIES} MPI::MPI_C ${MPI_FORTRAN_LINK_FLAGS} ${MPI_FORTRAN_LIBRARIES} MPI::MPI_Fortran) - target_include_directories(${name} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - ${MPI_C_INCLUDE_DIRS}) - target_compile_features(${name} PRIVATE cxx_std_11) - endforeach(name) # IN LISTS regression_test_names + add_subdirectory(regression_tests) endif() endif(ENABLE_EXAMPLES) diff --git a/examples/dmd/CMakeLists.txt b/examples/dmd/CMakeLists.txt new file mode 100644 index 000000000..c45510d04 --- /dev/null +++ b/examples/dmd/CMakeLists.txt @@ -0,0 +1,31 @@ +############################################################################### +# +# Copyright (c) 2013-2024, Lawrence Livermore National Security, LLC +# and other libROM project developers. See the top-level COPYRIGHT +# file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +# +############################################################################### + +set(examples + dg_advection + nonlinear_elasticity + heat_conduction + heat_conduction_dmdc + parametric_heat_conduction + de_parametric_heat_conduction_greedy + de_dg_advection_greedy + wave_equation + dg_euler + local_dw_csv + parametric_tw_csv + parametric_dw_csv + parametric_dmdc_heat_conduction) + +foreach(name IN LISTS examples) + add_executable(${name} ${name}.cpp) + target_link_libraries(${name} PRIVATE ROM ${CAROM_LIBS}) + target_include_directories(${name} PRIVATE ${CAROM_INCS}) + target_compile_features(${name} PRIVATE cxx_std_17) +endforeach() diff --git a/examples/dmd/de_dg_advection_greedy.cpp b/examples/dmd/de_dg_advection_greedy.cpp index ce545bede..96b8da1d3 100644 --- a/examples/dmd/de_dg_advection_greedy.cpp +++ b/examples/dmd/de_dg_advection_greedy.cpp @@ -72,7 +72,18 @@ #include "utils/CSVDatabase.h" -using namespace std; +using std::vector; +using std::cout; +using std::endl; +using std::flush; +using std::max; +using std::min; +using std::to_string; +using std::ifstream; +using std::ofstream; +using std::ostringstream; +using std::setfill; +using std::setw; using namespace mfem; // Choice for the problem setup. The fluid velocity, initial condition and diff --git a/examples/dmd/de_parametric_heat_conduction_greedy.cpp b/examples/dmd/de_parametric_heat_conduction_greedy.cpp index b0a3aff09..d0435507e 100644 --- a/examples/dmd/de_parametric_heat_conduction_greedy.cpp +++ b/examples/dmd/de_parametric_heat_conduction_greedy.cpp @@ -70,7 +70,18 @@ #define mkdir(dir, mode) _mkdir(dir) #endif -using namespace std; +using std::vector; +using std::cout; +using std::endl; +using std::flush; +using std::max; +using std::min; +using std::to_string; +using std::ifstream; +using std::ofstream; +using std::ostringstream; +using std::setfill; +using std::setw; using namespace mfem; /** After spatial discretization, the conduction model can be written as: diff --git a/examples/dmd/heat_conduction_dmdc.cpp b/examples/dmd/heat_conduction_dmdc.cpp index 910b68215..c507e3ef0 100644 --- a/examples/dmd/heat_conduction_dmdc.cpp +++ b/examples/dmd/heat_conduction_dmdc.cpp @@ -210,7 +210,7 @@ int main(int argc, char *argv[]) // handle triangular, quadrilateral, tetrahedral and hexahedral meshes // with the same code. Mesh *mesh; - if (mesh_file == "") + if (strcmp(mesh_file, "") == 0 ) { mesh = new Mesh(Mesh::MakeCartesian2D(2, 2, Element::QUADRILATERAL)); } diff --git a/examples/dmd/parametric_dmdc_heat_conduction.cpp b/examples/dmd/parametric_dmdc_heat_conduction.cpp index b1692deb7..1b373e964 100644 --- a/examples/dmd/parametric_dmdc_heat_conduction.cpp +++ b/examples/dmd/parametric_dmdc_heat_conduction.cpp @@ -323,7 +323,7 @@ int main(int argc, char *argv[]) // handle triangular, quadrilateral, tetrahedral and hexahedral meshes // with the same code. Mesh *mesh; - if (mesh_file == "") + if (strcmp(mesh_file, "") == 0 ) { mesh = new Mesh(Mesh::MakeCartesian2D(2, 2, Element::QUADRILATERAL)); } diff --git a/examples/misc/CMakeLists.txt b/examples/misc/CMakeLists.txt new file mode 100644 index 000000000..c93e056ca --- /dev/null +++ b/examples/misc/CMakeLists.txt @@ -0,0 +1,9 @@ +set(examples + combine_samples) + +foreach(name IN LISTS examples) + add_executable(${name} ${name}.cpp) + target_link_libraries(${name} PRIVATE ROM ${CAROM_LIBS}) + target_include_directories(${name} PRIVATE ${CAROM_INCS}) + target_compile_features(${name} PRIVATE cxx_std_17) +endforeach() diff --git a/examples/prom/CMakeLists.txt b/examples/prom/CMakeLists.txt new file mode 100644 index 000000000..063018cfa --- /dev/null +++ b/examples/prom/CMakeLists.txt @@ -0,0 +1,28 @@ +############################################################################### +# +# Copyright (c) 2013-2024, Lawrence Livermore National Security, LLC +# and other libROM project developers. See the top-level COPYRIGHT +# file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +# +############################################################################### +set(examples + poisson_global_rom + poisson_local_rom_greedy + dg_advection_global_rom + dg_advection_local_rom_matrix_interp + mixed_nonlinear_diffusion + nonlinear_elasticity_global_rom + linear_elasticity_global_rom + maxwell_global_rom + de_parametric_maxwell_greedy + maxwell_local_rom_greedy + elliptic_eigenproblem_global_rom) + +foreach(name IN LISTS examples) + add_executable(${name} ${name}.cpp) + target_link_libraries(${name} PRIVATE ROM ${CAROM_LIBS}) + target_include_directories(${name} PRIVATE ${CAROM_INCS}) + target_compile_features(${name} PRIVATE cxx_std_17) +endforeach() diff --git a/examples/prom/de_parametric_maxwell_greedy.cpp b/examples/prom/de_parametric_maxwell_greedy.cpp index 86a283d88..f71a18b9d 100644 --- a/examples/prom/de_parametric_maxwell_greedy.cpp +++ b/examples/prom/de_parametric_maxwell_greedy.cpp @@ -72,7 +72,20 @@ #define mkdir(dir, mode) _mkdir(dir) #endif -using namespace std; +using std::vector; +using std::set; +using std::map; +using std::make_pair; +using std::string; +using std::cout; +using std::endl; +using std::flush; +using std::max; +using std::min; +using std::to_string; +using std::ifstream; +using std::ofstream; +using std::ostringstream; using namespace mfem; // Exact solution, E, and r.h.s., f. See below for implementation. diff --git a/examples/prom/elliptic_eigenproblem_global_rom.cpp b/examples/prom/elliptic_eigenproblem_global_rom.cpp index 7619486f8..c4cdc3979 100644 --- a/examples/prom/elliptic_eigenproblem_global_rom.cpp +++ b/examples/prom/elliptic_eigenproblem_global_rom.cpp @@ -234,7 +234,7 @@ int main(int argc, char *argv[]) // handle triangular, quadrilateral, tetrahedral and hexahedral meshes // with the same code. Mesh *mesh; - if (mesh_file == "") + if (strcmp(mesh_file, "") == 0 ) { mesh = new Mesh(Mesh::MakeCartesian2D(2, 2, Element::QUADRILATERAL)); } diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 873fd3db2..d3dd8fb5f 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -97,9 +97,9 @@ if (BLAS_LIBRARIES MATCHES ".*mkl.*") find_package(MKL COMPONENTS BLACS ScaLAPACK) if (NOT MKL_ScaLAPACK_FOUND) find_package(ScaLAPACK REQUIRED) - target_link_libraries(ROM PUBLIC ${ScaLAPACK_LIBRARIES}) + target_link_libraries(ROM PUBLIC ${ScaLAPACK_LIBRARIES} ${MFEM_LIBRARIES}) else() - target_link_libraries(ROM PUBLIC ${MKL_ScaLAPACK_LIBRARY} ${MKL_BLACS_LIBRARY} ${MKL_LIBRARIES}) + target_link_libraries(ROM PUBLIC ${MKL_ScaLAPACK_LIBRARY} ${MKL_BLACS_LIBRARY} ${MKL_LIBRARIES} ${MFEM_LIBRARIES}) target_include_directories(ROM PUBLIC ${MKL_INCLUDE_DIRS}) endif() else() # BLAS or LAPACK isn't MKL @@ -112,7 +112,7 @@ else() # BLAS or LAPACK isn't MKL set(ENV{PATH} "${CMAKE_SOURCE_DIR}/dependencies/scalapack-2.2.0:$ENV{PATH}") find_package(ScaLAPACK REQUIRED) endif() - target_link_libraries(ROM PUBLIC ${ScaLAPACK_LIBRARIES}) + target_link_libraries(ROM PUBLIC ${ScaLAPACK_LIBRARIES} ${MFEM_LIBRARIES}) endif() # PUBLIC dependencies are transitive; these dependencies are used in @@ -131,7 +131,7 @@ endif() # 3.0. target_link_libraries(ROM PUBLIC ${MPI_C_LINK_FLAGS} ${MPI_C_LIBRARIES} MPI::MPI_C ${MPI_FORTRAN_LINK_FLAGS} ${MPI_FORTRAN_LIBRARIES} MPI::MPI_Fortran ${HDF5_LIBRARIES} - ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${MFEM} ${HYPRE} ${PARMETIS} ${METIS} + ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${MFEM} ${HYPRE} ${PARMETIS} ${METIS} ${MFEM_LIBRARIES} PRIVATE ${ZLIB_LIBRARIES} ZLIB::ZLIB) target_include_directories(ROM PUBLIC @@ -144,6 +144,8 @@ target_include_directories(ROM PUBLIC ${MFEM_C_INCLUDE_DIRS} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +target_compile_features(ROM PRIVATE cxx_std_17) + # Find headers from the source file list that need to be installed set(HEADERS "") foreach(file IN LISTS source_files) diff --git a/lib/algo/greedy/GreedySampler.h b/lib/algo/greedy/GreedySampler.h index 4e1c7fceb..48d2d14f4 100644 --- a/lib/algo/greedy/GreedySampler.h +++ b/lib/algo/greedy/GreedySampler.h @@ -254,7 +254,7 @@ class GreedySampler /** * @brief Destructor. */ - ~GreedySampler(); + virtual ~GreedySampler(); /** * @brief Returns the next parameter point for which sampling is required. diff --git a/lib/linalg/Matrix.cpp b/lib/linalg/Matrix.cpp index 559176bbc..6d431bdc8 100644 --- a/lib/linalg/Matrix.cpp +++ b/lib/linalg/Matrix.cpp @@ -816,7 +816,8 @@ Matrix::gather() MPI_COMM_WORLD) == MPI_SUCCESS); delete [] d_mat; - delete [] data_offsets, data_cnts; + delete [] data_offsets; + delete [] data_cnts; d_mat = d_new_mat; d_alloc_size = new_size; diff --git a/lib/linalg/Vector.cpp b/lib/linalg/Vector.cpp index 8f27a1d0e..1459e50e3 100644 --- a/lib/linalg/Vector.cpp +++ b/lib/linalg/Vector.cpp @@ -507,7 +507,8 @@ Vector::gather() MPI_COMM_WORLD) == MPI_SUCCESS); delete [] d_vec; - delete [] data_offsets, data_cnts; + delete [] data_offsets; + delete [] data_cnts; d_vec = d_new_vec; d_alloc_size = new_size; d_dim = new_size; diff --git a/lib/linalg/svd/IncrementalSVD.h b/lib/linalg/svd/IncrementalSVD.h index 5e4bcb2c6..a79fd1bfa 100644 --- a/lib/linalg/svd/IncrementalSVD.h +++ b/lib/linalg/svd/IncrementalSVD.h @@ -62,7 +62,7 @@ class IncrementalSVD : public SVD bool takeSample( double* u_in, - bool add_without_increase = false); + bool add_without_increase = false) override; /** * @brief Returns the basis vectors for the current time interval as a diff --git a/lib/linalg/svd/IncrementalSVDBrand.h b/lib/linalg/svd/IncrementalSVDBrand.h index 35cdf9f0d..c0ff2fd90 100644 --- a/lib/linalg/svd/IncrementalSVDBrand.h +++ b/lib/linalg/svd/IncrementalSVDBrand.h @@ -142,7 +142,7 @@ class IncrementalSVDBrand : public IncrementalSVD addLinearlyDependentSample( const Matrix & A, const Matrix & W, - const Matrix & sigma); + const Matrix & sigma) override; /** * @brief Add a new, unique sample to the SVD. @@ -157,7 +157,7 @@ class IncrementalSVDBrand : public IncrementalSVD const Vector & j, const Matrix & A, const Matrix & W, - const Matrix & sigma); + const Matrix & sigma) override; /** * @brief The matrix U'. U' is not distributed and the entire matrix diff --git a/lib/linalg/svd/IncrementalSVDFastUpdate.h b/lib/linalg/svd/IncrementalSVDFastUpdate.h index 87aac3955..973454a12 100644 --- a/lib/linalg/svd/IncrementalSVDFastUpdate.h +++ b/lib/linalg/svd/IncrementalSVDFastUpdate.h @@ -98,7 +98,7 @@ class IncrementalSVDFastUpdate : public IncrementalSVD addLinearlyDependentSample( const Matrix & A, const Matrix & W, - const Matrix & sigma); + const Matrix & sigma) override; /** * @brief Add a new, unique sample to the SVD. @@ -113,7 +113,7 @@ class IncrementalSVDFastUpdate : public IncrementalSVD const Vector & j, const Matrix & A, const Matrix & W, - const Matrix & sigma); + const Matrix & sigma) override; /** * @brief The matrix U'. U' is not distributed and the entire matrix diff --git a/lib/linalg/svd/IncrementalSVDStandard.h b/lib/linalg/svd/IncrementalSVDStandard.h index d38613358..f6722d575 100644 --- a/lib/linalg/svd/IncrementalSVDStandard.h +++ b/lib/linalg/svd/IncrementalSVDStandard.h @@ -97,7 +97,7 @@ class IncrementalSVDStandard : public IncrementalSVD addLinearlyDependentSample( const Matrix & A, const Matrix & W, - const Matrix & sigma); + const Matrix & sigma) override; /** * @brief Add a new, unique sample to the SVD. @@ -112,7 +112,7 @@ class IncrementalSVDStandard : public IncrementalSVD const Vector & j, const Matrix & A, const Matrix & W, - const Matrix & sigma); + const Matrix & sigma) override; }; } diff --git a/lib/linalg/svd/StaticSVD.h b/lib/linalg/svd/StaticSVD.h index ebdab51fb..5fec4982f 100644 --- a/lib/linalg/svd/StaticSVD.h +++ b/lib/linalg/svd/StaticSVD.h @@ -51,7 +51,7 @@ class StaticSVD : public SVD bool takeSample( double* u_in, - bool add_without_increase = false); + bool add_without_increase = false) override; /** * @brief Returns the basis vectors for the current time interval as a diff --git a/lib/mfem/PointwiseSnapshot.cpp b/lib/mfem/PointwiseSnapshot.cpp index 9d3ea9a4b..426de547b 100644 --- a/lib/mfem/PointwiseSnapshot.cpp +++ b/lib/mfem/PointwiseSnapshot.cpp @@ -1,6 +1,8 @@ #include "PointwiseSnapshot.hpp" #ifdef MFEM_USE_GSLIB +using std::cout; +using std::endl; namespace CAROM { PointwiseSnapshot::PointwiseSnapshot(const int sdim, const int *dims_) diff --git a/lib/mfem/PointwiseSnapshot.hpp b/lib/mfem/PointwiseSnapshot.hpp index 33e99f4e0..0da1852dc 100644 --- a/lib/mfem/PointwiseSnapshot.hpp +++ b/lib/mfem/PointwiseSnapshot.hpp @@ -14,7 +14,6 @@ #include "mfem.hpp" using namespace mfem; -using namespace std; #ifdef MFEM_USE_GSLIB namespace CAROM { diff --git a/lib/mfem/SampleMesh.cpp b/lib/mfem/SampleMesh.cpp index 944097b9a..35fc00052 100644 --- a/lib/mfem/SampleMesh.cpp +++ b/lib/mfem/SampleMesh.cpp @@ -10,6 +10,11 @@ #include "SampleMesh.hpp" +using std::endl; +using std::make_pair; +using std::ofstream; +using std::ifstream; + namespace CAROM { #define FULL_DOF_STENCIL diff --git a/lib/mfem/SampleMesh.hpp b/lib/mfem/SampleMesh.hpp index 343c439b6..ec4d1b969 100644 --- a/lib/mfem/SampleMesh.hpp +++ b/lib/mfem/SampleMesh.hpp @@ -20,7 +20,10 @@ #include "linalg/Matrix.h" using namespace mfem; -using namespace std; +using std::vector; +using std::set; +using std::map; +using std::string; namespace CAROM { diff --git a/lib/mfem/Utilities.hpp b/lib/mfem/Utilities.hpp index 9e7b32b57..d55bad445 100644 --- a/lib/mfem/Utilities.hpp +++ b/lib/mfem/Utilities.hpp @@ -15,7 +15,6 @@ #include "linalg/Matrix.h" using namespace mfem; -using namespace std; namespace CAROM { diff --git a/lib/utils/CSVDatabase.h b/lib/utils/CSVDatabase.h index c9132a15f..5da496070 100644 --- a/lib/utils/CSVDatabase.h +++ b/lib/utils/CSVDatabase.h @@ -77,7 +77,7 @@ class CSVDatabase : public Database * @return True if the file close was successful. */ bool - close(); + close() override; /** * @brief Writes an array of integers associated with the supplied filename. diff --git a/lib/utils/HDFDatabase.h b/lib/utils/HDFDatabase.h index 3faadcf60..4c82377a5 100644 --- a/lib/utils/HDFDatabase.h +++ b/lib/utils/HDFDatabase.h @@ -77,7 +77,7 @@ class HDFDatabase : public Database */ virtual bool - close(); + close() override; /** * @brief Writes an array of integers associated with the supplied key to @@ -101,7 +101,7 @@ class HDFDatabase : public Database const std::string& key, const int* const data, int nelements, - const bool distributed=false); + const bool distributed=false) override; /** * @brief Writes an array of doubles associated with the supplied key to @@ -125,7 +125,7 @@ class HDFDatabase : public Database const std::string& key, const double* const data, int nelements, - const bool distributed=false); + const bool distributed=false) override; /** * @brief Writes a vector of doubles associated with the supplied key to @@ -149,7 +149,7 @@ class HDFDatabase : public Database const std::string& key, const std::vector& data, int nelements, - const bool distributed=false); + const bool distributed=false) override; /** * @brief Reads an array of integers associated with the supplied key @@ -172,7 +172,7 @@ class HDFDatabase : public Database const std::string& key, int* data, int nelements, - const bool distributed=false); + const bool distributed=false) override; /** * @brief Count the number of elements in an array of doubles associated @@ -184,7 +184,7 @@ class HDFDatabase : public Database */ virtual int - getDoubleArraySize(const std::string& key); + getDoubleArraySize(const std::string& key) override; /** * @brief Reads an array of doubles associated with the supplied key @@ -207,7 +207,7 @@ class HDFDatabase : public Database const std::string& key, double* data, int nelements, - const bool distributed=false); + const bool distributed=false) override; /** * @brief Reads a sub-array of doubles associated with the supplied key @@ -232,7 +232,7 @@ class HDFDatabase : public Database double* data, int nelements, const std::vector& idx, - const bool distributed=false); + const bool distributed=false) override; /** * @brief Reads an array of doubles associated with the supplied key @@ -264,7 +264,7 @@ class HDFDatabase : public Database int offset, int block_size, int stride, - const bool distributed=false); + const bool distributed=false) override; protected: diff --git a/regression_tests/CMakeLists.txt b/regression_tests/CMakeLists.txt new file mode 100644 index 000000000..67824a55d --- /dev/null +++ b/regression_tests/CMakeLists.txt @@ -0,0 +1,25 @@ +############################################################################### +# +# Copyright (c) 2013-2024, Lawrence Livermore National Security, LLC +# and other libROM project developers. See the top-level COPYRIGHT +# file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +# +############################################################################### + +set(regression_test_names + basisComparator + checkError + computeSpeedup + solutionComparator + fileComparator) + +foreach(name IN LISTS regression_test_names) + add_executable(${name} ${name}.cpp) + target_link_libraries(${name} PRIVATE ROM ${CAROM_LIBS}) + target_include_directories(${name} PRIVATE ${CAROM_INCS}) + target_compile_features(${name} PRIVATE cxx_std_17) +endforeach() + +