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

added missing includes

parent a5944b68
......@@ -7,5 +7,5 @@ Module: dune-vtk
Version: 0.2
Maintainer: simon.praetorius@tu-dresden.de
#depending on
Depends: dune-common (>= 2.6) dune-geometry (>= 2.6) dune-grid
Suggests: dune-functions dune-spgrid dune-polygongrid dune-uggrid dune-alugrid
Depends: dune-common (>= 2.6) dune-geometry (>= 2.6) dune-grid dune-uggrid
Suggests: dune-functions dune-spgrid dune-polygongrid dune-alugrid
......@@ -85,7 +85,7 @@ namespace Dune
/// \brief Return a flat vector of function values evaluated at the cells in the order of traversal.
/**
* \see pointData.
* Note: Cells might be descibred explicitly by connectivity, offsets, and types, e.g. in
* Note: Cells might be described explicitly by connectivity, offsets, and types, e.g. in
* an UnstructuredGrid, or might be described implicitly by the grid type, e.g. in
* StructuredGrid.
*/
......
......@@ -24,7 +24,8 @@ namespace Dune
public:
/// Constructor. Stores a copy of the passed `localFct` in a local variable.
template <class LocalFct, disableCopyMove<Self, LocalFct> = 0>
template <class LocalFct,
disableCopyMove<Self, LocalFct> = 0>
LocalFunctionWrapper (LocalFct&& localFct)
: localFct_(std::forward<LocalFct>(localFct))
{}
......
......@@ -4,6 +4,8 @@
#include <string>
#include <utility>
#include <dune/common/exceptions.hh>
#include <dune/grid/common/gridfactory.hh>
#include <dune/vtk/forward.hh>
namespace Dune
......
#pragma once
#include <string>
#include <dune/common/std/optional.hh>
#include <dune/common/std/optional.hh>
#include <dune/vtk/forward.hh>
namespace Dune
......
......@@ -71,7 +71,7 @@ namespace Dune
* GridFunction if not given.
**/
template <class F,
std::enable_if_t<Std::is_detected<HasLocalFunction,F>::value, int> = 0>
class = void_t<HasLocalFunction<F>> >
VtkFunction (F&& fct, std::string name,
Std::optional<int> ncomps = {},
Std::optional<Vtk::DataTypes> type = {})
......@@ -84,8 +84,9 @@ namespace Dune
type_ = type ? *type : Vtk::Map::type<R>();
}
/// Constructor that forward the number of components and data type to the other constructor
template <class F,
std::enable_if_t<Std::is_detected<HasLocalFunction,F>::value, int> = 0>
class = void_t<HasLocalFunction<F>> >
VtkFunction (F&& fct, Vtk::FieldInfo fieldInfo,
Std::optional<Vtk::DataTypes> type = {})
: VtkFunction(std::forward<F>(fct), fieldInfo.name(), fieldInfo.ncomps(), type)
......
......@@ -11,6 +11,11 @@
namespace Dune
{
/// \brief A VtkLocalFunction is a function-like object that can be bound to a grid element
/// an that provides an evaluate method with a component argument.
/**
* Stores internally a VtkLocalFunctionInterface object for the concrete evaluation.
**/
template <class GridView>
class VtkLocalFunction
{
......@@ -22,38 +27,45 @@ namespace Dune
using HasBind = decltype(std::declval<LF>().bind(std::declval<E>()));
public:
template <class LF, disableCopyMove<Self, LF> = 0,
std::enable_if_t<Std::is_detected<HasBind,LF,Entity>::value, int> = 0>
/// Construct the VtkLocalFunction from any function object that has a bind(element) method.
template <class LF,
disableCopyMove<Self, LF> = 0,
class = void_t<HasBind<LF,Entity>> >
VtkLocalFunction (LF&& lf)
: localFct_(std::make_shared<LocalFunctionWrapper<GridView,LF>>(std::forward<LF>(lf)))
{}
/// Construct a VtkLocalFunction from a legacy VTKFunction
VtkLocalFunction (std::shared_ptr<VTKFunction<GridView> const> const& lf)
: localFct_(std::make_shared<VTKLocalFunctionWrapper<GridView>>(lf))
{}
/// Allow the default construction of a VtkLocalFunction
VtkLocalFunction () = default;
/// Bind the function to the grid entity
void bind (Entity const& entity)
{
assert(bool(localFct_));
localFct_->bind(entity);
}
/// Unbind from the currently bound entity
void unbind ()
{
assert(bool(localFct_));
localFct_->unbind();
}
/// Evaluate the `comp` component of the Range value at local coordinate `xi`
double evaluate (int comp, LocalCoordinate const& xi) const
{
assert(bool(localFct_));
return localFct_->evaluate(comp, xi);
}
private:
std::shared_ptr<VtkLocalFunctionInterface<GridView>> localFct_;
std::shared_ptr<VtkLocalFunctionInterface<GridView>> localFct_ = nullptr;
};
} // end namespace Dune
......@@ -2,7 +2,8 @@
namespace Dune
{
/// An abstract base class for LocalFunctions
/// \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>
class VtkLocalFunctionInterface
{
......
......@@ -5,6 +5,7 @@
#include <memory>
#include <vector>
#include <dune/common/shared_ptr.hh>
#include <dune/common/typeutilities.hh>
#include <dune/vtk/filereader.hh>
......@@ -94,7 +95,7 @@ namespace Dune
/// Construct a grid using the GridCreator
// NOTE: requires the internal data structures to be filled by an aforgoing call to readFromFile
void createGrid(bool insertPieces = true);
void createGrid (bool insertPieces = true);
/// @}
......@@ -151,7 +152,7 @@ namespace Dune
std::uint64_t findAppendedDataPosition (std::ifstream& input) const;
// Read attributes from current xml tag
std::map<std::string, std::string> parseXml(std::string const& line, bool& closed);
std::map<std::string, std::string> parseXml (std::string const& line, bool& closed);
// clear all vectors
void clear ();
......
......@@ -39,7 +39,8 @@ namespace Dune
public:
/// Constructor, stores the gridView
template <class... Args, disableCopyMove<Self, Args...> = 0>
template <class... Args,
disableCopyMove<Self, Args...> = 0>
VtkTimeseriesWriter (Args&&... args)
: vtkWriter_{std::forward<Args>(args)...}
{
......
......@@ -46,6 +46,9 @@ namespace Dune
* DataCollector that is used to collect point coordinates, cell connectivity and
* data values.
*
* This constructor assumes, that the DataCollector can be constructed from a single argument,
* the passed gridView.
*
* \param gridView Implementation of Dune::GridView
* \param format Format of the VTK file, either Vtk::BINARY, Vtk::ASCII, or Vtk::COMPRESSED
* \param datatype Output datatype used for coordinates and other global floating point values
......
......@@ -5,5 +5,4 @@ dune_add_test(SOURCES parallel_reader_writer_test.cc
LINK_LIBRARIES dunevtk)
dune_add_test(SOURCES mixed_element_test.cc
LINK_LIBRARIES dunevtk
CMAKE_GUARD HAVE_UG)
\ No newline at end of file
LINK_LIBRARIES dunevtk)
Markdown is supported
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