diff --git a/dune/vtk/datacollectors/continuousdatacollector.hh b/dune/vtk/datacollectors/continuousdatacollector.hh index 1c9d4dc26931367bebc9c679efbad291ba25506a..22f48f3ccdc807debe700059946bb0a1616be79f 100644 --- a/dune/vtk/datacollectors/continuousdatacollector.hh +++ b/dune/vtk/datacollectors/continuousdatacollector.hh @@ -2,7 +2,7 @@ #include "unstructureddatacollector.hh" -namespace Dune { namespace experimental +namespace Dune { /// Implementation of \ref DataCollector for linear cells, with continuous data. @@ -101,4 +101,4 @@ protected: using Super::gridView_; }; -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/datacollectors/datacollectorinterface.hh b/dune/vtk/datacollectors/datacollectorinterface.hh index 5d4f16d61e8b765ec4b416166f10d309f45800e0..1dcb283fa25c48addcf657dc4b74951361ef9935 100644 --- a/dune/vtk/datacollectors/datacollectorinterface.hh +++ b/dune/vtk/datacollectors/datacollectorinterface.hh @@ -2,7 +2,7 @@ #include <dune/vtk/vtktypes.hh> -namespace Dune { namespace experimental { +namespace Dune { template <class GridView, class Derived> class DataCollectorInterface @@ -98,10 +98,10 @@ public: // default implementations auto localFct = localFunction(fct); for (auto const& e : elements(gridView_, Partitions::all)) { localFct.bind(e); - auto geometry = e.geometry(); + auto refElem = referenceElement<T,GridView::dimension>(e.type()); std::size_t idx = fct.ncomps() * indexSet.index(e); 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(); } return data; @@ -111,4 +111,4 @@ protected: GridView gridView_; }; -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/datacollectors/discontinuousdatacollector.hh b/dune/vtk/datacollectors/discontinuousdatacollector.hh index 1816a37854fce90986d4e98f309e9e37ce97dca1..4a50662f81abc9ec423ee7472f84e3f78a4420ac 100644 --- a/dune/vtk/datacollectors/discontinuousdatacollector.hh +++ b/dune/vtk/datacollectors/discontinuousdatacollector.hh @@ -2,7 +2,7 @@ #include "unstructureddatacollector.hh" -namespace Dune { namespace experimental +namespace Dune { /// Implementation of \ref DataCollector for linear cells, with discontinuous data. @@ -115,4 +115,4 @@ protected: std::vector<std::int64_t> indexMap_; }; -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/datacollectors/quadraticdatacollector.hh b/dune/vtk/datacollectors/quadraticdatacollector.hh index e9c8052121d82a91966a631bd10d60f807bc820c..55e98c24d9576e73a8f95ce57308cffc6167148a 100644 --- a/dune/vtk/datacollectors/quadraticdatacollector.hh +++ b/dune/vtk/datacollectors/quadraticdatacollector.hh @@ -2,7 +2,7 @@ #include "unstructureddatacollector.hh" -namespace Dune { namespace experimental +namespace Dune { /// Implementation of \ref DataCollector for quadratic cells, with continuous data. @@ -132,4 +132,4 @@ protected: using Super::gridView_; }; -}} // end namespace Dune::extensions +} // end namespace Dune diff --git a/dune/vtk/datacollectors/spdatacollector.hh b/dune/vtk/datacollectors/spdatacollector.hh index cb7e2b6544c81b7591d1fdbb94dc07c192791b45..a7ba2086bb88ec7df66817776ab9ed717944dbba 100644 --- a/dune/vtk/datacollectors/spdatacollector.hh +++ b/dune/vtk/datacollectors/spdatacollector.hh @@ -6,7 +6,7 @@ #include "structureddatacollector.hh" -namespace Dune { namespace experimental +namespace Dune { #if HAVE_DUNE_SPGRID @@ -88,4 +88,4 @@ namespace Impl } #endif // HAVE_DUNE_SPGRID -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/datacollectors/structureddatacollector.hh b/dune/vtk/datacollectors/structureddatacollector.hh index 854aa032b50baa5d04bc7442d421c81f1e102eef..9a5bb0f40dfbbbd6a7a1d65f4d196c64be6cae40 100644 --- a/dune/vtk/datacollectors/structureddatacollector.hh +++ b/dune/vtk/datacollectors/structureddatacollector.hh @@ -1,11 +1,12 @@ #pragma once #include <array> +#include <dune/common/filledarray.hh> #include <dune/common/fvector.hh> #include "continuousdatacollector.hh" -namespace Dune { namespace experimental +namespace Dune { namespace Impl @@ -228,4 +229,4 @@ protected: #endif }; -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/datacollectors/unstructureddatacollector.hh b/dune/vtk/datacollectors/unstructureddatacollector.hh index b831102fd6cfbda8208404d5e008c474b19dca4a..a473ed30e20c49c330e9af78c3490b937d8914a6 100644 --- a/dune/vtk/datacollectors/unstructureddatacollector.hh +++ b/dune/vtk/datacollectors/unstructureddatacollector.hh @@ -5,7 +5,7 @@ #include "datacollectorinterface.hh" -namespace Dune { namespace experimental { +namespace Dune { struct Cells { @@ -41,4 +41,4 @@ protected: using Super::gridView_; }; -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/datacollectors/yaspdatacollector.hh b/dune/vtk/datacollectors/yaspdatacollector.hh index 7dbbfd4c0082fafa1fae2307ba1dba73831aa55b..12315d175e602f38023ce5afa8a672b65f459f06 100644 --- a/dune/vtk/datacollectors/yaspdatacollector.hh +++ b/dune/vtk/datacollectors/yaspdatacollector.hh @@ -4,7 +4,7 @@ #include "structureddatacollector.hh" -namespace Dune { namespace experimental +namespace Dune { // Specialization for YaspGrid template <class GridView> @@ -53,10 +53,10 @@ public: for (int i = 0; i < dim; ++i) { 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& gc = *g.dataBegin(); for (int i = 0; i < dim; ++i) { @@ -64,7 +64,7 @@ public: extent_[2*i+1] = gc.max(i)+1; } - auto it = gridView_.grid().begin(level_); + auto it = grid(gridView_).begin(level_); initGeometry(it->coords); } @@ -97,7 +97,7 @@ public: template <class T> 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; std::array<std::vector<T>, 3> ordinates{}; @@ -114,6 +114,26 @@ public: 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: using Super::gridView_; std::array<int, 6> wholeExtent_; @@ -132,4 +152,4 @@ namespace Impl }; } -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/defaultvtkfunction.hh b/dune/vtk/defaultvtkfunction.hh index 078909bba5134bf80e0a129f54a41df957c53c2a..d32f8a4ef9c544be49a91b5514a6462f5867fb08 100644 --- a/dune/vtk/defaultvtkfunction.hh +++ b/dune/vtk/defaultvtkfunction.hh @@ -2,7 +2,7 @@ #include "vtklocalfunctioninterface.hh" -namespace Dune { namespace experimental +namespace Dune { /// Type erasure for dune-functions LocalFunction interface template <class GridView, class LocalFunction> @@ -60,4 +60,4 @@ namespace Dune { namespace experimental LocalFunction localFct_; }; -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/filereader.hh b/dune/vtk/filereader.hh index aad0764a6db89ba1cde05805833e8cb090c35129..abc9d0c7a66ce946bbaca9d51f6de83bbcebc38f 100644 --- a/dune/vtk/filereader.hh +++ b/dune/vtk/filereader.hh @@ -4,7 +4,7 @@ #include <string> #include <utility> -namespace Dune { namespace experimental +namespace Dune { template <class Grid, class FilerReaderImp> class FileReader @@ -68,4 +68,4 @@ namespace Dune { namespace experimental } }; -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/filewriter.hh b/dune/vtk/filewriter.hh index f184f34367998ae67e0a861db90d134a32dba43b..ffe21e06698895a5f018ebc1c2fdea0e5d31e3c1 100644 --- a/dune/vtk/filewriter.hh +++ b/dune/vtk/filewriter.hh @@ -2,7 +2,7 @@ #include <string> -namespace Dune { namespace experimental +namespace Dune { class FileWriter { @@ -14,4 +14,4 @@ namespace Dune { namespace experimental virtual void write (std::string const& filename) = 0; }; -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/gridcreator.hh b/dune/vtk/gridcreator.hh index 50504b8bb94eef6b537555bf3a61a596ebbdbf0a..4fec1291e6a7f9d3f86d86386b30716056485627 100644 --- a/dune/vtk/gridcreator.hh +++ b/dune/vtk/gridcreator.hh @@ -10,7 +10,7 @@ #include "vtktypes.hh" -namespace Dune { namespace experimental +namespace Dune { // Create a grid where the input points and connectivity is already // connected correctly. @@ -116,4 +116,4 @@ namespace Dune { namespace experimental } }; -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/legacyvtkfunction.hh b/dune/vtk/legacyvtkfunction.hh index 2d3f7979f963b65013c98cbaa8179f166955e115..10cfb04520c6c3cfe774a55639e841e7c8f10254 100644 --- a/dune/vtk/legacyvtkfunction.hh +++ b/dune/vtk/legacyvtkfunction.hh @@ -6,7 +6,7 @@ #include "vtklocalfunctioninterface.hh" -namespace Dune { namespace experimental +namespace Dune { /// Type erasure for Legacy VTKFunction template <class GridView> @@ -42,4 +42,4 @@ namespace Dune { namespace experimental Entity const* entity_; }; -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/vtkfunction.hh b/dune/vtk/vtkfunction.hh index 70428b0e6f7d92c47165e5e7d2ad25333f91c13d..4593f8d9ea57dd5d05f69911f389fdf3e9ab8fcd 100644 --- a/dune/vtk/vtkfunction.hh +++ b/dune/vtk/vtkfunction.hh @@ -8,7 +8,7 @@ #include "vtklocalfunction.hh" #include "vtktypes.hh" -namespace Dune { namespace experimental +namespace Dune { template <class GridView> class VtkFunction @@ -86,4 +86,4 @@ namespace Dune { namespace experimental Vtk::DataTypes type_ = Vtk::FLOAT32; }; -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/vtklocalfunction.hh b/dune/vtk/vtklocalfunction.hh index 9b5dc85927eeee975252c7f9cc80710f2316626c..faf8309daf959335c95ba976df0f2415f4ad41fa 100644 --- a/dune/vtk/vtklocalfunction.hh +++ b/dune/vtk/vtklocalfunction.hh @@ -9,7 +9,7 @@ #include "legacyvtkfunction.hh" #include "defaultvtkfunction.hh" -namespace Dune { namespace experimental +namespace Dune { template <class GridView> class VtkLocalFunction @@ -56,4 +56,4 @@ namespace Dune { namespace experimental std::shared_ptr<VtkLocalFunctionInterface<GridView>> localFct_; }; -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/vtklocalfunctioninterface.hh b/dune/vtk/vtklocalfunctioninterface.hh index 221dbc1b229f17fff22b0a08a6e188eb23c95bb1..d1d047c7dc2c6803e67d9a9359b55c83f031404d 100644 --- a/dune/vtk/vtklocalfunctioninterface.hh +++ b/dune/vtk/vtklocalfunctioninterface.hh @@ -1,6 +1,6 @@ #pragma once -namespace Dune { namespace experimental +namespace Dune { /// An abstract base class for LocalFunctions template <class GridView> @@ -23,4 +23,4 @@ namespace Dune { namespace experimental virtual ~VtkLocalFunctionInterface () = default; }; -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/vtkreader.hh b/dune/vtk/vtkreader.hh index 2dc6bebcfbc2a6d3e36f227d5d7c415553448d39..3b90c76706f5e0036f07a374cfd8ea78b84b4160 100644 --- a/dune/vtk/vtkreader.hh +++ b/dune/vtk/vtkreader.hh @@ -7,7 +7,7 @@ #include "gridcreator.hh" #include "vtktypes.hh" -namespace Dune { namespace experimental +namespace Dune { /// File-Reader for Vtk .vtu files /** @@ -129,6 +129,6 @@ namespace Dune { namespace experimental std::uint64_t offset0_; }; -}} // end namespace Dune::experimental +} // end namespace Dune #include "vtkreader.impl.hh" diff --git a/dune/vtk/vtkreader.impl.hh b/dune/vtk/vtkreader.impl.hh index 320fae1c52557c989c9b2057b88b9ca56910b374..948c3877211554bd819c567b4abbfb2abee4eba0 100644 --- a/dune/vtk/vtkreader.impl.hh +++ b/dune/vtk/vtkreader.impl.hh @@ -12,7 +12,7 @@ #include "utility/filesystem.hh" #include "utility/string.hh" -namespace Dune { namespace experimental { +namespace Dune { template <class Grid, class Creator> 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 return attr; } -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/vtktypes.cc b/dune/vtk/vtktypes.cc index 6e2f9e6528769851bdb20d4bbafefae069f662c7..d8becf47f686de4c69d336e4b3420121ffa16a30 100644 --- a/dune/vtk/vtktypes.cc +++ b/dune/vtk/vtktypes.cc @@ -2,7 +2,7 @@ #include <iostream> -namespace Dune { namespace experimental { +namespace Dune { namespace Vtk { std::string to_string (FormatTypes type) @@ -154,4 +154,4 @@ CellType::CellType (GeometryType const& t, CellParametrization parametrization) } } -}}} // end namespace Dune::experimental::Vtk +}} // end namespace Dune::Vtk diff --git a/dune/vtk/vtktypes.hh b/dune/vtk/vtktypes.hh index 9991b238835aa8d1bfe41965d872c66b16d866a2..250d5a8e5464d82944889404215c94d5e3ee307f 100644 --- a/dune/vtk/vtktypes.hh +++ b/dune/vtk/vtktypes.hh @@ -7,7 +7,7 @@ #include <dune/geometry/type.hh> -namespace Dune { namespace experimental +namespace Dune { namespace Vtk { @@ -113,4 +113,4 @@ namespace Dune { namespace experimental }; } // end namespace Vtk -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/vtkwriter.hh b/dune/vtk/vtkwriter.hh index 6667f8ebcace1630fd54a6b3f6c8ed1513e290fd..d33339260c5481230379f11c1c50c5fc852533f5 100644 --- a/dune/vtk/vtkwriter.hh +++ b/dune/vtk/vtkwriter.hh @@ -14,7 +14,7 @@ #include <dune/grid/yaspgrid.hh> #include <dune/vtk/datacollectors/yaspdatacollector.hh> -namespace Dune { namespace experimental +namespace Dune { namespace Impl { @@ -63,4 +63,4 @@ namespace Dune { namespace experimental template <class GridView> using VtkWriter = typename Impl::VtkWriterImpl<GridView, typename GridView::Grid>::type; -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/writers/vtkimagedatawriter.hh b/dune/vtk/writers/vtkimagedatawriter.hh index 34c9fa7e8e7961e1f642b1300a2433ec42c71425..c9a67836f7eec2fa1d24e834eab21f1c684d30f2 100644 --- a/dune/vtk/writers/vtkimagedatawriter.hh +++ b/dune/vtk/writers/vtkimagedatawriter.hh @@ -11,7 +11,7 @@ #include "vtkwriterinterface.hh" -namespace Dune { namespace experimental +namespace Dune { /// File-Writer for ImageData VTK .vti files /** @@ -57,6 +57,6 @@ namespace Dune { namespace experimental using Super::cellData_; }; -}} // end namespace Dune::experimental +} // end namespace Dune #include "vtkimagedatawriter.impl.hh" diff --git a/dune/vtk/writers/vtkimagedatawriter.impl.hh b/dune/vtk/writers/vtkimagedatawriter.impl.hh index 468b785d3927be30687895d0ff6afbe77940aa2c..235b4ef89186a2e3f772c9a4b3d4c7246111d2c6 100644 --- a/dune/vtk/writers/vtkimagedatawriter.impl.hh +++ b/dune/vtk/writers/vtkimagedatawriter.impl.hh @@ -14,7 +14,7 @@ #include <dune/vtk/utility/filesystem.hh> #include <dune/vtk/utility/string.hh> -namespace Dune { namespace experimental { +namespace Dune { template <class GV, class DC> void VtkImageDataWriter<GV,DC> @@ -163,4 +163,4 @@ void VtkImageDataWriter<GV,DC> out << "</VTKFile>"; } -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/writers/vtkrectilineargridwriter.hh b/dune/vtk/writers/vtkrectilineargridwriter.hh index 8ee4f80b03c3caad1ef01e83369c4eebae9a4d8f..fdfa416329bc9be944b23d6828d47dd963d99c8e 100644 --- a/dune/vtk/writers/vtkrectilineargridwriter.hh +++ b/dune/vtk/writers/vtkrectilineargridwriter.hh @@ -11,7 +11,7 @@ #include "vtkwriterinterface.hh" -namespace Dune { namespace experimental +namespace Dune { /// File-Writer for RectilinearGrid VTK .vtr files /** @@ -62,6 +62,6 @@ namespace Dune { namespace experimental using Super::cellData_; }; -}} // end namespace Dune::experimental +} // end namespace Dune #include "vtkrectilineargridwriter.impl.hh" diff --git a/dune/vtk/writers/vtkrectilineargridwriter.impl.hh b/dune/vtk/writers/vtkrectilineargridwriter.impl.hh index 6d37be65518708621946bd873e41b6ddc3417fe1..23b8f09a179abc27519e709217a687fcf8dab722 100644 --- a/dune/vtk/writers/vtkrectilineargridwriter.impl.hh +++ b/dune/vtk/writers/vtkrectilineargridwriter.impl.hh @@ -14,7 +14,7 @@ #include <dune/vtk/utility/filesystem.hh> #include <dune/vtk/utility/string.hh> -namespace Dune { namespace experimental { +namespace Dune { template <class GV, class DC> void VtkRectilinearGridWriter<GV,DC> @@ -219,4 +219,4 @@ std::array<std::uint64_t,3> VtkRectilinearGridWriter<GV,DC> return {bs0, bs1, bs2}; } -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/writers/vtkstructuredgridwriter.hh b/dune/vtk/writers/vtkstructuredgridwriter.hh index e2772b84bd7e60286e9cdb99f7bf0ac0934e57a0..6dff211c33f0fcf93665049c4385539e2ce9df7c 100644 --- a/dune/vtk/writers/vtkstructuredgridwriter.hh +++ b/dune/vtk/writers/vtkstructuredgridwriter.hh @@ -11,7 +11,7 @@ #include "vtkwriterinterface.hh" -namespace Dune { namespace experimental +namespace Dune { /// File-Writer for StructuredGrid VTK .vts files /** @@ -57,6 +57,6 @@ namespace Dune { namespace experimental using Super::cellData_; }; -}} // end namespace Dune::experimental +} // end namespace Dune #include "vtkstructuredgridwriter.impl.hh" diff --git a/dune/vtk/writers/vtkstructuredgridwriter.impl.hh b/dune/vtk/writers/vtkstructuredgridwriter.impl.hh index 1cab9b55dd27d38fc4c32c195fa656a4793c57e9..61c69cb8f9936f9f784eb7b6e39283cf970a8b8b 100644 --- a/dune/vtk/writers/vtkstructuredgridwriter.impl.hh +++ b/dune/vtk/writers/vtkstructuredgridwriter.impl.hh @@ -14,7 +14,7 @@ #include <dune/vtk/utility/filesystem.hh> #include <dune/vtk/utility/string.hh> -namespace Dune { namespace experimental { +namespace Dune { template <class GV, class DC> void VtkStructuredGridWriter<GV,DC> @@ -170,4 +170,4 @@ void VtkStructuredGridWriter<GV,DC> out << "</VTKFile>"; } -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/writers/vtkunstructuredgridwriter.hh b/dune/vtk/writers/vtkunstructuredgridwriter.hh index 2616e0176b6b9a73c92f342a88fc00cb4402b28b..4368d0bb4f7a46c10a3fa52b982ece47d51211cb 100644 --- a/dune/vtk/writers/vtkunstructuredgridwriter.hh +++ b/dune/vtk/writers/vtkunstructuredgridwriter.hh @@ -11,7 +11,7 @@ #include "vtkwriterinterface.hh" -namespace Dune { namespace experimental +namespace Dune { /// File-Writer for VTK .vtu files /** @@ -67,6 +67,6 @@ namespace Dune { namespace experimental using Super::cellData_; }; -}} // end namespace Dune::experimental +} // end namespace Dune #include "vtkunstructuredgridwriter.impl.hh" diff --git a/dune/vtk/writers/vtkunstructuredgridwriter.impl.hh b/dune/vtk/writers/vtkunstructuredgridwriter.impl.hh index 4d34751ad9385cca35913a54f6278c8219dbc991..42769b600cc169ad1936a5fe9ac2d4c2b5c19bae 100644 --- a/dune/vtk/writers/vtkunstructuredgridwriter.impl.hh +++ b/dune/vtk/writers/vtkunstructuredgridwriter.impl.hh @@ -14,7 +14,7 @@ #include <dune/vtk/utility/filesystem.hh> #include <dune/vtk/utility/string.hh> -namespace Dune { namespace experimental { +namespace Dune { template <class GV, class DC> void VtkUnstructuredGridWriter<GV,DC> @@ -234,4 +234,4 @@ std::array<std::uint64_t,3> VtkUnstructuredGridWriter<GV,DC> } -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/dune/vtk/writers/vtkwriterinterface.hh b/dune/vtk/writers/vtkwriterinterface.hh index aa657965455f0198bf28cde8ebb56b7a55188466..5f9d3d2d5cb343d0f03f89f65cb2321c38e05666 100644 --- a/dune/vtk/writers/vtkwriterinterface.hh +++ b/dune/vtk/writers/vtkwriterinterface.hh @@ -10,7 +10,7 @@ #include <dune/vtk/vtkfunction.hh> #include <dune/vtk/vtktypes.hh> -namespace Dune { namespace experimental +namespace Dune { /// File-Writer for Vtk .vtu files template <class GridView, class DataCollector> @@ -20,7 +20,7 @@ namespace Dune { namespace experimental protected: static constexpr int dimension = GridView::dimension; - using VtkFunction = Dune::experimental::VtkFunction<GridView>; + using VtkFunction = Dune::VtkFunction<GridView>; using pos_type = typename std::ostream::pos_type; enum PositionTypes { @@ -136,6 +136,6 @@ namespace Dune { namespace experimental int compression_level = -1; // in [0,9], -1 ... use default value }; -}} // end namespace Dune::experimental +} // end namespace Dune #include "vtkwriterinterface.impl.hh" diff --git a/dune/vtk/writers/vtkwriterinterface.impl.hh b/dune/vtk/writers/vtkwriterinterface.impl.hh index 353fb08c7147d7c4054955e545d12223cdfd435e..5b17a3cac88bf71e25caddff352898feffd1c7ee 100644 --- a/dune/vtk/writers/vtkwriterinterface.impl.hh +++ b/dune/vtk/writers/vtkwriterinterface.impl.hh @@ -18,7 +18,7 @@ #include <dune/vtk/utility/filesystem.hh> #include <dune/vtk/utility/string.hh> -namespace Dune { namespace experimental { +namespace Dune { template <class GV, class DC> void VtkWriterInterface<GV,DC> @@ -236,4 +236,4 @@ std::uint64_t VtkWriterInterface<GV,DC> return std::uint64_t(end_pos - begin_pos); } -}} // end namespace Dune::experimental +} // end namespace Dune diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0cd13b5fb8fcd2dfd14b95c49b742adbbf971854..a50e8fcacb540d9d70f53c732778db330bd0199a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,6 +22,10 @@ add_executable("legacyvtkwriter" legacyvtkwriter.cc) target_link_dune_default_libraries("legacyvtkwriter") target_link_libraries("legacyvtkwriter" dunevtk) +add_executable("geometrygrid" geometrygrid.cc) +target_link_dune_default_libraries("geometrygrid") +target_link_libraries("geometrygrid" dunevtk) + if (dune-polygongrid_FOUND) add_executable("polygongrid" polygongrid.cc) target_link_dune_default_libraries("polygongrid") diff --git a/src/benchmark.cc b/src/benchmark.cc index 3f2cf8fd11d1b5f59f1d6f65cf1584aeb65797c0..e1d731adcda8575d8534d1058f32d9927f86e91e 100644 --- a/src/benchmark.cc +++ b/src/benchmark.cc @@ -34,14 +34,14 @@ static TestCasesOld test_cases_old = { }; -using TestCasesNew = std::set<std::tuple<std::string,experimental::Vtk::FormatTypes,experimental::Vtk::DataTypes>>; +using TestCasesNew = std::set<std::tuple<std::string,Vtk::FormatTypes,Vtk::DataTypes>>; static TestCasesNew test_cases_new = { - {"ascii32", experimental::Vtk::ASCII, experimental::Vtk::FLOAT32}, - {"bin32", experimental::Vtk::BINARY, experimental::Vtk::FLOAT32}, - // {"zlib32", experimental::Vtk::COMPRESSED, experimental::Vtk::FLOAT32}, - // {"ascii64", experimental::Vtk::ASCII, experimental::Vtk::FLOAT64}, - // {"bin64", experimental::Vtk::BINARY, experimental::Vtk::FLOAT64}, - // {"zlib64", experimental::Vtk::COMPRESSED, experimental::Vtk::FLOAT64} + {"ascii32", Vtk::ASCII, Vtk::FLOAT32}, + {"bin32", Vtk::BINARY, Vtk::FLOAT32}, + // {"zlib32", Vtk::COMPRESSED, Vtk::FLOAT32}, + // {"ascii64", Vtk::ASCII, Vtk::FLOAT64}, + // {"bin64", Vtk::BINARY, Vtk::FLOAT64}, + // {"zlib64", Vtk::COMPRESSED, Vtk::FLOAT64} }; template <class GridView> @@ -61,7 +61,7 @@ template <class GridView> void writer_new (GridView const& gridView) { Timer t; - experimental::VtkUnstructuredGridWriter<GridView> vtkWriter(gridView); + VtkUnstructuredGridWriter<GridView> vtkWriter(gridView); for (auto const& test_case : test_cases_new) { t.reset(); vtkWriter.write("writer_new_" + std::get<0>(test_case) + ".vtu", diff --git a/src/datacollector.cc b/src/datacollector.cc index fed2887dc80b2ef3af033203afbf6abf77e0bce8..5864a4f013561604623d31c180613863cde51807 100644 --- a/src/datacollector.cc +++ b/src/datacollector.cc @@ -27,7 +27,6 @@ #include <dune/vtk/datacollectors/quadraticdatacollector.hh> using namespace Dune; -using namespace Dune::experimental; using namespace Dune::Functions; template <class DataCollector, class GridView, class Fct1, class Fct2> diff --git a/src/geometrygrid.cc b/src/geometrygrid.cc new file mode 100644 index 0000000000000000000000000000000000000000..0bb10c705be587b76fd668f6304e439eedc360e2 --- /dev/null +++ b/src/geometrygrid.cc @@ -0,0 +1,78 @@ +// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// vi: set et ts=4 sw=2 sts=2: + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <iostream> +#include <vector> + +#include <dune/common/parallel/mpihelper.hh> // An initializer of MPI +#include <dune/functions/functionspacebases/defaultglobalbasis.hh> +#include <dune/functions/functionspacebases/lagrangebasis.hh> +#include <dune/functions/gridfunctions/analyticgridviewfunction.hh> +#include <dune/grid/yaspgrid.hh> +#include <dune/grid/geometrygrid.hh> + +#include <dune/vtk/vtkwriter.hh> + +using namespace Dune; +using namespace Dune::Functions; + +class TorusMapper + : public AnalyticalCoordFunction<double, 2, 3, TorusMapper> +{ + using Super = AnalyticalCoordFunction<double, 2, 3, TorusMapper>; + +public: + using DomainVector = Super::DomainVector; + using RangeVector = Super::RangeVector; + + TorusMapper(double R, double r) + : R_(R), r_(r) {} + + void evaluate(DomainVector const& x, RangeVector& y) const + { + y[0] = (R_ + r_*std::cos(x[0])) * std::cos(x[1]); + y[1] = (R_ + r_*std::cos(x[0])) * std::sin(x[1]); + y[2] = r_*std::sin(x[0]); + } + +private: + double R_, r_; +}; + +template <class GridView> +void write (std::string prefix, GridView const& gridView) +{ + FieldVector<double,GridView::dimension> c; + if (GridView::dimension > 0) c[0] = 11.0; + if (GridView::dimension > 1) c[1] = 7.0; + if (GridView::dimension > 2) c[2] = 3.0; + + auto p1Analytic = makeAnalyticGridViewFunction([&c](auto const& x) { return c.dot(x); }, gridView); + + VtkWriter<GridView> vtkWriter(gridView); + vtkWriter.addPointData(p1Analytic, "q1"); + vtkWriter.addCellData(p1Analytic, "q0"); + vtkWriter.write(prefix + "_ascii.vtu", Vtk::ASCII, Vtk::FLOAT32); +} + +int main (int argc, char** argv) +{ + Dune::MPIHelper::instance(argc, argv); + + using HostGrid = YaspGrid<2>; + FieldVector<double,2> bbox = {2.0*M_PI, 2.0*M_PI}; + std::array num = {4, 12}; + HostGrid hostGrid{bbox, num}; //, std::bitset<2>{"11"}}; + + // grid build up of mapped coordinates + double R = 1.0, r = 0.25; + TorusMapper mapper{R,r}; + using Grid = GeometryGrid<HostGrid,TorusMapper>; + Grid grid{hostGrid, mapper}; + + write("torus", grid.leafGridView()); +} \ No newline at end of file diff --git a/src/legacyvtkwriter.cc b/src/legacyvtkwriter.cc index 52e273574c4a8ffcdae40ac419a9299c84240d83..0ed25c63fae246e5e9f633966da72f9b9eb9aa34 100644 --- a/src/legacyvtkwriter.cc +++ b/src/legacyvtkwriter.cc @@ -24,7 +24,6 @@ #include <dune/vtk/legacyvtkfunction.hh> using namespace Dune; -using namespace Dune::experimental; using namespace Dune::Functions; int main(int argc, char** argv) diff --git a/src/polygongrid.cc b/src/polygongrid.cc index dcc1ff973f04df0fa76efb63ff3de8f4805089ab..fd24fd3ed3ef824650b3c801e7e0a1ca76511660 100644 --- a/src/polygongrid.cc +++ b/src/polygongrid.cc @@ -24,7 +24,6 @@ #include <dune/vtk/vtkunstructuredgridwriter.hh> using namespace Dune; -using namespace Dune::experimental; using namespace Dune::Functions; using GridType = Dune::PolygonGrid<double>; diff --git a/src/structuredgridwriter.cc b/src/structuredgridwriter.cc index a331c4b6c31aee8c2279dce0204ff3da0ea98379..a8db430d4183f6b719e8f47e056799e1e7599ed7 100644 --- a/src/structuredgridwriter.cc +++ b/src/structuredgridwriter.cc @@ -28,7 +28,6 @@ #include <dune/vtk/datacollectors/spdatacollector.hh> using namespace Dune; -using namespace Dune::experimental; using namespace Dune::Functions; template <int dim> diff --git a/src/test/mixed_element_test.cc b/src/test/mixed_element_test.cc index 8293398ff4c542fb4efa7e2885c8fbfb348eb8e5..6b15247c0d03c25a4efde4c113164b9cb2b01d65 100644 --- a/src/test/mixed_element_test.cc +++ b/src/test/mixed_element_test.cc @@ -21,7 +21,6 @@ #include <dune/vtk/writers/vtkunstructuredgridwriter.hh> using namespace Dune; -using namespace Dune::experimental; // see https://stackoverflow.com/questions/6163611/compare-two-files bool compare_files (std::string const& fn1, std::string const& fn2) diff --git a/src/test/reader_writer_test.cc b/src/test/reader_writer_test.cc index 0bb509e2487ff363fff15193f200feda6ecb3bad..d34cbd86b1574d2b0051108c5bc39a6c5a5897dc 100644 --- a/src/test/reader_writer_test.cc +++ b/src/test/reader_writer_test.cc @@ -21,7 +21,6 @@ #include <dune/vtk/writers/vtkunstructuredgridwriter.hh> using namespace Dune; -using namespace Dune::experimental; // see https://stackoverflow.com/questions/6163611/compare-two-files bool compare_files (std::string const& fn1, std::string const& fn2) diff --git a/src/vtkreader.cc b/src/vtkreader.cc index f78871619517efa5551f939fe474fc66da2c2235..b02fceeb59096b2808125b79ab597ab238752751 100644 --- a/src/vtkreader.cc +++ b/src/vtkreader.cc @@ -19,7 +19,6 @@ #include <dune/vtk/writers/vtkunstructuredgridwriter.hh> using namespace Dune; -using namespace Dune::experimental; int main(int argc, char** argv) { diff --git a/src/vtkwriter.cc b/src/vtkwriter.cc index 001d0d3562847bb28b836dd86b02b43429392a14..b15b5ff0fdb5d48c2a597710ac8d7d6d9d7e9e6d 100644 --- a/src/vtkwriter.cc +++ b/src/vtkwriter.cc @@ -10,7 +10,6 @@ #include <dune/common/parallel/mpihelper.hh> // An initializer of MPI #include <dune/common/exceptions.hh> // We use exceptions -#include <dune/common/filledarray.hh> #include <dune/functions/functionspacebases/defaultglobalbasis.hh> #include <dune/functions/functionspacebases/lagrangebasis.hh> @@ -23,7 +22,6 @@ #include <dune/vtk/vtkwriter.hh> using namespace Dune; -using namespace Dune::experimental; using namespace Dune::Functions; using TestCases = std::set<std::tuple<std::string,Vtk::FormatTypes,Vtk::DataTypes>>;