Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
73 changes: 40 additions & 33 deletions CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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()

Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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()
8 changes: 0 additions & 8 deletions examples/mirror_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
*
*/

#if HAVE_ECL_INPUT
#include <opm/input/eclipse/Deck/Deck.hpp>

#include <opm/input/eclipse/Parser/ParseContext.hpp>
Expand Down Expand Up @@ -403,10 +402,3 @@ int main(int argc, char** argv)
mirror_celldata<double>("SOWCR", deck, direction, outfile);
return 0;
}
#else
int main () {
std::cerr << "Program need activated ECL input. (Configure opm-common "
<< " with -DENABLE_ECL_INPUT=ON)"<<std::endl;
return 1;
}
#endif // #if HAVE_OPM_COMMON
5 changes: 1 addition & 4 deletions opm-grid-prereqs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ set (opm-grid_CONFIG_VAR
HAVE_PTSCOTCH
IS_SCOTCH_METIS_HEADER
HAVE_ZOLTAN
HAVE_OPM_COMMON
HAVE_ECL_INPUT
)
)

# dependencies
set (opm-grid_DEPS
Expand All @@ -26,7 +24,6 @@ set (opm-grid_DEPS
"dune-common REQUIRED"
"dune-grid REQUIRED"
"dune-istl"
"opm-common REQUIRED"
"ZOLTAN"
"PTScotch"
"Scotch"
Expand Down
5 changes: 4 additions & 1 deletion opm/grid/CellQuadrature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
#include <opm/grid/CellQuadrature.hpp>

#include <opm/grid/UnstructuredGrid.h>
#include <opm/common/ErrorMacros.hpp>
#include <opm/grid/utility/ErrorMacros.hpp>

#include <algorithm>
#include <cassert>
#include <cmath>
#include <stdexcept>

namespace {

Expand Down
4 changes: 2 additions & 2 deletions opm/grid/CpGrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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').
///
Expand Down
5 changes: 4 additions & 1 deletion opm/grid/FaceQuadrature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
#include <config.h>
#include <opm/grid/FaceQuadrature.hpp>

#include <opm/common/ErrorMacros.hpp>
#include <opm/grid/utility/ErrorMacros.hpp>
#include <opm/grid/UnstructuredGrid.h>

#include <cassert>
#include <cmath>
#include <stdexcept>

namespace {

Expand Down
3 changes: 2 additions & 1 deletion opm/grid/GraphOfGridWrappers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
#ifndef GRAPH_OF_GRID_WRAPPERS_HEADER
#define GRAPH_OF_GRID_WRAPPERS_HEADER

#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/grid/utility/OpmLog.hpp>

#include <opm/grid/GraphOfGrid.hpp>
#include <opm/grid/common/WellConnections.hpp>
#include <opm/grid/common/ZoltanGraphFunctions.hpp> // defines Zoltan and null-callback-functions
Expand Down
9 changes: 4 additions & 5 deletions opm/grid/GridHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
#include "config.h"
#include <opm/grid/GridHelpers.hpp>

#include <opm/common/utility/ActiveGridCells.hpp>

#include <opm/grid/common/Volumes.hpp>

#if HAVE_ECL_INPUT
#if HAVE_OPM_COMMON
#include <opm/common/utility/ActiveGridCells.hpp>
#include <opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#endif

Expand Down Expand Up @@ -62,7 +61,7 @@ const int* cartDims(const UnstructuredGrid& grid)
return grid.cartdims;
}

#if HAVE_ECL_INPUT
#if HAVE_OPM_COMMON
std::vector<int> createACTNUM(const UnstructuredGrid& grid) {
const int* dims = cartDims(grid);
return ActiveGridCells(dims[0], dims[1], dims[2], globalCell(grid), numCells(grid)).actNum();
Expand Down Expand Up @@ -329,7 +328,7 @@ FaceCellTraits<UnstructuredGrid>::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 );

Expand Down
4 changes: 2 additions & 2 deletions opm/grid/GridHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -220,7 +220,7 @@ struct CellVolumeIteratorTraits<UnstructuredGrid>
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 );
Expand Down
12 changes: 4 additions & 8 deletions opm/grid/GridManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,16 @@
#include <opm/grid/cart_grid.h>
#include <opm/grid/cornerpoint_grid.h>
#include <opm/grid/MinpvProcessor.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/grid/utility/ErrorMacros.hpp>

#if HAVE_ECL_INPUT
#if HAVE_OPM_COMMON
#include <opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#endif

#include <array>
#include <algorithm>
#include <numeric>

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)
Expand Down Expand Up @@ -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<double>& poreVolumes,
Expand Down
Loading