@@ -110,133 +110,45 @@ set(CAROM_HAVE_LAPACK ${LAPACK_FOUND})
110110set (CAROM_HAVE_HDF5 ${HDF5_FOUND} )
111111
112112if (USE_MFEM)
113- find_library (MFEM mfem "${CMAKE_SOURCE_DIR} /dependencies/mfem" "${MFEM_DIR} /lib" )
114- find_library (HYPRE HYPRE "${CMAKE_SOURCE_DIR} /dependencies/hypre/src/hypre/lib" "${HYPRE_DIR} /lib" )
115- find_library (PARMETIS parmetis "${CMAKE_SOURCE_DIR} /dependencies/parmetis-4.0.3/build/lib/libparmetis" "${PARMETIS_DIR} /lib" )
116- find_library (METIS metis "${CMAKE_SOURCE_DIR} /dependencies/parmetis-4.0.3/build/lib/libmetis" "${METIS_DIR} /lib" )
117- find_path (MFEM_INCLUDES mfem.hpp "${CMAKE_SOURCE_DIR} /dependencies/mfem" "${MFEM_DIR} /include" )
118- find_path (HYPRE_INCLUDES HYPRE.h "${CMAKE_SOURCE_DIR} /dependencies/hypre/src/hypre/include" "${HYPRE_DIR} /include" )
119- find_path (PARMETIS_INCLUDES metis.h "${CMAKE_SOURCE_DIR} /dependencies/parmetis-4.0.3/metis/include" "${PARMETIS_DIR} /metis/include" )
113+ # Try to find MFEM installed using cmake
114+ find_package (mfem NAMES MFEM HINTS "${MFEM_DIR} "
115+ "${MFEM_DIR} /lib/cmake/mfem" "${CMAKE_SOURCE_DIR} /dependencies/mfem/lib/cmake/mfem" NO_DEFAULT_PATH QUIET )
116+ if (mfem_FOUND)
117+ message (STATUS "Found mfem config in: ${mfem_DIR} (version ${MFEM_VERSION} )" )
118+ else ()
119+ # Try to find MFEM installed using configure
120+ find_library (MFEM mfem HINTS "${MFEM_DIR} /lib" "${CMAKE_SOURCE_DIR} /dependencies/mfem" )
121+ find_library (HYPRE HYPRE HINTS "${HYPRE_DIR} /lib" "${CMAKE_SOURCE_DIR} /dependencies/hypre/src/hypre/lib" )
122+ find_library (PARMETIS parmetis HINTS "${PARMETIS_DIR} /lib" "${CMAKE_SOURCE_DIR} /dependencies/parmetis-4.0.3/build/lib/libparmetis" )
123+ find_library (METIS metis HINTS "${METIS_DIR} /lib" "${CMAKE_SOURCE_DIR} /dependencies/parmetis-4.0.3/build/lib/libmetis" )
124+ find_path (MFEM_INCLUDES mfem.hpp HINTS "${MFEM_DIR} /include" "${CMAKE_SOURCE_DIR} /dependencies/mfem" )
125+ find_path (HYPRE_INCLUDES HYPRE.h HINTS "${HYPRE_DIR} /include" "${CMAKE_SOURCE_DIR} /dependencies/hypre/src/hypre/include" )
126+ find_path (PARMETIS_INCLUDES metis.h "${PARMETIS_DIR} /metis/include" "${CMAKE_SOURCE_DIR} /dependencies/parmetis-4.0.3/metis/include" )
127+
128+ if (${MFEM} STREQUAL "MFEM-NOTFOUND" )
129+ error( "MFEM not found" )
130+ else ()
131+ message (STATUS "MFEM library:" ${MFEM} )
132+ message (STATUS "MFEM includes:" ${MFEM_INCLUDES} )
133+ endif ()
134+ endif ()
120135endif ()
121136
122- add_subdirectory (lib)
137+ 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)
138+ set (CAROM_INCS ${CMAKE_CURRENT_SOURCE_DIR} ${MPI_C_INCLUDE_DIRS} )
123139
124- # Use the C++11 standard as an entire feature instead of
125- # enumerating individual compiler features for simplicity
126- target_compile_features (ROM PRIVATE cxx_std_11)
140+ add_subdirectory (lib)
127141
128142if (ENABLE_EXAMPLES)
143+ add_subdirectory (examples/misc)
129144 if (USE_MFEM)
130- set (examples
131- poisson_global_rom
132- poisson_local_rom_greedy
133- dg_advection_global_rom
134- dg_advection_local_rom_matrix_interp
135- mixed_nonlinear_diffusion
136- nonlinear_elasticity_global_rom
137- linear_elasticity_global_rom
138- maxwell_global_rom
139- de_parametric_maxwell_greedy
140- maxwell_local_rom_greedy
141- grad_div_global_rom
142- elliptic_eigenproblem_global_rom
143- dg_advection
144- nonlinear_elasticity
145- heat_conduction
146- heat_conduction_dmdc
147- parametric_heat_conduction
148- de_parametric_heat_conduction_greedy
149- de_dg_advection_greedy
150- wave_equation
151- dg_euler
152- local_dw_csv
153- parametric_tw_csv
154- parametric_dw_csv
155- parametric_dmdc_heat_conduction)
156- set (example_directories
157- prom
158- prom
159- prom
160- prom
161- prom
162- prom
163- prom
164- prom
165- prom
166- prom
167- prom
168- prom
169- dmd
170- dmd
171- dmd
172- dmd
173- dmd
174- dmd
175- dmd
176- dmd
177- dmd
178- dmd
179- dmd
180- dmd
181- dmd)
182-
183- list (LENGTH examples len1)
184- math (EXPR len2 "${len1} - 1" )
185-
186- foreach (val RANGE ${len2} )
187- list (GET examples ${val} name )
188- list (GET example_directories ${val} example_dir)
189- set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /examples/${example_dir} )
190- add_executable (${name} examples/${example_dir} /${name} .cpp)
191-
192- target_link_libraries (${name}
193- PRIVATE ROM ${MPI_C_LINK_FLAGS} ${MPI_C_LIBRARIES} MPI::MPI_C ${MPI_FORTRAN_LINK_FLAGS} ${MPI_FORTRAN_LIBRARIES} MPI::MPI_Fortran)
194- target_include_directories (${name}
195- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
196- ${MPI_C_INCLUDE_DIRS} )
197- target_compile_features (${name} PRIVATE cxx_std_11)
198- endforeach () # IN LISTS examples
145+ add_subdirectory (examples/prom)
146+ add_subdirectory (examples/dmd)
199147 file (COPY examples/data DESTINATION ${CMAKE_BINARY_DIR} /examples)
200148 file (COPY examples/merlin DESTINATION ${CMAKE_BINARY_DIR} /examples)
201149 file (COPY examples/dmd/heat_conduction_csv.sh DESTINATION ${CMAKE_BINARY_DIR} /examples/dmd)
202150 file (COPY examples/dmd/heat_conduction_hdf.sh DESTINATION ${CMAKE_BINARY_DIR} /examples/dmd)
203- endif ()
204-
205- set (misc_example_names
206- combine_samples)
207-
208- set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /examples/misc)
209-
210- foreach (name IN LISTS misc_example_names)
211- add_executable (${name} examples/misc/${name} .cpp)
212-
213- target_link_libraries (${name}
214- PRIVATE ROM ${MPI_C_LINK_FLAGS} ${MPI_C_LIBRARIES} MPI::MPI_C ${MPI_FORTRAN_LINK_FLAGS} ${MPI_FORTRAN_LIBRARIES} MPI::MPI_Fortran)
215- target_include_directories (${name}
216- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
217- ${MPI_C_INCLUDE_DIRS} )
218- target_compile_features (${name} PRIVATE cxx_std_11)
219- endforeach (name ) # IN LISTS misc_exmaple_names
220-
221- set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /tests)
222-
223- if (USE_MFEM)
224- set (regression_test_names
225- basisComparator
226- checkError
227- computeSpeedup
228- solutionComparator
229- fileComparator)
230-
231- foreach (name IN LISTS regression_test_names)
232- add_executable (${name} regression_tests/${name} .cpp)
233- target_link_libraries (${name}
234- PRIVATE ROM ${MPI_C_LINK_FLAGS} ${MPI_C_LIBRARIES} MPI::MPI_C ${MPI_FORTRAN_LINK_FLAGS} ${MPI_FORTRAN_LIBRARIES} MPI::MPI_Fortran)
235- target_include_directories (${name}
236- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
237- ${MPI_C_INCLUDE_DIRS} )
238- target_compile_features (${name} PRIVATE cxx_std_11)
239- endforeach (name ) # IN LISTS regression_test_names
151+ add_subdirectory (regression_tests)
240152 endif ()
241153endif (ENABLE_EXAMPLES)
242154
0 commit comments