Skip to content
Snippets Groups Projects
Commit 0341ff69 authored by Santiago Ospina De Los Ríos's avatar Santiago Ospina De Los Ríos
Browse files

Merge branch 'feature/fix-errors-dune-2.8' into 'master'

Feature/fix errors dune 2.8

See merge request !30
parents 2da6b536 bf49122f
No related branches found
No related tags found
1 merge request!30Feature/fix errors dune 2.8
Pipeline #38164 passed
---
debian:10--gcc:
image: registry.dune-project.org/docker/ci/dune:2.7-debian-10-gcc-8-17
image: registry.dune-project.org/docker/ci/dune:git-debian-10-gcc-8-17
script: duneci-standard-test
tags: [duneci]
artifacts:
......@@ -8,7 +8,7 @@ debian:10--gcc:
junit: junit/*.xml
debian:10--clang:
image: registry.dune-project.org/docker/ci/dune:2.7-debian-10-clang-7-libcpp-17
image: registry.dune-project.org/docker/ci/dune:git-debian-10-clang-7-libcpp-17
script: duneci-standard-test
tags: [duneci]
artifacts:
......
......@@ -988,7 +988,7 @@ public:
}
template<typename IntersectionType>
static const typename SubDomainGrid::template MultiDomainIntersection<IntersectionType>::Type& multiDomainIntersection(const IntersectionType& is) {
static const auto& multiDomainIntersection(const IntersectionType& is) {
return SubDomainGrid::multiDomainIntersection(is);
}
/*@}*/
......
......@@ -28,8 +28,7 @@ namespace {
typedef typename GV::IndexSet::IndexType IndexType;
MCMGMapperStorageProvider(const GV& gv)
{}
void update(const GV& gv) {}
std::array<std::vector<IndexType>,GV::Grid::maxSubDomainIndex()> _offsets; // provide a map with all geometry types
......@@ -43,9 +42,9 @@ namespace {
typedef typename GV::IndexSet::IndexType IndexType;
MCMGMapperStorageProvider(const GV& gv)
: _offsets(gv.grid().maxSubDomainIndex())
{}
void update(const GV& gv) {
_offsets.resize(gv.grid().maxSubDomainIndex());
}
std::vector<std::vector<IndexType> > _offsets; // provide a map with all geometry types
......@@ -99,12 +98,10 @@ public:
typedef typename GV::IndexSet::IndexType IndexType;
typedef typename GV::Grid::SubDomainIndex SubDomainIndex;
MultiDomainMCMGMapper (const GV& gridView, const MCMGLayout& layout)
: Base(gridView,layout)
, StorageProvider(gridView)
, _gv(gridView)
MultiDomainMCMGMapper (const GV& gv, const MCMGLayout& layout)
: Base(gv,layout)
{
update();
update(gv);
}
/** @brief Construct mapper from grid and one of its index sets.
......@@ -113,14 +110,14 @@ public:
\param indexset IndexSet object returned by grid.
*/
MultiDomainMCMGMapper (const GV& gridView)
: Base(gridView)
, StorageProvider(gridView)
, _gv(gridView)
MultiDomainMCMGMapper (const GV& gv)
: Base(gv)
{
update();
update(gv);
}
using Base::gridView;
/** @brief Map entity to array index.
\param e Reference to codim cc entity, where cc is the template parameter of the function.
......@@ -129,7 +126,7 @@ public:
template<class EntityType>
int map (SubDomainIndex subDomain, const EntityType& e) const
{
return _gv.indexSet().index(subDomain,e) + _offsets[subDomain][GlobalGeometryTypeIndex::index(e.type())];
return gridView().indexSet().index(subDomain,e) + _offsets[subDomain][GlobalGeometryTypeIndex::index(e.type())];
}
/** @brief Map subentity of codim 0 entity to array index.
......@@ -141,8 +138,11 @@ public:
*/
int map (SubDomainIndex subDomain, const typename GV::template Codim<0>::Entity& e, int i, unsigned int codim) const
{
GeometryType gt = ReferenceElements<double,GV::dimension>::general(e.type()).type(i,codim);
return _gv.indexSet().subIndex(subDomain,e,i,codim) + _offsets[subDomain][GlobalGeometryTypeIndex::index(gt)];
GeometryType gt =
ReferenceElements<double, GV::dimension>::general(e.type()).type(i,
codim);
return gridView().indexSet().subIndex(subDomain, e, i, codim) +
_offsets[subDomain][GlobalGeometryTypeIndex::index(gt)];
}
/** @brief Return total number of entities in the entity set managed by the mapper.
......@@ -167,11 +167,11 @@ public:
template<class EntityType>
bool contains (SubDomainIndex subDomain, const EntityType& e, IndexType& result) const
{
if(!_gv.indexSet().contains(subDomain,e) || !Base::layout()(e.type(),GV::dimension))
{
result = 0;
return false;
}
if (!gridView().indexSet().contains(subDomain, e) ||
!Base::layout()(e.type(), GV::dimension)) {
result = 0;
return false;
}
result = map(subDomain,e);
return true;
}
......@@ -188,22 +188,35 @@ public:
{
GeometryType gt = ReferenceElements<double,GV::dimension>::general(e.type()).type(i,cc);
// if the entity is contained in the subdomain, all of its subentities are contained as well
if(!_gv.indexSet().contains(subDomain,e) || !Base::layout()(gt,GV::dimension))
{
result = 0;
return false;
}
result = _gv.indexSet().subIndex(subDomain,e,i,cc) + _offsets[subDomain][GlobalGeometryTypeIndex::index(gt)];
if (!gridView().indexSet().contains(subDomain, e) ||
!Base::layout()(gt, GV::dimension)) {
result = 0;
return false;
}
result = gridView().indexSet().subIndex(subDomain, e, i, cc) +
_offsets[subDomain][GlobalGeometryTypeIndex::index(gt)];
return true;
}
/** @brief Recalculates indices after grid adaptation
*/
[[deprecated("Use update(gridView) instead! Will be removed after release 2.8.")]]
void update ()
{
update(gridView());
}
/** @brief Recalculates map after mesh adaptation
/** @brief Recalculates indices after grid adaptation
*
* After grid adaptation you need to call this to update
* the stored gridview and recalculate the indices.
*/
void update()
void update(const GV& gv)
{
static_cast<Base*>(this)->update();
for (SubDomainIndex subDomain = 0; subDomain < _gv.grid().maxSubDomainIndex(); ++subDomain) {
static_cast<Base*>(this)->update(gv);
StorageProvider::update(gv);
for (SubDomainIndex subDomain = 0;
subDomain < gridView().grid().maxSubDomainIndex(); ++subDomain) {
std::vector<IndexType>& offsets = _offsets[subDomain];
offsets.resize(GlobalGeometryTypeIndex::size(GV::dimension) + 1);
std::fill(offsets.begin(),offsets.end(),0);
......@@ -212,17 +225,15 @@ public:
// Note that mapper becomes invalid when the grid is modified.
for (int cc = 0; cc <= GV::dimension; ++cc)
{
for (auto gt : _gv.indexSet().types(subDomain,cc))
offsets[GlobalGeometryTypeIndex::index(gt) + 1] = _gv.indexSet().size(subDomain,gt);
for (auto gt : gridView().indexSet().types(subDomain,cc))
offsets[GlobalGeometryTypeIndex::index(gt) + 1] =
gridView().indexSet().size(subDomain, gt);
// convert sizes to offset
// last entry stores total size
std::partial_sum(offsets.begin(),offsets.end(),offsets.begin());
}
}
}
private:
GV _gv;
};
/** @} */
......
......@@ -621,14 +621,11 @@ public:
return e.impl().hostEntity();
}
template<typename IntersectionType>
struct MultiDomainIntersection
{
typedef typename BaseT::template ReturnImplementationType<IntersectionType>::ImplementationType::MultiDomainIntersection Type;
};
static const auto& multiDomainIntersection(const typename Traits::LeafIntersection& is) {
return is.impl().multiDomainIntersection();
}
template<typename IntersectionType>
static const typename MultiDomainIntersection<IntersectionType>::Type& multiDomainIntersection(const IntersectionType& is) {
static const auto& multiDomainIntersection(const typename Traits::LevelIntersection& is) {
return is.impl().multiDomainIntersection();
}
......
......@@ -45,16 +45,16 @@ dune_add_test(
CMD_ARGS 3
)
dune_add_test(SOURCES multidomain-leveliterator-bug)
dune_add_test(SOURCES testadaptation)
dune_add_test(SOURCES testintersectionconversion)
dune_add_test(SOURCES testintersectiongeometrytypes)
dune_add_test(SOURCES testlargedomainnumbers)
dune_add_test(SOURCES multidomain-leveliterator-bug.cc)
dune_add_test(SOURCES testadaptation.cc)
dune_add_test(SOURCES testintersectionconversion.cc)
dune_add_test(SOURCES testintersectiongeometrytypes.cc)
dune_add_test(SOURCES testlargedomainnumbers.cc)
dune_add_test(
SOURCES testparallel
SOURCES testparallel.cc
MPI_RANKS 2
TIMEOUT 10
CMD_ARGS 16 2
)
dune_add_test(SOURCES testpartitioning)
dune_add_test(SOURCES testpartitioning.cc)
......@@ -45,8 +45,8 @@ int main(int argc, char** argv)
SDGrid::LeafGridView::Codim<0>::Iterator it = sdgv.begin<0>();
SDGrid::LeafGridView::IntersectionIterator iit = sdgv.ibegin(*it);
MDGrid::LeafGridView::Intersection is1 DUNE_UNUSED = sdgrid.multiDomainIntersection(*iit);
MDGrid::LeafGridView::Intersection is2 DUNE_UNUSED = mdgrid.multiDomainIntersection(*iit);
MDGrid::LeafGridView::Intersection is1 [[maybe_unused]] = sdgrid.multiDomainIntersection(*iit);
MDGrid::LeafGridView::Intersection is2 [[maybe_unused]] = mdgrid.multiDomainIntersection(*iit);
assert(is1.geometry().center() == is2.geometry().center());
......
......@@ -46,7 +46,7 @@ int main(int argc, char** argv) {
grid.postUpdateSubDomains();
Grid::SubDomainGrid::LeafGridView::Codim<0>::Entity se0(*grid.subDomain(0).leafGridView().begin<0>());
const auto& e0 DUNE_UNUSED = grid.subDomain(0).multiDomainEntity(se0);
const auto& e0 [[maybe_unused]] = grid.subDomain(0).multiDomainEntity(se0);
printStatus(grid,"partitioning1");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment