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

replace Dune::Std::optional with std::optional

parent 9d6d4bc5
#pragma once
#include <optional>
#include <string>
#include <dune/common/std/optional.hh>
#include <dune/vtk/forward.hh>
namespace Dune
......@@ -14,7 +14,7 @@ namespace Dune
virtual ~FileWriter () = default;
/// Write to file given by `filename` and (optionally) store additional data in `dataDir`
virtual std::string write (std::string const& filename, Std::optional<std::string> dataDir = {}) const = 0;
virtual std::string write (std::string const& filename, std::optional<std::string> dataDir = {}) const = 0;
};
} // end namespace Dune
......@@ -3,11 +3,11 @@
#include <cassert>
#include <cstdint>
#include <limits>
#include <optional>
#include <vector>
#include <dune/common/exceptions.hh>
#include <dune/common/hybridutilities.hh>
#include <dune/common/std/optional.hh>
#include <dune/geometry/utility/typefromvertexcount.hh>
#include <dune/localfunctions/lagrange.hh>
#include <dune/grid/common/gridfactory.hh>
......@@ -297,7 +297,7 @@ namespace Dune
private:
LocalFE localFE_;
std::vector<GlobalCoordinate> localNodes_;
Std::optional<LocalGeometry> localGeometry_;
std::optional<LocalGeometry> localGeometry_;
mutable std::vector<typename LocalBasisTraits::RangeType> shapeValues_;
};
......@@ -343,7 +343,7 @@ namespace Dune
LagrangeGridCreator const* gridCreator_;
LocalContext localContext_;
Std::optional<LocalParametrization> localParametrization_;
std::optional<LocalParametrization> localParametrization_;
};
} // end namespace Dune
#pragma once
#include <iosfwd>
#include <optional>
#include <string>
#include <vector>
#include <tuple>
#include <dune/common/std/optional.hh>
#include <dune/vtk/vtktypes.hh>
#include <dune/vtk/filewriter.hh>
#include <dune/vtk/forward.hh>
......@@ -42,7 +41,7 @@ namespace Dune
* \param dir Specifies where to write the timestep files.
* \param writeCollection Create a collection .pvd file directly
**/
void writeTimestep (double time, std::string const& fn, Std::optional<std::string> dir = {},
void writeTimestep (double time, std::string const& fn, std::optional<std::string> dir = {},
bool writeCollection = true) const;
/// \brief Writes collection of timesteps to .pvd file.
......@@ -52,7 +51,7 @@ namespace Dune
* \param dir (Ignored) Timestep files are already written and their filenames are
* stored in \ref timesteps_.
**/
virtual std::string write (std::string const& fn, Std::optional<std::string> dir = {}) const override;
virtual std::string write (std::string const& fn, std::optional<std::string> dir = {}) const override;
/// Attach point data to the writer, \see VtkFunction for possible arguments
template <class Function, class... Args>
......
......@@ -10,7 +10,7 @@ namespace Dune {
template <class W>
void PvdWriter<W>
::writeTimestep (double time, std::string const& fn, Std::optional<std::string> dir, bool writeCollection) const
::writeTimestep (double time, std::string const& fn, std::optional<std::string> dir, bool writeCollection) const
{
auto p = filesystem::path(fn);
auto name = p.stem();
......@@ -50,7 +50,7 @@ void PvdWriter<W>
template <class W>
std::string PvdWriter<W>
::write (std::string const& fn, Std::optional<std::string> /*dir*/) const
::write (std::string const& fn, std::optional<std::string> /*dir*/) const
{
auto p = filesystem::path(fn);
auto name = p.stem();
......
#pragma once
#include <optional>
#include <type_traits>
#include <dune/common/std/optional.hh>
#include <dune/common/std/type_traits.hh>
#include "vtklocalfunction.hh"
......@@ -52,7 +52,7 @@ namespace Dune
* \param type The VTK datatype how to write the function values to the output [Vtk::FLOAT64]
**/
VtkFunction (std::shared_ptr<VTKFunction<GridView> const> const& fct,
Std::optional<Vtk::DataTypes> type = {})
std::optional<Vtk::DataTypes> type = {})
: localFct_(fct)
, name_(fct->name())
, ncomps_(fct->ncomps())
......@@ -73,8 +73,8 @@ namespace Dune
template <class F,
class = void_t<LocalFunction<F>> >
VtkFunction (F&& fct, std::string name,
Std::optional<int> ncomps = {},
Std::optional<Vtk::DataTypes> type = {})
std::optional<int> ncomps = {},
std::optional<Vtk::DataTypes> type = {})
: localFct_(localFunction(std::forward<F>(fct)))
, name_(std::move(name))
{
......@@ -88,7 +88,7 @@ namespace Dune
template <class F,
class = void_t<LocalFunction<F>> >
VtkFunction (F&& fct, Vtk::FieldInfo fieldInfo,
Std::optional<Vtk::DataTypes> type = {})
std::optional<Vtk::DataTypes> type = {})
: VtkFunction(std::forward<F>(fct), fieldInfo.name(), fieldInfo.ncomps(), type)
{}
......
#pragma once
#include <cassert>
#include <optional>
#include <string>
#include <tuple>
#include <vector>
#include <dune/common/std/optional.hh>
#include <dune/vtk/filewriter.hh>
#include <dune/vtk/forward.hh>
#include <dune/vtk/vtktypes.hh>
......@@ -66,7 +65,7 @@ namespace Dune
* \param writeCollection Create a timeseries file directly
**/
void writeTimestep (double time, std::string const& fn,
Std::optional<std::string> tmpDir = {},
std::optional<std::string> tmpDir = {},
bool writeCollection = true) const;
/// Writes all timesteps to single timeseries file.
......@@ -79,7 +78,7 @@ namespace Dune
*
* \returns File name of the actual written file
**/
virtual std::string write (std::string const& fn, Std::optional<std::string> dir = {}) const override;
virtual std::string write (std::string const& fn, std::optional<std::string> dir = {}) const override;
/// Attach point data to the writer, \see VtkFunction for possible arguments
template <class Function, class... Args>
......
......@@ -39,7 +39,7 @@ VtkTimeseriesWriter<W>::~VtkTimeseriesWriter ()
template <class W>
void VtkTimeseriesWriter<W>
::writeTimestep (double time, std::string const& fn, Std::optional<std::string> tmpDir, bool writeCollection) const
::writeTimestep (double time, std::string const& fn, std::optional<std::string> tmpDir, bool writeCollection) const
{
auto name = filesystem::path(fn).stem();
auto tmpBase = tmpDir ? filesystem::path(*tmpDir) : tmpDir_;
......@@ -75,7 +75,7 @@ void VtkTimeseriesWriter<W>
template <class W>
std::string VtkTimeseriesWriter<W>
::write (std::string const& fn, Std::optional<std::string> dir) const
::write (std::string const& fn, std::optional<std::string> dir) const
{
assert( initialized_ );
......
......@@ -3,11 +3,11 @@
#include <iosfwd>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include <dune/common/parallel/mpihelper.hh>
#include <dune/common/std/optional.hh>
#include <dune/vtk/filewriter.hh>
#include <dune/vtk/forward.hh>
#include <dune/vtk/vtkfunction.hh>
......@@ -84,7 +84,7 @@ namespace Dune
*
* \returns File name that is actually written.
**/
virtual std::string write (std::string const& fn, Std::optional<std::string> dir = {}) const override;
virtual std::string write (std::string const& fn, std::optional<std::string> dir = {}) const override;
/// \brief Attach point data to the writer
/**
......@@ -158,7 +158,7 @@ namespace Dune
std::vector<pos_type>& offsets,
VtkFunction const& fct,
PositionTypes type,
Std::optional<std::size_t> timestep = {}) const;
std::optional<std::size_t> timestep = {}) const;
// Write point-data and cell-data in raw/compressed format to output stream
void writeDataAppended (std::ofstream& out, std::vector<std::uint64_t>& blocks) const;
......@@ -168,7 +168,7 @@ namespace Dune
// vector `offsets`.
void writePoints (std::ofstream& out,
std::vector<pos_type>& offsets,
Std::optional<std::size_t> timestep = {}) const;
std::optional<std::size_t> timestep = {}) const;
// Write Appended section and fillin offset values to XML attributes
void writeAppended (std::ofstream& out, std::vector<pos_type> const& offsets) const;
......
......@@ -24,7 +24,7 @@ namespace Dune {
template <class GV, class DC>
std::string VtkWriterInterface<GV,DC>
::write (std::string const& fn, Std::optional<std::string> dir) const
::write (std::string const& fn, std::optional<std::string> dir) const
{
dataCollector_->update();
......@@ -80,7 +80,7 @@ template <class GV, class DC>
void VtkWriterInterface<GV,DC>
::writeData (std::ofstream& out, std::vector<pos_type>& offsets,
VtkFunction const& fct, PositionTypes type,
Std::optional<std::size_t> timestep) const
std::optional<std::size_t> timestep) const
{
out << "<DataArray Name=\"" << fct.name() << "\" type=\"" << to_string(fct.type()) << "\""
<< " NumberOfComponents=\"" << fct.ncomps() << "\" format=\"" << (format_ == Vtk::ASCII ? "ascii\"" : "appended\"");
......@@ -106,7 +106,7 @@ void VtkWriterInterface<GV,DC>
template <class GV, class DC>
void VtkWriterInterface<GV,DC>
::writePoints (std::ofstream& out, std::vector<pos_type>& offsets,
Std::optional<std::size_t> timestep) const
std::optional<std::size_t> timestep) const
{
out << "<DataArray type=\"" << to_string(datatype_) << "\""
<< " NumberOfComponents=\"3\" format=\"" << (format_ == Vtk::ASCII ? "ascii\"" : "appended\"");
......
......@@ -42,7 +42,7 @@ namespace Dune
virtual void writeParallelFile (std::ofstream& out, std::string const& pfilename, int size) const override;
void writeCoordinates (std::ofstream& out, std::vector<pos_type>& offsets,
Std::optional<std::size_t> timestep = {}) const;
std::optional<std::size_t> timestep = {}) const;
template <class T>
std::array<std::uint64_t, 3> writeCoordinatesAppended (std::ofstream& out) const;
......
......@@ -116,7 +116,7 @@ void VtkRectilinearGridWriter<GV,DC>
template <class GV, class DC>
void VtkRectilinearGridWriter<GV,DC>
::writeCoordinates (std::ofstream& out, std::vector<pos_type>& offsets,
Std::optional<std::size_t> timestep) const
std::optional<std::size_t> timestep) const
{
std::string names = "xyz";
if (format_ == Vtk::ASCII) {
......
......@@ -74,11 +74,11 @@ namespace Dune
// vector `offsets`.
void writeCells (std::ofstream& out,
std::vector<pos_type>& offsets,
Std::optional<std::size_t> timestep = {}) const;
std::optional<std::size_t> timestep = {}) const;
void writePointIds (std::ofstream& out,
std::vector<pos_type>& offsets,
Std::optional<std::size_t> timestep = {}) const;
std::optional<std::size_t> timestep = {}) const;
private:
using Super::dataCollector_;
......
......@@ -281,7 +281,7 @@ void VtkUnstructuredGridWriter<GV,DC>
template <class GV, class DC>
void VtkUnstructuredGridWriter<GV,DC>
::writeCells (std::ofstream& out, std::vector<pos_type>& offsets,
Std::optional<std::size_t> timestep) const
std::optional<std::size_t> timestep) const
{
if (format_ == Vtk::ASCII) {
auto cells = dataCollector_->cells();
......@@ -337,7 +337,7 @@ template <class GV, class DC>
void VtkUnstructuredGridWriter<GV,DC>
::writePointIds (std::ofstream& out,
std::vector<pos_type>& offsets,
Std::optional<std::size_t> timestep) const
std::optional<std::size_t> timestep) const
{
auto ids = dataCollector_->pointIds();
if (ids.empty())
......
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