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

removed experimental namespace and geometrygrid example added

parent 6411139a
......@@ -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
......@@ -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"
......@@ -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
......@@ -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"
......@@ -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
......@@ -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"
......@@ -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
......@@ -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"
......@@ -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
......@@ -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"
......@@ -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
......@@ -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")
......
......@@ -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",
......
......@@ -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>
......
// -*- 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
......@@ -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)
......
......@@ -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>;
......
......@@ -28,7 +28,6 @@
#include <dune/vtk/datacollectors/spdatacollector.hh>
using namespace Dune;
using namespace Dune::experimental;
using namespace Dune::Functions;
template <int dim>
......
......@@ -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)
......
......@@ -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)
......
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