Skip to content

Commit 5378be3

Browse files
committed
add option USE_OPM_COMMON
turn it off build without opm-common
1 parent fd0be81 commit 5378be3

File tree

65 files changed

+357
-176
lines changed

Some content is hidden

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

65 files changed

+357
-176
lines changed

CMakeLists.txt

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ project(opm-grid C CXX Fortran)
2525

2626
option(SIBLING_SEARCH "Search for other modules in sibling directories?" ON)
2727
option(REQUIRE_ZOLTAN "Require Zoltan to be found (needed for productive run" ON)
28+
option(USE_OPM_COMMON "Use data structures from opm-common?" ON)
29+
30+
macro(opm-grid_prereqs_hook)
31+
if(USE_OPM_COMMON)
32+
target_link_libraries(opmgrid PUBLIC opmcommon)
33+
endif()
34+
endmacro()
2835

2936
macro(opm-grid_language_hook)
3037
include(FortranCInterface)
@@ -66,18 +73,22 @@ macro(opm-grid_tests_hook)
6673
set(tests_4proc
6774
addLgrsOnDistributedGrid_test
6875
autoRefine_test
69-
communicate_distributed_grid_with_lgrs_test
70-
distribute_level_zero_from_grid_with_lgrs_and_wells_test
71-
distribute_level_zero_from_grid_with_lgrs_test
7276
distribution_test
73-
grid_global_id_set_test
7477
level_and_grid_cartesianIndexMappers_test
75-
lgr_cell_id_sync_test
7678
logicalCartesianSize_and_refinement_test
77-
mapLevelIndicesToCartesianOutputOrder_test
7879
test_communication_utils
7980
id_entity_entityrep_test
8081
)
82+
if(USE_OPM_COMMON)
83+
list(APPEND tests_4proc
84+
communicate_distributed_grid_with_lgrs_test
85+
distribute_level_zero_from_grid_with_lgrs_test
86+
distribute_level_zero_from_grid_with_lgrs_and_wells_test
87+
grid_global_id_set_test
88+
lgr_cell_id_sync_test
89+
mapLevelIndicesToCartesianOutputOrder_test
90+
)
91+
endif()
8192

8293
list(APPEND test_4proc lgr_with_inactive_parent_cells_test)
8394
foreach(procs 3 4)
@@ -106,7 +117,7 @@ macro(opm-grid_tests_hook)
106117
set_tests_properties(${test4}_parallel PROPERTIES PROCESSORS 4)
107118
endforeach()
108119

109-
if(HAVE_OPM_TESTS AND HAVE_ECL_INPUT)
120+
if(HAVE_OPM_TESTS AND USE_OPM_COMMON)
110121
opm_add_test(cpgrid_aquifer_test
111122
ONLY_COMPILE
112123
SOURCES

CMakeLists_files.cmake

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ list(APPEND MAIN_SOURCE_FILES
7272
opm/grid/utility/WachspressCoord.cpp
7373
)
7474

75-
if (opm-common_FOUND)
75+
if(USE_OPM_COMMON)
7676
list(APPEND MAIN_SOURCE_FILES
7777
opm/grid/utility/VelocityInterpolation.cpp
7878
opm/grid/transmissibility/trans_tpfa.c
@@ -84,7 +84,6 @@ endif()
8484
list(APPEND TEST_SOURCE_FILES
8585
tests/p2pcommunicator_test.cc
8686
tests/test_cartgrid.cpp
87-
tests/test_cellCentroid_polyhedralGrid.cpp
8887
tests/test_column_extract.cpp
8988
tests/test_communication_utils.cpp
9089
tests/test_compressed_cartesian_mapping.cpp
@@ -94,7 +93,6 @@ list(APPEND TEST_SOURCE_FILES
9493
tests/test_graphofgrid.cpp
9594
tests/test_graphofgrid_parallel.cpp
9695
tests/test_gridutilities.cpp
97-
tests/test_lookupdata_polyhedral.cpp
9896
tests/test_minpvprocessor.cpp
9997
tests/test_polyhedralgrid.cpp
10098
tests/test_process_grdecl.cpp
@@ -103,7 +101,6 @@ list(APPEND TEST_SOURCE_FILES
103101
tests/test_sparsetable.cpp
104102
tests/test_subgridpart.cpp
105103
tests/cpgrid/distribution_test.cpp
106-
tests/cpgrid/eclCentroid_test.cpp
107104
tests/cpgrid/entityrep_test.cpp
108105
tests/cpgrid/entity_test.cpp
109106
tests/cpgrid/facetag_test.cpp
@@ -113,42 +110,45 @@ list(APPEND TEST_SOURCE_FILES
113110
tests/cpgrid/shifted_cart_test.cpp
114111
tests/cpgrid/zoltan_test.cpp
115112
tests/cpgrid/lgr/adapt_cpgrid_test.cpp
116-
tests/cpgrid/lgr/addLgrs_if_non_nnc_in_lgrs_test.cpp
117113
tests/cpgrid/lgr/addLgrs_in_allActiveCartesianGrid_test.cpp
118114
tests/cpgrid/lgr/addLgrsOnDistributedGrid_test.cpp
119115
tests/cpgrid/lgr/autoRefine_test.cpp
120-
tests/cpgrid/lgr/communicate_distributed_grid_with_lgrs_test.cpp
121-
tests/cpgrid/lgr/distribute_level_zero_from_grid_with_lgrs_and_wells_test.cpp
122-
tests/cpgrid/lgr/distribute_level_zero_from_grid_with_lgrs_test.cpp
123116
tests/cpgrid/lgr/global_refine_test.cpp
124-
tests/cpgrid/lgr/grid_global_id_set_test.cpp
125117
tests/cpgrid/lgr/id_entity_entityrep_test.cpp
126118
tests/cpgrid/lgr/level_and_grid_cartesianIndexMappers_test.cpp
127-
tests/cpgrid/lgr/levelCartToLevelCompressed_test.cpp
128-
tests/cpgrid/lgr/lgrIJK_test.cpp
129-
tests/cpgrid/lgr/lgr_cartesian_idx_test.cpp
130-
tests/cpgrid/lgr/lgr_cell_id_sync_test.cpp
131-
tests/cpgrid/lgr/lgr_coord_zcorn_test.cpp
132-
tests/cpgrid/lgr/lgr_with_inactive_parent_cells_test.cpp
133119
tests/cpgrid/lgr/lgrs_sharing_faces_test.cpp
134120
tests/cpgrid/lgr/logicalCartesianSize_and_refinement_test.cpp
135-
tests/cpgrid/lgr/lookUpCellCentroid_cpgrid_test.cpp
136-
tests/cpgrid/lgr/lookupdataCpGrid_test.cpp
137-
tests/cpgrid/lgr/mapLevelIndicesToCartesianOutputOrder_test.cpp
138121
tests/cpgrid/lgr/nested_refinement_test.cpp
139-
tests/cpgrid/lgr/refine_hexahedron_with_non_rectangular_faces_test.cpp
140122
tests/cpgrid/lgr/replace_lgr1_corner_idx_by_lgr2_corner_idx_test.cpp
141123
tests/cpgrid/lgr/replace_lgr1_face_idx_by_lgr2_face_idx_test.cpp
142-
tests/cpgrid/lgr/restrict_data_to_level_grids_test.cpp
143-
tests/cpgrid/lgr/save_lgr_coord_zcorn_test.cpp
144124
)
145125

146-
if(HAVE_ECL_INPUT)
126+
if(USE_OPM_COMMON)
147127
list(APPEND TEST_SOURCE_FILES
148128
tests/test_regionmapping.cpp
149129
tests/test_ug.cpp
130+
tests/test_cellCentroid_polyhedralGrid.cpp
131+
tests/test_lookupdata_polyhedral.cpp
150132
tests/cpgrid/grid_nnc.cpp
151133
tests/cpgrid/grid_pinch.cpp
134+
tests/cpgrid/lgr/communicate_distributed_grid_with_lgrs_test.cpp
135+
tests/cpgrid/lgr/distribute_level_zero_from_grid_with_lgrs_test.cpp
136+
tests/cpgrid/lgr/distribute_level_zero_from_grid_with_lgrs_and_wells_test.cpp
137+
tests/cpgrid/lgr/grid_global_id_set_test.cpp
138+
tests/cpgrid/lgr/levelCartToLevelCompressed_test.cpp
139+
tests/cpgrid/lgr/lgr_cell_id_sync_test.cpp
140+
tests/cpgrid/lgr/mapLevelIndicesToCartesianOutputOrder_test.cpp
141+
tests/cpgrid/lgr/restrict_data_to_level_grids_test.cpp
142+
tests/cpgrid/eclCentroid_test.cpp
143+
tests/cpgrid/lgr/addLgrs_if_non_nnc_in_lgrs_test.cpp
144+
tests/cpgrid/lgr/lgrIJK_test.cpp
145+
tests/cpgrid/lgr/lgr_cartesian_idx_test.cpp
146+
tests/cpgrid/lgr/lgr_coord_zcorn_test.cpp
147+
tests/cpgrid/lgr/lgr_with_inactive_parent_cells_test.cpp
148+
tests/cpgrid/lgr/lookUpCellCentroid_cpgrid_test.cpp
149+
tests/cpgrid/lgr/lookupdataCpGrid_test.cpp
150+
tests/cpgrid/lgr/refine_hexahedron_with_non_rectangular_faces_test.cpp
151+
tests/cpgrid/lgr/save_lgr_coord_zcorn_test.cpp
152152
)
153153
endif()
154154

@@ -169,18 +169,18 @@ list(APPEND TEST_DATA_FILES
169169
# find tutorials examples -name '*.c*' -printf '\t%p\n' | sort
170170
list(APPEND EXAMPLE_SOURCE_FILES
171171
examples/finitevolume/finitevolume.cc
172-
examples/mirror_grid.cpp
173172
examples/griditer.cpp
174173
)
175174

176-
# programs listed here will not only be compiled, but also marked for
177-
# installation
178-
list(APPEND PROGRAM_SOURCE_FILES
179-
examples/mirror_grid.cpp
180-
)
181-
if(HAVE_ECL_INPUT)
182-
list(APPEND EXAMPLE_SOURCE_FILES examples/grdecl2vtu.cpp)
183-
list(APPEND PROGRAM_SOURCE_FILES examples/grdecl2vtu.cpp)
175+
if(USE_OPM_COMMON)
176+
list(APPEND EXAMPLE_SOURCE_FILES
177+
examples/grdecl2vtu.cpp
178+
examples/mirror_grid.cpp
179+
)
180+
list(APPEND PROGRAM_SOURCE_FILES
181+
examples/grdecl2vtu.cpp
182+
examples/mirror_grid.cpp
183+
)
184184
endif()
185185

186186
# originally generated with the command:
@@ -215,8 +215,6 @@ list(APPEND PUBLIC_HEADER_FILES
215215
opm/grid/cpgrid/Iterators.hpp
216216
opm/grid/cpgrid/LgrHelpers.hpp
217217
opm/grid/cpgrid/LgrOutputHelpers.hpp
218-
opm/grid/LookUpCellCentroid.hh
219-
opm/grid/LookUpData.hh
220218
opm/grid/cpgrid/ElementMarkHandle.hpp
221219
opm/grid/cpgrid/OrientedEntityTable.hpp
222220
opm/grid/cpgrid/ParentToChildrenCellGlobalIdHandle.hpp
@@ -275,7 +273,9 @@ list(APPEND PUBLIC_HEADER_FILES
275273
opm/grid/utility/cartesianToCompressed.hpp
276274
opm/grid/utility/createThreadIterators.hpp
277275
opm/grid/utility/ElementChunks.hpp
276+
opm/grid/utility/ErrorMacros.hpp
278277
opm/grid/utility/IteratorRange.hpp
278+
opm/grid/utility/OpmLog.hpp
279279
opm/grid/utility/OpmWellType.hpp
280280
opm/grid/utility/RegionMapping.hpp
281281
opm/grid/utility/SparseTable.hpp
@@ -286,3 +286,10 @@ list(APPEND PUBLIC_HEADER_FILES
286286
opm/grid/utility/platform_dependent/disable_warnings.h
287287
opm/grid/utility/platform_dependent/reenable_warnings.h
288288
)
289+
290+
if(USE_OPM_COMMON)
291+
list(APPEND PUBLIC_HEADER_FILES
292+
opm/grid/LookUpCellCentroid.hh
293+
opm/grid/LookUpData.hh
294+
)
295+
endif()

examples/mirror_grid.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
*
3333
*/
3434

35-
#if HAVE_ECL_INPUT
3635
#include <opm/input/eclipse/Deck/Deck.hpp>
3736

3837
#include <opm/input/eclipse/Parser/ParseContext.hpp>
@@ -403,10 +402,3 @@ int main(int argc, char** argv)
403402
mirror_celldata<double>("SOWCR", deck, direction, outfile);
404403
return 0;
405404
}
406-
#else
407-
int main () {
408-
std::cerr << "Program need activated ECL input. (Configure opm-common "
409-
<< " with -DENABLE_ECL_INPUT=ON)"<<std::endl;
410-
return 1;
411-
}
412-
#endif // #if HAVE_OPM_COMMON

opm-grid-prereqs.cmake

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ set (opm-grid_CONFIG_VAR
1515
HAVE_PTSCOTCH
1616
IS_SCOTCH_METIS_HEADER
1717
HAVE_ZOLTAN
18-
HAVE_OPM_COMMON
19-
HAVE_ECL_INPUT
20-
)
18+
)
2119

2220
# dependencies
2321
set (opm-grid_DEPS
@@ -26,7 +24,6 @@ set (opm-grid_DEPS
2624
"dune-common REQUIRED"
2725
"dune-grid REQUIRED"
2826
"dune-istl"
29-
"opm-common REQUIRED"
3027
"ZOLTAN"
3128
"PTScotch"
3229
"Scotch"

opm/grid/CellQuadrature.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@
2020
#include <opm/grid/CellQuadrature.hpp>
2121

2222
#include <opm/grid/UnstructuredGrid.h>
23-
#include <opm/common/ErrorMacros.hpp>
23+
#include <opm/grid/utility/ErrorMacros.hpp>
24+
2425
#include <algorithm>
26+
#include <cassert>
2527
#include <cmath>
28+
#include <stdexcept>
2629

2730
namespace {
2831

opm/grid/CpGrid.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ namespace Dune
226226

227227
explicit CpGrid(MPIHelper::MPICommunicator comm);
228228

229-
#if HAVE_ECL_INPUT
229+
#if HAVE_OPM_COMMON
230230
/// Read the Eclipse grid format ('grdecl').
231231
///
232232
/// \return Vector of global indices to the cells which have been
@@ -316,7 +316,7 @@ namespace Dune
316316
bool turn_normals = false,
317317
bool clip_z = false,
318318
bool edge_conformal = false);
319-
#endif // HAVE_ECL_INPUT
319+
#endif // HAVE_OPM_COMMON
320320

321321
/// Read the Eclipse grid format ('grdecl').
322322
///

opm/grid/FaceQuadrature.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919
#include <config.h>
2020
#include <opm/grid/FaceQuadrature.hpp>
2121

22-
#include <opm/common/ErrorMacros.hpp>
22+
#include <opm/grid/utility/ErrorMacros.hpp>
2323
#include <opm/grid/UnstructuredGrid.h>
24+
25+
#include <cassert>
2426
#include <cmath>
27+
#include <stdexcept>
2528

2629
namespace {
2730

opm/grid/GraphOfGridWrappers.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
#ifndef GRAPH_OF_GRID_WRAPPERS_HEADER
2727
#define GRAPH_OF_GRID_WRAPPERS_HEADER
2828

29-
#include <opm/common/OpmLog/OpmLog.hpp>
29+
#include <opm/grid/utility/OpmLog.hpp>
30+
3031
#include <opm/grid/GraphOfGrid.hpp>
3132
#include <opm/grid/common/WellConnections.hpp>
3233
#include <opm/grid/common/ZoltanGraphFunctions.hpp> // defines Zoltan and null-callback-functions

opm/grid/GridHelpers.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222
#include "config.h"
2323
#include <opm/grid/GridHelpers.hpp>
2424

25-
#include <opm/common/utility/ActiveGridCells.hpp>
26-
2725
#include <opm/grid/common/Volumes.hpp>
2826

29-
#if HAVE_ECL_INPUT
27+
#if HAVE_OPM_COMMON
28+
#include <opm/common/utility/ActiveGridCells.hpp>
3029
#include <opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp>
3130
#endif
3231

@@ -62,7 +61,7 @@ const int* cartDims(const UnstructuredGrid& grid)
6261
return grid.cartdims;
6362
}
6463

65-
#if HAVE_ECL_INPUT
64+
#if HAVE_OPM_COMMON
6665
std::vector<int> createACTNUM(const UnstructuredGrid& grid) {
6766
const int* dims = cartDims(grid);
6867
return ActiveGridCells(dims[0], dims[1], dims[2], globalCell(grid), numCells(grid)).actNum();
@@ -329,7 +328,7 @@ FaceCellTraits<UnstructuredGrid>::Type faceCells(const UnstructuredGrid& grid)
329328
}
330329

331330

332-
#if HAVE_ECL_INPUT
331+
#if HAVE_OPM_COMMON
333332
Opm::EclipseGrid createEclipseGrid(const UnstructuredGrid& grid, const Opm::EclipseGrid& inputGrid ) {
334333
const int * dims = UgGridHelpers::cartDims( grid );
335334

opm/grid/GridHelpers.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const int* cartDims(const UnstructuredGrid& grid);
110110
/// in the underlying structured grid.
111111
const int* globalCell(const UnstructuredGrid& grid);
112112

113-
#if HAVE_ECL_INPUT
113+
#if HAVE_OPM_COMMON
114114
/// \brief Create Eclipse style ACTNUM array.
115115
///
116116
/// Create a vector with global cartesian number of elements,
@@ -220,7 +220,7 @@ struct CellVolumeIteratorTraits<UnstructuredGrid>
220220
correctly represented in the EclipseGrid created by this
221221
method.
222222
*/
223-
#if HAVE_ECL_INPUT
223+
#if HAVE_OPM_COMMON
224224
/// \brief Construct an EclipseGrid instance based on the inputGrid, with modifications to
225225
/// zcorn and actnum from the dune UnstructuredGrid.
226226
Opm::EclipseGrid createEclipseGrid(const UnstructuredGrid& grid, const Opm::EclipseGrid& inputGrid );

0 commit comments

Comments
 (0)