Skip to content
Open
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
16 changes: 8 additions & 8 deletions opm/grid/cpgrid/CpGridData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1577,8 +1577,8 @@ void CpGridData::distributeGlobalGrid(CpGrid& grid,

// Compute partition type for points
computePointPartitionType();
computeCommunicationInterfaces(noExistingPoints);

computeCommunicationInterfaces(noExistingPoints);
#else // #if HAVE_MPI
static_cast<void>(grid);
static_cast<void>(view_data);
Expand Down Expand Up @@ -2065,9 +2065,9 @@ int CpGridData::sharedFaceTag(const std::vector<std::array<int,3>>& startIJK_2Pa
assert(endIJK_2Patches.size() == 2);

int faceTag = -1; // 0 represents I_FACE, 1 J_FACE, and 2 K_FACE. Use -1 for no sharing face case.

if (patchesShareFace(startIJK_2Patches, endIJK_2Patches)) {

const auto& detectSharing = [](const std::vector<int>& faceIdxs, const std::vector<int>& otherFaceIdxs){
bool faceIsShared = false;
for (const auto& face : faceIdxs) {
Expand All @@ -2080,7 +2080,7 @@ int CpGridData::sharedFaceTag(const std::vector<std::array<int,3>>& startIJK_2Pa
}
return faceIsShared; // should be false here
};

const auto& [iFalse, iTrue, jFalse, jTrue, kFalse, kTrue] = this->getBoundaryPatchFaces(startIJK_2Patches[0], endIJK_2Patches[0]);
const auto& [iFalseOther, iTrueOther, jFalseOther, jTrueOther, kFalseOther, kTrueOther] =
this->getBoundaryPatchFaces(startIJK_2Patches[1], endIJK_2Patches[1]);
Expand Down Expand Up @@ -2668,11 +2668,11 @@ CpGridData::refinePatch(const std::array<int,3>& cells_per_dim, const std::array
bool CpGridData::mark(int refCount, const cpgrid::Entity<0>& element)
{
if (refCount == -1) {
OPM_THROW(std::logic_error, "Coarsening is not supported yet.");
return false; // Coarsening is not supported yet.
}
// Prevent refinement if the cell has a non-neighbor connection (NNC).
if (hasNNCs({element.index()}) && (refCount == 1)) {
OPM_THROW(std::logic_error, "Refinement of cells with face representing an NNC is not supported yet.");
return false; // Refinement of cells with face representing an NNC is not supported yet
}
assert((refCount == 0) || (refCount == 1)); // Do nothing (0), Refine (1), Coarsen (-1) not supported yet.
if (mark_.empty()) {
Expand All @@ -2699,7 +2699,7 @@ bool CpGridData::preAdapt()
if (local_empty)
mark_.resize(size(0));
}

// Detect the maximum mark across processes, and rewrite
// the local entry in mark_, i.e.,
// mark_[ element.index() ] = max{ local marks in processes where this element belongs to}.
Expand Down
6 changes: 6 additions & 0 deletions opm/grid/cpgrid/Entity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,12 @@ unsigned int Entity<codim>::subEntities ( const unsigned int cc ) const
if ( cc == 3 ) { // Get number of corners of the element.
return 8;
}
if ( cc == 2 ) { // Get number of lines of the element.
return 12;
}
if ( cc == 1 ) { // Get number of faces of the element.
return 6;
}
}
return 0;
}
Expand Down
13 changes: 8 additions & 5 deletions tests/test_cpgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ using Dune::referenceElement; //grid check assume usage of Dune::Geometry
#include <opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/input/eclipse/Parser/Parser.hpp>

#include <dune/common/version.hh>

#include <iostream>

template <class GridView>
Expand Down Expand Up @@ -91,16 +93,17 @@ template <class Grid>
void testGrid(Grid& grid, const std::string& name, const size_t nElem, const size_t nVertices)
{
typedef typename Grid::LeafGridView GridView;
/*

#if DUNE_VERSION_GTE(DUNE_GRID, 2, 10)
try {
gridcheck( grid );
}
catch ( const Dune::Exception& e)
{
std::cerr << "Warning: " << e.what() << std::endl;
}
*/
#endif

std::cout << name << std::endl;

testGridIteration( grid.leafGridView(), nElem );
Expand Down Expand Up @@ -166,7 +169,7 @@ int main(int argc, char** argv )

grid.processEclipseFormat(&ecl_grid, nullptr, false, false, false);
testGrid( grid, "CpGrid_ecl", 8, 27 );

const auto& grid_leafView = grid.leafGridView();
Dune::CartesianIndexMapper<Grid> grid_cartMapper = Dune::CartesianIndexMapper<Grid>(grid);
for (const auto& element: Dune::elements(grid_leafView)){
Expand All @@ -183,8 +186,8 @@ int main(int argc, char** argv )
}
std::cout << " " << '\n';
}


#endif

std::stringstream dgfFile;
Expand Down