Commit 56785e12 authored by Praetorius, Simon's avatar Praetorius, Simon

small errors related to AlbertaGrid corrected

parent 848b8812
......@@ -51,9 +51,8 @@ namespace Dune
template <class... Args>
explicit GridFactory (std::size_t n, Args&&... args)
{
gridFactories_.reserve(n);
for (std::size_t i = 0; i < n; ++i)
gridFactories_.emplace_back(std::forward<Args>(args)...);
gridFactories_.emplace_back(new GridFactory<HostGrid>{args...});
}
// initialize at least 1 grid
......@@ -68,7 +67,7 @@ namespace Dune
virtual void insertVertex (const GlobalCoordinate& pos) override
{
for (auto& gridFactory : gridFactories_)
gridFactory.insertVertex(pos);
gridFactory->insertVertex(pos);
}
/// \brief Insert an element into the coarse grid
......@@ -80,7 +79,7 @@ namespace Dune
const std::vector<unsigned int>& vertices) override
{
for (auto& gridFactory : gridFactories_)
gridFactory.insertElement(type, vertices);
gridFactory->insertElement(type, vertices);
}
......@@ -104,7 +103,7 @@ namespace Dune
Hybrid::ifElse(Std::is_detected<HasInsertElement, GridFactory<HostGrid>>{},
[&](auto id) {
for (auto& gridFactory : gridFactories_)
id(gridFactory).insertElement(type, vertices, param);
id(gridFactory)->insertElement(type, vertices, param);
});
}
......@@ -117,7 +116,7 @@ namespace Dune
const std::vector<unsigned int>& vertices) override
{
for (auto& gridFactory : gridFactories_)
gridFactory.insertBoundarySegment(vertices);
gridFactory->insertBoundarySegment(vertices);
}
......@@ -138,7 +137,7 @@ namespace Dune
Hybrid::ifElse(Std::is_detected<HasInsertBoundarySegment, GridFactory<HostGrid>>{},
[&](auto id) {
for (auto& gridFactory : gridFactories_)
id(gridFactory).insertBoundarySegment(vertices, boundarySegment);
id(gridFactory)->insertBoundarySegment(vertices, boundarySegment);
});
}
......@@ -152,12 +151,12 @@ namespace Dune
{
Grid* multimesh = new Grid{};
for (auto& gridFactory : gridFactories_)
multimesh->grids_.emplace_back(gridFactory.createGrid());
multimesh->grids_.emplace_back(gridFactory->createGrid());
return multimesh;
}
private:
std::vector<GridFactory<HostGrid> > gridFactories_;
std::vector<std::unique_ptr<GridFactory<HostGrid>>> gridFactories_;
};
} // end namespace Dune
......
......@@ -229,7 +229,7 @@ namespace Dune
using Grid = typename Traits::Grid;
/// Type of the corresponding GridType hosted by the MultiMesh
using HostGrid = typename GridImp::HostGridType;
using HostGrid = typename GridImp::HostGrid;
using IndexSet = typename Traits::IndexSet;
using Intersection = typename Traits::Intersection;
......@@ -255,7 +255,7 @@ namespace Dune
const HostGrid& grid (std::size_t i) const
{
return multiMesh_->grid(i);
return multiMesh_[i];
}
/// Obtain the level-indexSet
......
......@@ -239,7 +239,7 @@ namespace Dune
template <PartitionIteratorType pitype = All_Partition, class Grid>
inline auto master_leaf_elements(Grid const& multiMesh, std::size_t master)
{
using Iterator = MultiMeshMasterLeafIterator<0,pitype,Grid>;
using Iterator = MultiMeshMasterLeafIterator<0,pitype,typename Grid::HostGrid>;
using Range = IteratorRange<Iterator>;
return Range{ Iterator{tag::begin_iterator{}, &multiMesh, master},
Iterator{tag::end_iterator{}, &multiMesh} };
......
......@@ -154,7 +154,7 @@ namespace Dune
for (; !this->levelReached(i, child); child = dereference(i)) {
assert(child.isRegular() && "No irregular elements allowed in multi-mesh traversal");
entityStack.emplace(child);
assert(entityStack.size() <= maxLevel_[i]);
assert(int(entityStack.size()) <= maxLevel_[i]);
}
return entityStack.size();
......@@ -188,7 +188,7 @@ namespace Dune
for (; !this->levelReached(i, child); child = dereference(i)) {
assert(child.isRegular() && "No irregular elements allowed in multi-mesh traversal");
entityStack.emplace(child);
assert(entityStack.size() <= maxLevel_[i]);
assert(int(entityStack.size()) <= maxLevel_[i]);
}
return entityStack.size();
......
......@@ -78,10 +78,10 @@ namespace Dune
*
* \tparam HostGrid The host grid type wrapped by the MultiMesh
*/
template <class HostGrid>
template <class HG>
class MultiMesh
: public GridDefaultImplementation<HostGrid::dimension, HostGrid::dimensionworld,
typename HostGrid::ctype, MultiMeshFamily<HostGrid> >
: public GridDefaultImplementation<HG::dimension, HG::dimensionworld,
typename HG::ctype, MultiMeshFamily<HG> >
{
template <class GridImp>
friend class MultiMeshLevelGridView;
......@@ -92,13 +92,13 @@ namespace Dune
template <class GridImp>
friend class MultiEntity;
friend class GridFactory<MultiMesh<HostGrid> >;
friend class GridFactory<MultiMesh<HG> >;
using Super = GridDefaultImplementation<HostGrid::dimension, HostGrid::dimensionworld,
typename HostGrid::ctype, MultiMeshFamily<HostGrid> >;
using Super = GridDefaultImplementation<HG::dimension, HG::dimensionworld,
typename HG::ctype, MultiMeshFamily<HG> >;
public:
using HostGridType = HostGrid;
using HostGrid = HG;
/// Type of the used GridFamily for this grid
using GridFamily = MultiMeshFamily<HostGrid>;
......@@ -133,14 +133,14 @@ namespace Dune
}
/// Returns the i'th grid managed by this MultiMesh
HostGridType& operator[] (std::size_t i)
HostGrid& operator[] (std::size_t i)
{
assert(i < grids_.size());
return *grids_[i];
}
/// Returns the i'th grid managed by this MultiMesh
HostGridType const& operator[] (std::size_t i) const
HostGrid const& operator[] (std::size_t i) const
{
assert(i < grids_.size());
return *grids_[i];
......
......@@ -19,9 +19,9 @@ namespace Dune
using MultiLeafGridView = typename MultiMesh::LeafGridView;
/// Constructor. Stores a leafgridView of the MultiMesh and LocalView/LocalIndexSet of the bases
MultiBasis (MultiMesh const& mm, Bases&&... bases)
MultiBasis (MultiMesh const& mm, Bases const&... bases)
: multiGridView_(mm.leafGridView())
, bases_{std::forward<Bases>(bases)...}
, bases_{bases...}
, localViews_(Std::apply([](auto const&... b) { return std::make_tuple(b.localView()...); }, bases_))
, localIndexSets_(Std::apply([](auto const&... b) { return std::make_tuple(b.localIndexSet()...); }, bases_))
{}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment