Commit f2d0d57b authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

yasp-datacollector writes only on initial gridview level

parent cdc91a18
......@@ -26,7 +26,7 @@ public:
, extent_(filledArray<6,int>(0))
, origin_(0.0)
, spacing_(0.0)
, level_(gridView.template begin<0,All_Partition>()->level())
, level_(0)
{}
std::array<int, 6> const& wholeExtentImpl () const
......@@ -53,12 +53,13 @@ public:
{
Super::updateImpl();
level_ = gridView_.template begin<0,All_Partition>()->level();
for (int i = 0; i < dim; ++i) {
wholeExtent_[2*i] = 0;
wholeExtent_[2*i+1] = grid(gridView_).levelSize(level_,i);
wholeExtent_[2*i+1] = grid(gridView_.grid()).levelSize(level_,i);
}
auto const& gl = *grid(gridView_).begin(level_);
auto const& gl = *grid(gridView_.grid()).begin(level_);
auto const& g = gl.interior[0];
auto const& gc = *g.dataBegin();
for (int i = 0; i < dim; ++i) {
......@@ -66,7 +67,7 @@ public:
extent_[2*i+1] = gc.max(i)+1;
}
auto it = grid(gridView_).begin(level_);
auto it = grid(gridView_.grid()).begin(level_);
initGeometry(it->coords);
}
......@@ -99,7 +100,7 @@ public:
template <class T>
std::array<std::vector<T>, 3> coordinatesImpl () const
{
auto it = grid(gridView_).begin(level_);
auto it = grid(gridView_.grid()).begin(level_);
auto const& coords = it->coords;
std::array<std::vector<T>, 3> ordinates{};
......@@ -122,18 +123,18 @@ private:
template <class G>
using HostGrid = decltype(std::declval<G>().hostGrid());
template <class GV,
std::enable_if_t<Std::is_detected<HostGrid, typename GV::Grid>::value, int> = 0>
auto const& grid (GV const& gridView) const
template <class G,
std::enable_if_t<not Std::is_detected<HostGrid, G>::value, int> = 0>
auto const& grid (G const& g) const
{
return gridView.grid().hostGrid();
return g;
}
template <class GV,
std::enable_if_t<not Std::is_detected<HostGrid, typename GV::Grid>::value, int> = 0>
auto const& grid (GV const& gridView) const
template <class G,
std::enable_if_t<Std::is_detected<HostGrid, G>::value, int> = 0>
auto const& grid (G const& g) const
{
return gridView.grid();
return grid(g.hostGrid());
}
protected:
......
......@@ -41,19 +41,19 @@ namespace Dune
namespace Impl
{
// A structured grid with constant spacing in x, y, and z direction.
// A structured grid with coordinates in x, y, and z direction with arbitrary spacing
template <class GridView, int dim, class Coordinates>
struct VtkWriterImpl<GridView, YaspGrid<dim,Coordinates>>
{
using type = VtkImageDataWriter<GridView, YaspDataCollector<GridView>>;
using type = VtkRectilinearGridWriter<GridView, YaspDataCollector<GridView>>;
};
#if HAVE_DUNE_SPGRID
// A structured grid with constant spacing in x, y, and z direction.
// A structured grid with coordinates in x, y, and z direction with arbitrary spacing
template <class GridView, class ct, int dim, template <int> class Ref, class Comm>
struct VtkWriterImpl<GridView, SPGrid<ct,dim,Ref,Comm>>
{
using type = VtkImageDataWriter<GridView, SPDataCollector<GridView>>;
using type = VtkRectilinearGridWriter<GridView, SPDataCollector<GridView>>;
};
#endif
......
Supports Markdown
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