Commit 78919b8c authored by Praetorius, Simon's avatar Praetorius, Simon

Cleanup of comments and removed HostAccess

parent 38e5bce1
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2: // vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_MULTIMESH_GRIDFACTORY_HH #ifndef DUNE_MULTIMESH_GRIDFACTORY_HH
#define DUNE_MULTIMESH_GRIDFACTORY_HH #define DUNE_MULTIMESH_GRIDFACTORY_HH
......
...@@ -73,7 +73,7 @@ namespace Dune ...@@ -73,7 +73,7 @@ namespace Dune
c.reserve(maxLevel); c.reserve(maxLevel);
} }
// return true if all levels >= l are finished, i.e. hierarchic iterators it == end // return true if all levels >= l are finished, i.e. hierarchic iterators it+1 == end
bool finished (std::size_t l = 0) const bool finished (std::size_t l = 0) const
{ {
bool f = true; bool f = true;
......
...@@ -3,10 +3,6 @@ ...@@ -3,10 +3,6 @@
#ifndef DUNE_MULTIMESH_GRID_HH #ifndef DUNE_MULTIMESH_GRID_HH
#define DUNE_MULTIMESH_GRID_HH #define DUNE_MULTIMESH_GRID_HH
/** \file
* \brief The MultiMesh class
*/
#include <string> #include <string>
#include <map> #include <map>
...@@ -27,10 +23,6 @@ namespace Dune ...@@ -27,10 +23,6 @@ namespace Dune
template <class HostGrid> template <class HostGrid>
class MultiMesh; class MultiMesh;
// External forward declarations
template <class Grid>
struct HostGridAccess;
template <int dim, class HostGrid> template <int dim, class HostGrid>
struct MultiMeshFamily struct MultiMeshFamily
{ {
...@@ -78,12 +70,12 @@ namespace Dune ...@@ -78,12 +70,12 @@ namespace Dune
}; };
}; };
/// \brief Provides a meta grid that encapsulates n versions of its host /// \brief Provides a meta grid that encapsulates n versions of its host grid
/** /**
* \ingroup GridImplementations * \ingroup GridImplementations
* \ingroup MultiMesh * \ingroup MultiMesh
* *
* \tparam HostGrid The host grid type wrapped by the MultiMesh * \tparam HostGrid The host grid type wrapped by the MultiMesh
*/ */
template <class HostGrid> template <class HostGrid>
class MultiMesh class MultiMesh
...@@ -99,7 +91,6 @@ namespace Dune ...@@ -99,7 +91,6 @@ namespace Dune
template <class GridImp_> template <class GridImp_>
friend class MultiMeshLeafGridView; friend class MultiMeshLeafGridView;
friend struct HostGridAccess<MultiMesh<HostGrid> >;
friend class GridFactory<MultiMesh<HostGrid> >; friend class GridFactory<MultiMesh<HostGrid> >;
using HostGridType = HostGrid; using HostGridType = HostGrid;
...@@ -108,10 +99,10 @@ namespace Dune ...@@ -108,10 +99,10 @@ namespace Dune
public: public:
/// type of the used GridFamily for this grid /// Type of the used GridFamily for this grid
using GridFamily = MultiMeshFamily<HostGrid::dimension,HostGrid>; using GridFamily = MultiMeshFamily<HostGrid::dimension,HostGrid>;
/// the Traits /// The Traits
using Traits = typename MultiMeshFamily<HostGrid::dimension,HostGrid>::Traits; using Traits = typename MultiMeshFamily<HostGrid::dimension,HostGrid>::Traits;
/// The type used to store coordinates, inherited from the HostGrid /// The type used to store coordinates, inherited from the HostGrid
...@@ -120,7 +111,7 @@ namespace Dune ...@@ -120,7 +111,7 @@ namespace Dune
/// \brief Constructor, stores n copies of the hostgrid /// \brief Constructor, stores n copies of the hostgrid
/** /**
* \param n The number of host grids to handle by the MultiMesh * \param n The number of host grids to handle by the MultiMesh
*/ */
template <class... Args> template <class... Args>
explicit MultiMesh (std::size_t n, Args&&... args) explicit MultiMesh (std::size_t n, Args&&... args)
...@@ -130,9 +121,10 @@ namespace Dune ...@@ -130,9 +121,10 @@ namespace Dune
grids_.emplace_back(std::make_unique<HostGrid>(std::forward<Args>(args)...)); grids_.emplace_back(std::make_unique<HostGrid>(std::forward<Args>(args)...));
} }
// initialize 0 grids // Initialize an empty MultiMesh
MultiMesh () = default; MultiMesh () = default;
/// Return the number of grids handled by this MultiMesh
std::size_t size() const std::size_t size() const
{ {
return grids_.size(); return grids_.size();
...@@ -153,8 +145,8 @@ namespace Dune ...@@ -153,8 +145,8 @@ namespace Dune
} }
/** \brief Return maximum level defined in all grid. /// \brief Return maximum level defined in all grid.
* /**
* Levels are numbered 0 ... maxlevel with 0 the coarsest level. * Levels are numbered 0 ... maxlevel with 0 the coarsest level.
*/ */
int maxLevel () const int maxLevel () const
...@@ -214,14 +206,12 @@ namespace Dune ...@@ -214,14 +206,12 @@ namespace Dune
return leafIndexSet().size(codim); return leafIndexSet().size(codim);
} }
/// Number of entities per level, codim and geometry type in this process /// Number of entities per level, codim and geometry type in this process
int size (std::size_t idx, int level, GeometryType type) const int size (std::size_t idx, int level, GeometryType type) const
{ {
return levelIndexSet(level).size(type); return levelIndexSet(level).size(type);
} }
/// Number of leaf entities per codim and geometry type in this process /// Number of leaf entities per codim and geometry type in this process
int size (std::size_t idx, GeometryType type) const int size (std::size_t idx, GeometryType type) const
{ {
...@@ -235,9 +225,10 @@ namespace Dune ...@@ -235,9 +225,10 @@ namespace Dune
return grids_[idx].globalIdSet(); return grids_[idx].globalIdSet();
} }
/// Return the globalIdSet for grid 0
const typename HostGrid::GlobalIdSet& globalIdSet () const const typename HostGrid::GlobalIdSet& globalIdSet () const
{ {
assert(false && "Should be called on the i'th grid: grid(i).globalIdSet()"); assert(false && "Should be called on the i'th grid: globalIdSet(i)");
return globalIdSet(0); return globalIdSet(0);
} }
...@@ -248,9 +239,10 @@ namespace Dune ...@@ -248,9 +239,10 @@ namespace Dune
return grids_[idx].localIdSet(); return grids_[idx].localIdSet();
} }
/// Return the localIdSet for grid 0
const typename HostGrid::LocalIdSet& localIdSet () const const typename HostGrid::LocalIdSet& localIdSet () const
{ {
assert(false && "Should be called on the i'th grid: grid(i).localIdSet()"); assert(false && "Should be called on the i'th grid: localIdSet(i)");
return localIdSet(0); return localIdSet(0);
} }
...@@ -264,9 +256,10 @@ namespace Dune ...@@ -264,9 +256,10 @@ namespace Dune
return grids_[idx].levelIndexSet(level); return grids_[idx].levelIndexSet(level);
} }
/// Return the levelIndexSet for grid 0
const typename HostGrid::LevelIndexSet& levelIndexSet (int level) const const typename HostGrid::LevelIndexSet& levelIndexSet (int level) const
{ {
assert(false && "Should be called on the i'th grid: grid(i).levelIndexSet()"); assert(false && "Should be called on the i'th grid: levelIndexSet(i,level)");
return levelIndexSet(0, level); return levelIndexSet(0, level);
} }
...@@ -280,24 +273,28 @@ namespace Dune ...@@ -280,24 +273,28 @@ namespace Dune
/// Return the leafIndexSet for grid 0 /// Return the leafIndexSet for grid 0
const typename HostGrid::LeafIndexSet& leafIndexSet() const const typename HostGrid::LeafIndexSet& leafIndexSet() const
{ {
assert(false && "Should be called on the i'th grid: grid(i).leafIndexSet()"); assert(false && "Should be called on the i'th grid: leafIndexSet(i)");
return leafIndexSet(0); return leafIndexSet(0);
} }
/// View for a grid level for All_Partition /// View for a grid level for All_Partition of the idx'th grid
typename HostGrid::LevelGridView levelGridView(std::size_t idx, int level) const typename HostGrid::LevelGridView levelGridView(std::size_t idx, int level) const
{ {
return grids_[idx].levelGridView(level); return grids_[idx].levelGridView(level);
} }
/// Return \ref MultiMeshLevelGridView, i.e. a view on the combined
/// level of all grids
using Super::levelGridView; using Super::levelGridView;
/// View for the leaf grid for All_Partition /// View for the leaf grid for All_Partition of the idx'th grid
typename HostGrid::LeafGridView leafGridView(std::size_t idx) const typename HostGrid::LeafGridView leafGridView(std::size_t idx) const
{ {
return grids_[idx].leafGridView(); return grids_[idx].leafGridView();
} }
/// Return \ref MultiMeshLeafGridView, i.e. a view on the combined
/// leaf-level of all grids
using Super::leafGridView; using Super::leafGridView;
...@@ -312,37 +309,38 @@ namespace Dune ...@@ -312,37 +309,38 @@ namespace Dune
/** @name Grid Refinement Methods */ /** @name Grid Refinement Methods */
/*@{*/ /** @{ */
/// Global refinement /// Global refinement of all handled grids
void globalRefine (int refCount) void globalRefine (int refCount)
{ {
for (auto& grid : grids_) for (auto& grid : grids_)
grid->globalRefine(refCount); grid->globalRefine(refCount);
} }
/// Returns true, if at least one entity is marked for adaption /// Returns true, if at least one entity is marked for adaption in any of the
/// handled grids
bool preAdapt() bool preAdapt()
{ {
return std::accumulate(grids_.begin(), grids_.end(), false, return std::accumulate(grids_.begin(), grids_.end(), false,
[](bool b, auto& grid) { return grid->preAdapt() || b; }); [](bool b, auto& grid) { return grid->preAdapt() || b; });
} }
/// Triggers the grid refinement process /// Triggers the grid refinement process on all handled grids
bool adapt() bool adapt()
{ {
return std::accumulate(grids_.begin(), grids_.end(), false, return std::accumulate(grids_.begin(), grids_.end(), false,
[](bool b, auto& grid) { return grid->adapt() || b; }); [](bool b, auto& grid) { return grid->adapt() || b; });
} }
/// Clean up refinement markers /// Clean up refinement markers on all handled grids
void postAdapt() void postAdapt()
{ {
for (auto& grid : grids_) for (auto& grid : grids_)
grid->postAdapt(); grid->postAdapt();
} }
/*@}*/ /** @} */
/// Size of the overlap on the leaf level /// Size of the overlap on the leaf level
...@@ -390,7 +388,7 @@ namespace Dune ...@@ -390,7 +388,7 @@ namespace Dune
protected: protected:
/// The grids to handle by this multimesh grid-adapter /// The grids to handle by this MultiMesh
std::vector<std::unique_ptr<HostGrid>> grids_; std::vector<std::unique_ptr<HostGrid>> grids_;
}; // end Class MultiMesh }; // end Class MultiMesh
...@@ -407,6 +405,9 @@ namespace Dune ...@@ -407,6 +405,9 @@ namespace Dune
static const bool v = hasEntity<HostGrid,codim>::v; static const bool v = hasEntity<HostGrid,codim>::v;
}; };
/** \brief has entity-iterator for some codimensions as host grid
* \ingroup MultiMesh
*/
template <class HostGrid, int codim> template <class HostGrid, int codim>
struct hasEntityIterator<MultiMesh<HostGrid>, codim> struct hasEntityIterator<MultiMesh<HostGrid>, codim>
{ {
...@@ -430,8 +431,8 @@ namespace Dune ...@@ -430,8 +431,8 @@ namespace Dune
{ {
static const bool v = isLeafwiseConforming<HostGrid>::v; static const bool v = isLeafwiseConforming<HostGrid>::v;
}; };
} // end namespace Capabilities
} // end namespace Capabilities
} // end namespace Dune } // end namespace Dune
#endif // DUNE_MULTIMESH_GRID_HH #endif // DUNE_MULTIMESH_GRID_HH
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