Skip to content
Draft
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ if(MPI_FOUND)
add_test(distribute_level_zero_from_grid_with_lgrs_test_parallel ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 4 bin/distribute_level_zero_from_grid_with_lgrs_test)
add_test(distribution_test_parallel ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 4 bin/distribution_test)
add_test(grid_global_id_set_test_parallel ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 4 bin/grid_global_id_set_test)
add_test(idEntity_idLevelZeroEntityRep_test_parallel ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 4 bin/idEntity_idLevelZeroEntityRep_test)
add_test(lgr_cell_id_sync_test_parallel ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 4 bin/lgr_cell_id_sync_test)
add_test(logicalCartesianSize_and_refinement_test_parallel ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 4 bin/logicalCartesianSize_and_refinement_test)
if(Boost_VERSION_STRING VERSION_GREATER 1.53)
Expand Down
1 change: 1 addition & 0 deletions CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ list(APPEND TEST_SOURCE_FILES
tests/cpgrid/lgr/addLgrsOnDistributedGrid_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/idEntity_idLevelZeroEntityRep_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
Expand Down
14 changes: 7 additions & 7 deletions opm/grid/cpgrid/CpGridData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void CpGridData::populateGlobalCellIndexSet()
auto& cell_indexset = cellIndexSet();
cell_indexset.beginResize();
for (int index = 0, end = size(0); index != end ; ++index){
cell_indexset.add(global_id_set_->id(Entity<0>(*this, EntityRep<0>(index, true))),
cell_indexset.add(global_id_set_->idLevelZero(Entity<0>(*this, EntityRep<0>(index, true))),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The results that you encounter are may be explained by this line? This is obtaining the lvl 0 entity id whereas the current master picks up the overload for the different levels.

ParallelIndexSet::LocalIndex(index, AttributeSet::owner, true));
}
cell_indexset.endResize();
Expand Down Expand Up @@ -586,7 +586,7 @@ struct Cell2PointsDataHandle
const auto& points = globalCell2Points_[i];
std::for_each(points.begin(), points.end(),
[&buffer, this](const int& point){
buffer.write(globalIds_.id(EntityRep<3>(point, true)));});
buffer.write(globalIds_.idLevelZero(EntityRep<3>(point, true)));});
for (const auto& point: globalAdditionalPointIds_[i])
{
buffer.write(point);
Expand Down Expand Up @@ -703,7 +703,7 @@ struct SparseTableDataHandle
void gather(B& buffer, const T& t)
{
const auto& entries = global_[t.index()];
std::for_each(entries.begin(), entries.end(), [&buffer, this](const DataType& i){buffer.write(globalIds_.id(EntityRep<3>(i, true)));});
std::for_each(entries.begin(), entries.end(), [&buffer, this](const DataType& i){buffer.write(globalIds_.idLevelZero(EntityRep<3>(i, true)));});
}
template<class B, class T>
void scatter(B& buffer, const T& t, std::size_t )
Expand Down Expand Up @@ -774,7 +774,7 @@ struct OrientedEntityTableDataHandle
{
std::for_each(entries.begin(), entries.end(),
[&buffer, this](const ToEntity& i){
int id = globalIds_->id(i);
int id = globalIds_->idLevelZero(i);
if (!i.orientation())
id = ~id;
buffer.write(id);});
Expand Down Expand Up @@ -845,7 +845,7 @@ struct IndexSet2IdSet
map_[entry.local()] = entry.global();
}
template<class T>
int id(const T& t) const
int idLevelZero(const T& t) const
{
return map_[t.index()];
}
Expand Down Expand Up @@ -1362,7 +1362,7 @@ std::vector<std::set<int> > computeAdditionalFacePoints(const std::vector<std::a
auto candidate = std::find(points.begin(), points.end(), point);
if(candidate == points.end())
// point is not a corner of the cell
additionalFacePoints[c].insert(globalIds.id(EntityRep<3>(point,true)));
additionalFacePoints[c].insert(globalIds.idLevelZero(EntityRep<3>(point,true)));
}
}
return additionalFacePoints;
Expand Down Expand Up @@ -1465,7 +1465,7 @@ std::map<int,int> computeCell2Point(const CpGrid& grid,
createInterfaceList<true>(procCellLists, globalCell2Points,
globalAdditionalPoints,
[&globalIds](int i){
return globalIds.id(EntityRep<3>(i, true));
return globalIds.idLevelZero(EntityRep<3>(i, true));
},
globalMap2Local,
pointInterfaces[procCellLists.first]);
Expand Down
6 changes: 0 additions & 6 deletions opm/grid/cpgrid/Indexsets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ IndexSet::IndexType IndexSet::subIndex(const cpgrid::Entity<0>& e, int i, unsign
{
switch(cc) {
case 0: return index(e.subEntity<0>(i));
case 1: return index(e.subEntity<1>(i));
// case 2: return index(e.subEntity<2>(i)); // Not supported in this grid
case 3: return index(e.subEntity<3>(i));
default: OPM_THROW(std::runtime_error,
"Codimension " + std::to_string(cc) + " not supported.");
Expand All @@ -60,8 +58,6 @@ IdSet::IdType IdSet::subId(const cpgrid::Entity<0>& e, int i, int cc) const
{
switch (cc) {
case 0: return id(e.subEntity<0>(i));
case 1: return id(e.subEntity<1>(i));
// case 2: return id(e.subEntity<2>(i)); // Not supported in this grid
case 3: return id(e.subEntity<3>(i));
default: OPM_THROW(std::runtime_error,
"Cannot get subId of codimension " + std::to_string(cc));
Expand All @@ -75,8 +71,6 @@ LevelGlobalIdSet::IdType LevelGlobalIdSet::subId(const cpgrid::Entity<0>& e, int

switch (cc) {
case 0: return id(e.subEntity<0>(i));
//case 1: return id(*e.subEntity<1>(i));
//case 2: return id(*e.subEntity<2>(i));
case 3: return id(e.subEntity<3>(i));
default: OPM_THROW(std::runtime_error,
"Cannot get subId of codimension " + std::to_string(cc));
Expand Down
16 changes: 10 additions & 6 deletions opm/grid/cpgrid/Indexsets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,18 @@ namespace Dune
"IdSet::id not implemented for codims other thatn 0, 1, and 3.");
}

template<class EntityType>
IdType id(const EntityType& e) const
IdType id(const Entity<0>& e) const
{
return id<EntityType::codimension>(e);
return id<0>(e);
}

IdType id(const Entity<3>& e) const
{
return id<3>(e);
}

template<int codim>
IdType id(const cpgrid::EntityRep<codim>& e) const
IdType idLevelZero(const cpgrid::EntityRep<codim>& e) const
{
return computeId(e);
}
Expand Down Expand Up @@ -414,10 +418,10 @@ namespace Dune
}

template<int codim>
IdType id(const EntityRep<codim>& e) const
IdType idLevelZero(const EntityRep<codim>& e) const
{
if(idSet_)
return idSet_->id(e);
return idSet_->idLevelZero(e);
else
return this->template getMapping<codim>()[e.index()];
}
Expand Down
2 changes: 2 additions & 0 deletions tests/cpgrid/distribution_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,10 @@ BOOST_AUTO_TEST_CASE(compareWithSequential)
using namespace Dune::cpgrid;
auto face = grid.cellFace(eIt->index(), f);
auto seqFace = seqGrid.cellFace(seqEIt->index(), f);
/*
BOOST_REQUIRE(idSet.id(Dune::createEntity<1>(grid, face, true)) ==
seqIdSet.id(Dune::createEntity<1>(seqGrid, seqFace, true)));
*/
int vertices = grid.numFaceVertices(face);
BOOST_REQUIRE(vertices == seqGrid.numFaceVertices(seqFace));
for (int v = 0; v < vertices; ++v)
Expand Down
Loading