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

cleanup whitspaces and naming of writer classes

parent 1334467e
......@@ -12,10 +12,8 @@
namespace Dune
{
namespace Vtk
{
template <class GridCreator, class Derived>
struct DerivedGridCreator
: public GridCreatorInterface<typename GridCreator::Grid, Derived>
......
......@@ -15,7 +15,6 @@ namespace Dune
{
namespace Vtk
{
// Create a grid where the input points are not connected and the connectivity
// describes separated elements.
template <class Grid>
......
......@@ -22,7 +22,6 @@ namespace Dune
{
namespace Vtk
{
// \brief Create a grid from data that represents higher (lagrange) cells.
/**
* The grid is created from the first nodes of a cell parametrization, representing
......
......@@ -15,7 +15,6 @@ namespace Dune
{
namespace Vtk
{
// create a distributed grid in parallel. Currently only supported by ALUGrid
template <class Grid>
struct ParallelGridCreator
......@@ -34,7 +33,7 @@ namespace Dune
{}
void insertVerticesImpl (std::vector<GlobalCoordinate> const& points,
std::vector<std::uint64_t> const& point_ids)
std::vector<std::uint64_t> const& point_ids)
{
assert(point_ids.size() == points.size());
for (std::size_t i = 0; i < points.size(); ++i)
......
......@@ -11,10 +11,8 @@
namespace Dune
{
namespace Vtk
{
// create a distributed grid on rank 0. Needs to be load balanced afterwards.
template <class Grid>
struct SerialGridCreator
......@@ -29,7 +27,7 @@ namespace Dune
{}
void insertVerticesImpl (std::vector<GlobalCoordinate> const& points,
std::vector<std::uint64_t> const& /*point_ids*/)
std::vector<std::uint64_t> const& /*point_ids*/)
{
shift_.push_back(points_.size());
points_.reserve(points_.size() + points.size());
......@@ -37,8 +35,8 @@ namespace Dune
}
void insertElementsImpl (std::vector<std::uint8_t> const& types,
std::vector<std::int64_t> const& offsets,
std::vector<std::int64_t> const& connectivity)
std::vector<std::int64_t> const& offsets,
std::vector<std::int64_t> const& connectivity)
{
types_.reserve(types_.size() + types.size());
types_.insert(types_.end(), types.begin(), types.end());
......
......@@ -8,10 +8,8 @@
namespace Dune
{
namespace Vtk
{
/// Type erasure for Legacy VTKFunction
template <class GridView>
class VTKLocalFunctionWrapper final
......
......@@ -11,10 +11,8 @@
namespace Dune
{
namespace Vtk
{
/// \brief A Vtk::LocalFunction is a function-like object that can be bound to a grid element
/// an that provides an evaluate method with a component argument.
/**
......
......@@ -2,10 +2,8 @@
namespace Dune
{
namespace Vtk
{
/// \brief An abstract base class for LocalFunctions that can be bound to an element and
/// evaluated in local coordinates w.r.t. to a component of its value.
template <class GridView>
......
......@@ -14,7 +14,7 @@ void PvdWriter<W>
{
auto p = Vtk::Path(fn);
auto name = p.stem();
p.remove_filename();
p.removeFilename();
Vtk::Path fn_dir = p;
Vtk::Path data_dir = dir ? Vtk::Path(*dir) : fn_dir;
......@@ -54,7 +54,7 @@ std::string PvdWriter<W>
{
auto p = Vtk::Path(fn);
auto name = p.stem();
p.remove_filename();
p.removeFilename();
p /= name.string();
std::string outputFilename;
......
......@@ -5,8 +5,8 @@
#include "config.h" // autoconf defines, needed by the dune headers
#endif
#include <dune/vtk/reader.hh>
#include <dune/vtk/writer.hh>
#include <dune/vtk/vtkreader.hh>
#include <dune/vtk/vtkwriter.hh>
#if HAVE_UG
#include <dune/grid/uggrid.hh>
......
......@@ -20,7 +20,7 @@
#include <dune/grid/uggrid.hh>
#include <dune/grid/utility/structuredgridfactory.hh>
#endif
#include <dune/vtk/writer.hh>
#include <dune/vtk/vtkwriter.hh>
#include "checkvtkfile.hh"
......
......@@ -4,201 +4,197 @@
#include <dune/common/exceptions.hh>
namespace Dune
{
namespace Vtk
{
namespace Dune {
namespace Vtk {
std::string to_string (FormatTypes type)
{
switch (type) {
case ASCII: return "ascii";
case BINARY: return "binary";
case COMPRESSED: return "compressed";
case APPENDED: return "appended";
default:
DUNE_THROW(RangeError, "FormatType not found.");
std::abort();
}
}
std::string to_string (FormatTypes type)
{
switch (type) {
case ASCII: return "ascii";
case BINARY: return "binary";
case COMPRESSED: return "compressed";
case APPENDED: return "appended";
default:
DUNE_THROW(RangeError, "FormatType not found.");
std::abort();
}
}
std::string to_string (DataTypes type)
{
switch (type) {
case INT8: return "Int8";
case UINT8: return "UInt8";
case INT16: return "Int16";
case UINT16: return "UInt16";
case INT32: return "Int32";
case UINT32: return "UInt32";
case INT64: return "Int64";
case UINT64: return "UInt64";
case FLOAT32: return "Float32";
case FLOAT64: return "Float64";
default:
DUNE_THROW(RangeError, "DataType not found.");
std::abort();
}
}
std::string to_string (DataTypes type)
{
switch (type) {
case INT8: return "Int8";
case UINT8: return "UInt8";
case INT16: return "Int16";
case UINT16: return "UInt16";
case INT32: return "Int32";
case UINT32: return "UInt32";
case INT64: return "Int64";
case UINT64: return "UInt64";
case FLOAT32: return "Float32";
case FLOAT64: return "Float64";
default:
DUNE_THROW(RangeError, "DataType not found.");
std::abort();
}
}
GeometryType to_geometry (std::uint8_t cell)
{
switch (cell) {
case VERTEX: return GeometryTypes::vertex;
case LINE: return GeometryTypes::line;
case TRIANGLE: return GeometryTypes::triangle;
case QUAD: return GeometryTypes::quadrilateral;
case TETRA: return GeometryTypes::tetrahedron;
case HEXAHEDRON: return GeometryTypes::hexahedron;
case WEDGE: return GeometryTypes::prism;
case PYRAMID: return GeometryTypes::pyramid;
GeometryType to_geometry (std::uint8_t cell)
{
switch (cell) {
case VERTEX: return GeometryTypes::vertex;
case LINE: return GeometryTypes::line;
case TRIANGLE: return GeometryTypes::triangle;
case QUAD: return GeometryTypes::quadrilateral;
case TETRA: return GeometryTypes::tetrahedron;
case HEXAHEDRON: return GeometryTypes::hexahedron;
case WEDGE: return GeometryTypes::prism;
case PYRAMID: return GeometryTypes::pyramid;
// Quadratic VTK cell types
case QUADRATIC_EDGE: return GeometryTypes::line;
case QUADRATIC_TRIANGLE: return GeometryTypes::triangle;
case QUADRATIC_QUAD: return GeometryTypes::quadrilateral;
case QUADRATIC_TETRA: return GeometryTypes::tetrahedron;
case QUADRATIC_HEXAHEDRON: return GeometryTypes::hexahedron;
// Quadratic VTK cell types
case QUADRATIC_EDGE: return GeometryTypes::line;
case QUADRATIC_TRIANGLE: return GeometryTypes::triangle;
case QUADRATIC_QUAD: return GeometryTypes::quadrilateral;
case QUADRATIC_TETRA: return GeometryTypes::tetrahedron;
case QUADRATIC_HEXAHEDRON: return GeometryTypes::hexahedron;
// Arbitrary order Lagrange elements
case LAGRANGE_CURVE: return GeometryTypes::line;
case LAGRANGE_TRIANGLE: return GeometryTypes::triangle;
case LAGRANGE_QUADRILATERAL:return GeometryTypes::quadrilateral;
case LAGRANGE_TETRAHEDRON: return GeometryTypes::tetrahedron;
case LAGRANGE_HEXAHEDRON: return GeometryTypes::hexahedron;
case LAGRANGE_WEDGE: return GeometryTypes::prism;
default:
DUNE_THROW(RangeError, "CellType does not map to GeometryType.");
std::abort();
}
}
// Arbitrary order Lagrange elements
case LAGRANGE_CURVE: return GeometryTypes::line;
case LAGRANGE_TRIANGLE: return GeometryTypes::triangle;
case LAGRANGE_QUADRILATERAL:return GeometryTypes::quadrilateral;
case LAGRANGE_TETRAHEDRON: return GeometryTypes::tetrahedron;
case LAGRANGE_HEXAHEDRON: return GeometryTypes::hexahedron;
case LAGRANGE_WEDGE: return GeometryTypes::prism;
default:
DUNE_THROW(RangeError, "CellType does not map to GeometryType.");
std::abort();
}
}
std::map<std::string, DataTypes> Map::to_datatype = {
{"Int8", INT8},
{"UInt8", UINT8},
{"Int16", INT16},
{"UInt16", UINT16},
{"Int32", INT32},
{"UInt32", UINT32},
{"Int64", INT64},
{"UInt64", UINT64},
{"Float32", FLOAT32},
{"Float64", FLOAT64}
};
std::map<std::string, DataTypes> Map::to_datatype = {
{"Int8", INT8},
{"UInt8", UINT8},
{"Int16", INT16},
{"UInt16", UINT16},
{"Int32", INT32},
{"UInt32", UINT32},
{"Int64", INT64},
{"UInt64", UINT64},
{"Float32", FLOAT32},
{"Float64", FLOAT64}
};
CellType::CellType (GeometryType const& t, CellParametrization parametrization)
: noPermutation_(true)
{
if (parametrization == LINEAR) {
if (t.isVertex()) {
type_ = VERTEX;
permutation_ = {0};
}
else if (t.isLine()) {
type_ = LINE;
permutation_ = {0,1};
}
else if (t.isTriangle()) {
type_ = TRIANGLE;
permutation_ = {0,1,2};
}
else if (t.isQuadrilateral()) {
type_ = QUAD;
permutation_ = {0,1,3,2};
noPermutation_ = false;
}
else if (t.isTetrahedron()) {
type_ = TETRA;
permutation_ = {0,1,2,3};
}
else if (t.isHexahedron()) {
type_ = HEXAHEDRON;
permutation_ = {0,1,3,2,4,5,7,6};
noPermutation_ = false;
}
else if (t.isPrism()) {
type_ = WEDGE;
permutation_ = {0,2,1,3,5,4};
noPermutation_ = false;
}
else if (t.isPyramid()) {
type_ = PYRAMID;
permutation_ = {0,1,3,2,4};
noPermutation_ = false;
}
else if (t.isNone() && t.dim() == 1) {
type_ = LINE;
permutation_ = {0,1};
}
else if (t.isNone() && t.dim() == 2) {
type_ = POLYGON;
permutation_ = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
}
else {
std::cerr << "Geometry Type not supported by VTK!\n";
std::abort();
}
} else if (parametrization == QUADRATIC) {
if (t.isLine()) {
type_ = QUADRATIC_EDGE;
permutation_ = {0,1, 0};
}
else if (t.isTriangle()) {
type_ = QUADRATIC_TRIANGLE;
permutation_ = {0,1,2, 0,2,1};
noPermutation_ = false;
}
else if (t.isQuadrilateral()) {
type_ = QUADRATIC_QUAD;
permutation_ = {0,1,3,2, 2,1,3,0};
noPermutation_ = false;
}
else if (t.isTetrahedron()) {
type_ = QUADRATIC_TETRA;
permutation_ = {0,1,2,3, 0,2,1,3,4,5};
noPermutation_ = false;
}
else if (t.isHexahedron()) {
type_ = QUADRATIC_HEXAHEDRON;
permutation_ = {0,1,3,2,4,5,7,6, 6,5,7,4,10,9,11,8,0,1,3,2};
noPermutation_ = false;
}
else {
std::cerr << "Geometry Type not supported by VTK!\n";
std::abort();
}
} else if (parametrization == LAGRANGE) {
if (t.isLine()) {
type_ = LAGRANGE_CURVE;
}
else if (t.isTriangle()) {
type_ = LAGRANGE_TRIANGLE;
}
else if (t.isQuadrilateral()) {
type_ = LAGRANGE_QUADRILATERAL;
}
else if (t.isTetrahedron()) {
type_ = LAGRANGE_TETRAHEDRON;
}
else if (t.isHexahedron()) {
type_ = LAGRANGE_HEXAHEDRON;
}
else if (t.isPrism()) {
type_ = LAGRANGE_WEDGE;
}
else if (t.isPyramid()) {
type_ = LAGRANGE_PYRAMID;
}
else {
std::cerr << "Geometry Type not supported by VTK!\n";
std::abort();
}
}
CellType::CellType (GeometryType const& t, CellParametrization parametrization)
: noPermutation_(true)
{
if (parametrization == LINEAR) {
if (t.isVertex()) {
type_ = VERTEX;
permutation_ = {0};
}
else if (t.isLine()) {
type_ = LINE;
permutation_ = {0,1};
}
else if (t.isTriangle()) {
type_ = TRIANGLE;
permutation_ = {0,1,2};
}
else if (t.isQuadrilateral()) {
type_ = QUAD;
permutation_ = {0,1,3,2};
noPermutation_ = false;
}
else if (t.isTetrahedron()) {
type_ = TETRA;
permutation_ = {0,1,2,3};
}
else if (t.isHexahedron()) {
type_ = HEXAHEDRON;
permutation_ = {0,1,3,2,4,5,7,6};
noPermutation_ = false;
}
else if (t.isPrism()) {
type_ = WEDGE;
permutation_ = {0,2,1,3,5,4};
noPermutation_ = false;
}
else if (t.isPyramid()) {
type_ = PYRAMID;
permutation_ = {0,1,3,2,4};
noPermutation_ = false;
}
else if (t.isNone() && t.dim() == 1) {
type_ = LINE;
permutation_ = {0,1};
}
else if (t.isNone() && t.dim() == 2) {
type_ = POLYGON;
permutation_ = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
}
else {
std::cerr << "Geometry Type not supported by VTK!\n";
std::abort();
}
} else if (parametrization == QUADRATIC) {
if (t.isLine()) {
type_ = QUADRATIC_EDGE;
permutation_ = {0,1, 0};
}
else if (t.isTriangle()) {
type_ = QUADRATIC_TRIANGLE;
permutation_ = {0,1,2, 0,2,1};
noPermutation_ = false;
}
else if (t.isQuadrilateral()) {
type_ = QUADRATIC_QUAD;
permutation_ = {0,1,3,2, 2,1,3,0};
noPermutation_ = false;
}
else if (t.isTetrahedron()) {
type_ = QUADRATIC_TETRA;
permutation_ = {0,1,2,3, 0,2,1,3,4,5};
noPermutation_ = false;
}
else if (t.isHexahedron()) {
type_ = QUADRATIC_HEXAHEDRON;
permutation_ = {0,1,3,2,4,5,7,6, 6,5,7,4,10,9,11,8,0,1,3,2};
noPermutation_ = false;
}
else {
std::cerr << "Geometry Type not supported by VTK!\n";
std::abort();
}
} else if (parametrization == LAGRANGE) {
if (t.isLine()) {
type_ = LAGRANGE_CURVE;
}
else if (t.isTriangle()) {
type_ = LAGRANGE_TRIANGLE;
}
else if (t.isQuadrilateral()) {
type_ = LAGRANGE_QUADRILATERAL;
}
else if (t.isTetrahedron()) {
type_ = LAGRANGE_TETRAHEDRON;
}
else if (t.isHexahedron()) {
type_ = LAGRANGE_HEXAHEDRON;
}
else if (t.isPrism()) {
type_ = LAGRANGE_WEDGE;
}
else if (t.isPyramid()) {
type_ = LAGRANGE_PYRAMID;
}
else {
std::cerr << "Geometry Type not supported by VTK!\n";
std::abort();
}
}
}
} // end namespace Vtk
} // end namespace Dune
} } // end namespace Dune::Vtk
......@@ -6,8 +6,9 @@ install(FILES
enum.hh
filesystem.hh
lagrangepoints.hh
lagrangepoints.impl.hh
string.hh
uid.hh
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dune/vtkwriter/utility)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dune/vtk/utility)
add_subdirectory(test)
\ No newline at end of file
This diff is collapsed.
#pragma once
#include <cassert>
#include <array>
#include <dune/common/exceptions.hh>
#include <dune/geometry/type.hh>
#include <dune/localfunctions/lagrange/equidistantpoints.hh>
namespace Dune {
namespace Vtk {
namespace Impl {
/**
* The implementation of the point set builder is directly derived from VTK.
* Modification are a change in data-types and naming scheme. Additionally
* a LocalKey is created to reflect the concept of a Dune PointSet.
*
* Included is the license of the BSD 3-clause License included in the VTK
* source code from 2020/04/13 in commit b90dad558ce28f6d321420e4a6b17e23f5227a1c
* of git repository https://gitlab.kitware.com/vtk/vtk.
*
Program: Visualization Toolkit
Module: Copyright.txt
Copyright (c) 1993-2015 Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
of any contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**/
template <class K>
template <class Points>
void LagrangePointSetBuilder<K,0>::operator() (GeometryType gt, int /*order*/, Points& points) const
{