diff --git a/CMakeLists.txt b/CMakeLists.txt index e99b66ca12..b8d72486a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,13 @@ project(opm-grid C CXX Fortran) option(SIBLING_SEARCH "Search for other modules in sibling directories?" ON) option(REQUIRE_ZOLTAN "Require Zoltan to be found (needed for productive run" ON) +option(USE_OPM_COMMON "Use data structures from opm-common?" ON) + +macro(opm-grid_prereqs_hook) + if(USE_OPM_COMMON) + target_link_libraries(opmgrid PUBLIC opmcommon) + endif() +endmacro() macro(opm-grid_language_hook) include(FortranCInterface) @@ -66,18 +73,22 @@ macro(opm-grid_tests_hook) set(tests_4proc addLgrsOnDistributedGrid_test autoRefine_test - communicate_distributed_grid_with_lgrs_test - distribute_level_zero_from_grid_with_lgrs_and_wells_test - distribute_level_zero_from_grid_with_lgrs_test distribution_test - grid_global_id_set_test level_and_grid_cartesianIndexMappers_test - lgr_cell_id_sync_test logicalCartesianSize_and_refinement_test - mapLevelIndicesToCartesianOutputOrder_test test_communication_utils id_entity_entityrep_test ) + if(USE_OPM_COMMON) + list(APPEND tests_4proc + communicate_distributed_grid_with_lgrs_test + distribute_level_zero_from_grid_with_lgrs_test + distribute_level_zero_from_grid_with_lgrs_and_wells_test + grid_global_id_set_test + lgr_cell_id_sync_test + mapLevelIndicesToCartesianOutputOrder_test + ) + endif() list(APPEND test_4proc lgr_with_inactive_parent_cells_test) foreach(procs 3 4) @@ -106,7 +117,7 @@ macro(opm-grid_tests_hook) set_tests_properties(${test4}_parallel PROPERTIES PROCESSORS 4) endforeach() - if(HAVE_OPM_TESTS AND HAVE_ECL_INPUT) + if(HAVE_OPM_TESTS AND USE_OPM_COMMON) opm_add_test(cpgrid_aquifer_test ONLY_COMPILE SOURCES diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 10d984fcd1..982ca18308 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -72,7 +72,7 @@ list(APPEND MAIN_SOURCE_FILES opm/grid/utility/WachspressCoord.cpp ) -if (opm-common_FOUND) +if(USE_OPM_COMMON) list(APPEND MAIN_SOURCE_FILES opm/grid/utility/VelocityInterpolation.cpp opm/grid/transmissibility/trans_tpfa.c @@ -84,7 +84,6 @@ endif() list(APPEND TEST_SOURCE_FILES tests/p2pcommunicator_test.cc tests/test_cartgrid.cpp - tests/test_cellCentroid_polyhedralGrid.cpp tests/test_column_extract.cpp tests/test_communication_utils.cpp tests/test_compressed_cartesian_mapping.cpp @@ -94,7 +93,6 @@ list(APPEND TEST_SOURCE_FILES tests/test_graphofgrid.cpp tests/test_graphofgrid_parallel.cpp tests/test_gridutilities.cpp - tests/test_lookupdata_polyhedral.cpp tests/test_minpvprocessor.cpp tests/test_polyhedralgrid.cpp tests/test_process_grdecl.cpp @@ -103,7 +101,6 @@ list(APPEND TEST_SOURCE_FILES tests/test_sparsetable.cpp tests/test_subgridpart.cpp tests/cpgrid/distribution_test.cpp - tests/cpgrid/eclCentroid_test.cpp tests/cpgrid/entityrep_test.cpp tests/cpgrid/entity_test.cpp tests/cpgrid/facetag_test.cpp @@ -113,42 +110,45 @@ list(APPEND TEST_SOURCE_FILES tests/cpgrid/shifted_cart_test.cpp tests/cpgrid/zoltan_test.cpp tests/cpgrid/lgr/adapt_cpgrid_test.cpp - tests/cpgrid/lgr/addLgrs_if_non_nnc_in_lgrs_test.cpp tests/cpgrid/lgr/addLgrs_in_allActiveCartesianGrid_test.cpp tests/cpgrid/lgr/addLgrsOnDistributedGrid_test.cpp tests/cpgrid/lgr/autoRefine_test.cpp - tests/cpgrid/lgr/communicate_distributed_grid_with_lgrs_test.cpp - tests/cpgrid/lgr/distribute_level_zero_from_grid_with_lgrs_and_wells_test.cpp - tests/cpgrid/lgr/distribute_level_zero_from_grid_with_lgrs_test.cpp tests/cpgrid/lgr/global_refine_test.cpp - tests/cpgrid/lgr/grid_global_id_set_test.cpp tests/cpgrid/lgr/id_entity_entityrep_test.cpp tests/cpgrid/lgr/level_and_grid_cartesianIndexMappers_test.cpp - tests/cpgrid/lgr/levelCartToLevelCompressed_test.cpp - tests/cpgrid/lgr/lgrIJK_test.cpp - tests/cpgrid/lgr/lgr_cartesian_idx_test.cpp - tests/cpgrid/lgr/lgr_cell_id_sync_test.cpp - tests/cpgrid/lgr/lgr_coord_zcorn_test.cpp - tests/cpgrid/lgr/lgr_with_inactive_parent_cells_test.cpp tests/cpgrid/lgr/lgrs_sharing_faces_test.cpp tests/cpgrid/lgr/logicalCartesianSize_and_refinement_test.cpp - tests/cpgrid/lgr/lookUpCellCentroid_cpgrid_test.cpp - tests/cpgrid/lgr/lookupdataCpGrid_test.cpp - tests/cpgrid/lgr/mapLevelIndicesToCartesianOutputOrder_test.cpp tests/cpgrid/lgr/nested_refinement_test.cpp - tests/cpgrid/lgr/refine_hexahedron_with_non_rectangular_faces_test.cpp tests/cpgrid/lgr/replace_lgr1_corner_idx_by_lgr2_corner_idx_test.cpp tests/cpgrid/lgr/replace_lgr1_face_idx_by_lgr2_face_idx_test.cpp - tests/cpgrid/lgr/restrict_data_to_level_grids_test.cpp - tests/cpgrid/lgr/save_lgr_coord_zcorn_test.cpp ) -if(HAVE_ECL_INPUT) +if(USE_OPM_COMMON) list(APPEND TEST_SOURCE_FILES tests/test_regionmapping.cpp tests/test_ug.cpp + tests/test_cellCentroid_polyhedralGrid.cpp + tests/test_lookupdata_polyhedral.cpp tests/cpgrid/grid_nnc.cpp tests/cpgrid/grid_pinch.cpp + tests/cpgrid/lgr/communicate_distributed_grid_with_lgrs_test.cpp + tests/cpgrid/lgr/distribute_level_zero_from_grid_with_lgrs_test.cpp + tests/cpgrid/lgr/distribute_level_zero_from_grid_with_lgrs_and_wells_test.cpp + tests/cpgrid/lgr/grid_global_id_set_test.cpp + tests/cpgrid/lgr/levelCartToLevelCompressed_test.cpp + tests/cpgrid/lgr/lgr_cell_id_sync_test.cpp + tests/cpgrid/lgr/mapLevelIndicesToCartesianOutputOrder_test.cpp + tests/cpgrid/lgr/restrict_data_to_level_grids_test.cpp + tests/cpgrid/eclCentroid_test.cpp + tests/cpgrid/lgr/addLgrs_if_non_nnc_in_lgrs_test.cpp + tests/cpgrid/lgr/lgrIJK_test.cpp + tests/cpgrid/lgr/lgr_cartesian_idx_test.cpp + tests/cpgrid/lgr/lgr_coord_zcorn_test.cpp + tests/cpgrid/lgr/lgr_with_inactive_parent_cells_test.cpp + tests/cpgrid/lgr/lookUpCellCentroid_cpgrid_test.cpp + tests/cpgrid/lgr/lookupdataCpGrid_test.cpp + tests/cpgrid/lgr/refine_hexahedron_with_non_rectangular_faces_test.cpp + tests/cpgrid/lgr/save_lgr_coord_zcorn_test.cpp ) endif() @@ -169,18 +169,18 @@ list(APPEND TEST_DATA_FILES # find tutorials examples -name '*.c*' -printf '\t%p\n' | sort list(APPEND EXAMPLE_SOURCE_FILES examples/finitevolume/finitevolume.cc - examples/mirror_grid.cpp examples/griditer.cpp ) -# programs listed here will not only be compiled, but also marked for -# installation -list(APPEND PROGRAM_SOURCE_FILES - examples/mirror_grid.cpp -) -if(HAVE_ECL_INPUT) - list(APPEND EXAMPLE_SOURCE_FILES examples/grdecl2vtu.cpp) - list(APPEND PROGRAM_SOURCE_FILES examples/grdecl2vtu.cpp) +if(USE_OPM_COMMON) + list(APPEND EXAMPLE_SOURCE_FILES + examples/grdecl2vtu.cpp + examples/mirror_grid.cpp + ) + list(APPEND PROGRAM_SOURCE_FILES + examples/grdecl2vtu.cpp + examples/mirror_grid.cpp + ) endif() # originally generated with the command: @@ -215,8 +215,6 @@ list(APPEND PUBLIC_HEADER_FILES opm/grid/cpgrid/Iterators.hpp opm/grid/cpgrid/LgrHelpers.hpp opm/grid/cpgrid/LgrOutputHelpers.hpp - opm/grid/LookUpCellCentroid.hh - opm/grid/LookUpData.hh opm/grid/cpgrid/ElementMarkHandle.hpp opm/grid/cpgrid/OrientedEntityTable.hpp opm/grid/cpgrid/ParentToChildrenCellGlobalIdHandle.hpp @@ -275,7 +273,9 @@ list(APPEND PUBLIC_HEADER_FILES opm/grid/utility/cartesianToCompressed.hpp opm/grid/utility/createThreadIterators.hpp opm/grid/utility/ElementChunks.hpp + opm/grid/utility/ErrorMacros.hpp opm/grid/utility/IteratorRange.hpp + opm/grid/utility/OpmLog.hpp opm/grid/utility/OpmWellType.hpp opm/grid/utility/RegionMapping.hpp opm/grid/utility/SparseTable.hpp @@ -286,3 +286,10 @@ list(APPEND PUBLIC_HEADER_FILES opm/grid/utility/platform_dependent/disable_warnings.h opm/grid/utility/platform_dependent/reenable_warnings.h ) + +if(USE_OPM_COMMON) + list(APPEND PUBLIC_HEADER_FILES + opm/grid/LookUpCellCentroid.hh + opm/grid/LookUpData.hh + ) +endif() diff --git a/examples/mirror_grid.cpp b/examples/mirror_grid.cpp index 87aabe2143..002261f0f1 100644 --- a/examples/mirror_grid.cpp +++ b/examples/mirror_grid.cpp @@ -32,7 +32,6 @@ * */ -#if HAVE_ECL_INPUT #include #include @@ -403,10 +402,3 @@ int main(int argc, char** argv) mirror_celldata("SOWCR", deck, direction, outfile); return 0; } -#else -int main () { - std::cerr << "Program need activated ECL input. (Configure opm-common " - << " with -DENABLE_ECL_INPUT=ON)"< #include -#include +#include + #include +#include #include +#include namespace { diff --git a/opm/grid/CpGrid.hpp b/opm/grid/CpGrid.hpp index 3ca11cc654..d84478b03f 100644 --- a/opm/grid/CpGrid.hpp +++ b/opm/grid/CpGrid.hpp @@ -226,7 +226,7 @@ namespace Dune explicit CpGrid(MPIHelper::MPICommunicator comm); -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON /// Read the Eclipse grid format ('grdecl'). /// /// \return Vector of global indices to the cells which have been @@ -316,7 +316,7 @@ namespace Dune bool turn_normals = false, bool clip_z = false, bool edge_conformal = false); -#endif // HAVE_ECL_INPUT +#endif // HAVE_OPM_COMMON /// Read the Eclipse grid format ('grdecl'). /// diff --git a/opm/grid/FaceQuadrature.cpp b/opm/grid/FaceQuadrature.cpp index f935391bb5..e3c2dc2142 100644 --- a/opm/grid/FaceQuadrature.cpp +++ b/opm/grid/FaceQuadrature.cpp @@ -19,9 +19,12 @@ #include #include -#include +#include #include + +#include #include +#include namespace { diff --git a/opm/grid/GraphOfGridWrappers.hpp b/opm/grid/GraphOfGridWrappers.hpp index f5b6932b9d..8e4d9c7290 100644 --- a/opm/grid/GraphOfGridWrappers.hpp +++ b/opm/grid/GraphOfGridWrappers.hpp @@ -26,7 +26,8 @@ #ifndef GRAPH_OF_GRID_WRAPPERS_HEADER #define GRAPH_OF_GRID_WRAPPERS_HEADER -#include +#include + #include #include #include // defines Zoltan and null-callback-functions diff --git a/opm/grid/GridHelpers.cpp b/opm/grid/GridHelpers.cpp index 5b96fa442c..5ec122c3a1 100644 --- a/opm/grid/GridHelpers.cpp +++ b/opm/grid/GridHelpers.cpp @@ -22,11 +22,10 @@ #include "config.h" #include -#include - #include -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON +#include #include #endif @@ -62,7 +61,7 @@ const int* cartDims(const UnstructuredGrid& grid) return grid.cartdims; } -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON std::vector createACTNUM(const UnstructuredGrid& grid) { const int* dims = cartDims(grid); return ActiveGridCells(dims[0], dims[1], dims[2], globalCell(grid), numCells(grid)).actNum(); @@ -329,7 +328,7 @@ FaceCellTraits::Type faceCells(const UnstructuredGrid& grid) } -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON Opm::EclipseGrid createEclipseGrid(const UnstructuredGrid& grid, const Opm::EclipseGrid& inputGrid ) { const int * dims = UgGridHelpers::cartDims( grid ); diff --git a/opm/grid/GridHelpers.hpp b/opm/grid/GridHelpers.hpp index 7763fff287..04edb1817e 100644 --- a/opm/grid/GridHelpers.hpp +++ b/opm/grid/GridHelpers.hpp @@ -110,7 +110,7 @@ const int* cartDims(const UnstructuredGrid& grid); /// in the underlying structured grid. const int* globalCell(const UnstructuredGrid& grid); -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON /// \brief Create Eclipse style ACTNUM array. /// /// Create a vector with global cartesian number of elements, @@ -220,7 +220,7 @@ struct CellVolumeIteratorTraits correctly represented in the EclipseGrid created by this method. */ -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON /// \brief Construct an EclipseGrid instance based on the inputGrid, with modifications to /// zcorn and actnum from the dune UnstructuredGrid. Opm::EclipseGrid createEclipseGrid(const UnstructuredGrid& grid, const Opm::EclipseGrid& inputGrid ); diff --git a/opm/grid/GridManager.cpp b/opm/grid/GridManager.cpp index f01952f2dc..ce355f0fc1 100644 --- a/opm/grid/GridManager.cpp +++ b/opm/grid/GridManager.cpp @@ -25,20 +25,16 @@ #include #include #include -#include +#include -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON #include #endif -#include -#include -#include - namespace Opm { -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON /// Construct a 3d corner-point grid from a deck. GridManager::GridManager(const Opm::EclipseGrid& inputGrid, const bool edge_conformal) @@ -132,7 +128,7 @@ namespace Opm -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON // Construct corner-point grid from EclipseGrid. void GridManager::initFromEclipseGrid(const Opm::EclipseGrid& inputGrid, const std::vector& poreVolumes, diff --git a/opm/grid/GridManager.hpp b/opm/grid/GridManager.hpp index 084c3ef26d..60d5f02fdd 100644 --- a/opm/grid/GridManager.hpp +++ b/opm/grid/GridManager.hpp @@ -29,7 +29,7 @@ struct grdecl; namespace Opm { -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON class EclipseGrid; #endif @@ -45,7 +45,7 @@ class EclipseGrid; { public: -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON /// Construct a grid from an EclipseState::EclipseGrid instance. explicit GridManager(const EclipseGrid& inputGrid, bool edge_conformal = false); @@ -91,7 +91,7 @@ class EclipseGrid; GridManager(const GridManager& other) = delete; GridManager& operator=(const GridManager& other) = delete; -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON // Construct corner-point grid from EclipseGrid. void initFromEclipseGrid(const EclipseGrid& inputGrid, const std::vector& poreVolumes, diff --git a/opm/grid/LookUpCellCentroid.hh b/opm/grid/LookUpCellCentroid.hh index c3ab7191c3..89602132c7 100644 --- a/opm/grid/LookUpCellCentroid.hh +++ b/opm/grid/LookUpCellCentroid.hh @@ -34,8 +34,7 @@ #include #include - - +#include #include diff --git a/opm/grid/MinpvProcessor.cpp b/opm/grid/MinpvProcessor.cpp index 4d86f1a06a..87702181b3 100644 --- a/opm/grid/MinpvProcessor.cpp +++ b/opm/grid/MinpvProcessor.cpp @@ -19,9 +19,11 @@ #include #include -#include +#include #include +#include +#include namespace Opm { diff --git a/opm/grid/common/MetisPartition.cpp b/opm/grid/common/MetisPartition.cpp index d01603b519..41e3b2fbe5 100644 --- a/opm/grid/common/MetisPartition.cpp +++ b/opm/grid/common/MetisPartition.cpp @@ -21,14 +21,24 @@ #endif #if HAVE_MPI // no code in this file without MPI, then skip includes. -#include + // +#include + #include #include #include #include #include -#include -#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include #endif #if defined(HAVE_METIS) && HAVE_MPI diff --git a/opm/grid/common/MetisPartition.hpp b/opm/grid/common/MetisPartition.hpp index 36ef29f70d..71b1e22b23 100644 --- a/opm/grid/common/MetisPartition.hpp +++ b/opm/grid/common/MetisPartition.hpp @@ -19,8 +19,6 @@ #ifndef DUNE_CPGRID_METISPARTITION_HEADER #define DUNE_CPGRID_METISPARTITION_HEADER -#include - #include #include #include @@ -46,6 +44,14 @@ extern "C" { #endif // defined(HAVE_METIS) && HAVE_MPI #if defined(HAVE_METIS) && HAVE_MPI + +#include +#include +#include +#include +#include +#include + namespace Dune { namespace cpgrid diff --git a/opm/grid/common/WellConnections.cpp b/opm/grid/common/WellConnections.cpp index 4fbf9e15d0..dbaf43b000 100644 --- a/opm/grid/common/WellConnections.cpp +++ b/opm/grid/common/WellConnections.cpp @@ -24,8 +24,10 @@ #include +#if HAVE_OPM_COMMON #include #include +#endif #include #include @@ -110,7 +112,7 @@ void WellConnections::init([[maybe_unused]] const std::vector& well [[maybe_unused]] const std::array& cartesianSize, [[maybe_unused]] const std::vector& cartesian_to_compressed) { -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON well_indices_.resize(wells.size()); // We assume that we know all the wells. @@ -204,7 +206,7 @@ postProcessPartitioningForWells(std::vector& parts, // Contains for each process the indices of the wells assigned to it. std::vector > well_indices_on_proc(no_procs); -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON const auto& mpiType = MPITraits::getType(); std::map> addCells, removeCells; std::vector visited(noCells, false); @@ -470,7 +472,7 @@ computeParallelWells([[maybe_unused]] const std::vector >& well // We need to use well names as only they are consistent. std::vector> parallel_wells; -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON std::vector my_well_indices; std::vector globalWellNames; const int well_information_tag = 267553; diff --git a/opm/grid/common/ZoltanPartition.cpp b/opm/grid/common/ZoltanPartition.cpp index bb07431616..815a11edf3 100644 --- a/opm/grid/common/ZoltanPartition.cpp +++ b/opm/grid/common/ZoltanPartition.cpp @@ -22,9 +22,11 @@ #endif #if HAVE_MPI // no code in this file without MPI. Skip includes- #include -#include #include #include +#include +#include + #include #include #endif diff --git a/opm/grid/cpgrid/CpGrid.cpp b/opm/grid/cpgrid/CpGrid.cpp index 7d44d241c4..9b4693af74 100644 --- a/opm/grid/cpgrid/CpGrid.cpp +++ b/opm/grid/cpgrid/CpGrid.cpp @@ -41,11 +41,10 @@ #if HAVE_MPI #include -#include "mpi.h" #include #endif -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON #include #endif @@ -637,7 +636,7 @@ void CpGrid::createCartesian(const std::array& dims, // Note: This is a Cartesian, matching grid which is edge-conforming // regardless of the edge_conformal flag. current_data_->back()->processEclipseFormat(g, -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON /* ecl_state = */ nullptr, #endif nnc, @@ -1701,7 +1700,7 @@ const cpgrid::CpGridDataTraits::RemoteIndices& CpGrid::getCellRemoteIndices() co #endif -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON std::vector CpGrid::processEclipseFormat(const Opm::EclipseGrid* ecl_grid, Opm::EclipseState* ecl_state, @@ -1748,7 +1747,7 @@ void CpGrid::processEclipseFormat(const grdecl& input_data, using NNCMaps = std::array; NNCMaps nnc; current_data_->back()->processEclipseFormat(input_data, -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON nullptr, #endif nnc, diff --git a/opm/grid/cpgrid/CpGridData.hpp b/opm/grid/cpgrid/CpGridData.hpp index 030d8bdcc7..77db314e65 100644 --- a/opm/grid/cpgrid/CpGridData.hpp +++ b/opm/grid/cpgrid/CpGridData.hpp @@ -58,7 +58,7 @@ #include #include -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON #include #include #endif @@ -201,7 +201,7 @@ class CpGridData bool turn_normals = false, bool edge_conformal = false); -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON /// Read the Eclipse grid format ('grdecl'). /// /// \param[in] deck Low-level input Deck object from the OPM Parser. @@ -303,7 +303,7 @@ class CpGridData /// edge-conformal grid. Typically useful in geo-mechanical /// applications. void processEclipseFormat(const grdecl& input_data, -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON Opm::EclipseState* ecl_state, #endif std::array>, 2>& nnc, diff --git a/opm/grid/cpgrid/EntityRep.hpp b/opm/grid/cpgrid/EntityRep.hpp index 7cb1bc4ba0..ef2c401265 100644 --- a/opm/grid/cpgrid/EntityRep.hpp +++ b/opm/grid/cpgrid/EntityRep.hpp @@ -69,7 +69,6 @@ namespace Dune //#include -#include #include #include diff --git a/opm/grid/cpgrid/Geometry.hpp b/opm/grid/cpgrid/Geometry.hpp index a79afb2f51..90b676ebe4 100644 --- a/opm/grid/cpgrid/Geometry.hpp +++ b/opm/grid/cpgrid/Geometry.hpp @@ -56,7 +56,7 @@ #include #include -#include +#include namespace Dune { diff --git a/opm/grid/cpgrid/GridHelpers.cpp b/opm/grid/cpgrid/GridHelpers.cpp index b2282f89d5..fe3a404b00 100644 --- a/opm/grid/cpgrid/GridHelpers.cpp +++ b/opm/grid/cpgrid/GridHelpers.cpp @@ -22,9 +22,10 @@ #include #include +#if HAVE_OPM_COMMON #include - #include +#endif namespace Opm { @@ -33,7 +34,7 @@ namespace Opm namespace UgGridHelpers { -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON EclipseGrid createEclipseGrid(const Dune::CpGrid& grid, const EclipseGrid& inputGrid) { const int * dims = cartDims( grid ); @@ -92,7 +93,7 @@ const int* globalCell(const Dune::CpGrid& grid) return &(grid.globalCell()[0]); } -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON std::vector createACTNUM(const Dune::CpGrid& grid) { const int* dims = cartDims(grid); return ActiveGridCells(dims[0], dims[1], dims[2], globalCell(grid), numCells(grid)).actNum(); diff --git a/opm/grid/cpgrid/GridHelpers.hpp b/opm/grid/cpgrid/GridHelpers.hpp index b910a06b8e..c30dab6ef0 100644 --- a/opm/grid/cpgrid/GridHelpers.hpp +++ b/opm/grid/cpgrid/GridHelpers.hpp @@ -405,7 +405,7 @@ const int* cartDims(const Dune::CpGrid& grid); /// in the underlying structured grid. const int* globalCell(const Dune::CpGrid&); -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON /// \brief Create Eclipse style ACTNUM array. /// /// Create a vector with global cartesian number of elements, diff --git a/opm/grid/cpgrid/Indexsets.hpp b/opm/grid/cpgrid/Indexsets.hpp index 8e1b4910f0..82e252bc16 100644 --- a/opm/grid/cpgrid/Indexsets.hpp +++ b/opm/grid/cpgrid/Indexsets.hpp @@ -37,7 +37,7 @@ along with OPM. If not, see . #define OPM_INDEXSETS_HEADER #include -#include +#include #include "Entity.hpp" #include "GlobalIdMapping.hpp" #include "Intersection.hpp" diff --git a/opm/grid/cpgrid/Intersection.cpp b/opm/grid/cpgrid/Intersection.cpp index f589a90ab8..716e7f6e7c 100644 --- a/opm/grid/cpgrid/Intersection.cpp +++ b/opm/grid/cpgrid/Intersection.cpp @@ -20,9 +20,9 @@ along with OPM. If not, see . #ifdef HAVE_CONFIG_H #include"config.h" #endif -#include"Intersection.hpp" -#include"EntityRep.hpp" -#include"Entity.hpp" +#include "Intersection.hpp" +#include "EntityRep.hpp" +#include "Entity.hpp" #include "CpGridData.hpp" namespace Dune diff --git a/opm/grid/cpgrid/Intersection.hpp b/opm/grid/cpgrid/Intersection.hpp index e7d8376082..2d6a376bb9 100644 --- a/opm/grid/cpgrid/Intersection.hpp +++ b/opm/grid/cpgrid/Intersection.hpp @@ -36,12 +36,8 @@ #ifndef OPM_INTERSECTION_HEADER #define OPM_INTERSECTION_HEADER - - - #include - -#include +#include // The next statement is a layering violation: we only #include // preprocess.h to get at its "enum face_tag" definition. Enum @@ -51,6 +47,7 @@ #include "Geometry.hpp" #include "OrientedEntityTable.hpp" + namespace Dune { namespace cpgrid diff --git a/opm/grid/cpgrid/Iterators.hpp b/opm/grid/cpgrid/Iterators.hpp index 161a8d2272..ab5b1d30b0 100644 --- a/opm/grid/cpgrid/Iterators.hpp +++ b/opm/grid/cpgrid/Iterators.hpp @@ -38,7 +38,7 @@ along with OPM. If not, see . #include #include "PartitionIteratorRule.hpp" -#include +#include #include "CpGridData.hpp" diff --git a/opm/grid/cpgrid/LgrHelpers.cpp b/opm/grid/cpgrid/LgrHelpers.cpp index 16a3642d58..9ce7757386 100644 --- a/opm/grid/cpgrid/LgrHelpers.cpp +++ b/opm/grid/cpgrid/LgrHelpers.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include // for std::max #include diff --git a/opm/grid/cpgrid/LgrOutputHelpers.cpp b/opm/grid/cpgrid/LgrOutputHelpers.cpp index 804e89e89f..6f561b0d92 100644 --- a/opm/grid/cpgrid/LgrOutputHelpers.cpp +++ b/opm/grid/cpgrid/LgrOutputHelpers.cpp @@ -18,9 +18,11 @@ */ #include "config.h" +#if HAVE_OPM_COMMON #include #include #include +#endif #include #include @@ -77,6 +79,7 @@ std::vector> levelCartesianToLevelCompressedMaps(con return levelCartToLevelCompressed; } +#if HAVE_OPM_COMMON void extractSolutionLevelGrids(const Dune::CpGrid& grid, const std::vector>& toOutput_refinedLevels, const Opm::data::Solution& leafSolution, @@ -132,6 +135,7 @@ void extractSolutionLevelGrids(const Dune::CpGrid& grid, }); } } +#endif } // namespace Lgr } // namespace Opm diff --git a/opm/grid/cpgrid/LgrOutputHelpers.hpp b/opm/grid/cpgrid/LgrOutputHelpers.hpp index d0732c0d49..82e4d75062 100644 --- a/opm/grid/cpgrid/LgrOutputHelpers.hpp +++ b/opm/grid/cpgrid/LgrOutputHelpers.hpp @@ -23,10 +23,12 @@ #include #include +#if HAVE_OPM_COMMON #include #include #include #include +#endif #include // for std::min/max #include // for std::size_t @@ -179,6 +181,7 @@ void populateDataVectorLevelGrids(const Dune::CpGrid& grid, /// @param [out] A vector of Opm::data::Solution objects, one for each refinement level /// (from level 0 to grid.maxLevel()), where each entry contains data reordered /// according to increasing level Cartesian indices for output. +#if HAVE_OPM_COMMON void extractSolutionLevelGrids(const Dune::CpGrid& grid, const std::vector>& toOutput_refinedLevels, const Opm::data::Solution& leafSolution, @@ -199,6 +202,7 @@ template void extractRestartValueLevelGrids(const Grid& grid, const Opm::RestartValue& leafRestartValue, std::vector& restartValue_levels); +#endif } // namespace Lgr } // namespace Opm @@ -276,6 +280,7 @@ void Opm::Lgr::populateDataVectorLevelGrids(const Dune::CpGrid& grid, } } +#if HAVE_OPM_COMMON template void Opm::Lgr::extractRestartValueLevelGrids(const Grid& grid, const Opm::RestartValue& leafRestartValue, @@ -333,5 +338,6 @@ void Opm::Lgr::extractRestartValueLevelGrids(const Grid& grid, } } } +#endif #endif // OPM_GRID_CPGRID_LGROUTPUTHELPERS_HEADER_INCLUDED diff --git a/opm/grid/cpgrid/processEclipseFormat.cpp b/opm/grid/cpgrid/processEclipseFormat.cpp index 08959b1cdc..6db6196023 100644 --- a/opm/grid/cpgrid/processEclipseFormat.cpp +++ b/opm/grid/cpgrid/processEclipseFormat.cpp @@ -39,20 +39,23 @@ #include -#include -#include - #include #include #include #include +#include #include #include #include #include +#if HAVE_OPM_COMMON +#include +#include +#endif + #include #include #include @@ -80,18 +83,16 @@ namespace Dune // Forward declarations. namespace { -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON std::vector getSanitizedZCORN(const ::Opm::EclipseGrid& ecl_grid, const ::std::vector& actnum); -#endif typedef std::array coord_t; typedef std::array cellz_t; cellz_t getCellZvals(const coord_t& c, const coord_t& n, const double* z); -#if HAVE_ECL_INPUT void addOuterCellLayer(const grdecl& original, std::vector& new_coord, std::vector& new_zcorn, @@ -127,7 +128,7 @@ namespace Dune namespace cpgrid { -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON std::vector CpGridData::processEclipseFormat(const Opm::EclipseGrid* ecl_grid_ptr, Opm::EclipseState* ecl_state, @@ -427,7 +428,7 @@ namespace cpgrid return minpv_result.removed_cells; } -#endif // #if HAVE_ECL_INPUT +#endif // #if HAVE_OPM_COMMON enum { NNCFace = -1 }; @@ -435,7 +436,7 @@ namespace cpgrid /// Read the Eclipse grid format ('.grdecl'). void CpGridData::processEclipseFormat(const grdecl& input_data, -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON Opm::EclipseState* ecl_state, #endif NNCMaps& nnc, @@ -457,7 +458,7 @@ namespace cpgrid processed_grid output{}; int process_ok{}; -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON if ((ecl_state != nullptr) && ecl_state->aquifer().hasNumericalAquifer()) { const std::size_t global_nc = static_cast(input_data.dims[0]) * @@ -502,7 +503,7 @@ namespace cpgrid // removeUnusedNodes(output); } -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON if ((ecl_state != nullptr) && ecl_state->aquifer().hasNumericalAquifer()) { const std::size_t global_nc = static_cast(input_data.dims[0]) * @@ -548,7 +549,7 @@ namespace cpgrid #endif // here we need the cell volumes based on the active index order std::unordered_map aquifer_cell_volumes_local{}; -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON if ((ecl_state != nullptr) && ecl_state->aquifer().hasNumericalAquifer()) { const auto& aquifer_cell_volumes = ecl_state->aquifer() .numericalAquifers().aquiferCellVolumes(); @@ -621,7 +622,7 @@ namespace cpgrid namespace { -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON std::vector getSanitizedZCORN(const ::Opm::EclipseGrid& ecl_grid, const ::std::vector& actnumData) @@ -668,7 +669,6 @@ namespace cpgrid return zcornData; } -#endif typedef std::array coord_t; typedef std::array cellz_t; @@ -690,8 +690,6 @@ namespace cpgrid return cellz; } - - void setCellZvals(const coord_t& c, const coord_t& n, double* z, const cellz_t& cellvals) { const int delta[3] = { @@ -727,7 +725,6 @@ namespace cpgrid } -#if HAVE_ECL_INPUT /// Add an outer cell layer in the (i, j) directions, /// repeating the cells on the other side (for periodic /// boundary conditions). diff --git a/opm/grid/grid_equal.cpp b/opm/grid/grid_equal.cpp index 9d05fadf8c..0af47c14d5 100644 --- a/opm/grid/grid_equal.cpp +++ b/opm/grid/grid_equal.cpp @@ -1,6 +1,6 @@ #include -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON #include #include @@ -149,4 +149,4 @@ bool grid_equal(const UnstructuredGrid* g1, const UnstructuredGrid* g2) return eq; } -#endif // #if HAVE_ECL_INPUT +#endif // #if HAVE_OPM_COMMON diff --git a/opm/grid/polyhedralgrid/dgfparser.hh b/opm/grid/polyhedralgrid/dgfparser.hh index 3639ae5a2e..1a03c9bead 100644 --- a/opm/grid/polyhedralgrid/dgfparser.hh +++ b/opm/grid/polyhedralgrid/dgfparser.hh @@ -20,7 +20,7 @@ #include -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON #include #include #include @@ -60,7 +60,7 @@ namespace Dune if( !input ) DUNE_THROW( DGFException, "Macrofile '" << filename << "' not found" ); -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON if( !DuneGridFormatParser::isDuneGridFormat( input ) ) { Opm::Parser parser; diff --git a/opm/grid/polyhedralgrid/grid.hh b/opm/grid/polyhedralgrid/grid.hh index 97cacab5ce..ecf5abe353 100644 --- a/opm/grid/polyhedralgrid/grid.hh +++ b/opm/grid/polyhedralgrid/grid.hh @@ -30,7 +30,7 @@ // Re-enable warnings. #include -#include +#include #include #include @@ -39,7 +39,7 @@ #include #include -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON #include #endif @@ -318,7 +318,7 @@ namespace Dune /** \name Construction and Destruction * \{ */ -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON /** \brief constructor * * \param[in] deck Opm Eclipse deck @@ -887,7 +887,7 @@ namespace Dune } protected: -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON UnstructuredGridType* createGrid(const Opm::EclipseGrid& inputGrid, const std::vector& poreVolumes, diff --git a/opm/grid/utility/ErrorMacros.hpp b/opm/grid/utility/ErrorMacros.hpp new file mode 100644 index 0000000000..90749844bd --- /dev/null +++ b/opm/grid/utility/ErrorMacros.hpp @@ -0,0 +1,46 @@ +/* + Copyright 2026 Equinor ASA. + + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . +*/ +#ifndef OPM_GRID_ERROR_MACROS_HPP +#define OPM_GRID_ERROR_MACROS_HPP + +#if HAVE_OPM_COMMON +#include +#else + +#include +#include + +#define OPM_THROW(Exception, message) \ + do { \ + std::string oss_ = std::string{"["} + __FILE__ + ":" + \ + std::to_string(__LINE__) + "] " + \ + message; \ + throw Exception(oss_); \ + } while (false) + +#define OPM_THROW_NOLOG OPM_THROW + +// throw an exception if a condition is true +#define OPM_ERROR_IF(condition, message) do {if(condition){ OPM_THROW(std::logic_error, message);}} while(false) + +#define OPM_MESSAGE(x) do { std::cerr << x << std::endl; } while(false) + +#endif + +#endif // OPM_GRID_ERROR_MACROS_HPP diff --git a/opm/grid/utility/IteratorRange.hpp b/opm/grid/utility/IteratorRange.hpp index d5dd61de5b..937c9fb006 100644 --- a/opm/grid/utility/IteratorRange.hpp +++ b/opm/grid/utility/IteratorRange.hpp @@ -23,7 +23,11 @@ #include #include +#if HAVE_OPM_COMMON #include +#else +#define OPM_HOST_DEVICE +#endif namespace Opm { diff --git a/opm/grid/utility/OpmLog.hpp b/opm/grid/utility/OpmLog.hpp new file mode 100644 index 0000000000..6d3c814519 --- /dev/null +++ b/opm/grid/utility/OpmLog.hpp @@ -0,0 +1,54 @@ +/* + Copyright 2026 Equinor ASA. + + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . +*/ +#ifndef OPM_GRID_LOG_HPP +#define OPM_GRID_LOG_HPP + +#if HAVE_OPM_COMMON +#include +#else + +#include +#include + +namespace Opm::OpmLog { + static inline void error(std::string_view msg) + { + std::cerr << msg << std::endl; + } + + static inline void info(std::string_view msg) + { + std::cout << msg << std::endl; + } + + static inline void warning(std::string_view msg) + { + std::cout << msg << std::endl; + } + + static inline void warning(std::string_view tag, std::string_view msg) + { + std::cout << '[' << tag << "]: " << msg << std::endl; + } + + static inline void setupSimpleDefaultLogging() {} +} +#endif + +#endif // OPM_GRID_LOG_HPP diff --git a/opm/grid/utility/OpmWellType.hpp b/opm/grid/utility/OpmWellType.hpp index 3858b004f2..3071368305 100644 --- a/opm/grid/utility/OpmWellType.hpp +++ b/opm/grid/utility/OpmWellType.hpp @@ -19,7 +19,7 @@ #ifndef OPM_GRID_WELLTYPE_HEADER_INCLUDED #define OPM_GRID_WELLTYPE_HEADER_INCLUDED -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON namespace Opm { class Well; @@ -30,7 +30,7 @@ namespace Dune { using OpmWellType = Opm::Well; } } -#else // #if HAVE_ECL_INPUT +#else // #if HAVE_OPM_COMMON namespace Dune { namespace cpgrid { @@ -38,6 +38,6 @@ namespace Dune { } } -#endif // #if HAVE_ECL_INPUT +#endif // #if HAVE_OPM_COMMON #endif // #ifndef OPM_GRID_WELLTYPE_HEADER_INCLUDED diff --git a/opm/grid/utility/SparseTable.hpp b/opm/grid/utility/SparseTable.hpp index 0fde7c5268..b2c558b32e 100644 --- a/opm/grid/utility/SparseTable.hpp +++ b/opm/grid/utility/SparseTable.hpp @@ -35,15 +35,19 @@ #ifndef OPM_SPARSETABLE_HEADER #define OPM_SPARSETABLE_HEADER -#include -#include -#include -#include -#include -#include +#include #include +#if HAVE_OPM_COMMON #include +#endif + +#include +#include +#include +#include +#include +#include namespace Opm { diff --git a/opm/grid/utility/StopWatch.cpp b/opm/grid/utility/StopWatch.cpp index 330bb444a9..e28246879c 100644 --- a/opm/grid/utility/StopWatch.cpp +++ b/opm/grid/utility/StopWatch.cpp @@ -36,7 +36,9 @@ #include "config.h" #endif #include -#include +#include + +#include namespace Opm { diff --git a/tests/cpgrid/geometry_test.cpp b/tests/cpgrid/geometry_test.cpp index 4c48a69240..8d7905768b 100644 --- a/tests/cpgrid/geometry_test.cpp +++ b/tests/cpgrid/geometry_test.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include diff --git a/tests/cpgrid/lgr/LgrChecks.hpp b/tests/cpgrid/lgr/LgrChecks.hpp index 225e4aa4a6..64de2321ba 100644 --- a/tests/cpgrid/lgr/LgrChecks.hpp +++ b/tests/cpgrid/lgr/LgrChecks.hpp @@ -26,9 +26,12 @@ #include #include +#if HAVE_OPM_COMMON #include #include #include +#endif + #include #include #include @@ -94,12 +97,14 @@ void checkVertexAndFaceIndexAreNonNegative(const Dune::CpGrid& grid); void checkFaceHas4VerticesAndMax2NeighboringCells(const Dune::CpGrid& grid, const std::vector>& data); +#if HAVE_OPM_COMMON void createGridAndAddLgrs(Dune::CpGrid& grid, const std::string& deck_string, const std::vector>& cells_per_dim_vec, const std::vector>& startIJK_vec, const std::vector>& endIJK_vec, const std::vector& lgr_name_vec); +#endif void createGridAndAddLgrs(Dune::CpGrid& grid, const std::array& cell_sizes, @@ -537,6 +542,7 @@ void Opm::checkFaceHas4VerticesAndMax2NeighboringCells(const Dune::CpGrid& grid, } } +#if HAVE_OPM_COMMON void Opm::createGridAndAddLgrs(Dune::CpGrid& grid, const std::string& deck_string, const std::vector>& cells_per_dim_vec, @@ -553,6 +559,7 @@ void Opm::createGridAndAddLgrs(Dune::CpGrid& grid, grid.addLgrsUpdateLeafView(cells_per_dim_vec, startIJK_vec, endIJK_vec, lgr_name_vec); } +#endif void Opm::createGridAndAddLgrs(Dune::CpGrid& grid, const std::array& cell_sizes, diff --git a/tests/cpgrid/lgr/adapt_cpgrid_test.cpp b/tests/cpgrid/lgr/adapt_cpgrid_test.cpp index ef2addf1cd..47437ab45c 100644 --- a/tests/cpgrid/lgr/adapt_cpgrid_test.cpp +++ b/tests/cpgrid/lgr/adapt_cpgrid_test.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include diff --git a/tests/cpgrid/lgr/addLgrsOnDistributedGrid_test.cpp b/tests/cpgrid/lgr/addLgrsOnDistributedGrid_test.cpp index 8f69177f18..41e0e1b0cb 100644 --- a/tests/cpgrid/lgr/addLgrsOnDistributedGrid_test.cpp +++ b/tests/cpgrid/lgr/addLgrsOnDistributedGrid_test.cpp @@ -23,11 +23,11 @@ #include #include +#include #include #include #include -#include #include diff --git a/tests/cpgrid/lgr/addLgrs_in_allActiveCartesianGrid_test.cpp b/tests/cpgrid/lgr/addLgrs_in_allActiveCartesianGrid_test.cpp index deb0a64805..2a61774f41 100644 --- a/tests/cpgrid/lgr/addLgrs_in_allActiveCartesianGrid_test.cpp +++ b/tests/cpgrid/lgr/addLgrs_in_allActiveCartesianGrid_test.cpp @@ -22,6 +22,7 @@ #include #include +#include #include diff --git a/tests/cpgrid/lgr/autoRefine_test.cpp b/tests/cpgrid/lgr/autoRefine_test.cpp index ff5405ec1f..9a32af6169 100644 --- a/tests/cpgrid/lgr/autoRefine_test.cpp +++ b/tests/cpgrid/lgr/autoRefine_test.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include diff --git a/tests/cpgrid/lgr/global_refine_test.cpp b/tests/cpgrid/lgr/global_refine_test.cpp index a5e496650a..835964b26e 100644 --- a/tests/cpgrid/lgr/global_refine_test.cpp +++ b/tests/cpgrid/lgr/global_refine_test.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include diff --git a/tests/cpgrid/lgr/id_entity_entityrep_test.cpp b/tests/cpgrid/lgr/id_entity_entityrep_test.cpp index c6da59d830..bcaad20186 100644 --- a/tests/cpgrid/lgr/id_entity_entityrep_test.cpp +++ b/tests/cpgrid/lgr/id_entity_entityrep_test.cpp @@ -23,6 +23,7 @@ #include #include +#include #include diff --git a/tests/cpgrid/lgr/level_and_grid_cartesianIndexMappers_test.cpp b/tests/cpgrid/lgr/level_and_grid_cartesianIndexMappers_test.cpp index aa530f70f3..1f1e160ce2 100644 --- a/tests/cpgrid/lgr/level_and_grid_cartesianIndexMappers_test.cpp +++ b/tests/cpgrid/lgr/level_and_grid_cartesianIndexMappers_test.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -1003,6 +1004,7 @@ BOOST_AUTO_TEST_CASE(level_and_grid_cartesianIndexMapper_after_globalRefine) checkGloballyRefinedTestGrids(grid, cartMapp, levelCartMapp, isParallel); } +#if HAVE_OPM_COMMON BOOST_AUTO_TEST_CASE(level_and_grid_cartesianIndexMapper_after_addLgrsUpdateLeafView_with_a_few_inactive_parent_cells) { @@ -1292,6 +1294,7 @@ BOOST_AUTO_TEST_CASE(level_and_grid_cartesianIndexMapper_after_addLgrsUpdateLeaf BOOST_CHECK(grid.comm().max(foundId13)); BOOST_CHECK(grid.comm().max(foundId26)); } +#endif /** TODO: Define class LeafCartesianIndexMapper and include it in the test */ diff --git a/tests/cpgrid/lgr/lgrs_sharing_faces_test.cpp b/tests/cpgrid/lgr/lgrs_sharing_faces_test.cpp index 4640a8bc61..36c97a7f54 100644 --- a/tests/cpgrid/lgr/lgrs_sharing_faces_test.cpp +++ b/tests/cpgrid/lgr/lgrs_sharing_faces_test.cpp @@ -23,6 +23,7 @@ #include #include +#include #include diff --git a/tests/cpgrid/lgr/logicalCartesianSize_and_refinement_test.cpp b/tests/cpgrid/lgr/logicalCartesianSize_and_refinement_test.cpp index 1db5c8737f..f645849586 100644 --- a/tests/cpgrid/lgr/logicalCartesianSize_and_refinement_test.cpp +++ b/tests/cpgrid/lgr/logicalCartesianSize_and_refinement_test.cpp @@ -22,9 +22,8 @@ #include #include +#include - -#include #include #include diff --git a/tests/cpgrid/lgr/nested_refinement_test.cpp b/tests/cpgrid/lgr/nested_refinement_test.cpp index 4d04c69e9f..fccb1efbf2 100644 --- a/tests/cpgrid/lgr/nested_refinement_test.cpp +++ b/tests/cpgrid/lgr/nested_refinement_test.cpp @@ -22,9 +22,9 @@ #include #include +#include #include - #include #include #include diff --git a/tests/cpgrid/lgr/replace_lgr1_corner_idx_by_lgr2_corner_idx_test.cpp b/tests/cpgrid/lgr/replace_lgr1_corner_idx_by_lgr2_corner_idx_test.cpp index 5c91ac69f0..442973678d 100644 --- a/tests/cpgrid/lgr/replace_lgr1_corner_idx_by_lgr2_corner_idx_test.cpp +++ b/tests/cpgrid/lgr/replace_lgr1_corner_idx_by_lgr2_corner_idx_test.cpp @@ -23,13 +23,13 @@ #include #include +#include #include #include #include #include - struct Fixture { Fixture() diff --git a/tests/cpgrid/lgr/replace_lgr1_face_idx_by_lgr2_face_idx_test.cpp b/tests/cpgrid/lgr/replace_lgr1_face_idx_by_lgr2_face_idx_test.cpp index 5ee8698318..1bc82332de 100644 --- a/tests/cpgrid/lgr/replace_lgr1_face_idx_by_lgr2_face_idx_test.cpp +++ b/tests/cpgrid/lgr/replace_lgr1_face_idx_by_lgr2_face_idx_test.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include diff --git a/tests/cpgrid/shifted_cart_test.cpp b/tests/cpgrid/shifted_cart_test.cpp index 245ef6e813..5430f669ee 100644 --- a/tests/cpgrid/shifted_cart_test.cpp +++ b/tests/cpgrid/shifted_cart_test.cpp @@ -26,7 +26,10 @@ #else #include #endif + #include +#include + struct Fixture { Fixture() diff --git a/tests/test_cellCentroid_polyhedralGrid.cpp b/tests/test_cellCentroid_polyhedralGrid.cpp index 7ebbf7e983..ad17c2d0b0 100644 --- a/tests/test_cellCentroid_polyhedralGrid.cpp +++ b/tests/test_cellCentroid_polyhedralGrid.cpp @@ -44,11 +44,14 @@ #include #include +#if HAVE_OPM_COMMON #include #include #include -#include #include +#endif + +#include #include #include @@ -108,10 +111,8 @@ void createEclGridPolyhedralGrid_and_checkCentroid(const std::string& deckString } } - BOOST_AUTO_TEST_CASE(PolyGridFromEcl) { -#if HAVE_ECL_INPUT const char *deckString = "RUNSPEC\n" "METRIC\n" @@ -128,7 +129,6 @@ BOOST_AUTO_TEST_CASE(PolyGridFromEcl) "16*100.0 /\n"; createEclGridPolyhedralGrid_and_checkCentroid(deckString); -#endif } diff --git a/tests/test_column_extract.cpp b/tests/test_column_extract.cpp index 25278c8452..4565133b00 100644 --- a/tests/test_column_extract.cpp +++ b/tests/test_column_extract.cpp @@ -8,7 +8,7 @@ #include #include -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON #include #include #include @@ -130,7 +130,7 @@ BOOST_AUTO_TEST_CASE(DisjointColumn) correct_answer[4].resize(1); correct_answer[9].resize(1); -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON Opm::Parser parser; Opm::Deck deck = parser.parseString(grdecl); Opm::EclipseGrid ep = Opm::EclipseGrid(deck); diff --git a/tests/test_cpgrid.cpp b/tests/test_cpgrid.cpp index e5f4afa932..bd6d0fdc63 100644 --- a/tests/test_cpgrid.cpp +++ b/tests/test_cpgrid.cpp @@ -11,6 +11,10 @@ #include +#if HAVE_OPM_COMMON +#include +#include +#endif #define DISABLE_DEPRECATED_METHOD_CHECK 1 using Dune::referenceElement; //grid check assume usage of Dune::Geometry @@ -20,10 +24,6 @@ using Dune::referenceElement; //grid check assume usage of Dune::Geometry // Re-enable warnings. #include -#include -#include -#include - #include template @@ -142,7 +142,7 @@ int main(int argc, char** argv ) // test CpGrid typedef Dune::CpGrid Grid; -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON const char *deckString = "RUNSPEC\n" "METRIC\n" diff --git a/tests/test_elementchunks.cpp b/tests/test_elementchunks.cpp index 16234c6350..3be7e77e10 100644 --- a/tests/test_elementchunks.cpp +++ b/tests/test_elementchunks.cpp @@ -28,11 +28,12 @@ #define BOOST_TEST_MODULE ElementChunksTest #include -#include +#include #include -#include +#include +#include struct Fixture { diff --git a/tests/test_graphofgrid.cpp b/tests/test_graphofgrid.cpp index defa3e1cea..e6520bbba2 100644 --- a/tests/test_graphofgrid.cpp +++ b/tests/test_graphofgrid.cpp @@ -30,18 +30,19 @@ #define BOOST_TEST_MODULE GraphRepresentationOfGrid #define BOOST_TEST_NO_MAIN #include -#include -#include -#include #include - #include #include - #include + +#if HAVE_OPM_COMMON +#include +#include +#include #include #include #include +#endif #include @@ -243,6 +244,7 @@ BOOST_AUTO_TEST_CASE(LogarithmicTransmissibilities) BOOST_REQUIRE(checked==24); } +#if HAVE_OPM_COMMON BOOST_AUTO_TEST_CASE(SimpleGraphWithInactiveCells) { const std::string deckString = @@ -300,6 +302,7 @@ BOOST_AUTO_TEST_CASE(SimpleGraphWithInactiveCells) } BOOST_REQUIRE(checked==0+1+2); } +#endif #if HAVE_MPI BOOST_AUTO_TEST_CASE(WrapperForZoltan) @@ -642,6 +645,7 @@ BOOST_AUTO_TEST_CASE(WellsWithIntersectingBuffers2) BOOST_REQUIRE(gog.size()==1); } +#if HAVE_OPM_COMMON namespace { // create Wells, we only use well name and cell locations auto createConnection (int i, int j, int k) @@ -659,8 +663,9 @@ namespace { 0.,0.,false,false,0,Well::GasInflowEquation()); }; } // end anonymous namespace +#endif -#if HAVE_MPI +#if HAVE_MPI && HAVE_OPM_COMMON // Create yet another small grid with wells and test graph properties. // This time wells are supplied via OpmWellType interface BOOST_AUTO_TEST_CASE(addWellConnections) @@ -769,8 +774,9 @@ BOOST_AUTO_TEST_CASE(addWellConnections) } } -#endif // HAVE_MPI +#endif // HAVE_MPI && HAVE_OPM_COMMON +#if HAVE_OPM_COMMON BOOST_AUTO_TEST_CASE(gIDtoRankCorrection) { // create a grid with wells @@ -807,6 +813,7 @@ BOOST_AUTO_TEST_CASE(gIDtoRankCorrection) extendGIDtoRank(gog,gIDtoRank); BOOST_CHECK(gIDtoRank[8]==1); } +#endif #if HAVE_MPI // This function is in MPI guard even though it does not use the communication. @@ -844,6 +851,7 @@ BOOST_AUTO_TEST_CASE(ExtendAndSortImportList) } #endif // HAVE_MPI +#if HAVE_OPM_COMMON // getWellRanks takes wellConnections and vector gIDtoRank mapping cells to their ranks // and returns a vector of well ranks BOOST_AUTO_TEST_CASE(test_getWellRanks) @@ -882,6 +890,7 @@ BOOST_AUTO_TEST_CASE(test_getWellRanks) BOOST_CHECK(wellRanks[1]==3); BOOST_CHECK(wellRanks[2]==2); } +#endif bool init_unit_test_func() diff --git a/tests/test_graphofgrid_parallel.cpp b/tests/test_graphofgrid_parallel.cpp index e2fd294549..b792da5fd8 100644 --- a/tests/test_graphofgrid_parallel.cpp +++ b/tests/test_graphofgrid_parallel.cpp @@ -35,8 +35,9 @@ #include #include -// #include +#if HAVE_OPM_COMMON #include +#endif #include @@ -161,6 +162,7 @@ BOOST_AUTO_TEST_CASE(CommunicateExportedCells) } } +#if HAVE_OPM_COMMON namespace { auto createWell(const std::string& name) { @@ -365,6 +367,7 @@ BOOST_AUTO_TEST_CASE(SequentialZoltanSupport) impCells.swap(importedCells); BOOST_REQUIRE(importedCells == importSol); } +#endif // HAVE_OPM_COMMON #endif // HAVE_MPI bool init_unit_test_func() diff --git a/tests/test_lookupdata_polyhedral.cpp b/tests/test_lookupdata_polyhedral.cpp index 75b3f20d69..9733415a3f 100644 --- a/tests/test_lookupdata_polyhedral.cpp +++ b/tests/test_lookupdata_polyhedral.cpp @@ -147,7 +147,7 @@ void lookup_check(const Dune::PolyhedralGrid<3,3>& grid) BOOST_AUTO_TEST_CASE(PolyGridFromEcl) { -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON const char *deckString = "RUNSPEC\n" "METRIC\n" diff --git a/tests/test_polyhedralgrid.cpp b/tests/test_polyhedralgrid.cpp index c8a6ed5dcc..9604896d92 100644 --- a/tests/test_polyhedralgrid.cpp +++ b/tests/test_polyhedralgrid.cpp @@ -18,7 +18,9 @@ // Re-enable warnings. #include +#if HAVE_OPM_COMMON #include +#endif #include @@ -264,7 +266,7 @@ int main(int argc, char** argv ) { typedef Dune::PolyhedralGrid< 3, 3 > Grid; -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON const char *deckString = "RUNSPEC\n" "METRIC\n" diff --git a/tests/test_subgridpart.cpp b/tests/test_subgridpart.cpp index 1c32db12c8..5dddedf452 100644 --- a/tests/test_subgridpart.cpp +++ b/tests/test_subgridpart.cpp @@ -33,9 +33,11 @@ using Dune::referenceElement; //grid check assume usage of Dune::Geometry // Re-enable warnings. #include +#if HAVE_OPM_COMMON #include #include #include +#endif #include #include @@ -178,7 +180,7 @@ void testGrid(Grid& grid, const std::string& name, const std::size_t nElem, cons } -#if HAVE_ECL_INPUT +#if HAVE_OPM_COMMON BOOST_AUTO_TEST_CASE(FromDeck) { // ------------ Test grid from deck. ------------ @@ -208,7 +210,7 @@ TOPS grid.processEclipseFormat(&ecl_grid, nullptr, false, false, false); testGrid( grid, "CpGrid_ecl", 8, 27 ); } -#endif // HAVE_ECL_INPUT +#endif // HAVE_OPM_COMMON BOOST_AUTO_TEST_CASE(dgf)