Commit 319ca5cc authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

removed experimental namespace and geometrygrid example added

parent 6411139a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include "unstructureddatacollector.hh" #include "unstructureddatacollector.hh"
namespace Dune { namespace experimental namespace Dune
{ {
/// Implementation of \ref DataCollector for linear cells, with continuous data. /// Implementation of \ref DataCollector for linear cells, with continuous data.
...@@ -101,4 +101,4 @@ protected: ...@@ -101,4 +101,4 @@ protected:
using Super::gridView_; using Super::gridView_;
}; };
}} // end namespace Dune::experimental } // end namespace Dune
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include <dune/vtk/vtktypes.hh> #include <dune/vtk/vtktypes.hh>
namespace Dune { namespace experimental { namespace Dune {
template <class GridView, class Derived> template <class GridView, class Derived>
class DataCollectorInterface class DataCollectorInterface
...@@ -98,10 +98,10 @@ public: // default implementations ...@@ -98,10 +98,10 @@ public: // default implementations
auto localFct = localFunction(fct); auto localFct = localFunction(fct);
for (auto const& e : elements(gridView_, Partitions::all)) { for (auto const& e : elements(gridView_, Partitions::all)) {
localFct.bind(e); localFct.bind(e);
auto geometry = e.geometry(); auto refElem = referenceElement<T,GridView::dimension>(e.type());
std::size_t idx = fct.ncomps() * indexSet.index(e); std::size_t idx = fct.ncomps() * indexSet.index(e);
for (int comp = 0; comp < fct.ncomps(); ++comp) for (int comp = 0; comp < fct.ncomps(); ++comp)
data[idx + comp] = T(localFct.evaluate(comp, geometry.center())); data[idx + comp] = T(localFct.evaluate(comp, refElem.position(0,0)));
localFct.unbind(); localFct.unbind();
} }
return data; return data;
...@@ -111,4 +111,4 @@ protected: ...@@ -111,4 +111,4 @@ protected:
GridView gridView_; GridView gridView_;
}; };
}} // end namespace Dune::experimental } // end namespace Dune
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include "unstructureddatacollector.hh" #include "unstructureddatacollector.hh"
namespace Dune { namespace experimental namespace Dune
{ {
/// Implementation of \ref DataCollector for linear cells, with discontinuous data. /// Implementation of \ref DataCollector for linear cells, with discontinuous data.
...@@ -115,4 +115,4 @@ protected: ...@@ -115,4 +115,4 @@ protected:
std::vector<std::int64_t> indexMap_; std::vector<std::int64_t> indexMap_;
}; };
}} // end namespace Dune::experimental } // end namespace Dune
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include "unstructureddatacollector.hh" #include "unstructureddatacollector.hh"
namespace Dune { namespace experimental namespace Dune
{ {
/// Implementation of \ref DataCollector for quadratic cells, with continuous data. /// Implementation of \ref DataCollector for quadratic cells, with continuous data.
...@@ -132,4 +132,4 @@ protected: ...@@ -132,4 +132,4 @@ protected:
using Super::gridView_; using Super::gridView_;
}; };
}} // end namespace Dune::extensions } // end namespace Dune
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "structureddatacollector.hh" #include "structureddatacollector.hh"
namespace Dune { namespace experimental namespace Dune
{ {
#if HAVE_DUNE_SPGRID #if HAVE_DUNE_SPGRID
...@@ -88,4 +88,4 @@ namespace Impl ...@@ -88,4 +88,4 @@ namespace Impl
} }
#endif // HAVE_DUNE_SPGRID #endif // HAVE_DUNE_SPGRID
}} // end namespace Dune::experimental } // end namespace Dune
#pragma once #pragma once
#include <array> #include <array>
#include <dune/common/filledarray.hh>
#include <dune/common/fvector.hh> #include <dune/common/fvector.hh>
#include "continuousdatacollector.hh" #include "continuousdatacollector.hh"
namespace Dune { namespace experimental namespace Dune
{ {
namespace Impl namespace Impl
...@@ -228,4 +229,4 @@ protected: ...@@ -228,4 +229,4 @@ protected:
#endif #endif
}; };
}} // end namespace Dune::experimental } // end namespace Dune
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "datacollectorinterface.hh" #include "datacollectorinterface.hh"
namespace Dune { namespace experimental { namespace Dune {
struct Cells struct Cells
{ {
...@@ -41,4 +41,4 @@ protected: ...@@ -41,4 +41,4 @@ protected:
using Super::gridView_; using Super::gridView_;
}; };
}} // end namespace Dune::experimental } // end namespace Dune
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "structureddatacollector.hh" #include "structureddatacollector.hh"
namespace Dune { namespace experimental namespace Dune
{ {
// Specialization for YaspGrid // Specialization for YaspGrid
template <class GridView> template <class GridView>
...@@ -53,10 +53,10 @@ public: ...@@ -53,10 +53,10 @@ public:
for (int i = 0; i < dim; ++i) { for (int i = 0; i < dim; ++i) {
wholeExtent_[2*i] = 0; wholeExtent_[2*i] = 0;
wholeExtent_[2*i+1] = gridView_.grid().levelSize(level_,i); wholeExtent_[2*i+1] = grid(gridView_).levelSize(level_,i);
} }
auto const& gl = *gridView_.grid().begin(level_); auto const& gl = *grid(gridView_).begin(level_);
auto const& g = gl.interior[0]; auto const& g = gl.interior[0];
auto const& gc = *g.dataBegin(); auto const& gc = *g.dataBegin();
for (int i = 0; i < dim; ++i) { for (int i = 0; i < dim; ++i) {
...@@ -64,7 +64,7 @@ public: ...@@ -64,7 +64,7 @@ public:
extent_[2*i+1] = gc.max(i)+1; extent_[2*i+1] = gc.max(i)+1;
} }
auto it = gridView_.grid().begin(level_); auto it = grid(gridView_).begin(level_);
initGeometry(it->coords); initGeometry(it->coords);
} }
...@@ -97,7 +97,7 @@ public: ...@@ -97,7 +97,7 @@ public:
template <class T> template <class T>
std::array<std::vector<T>, 3> coordinatesImpl () const std::array<std::vector<T>, 3> coordinatesImpl () const
{ {
auto it = gridView_.grid().begin(level_); auto it = grid(gridView_).begin(level_);
auto const& coords = it->coords; auto const& coords = it->coords;
std::array<std::vector<T>, 3> ordinates{}; std::array<std::vector<T>, 3> ordinates{};
...@@ -114,6 +114,26 @@ public: ...@@ -114,6 +114,26 @@ public:
return ordinates; return ordinates;
} }
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
{
return gridView.grid().hostGrid();
}
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
{
return gridView.grid();
}
protected: protected:
using Super::gridView_; using Super::gridView_;
std::array<int, 6> wholeExtent_; std::array<int, 6> wholeExtent_;
...@@ -132,4 +152,4 @@ namespace Impl ...@@ -132,4 +152,4 @@ namespace Impl
}; };
} }
}} // end namespace Dune::experimental } // end namespace Dune
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include "vtklocalfunctioninterface.hh" #include "vtklocalfunctioninterface.hh"
namespace Dune { namespace experimental namespace Dune
{ {
/// Type erasure for dune-functions LocalFunction interface /// Type erasure for dune-functions LocalFunction interface
template <class GridView, class LocalFunction> template <class GridView, class LocalFunction>
...@@ -60,4 +60,4 @@ namespace Dune { namespace experimental ...@@ -60,4 +60,4 @@ namespace Dune { namespace experimental
LocalFunction localFct_; LocalFunction localFct_;
}; };
}} // end namespace Dune::experimental } // end namespace Dune
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <string> #include <string>
#include <utility> #include <utility>
namespace Dune { namespace experimental namespace Dune
{ {
template <class Grid, class FilerReaderImp> template <class Grid, class FilerReaderImp>
class FileReader class FileReader
...@@ -68,4 +68,4 @@ namespace Dune { namespace experimental ...@@ -68,4 +68,4 @@ namespace Dune { namespace experimental
} }
}; };
}} // end namespace Dune::experimental } // end namespace Dune
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include <string> #include <string>
namespace Dune { namespace experimental namespace Dune
{ {
class FileWriter class FileWriter
{ {
...@@ -14,4 +14,4 @@ namespace Dune { namespace experimental ...@@ -14,4 +14,4 @@ namespace Dune { namespace experimental
virtual void write (std::string const& filename) = 0; virtual void write (std::string const& filename) = 0;
}; };
}} // end namespace Dune::experimental } // end namespace Dune
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "vtktypes.hh" #include "vtktypes.hh"
namespace Dune { namespace experimental namespace Dune
{ {
// Create a grid where the input points and connectivity is already // Create a grid where the input points and connectivity is already
// connected correctly. // connected correctly.
...@@ -116,4 +116,4 @@ namespace Dune { namespace experimental ...@@ -116,4 +116,4 @@ namespace Dune { namespace experimental
} }
}; };
}} // end namespace Dune::experimental } // end namespace Dune
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "vtklocalfunctioninterface.hh" #include "vtklocalfunctioninterface.hh"
namespace Dune { namespace experimental namespace Dune
{ {
/// Type erasure for Legacy VTKFunction /// Type erasure for Legacy VTKFunction
template <class GridView> template <class GridView>
...@@ -42,4 +42,4 @@ namespace Dune { namespace experimental ...@@ -42,4 +42,4 @@ namespace Dune { namespace experimental
Entity const* entity_; Entity const* entity_;
}; };
}} // end namespace Dune::experimental } // end namespace Dune
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "vtklocalfunction.hh" #include "vtklocalfunction.hh"
#include "vtktypes.hh" #include "vtktypes.hh"
namespace Dune { namespace experimental namespace Dune
{ {
template <class GridView> template <class GridView>
class VtkFunction class VtkFunction
...@@ -86,4 +86,4 @@ namespace Dune { namespace experimental ...@@ -86,4 +86,4 @@ namespace Dune { namespace experimental
Vtk::DataTypes type_ = Vtk::FLOAT32; Vtk::DataTypes type_ = Vtk::FLOAT32;
}; };
}} // end namespace Dune::experimental } // end namespace Dune
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "legacyvtkfunction.hh" #include "legacyvtkfunction.hh"
#include "defaultvtkfunction.hh" #include "defaultvtkfunction.hh"
namespace Dune { namespace experimental namespace Dune
{ {
template <class GridView> template <class GridView>
class VtkLocalFunction class VtkLocalFunction
...@@ -56,4 +56,4 @@ namespace Dune { namespace experimental ...@@ -56,4 +56,4 @@ namespace Dune { namespace experimental
std::shared_ptr<VtkLocalFunctionInterface<GridView>> localFct_; std::shared_ptr<VtkLocalFunctionInterface<GridView>> localFct_;
}; };
}} // end namespace Dune::experimental } // end namespace Dune
#pragma once #pragma once
namespace Dune { namespace experimental namespace Dune
{ {
/// An abstract base class for LocalFunctions /// An abstract base class for LocalFunctions
template <class GridView> template <class GridView>
...@@ -23,4 +23,4 @@ namespace Dune { namespace experimental ...@@ -23,4 +23,4 @@ namespace Dune { namespace experimental
virtual ~VtkLocalFunctionInterface () = default; virtual ~VtkLocalFunctionInterface () = default;
}; };
}} // end namespace Dune::experimental } // end namespace Dune
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "gridcreator.hh" #include "gridcreator.hh"
#include "vtktypes.hh" #include "vtktypes.hh"
namespace Dune { namespace experimental namespace Dune
{ {
/// File-Reader for Vtk .vtu files /// File-Reader for Vtk .vtu files
/** /**
...@@ -129,6 +129,6 @@ namespace Dune { namespace experimental ...@@ -129,6 +129,6 @@ namespace Dune { namespace experimental
std::uint64_t offset0_; std::uint64_t offset0_;
}; };
}} // end namespace Dune::experimental } // end namespace Dune
#include "vtkreader.impl.hh" #include "vtkreader.impl.hh"
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "utility/filesystem.hh" #include "utility/filesystem.hh"
#include "utility/string.hh" #include "utility/string.hh"
namespace Dune { namespace experimental { namespace Dune {
template <class Grid, class Creator> template <class Grid, class Creator>
void VtkReader<Grid,Creator>::readFromFile (std::string const& filename) void VtkReader<Grid,Creator>::readFromFile (std::string const& filename)
...@@ -512,4 +512,4 @@ std::map<std::string, std::string> VtkReader<Grid,Creator>::parseXml (std::strin ...@@ -512,4 +512,4 @@ std::map<std::string, std::string> VtkReader<Grid,Creator>::parseXml (std::strin
return attr; return attr;
} }
}} // end namespace Dune::experimental } // end namespace Dune
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include <iostream> #include <iostream>
namespace Dune { namespace experimental { namespace Dune {
namespace Vtk { namespace Vtk {
std::string to_string (FormatTypes type) std::string to_string (FormatTypes type)
...@@ -154,4 +154,4 @@ CellType::CellType (GeometryType const& t, CellParametrization parametrization) ...@@ -154,4 +154,4 @@ CellType::CellType (GeometryType const& t, CellParametrization parametrization)
} }
} }
}}} // end namespace Dune::experimental::Vtk }} // end namespace Dune::Vtk
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <dune/geometry/type.hh> #include <dune/geometry/type.hh>
namespace Dune { namespace experimental namespace Dune
{ {
namespace Vtk namespace Vtk
{ {
...@@ -113,4 +113,4 @@ namespace Dune { namespace experimental ...@@ -113,4 +113,4 @@ namespace Dune { namespace experimental
}; };
} // end namespace Vtk } // end namespace Vtk
}} // end namespace Dune::experimental } // end namespace Dune
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