Commit 7bdce8e0 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

changed shared_ptr to unique_ptr for creators

parent d7a4c589
Pipeline #1316 passed with stage
in 19 minutes and 58 seconds
......@@ -78,7 +78,7 @@ namespace AMDiS
explicit AdaptInfo(std::string name);
/// Destructor.
virtual ~AdaptInfo() {}
virtual ~AdaptInfo() = default;
/// Resets all variables to zero (or something equivalent)
void reset();
......
......@@ -24,13 +24,13 @@ namespace AMDiS
class CreatorInterface
{
public:
virtual ~CreatorInterface() {}
virtual ~CreatorInterface() = default;
/** \brief
* Must be implemented by sub classes of CreatorInterface.
* Creates a new instance of the sub class of BaseClass.
*/
virtual std::shared_ptr<BaseClass> create() = 0;
virtual std::unique_ptr<BaseClass> create() = 0;
};
/**
......@@ -45,7 +45,7 @@ namespace AMDiS
{
public:
virtual std::shared_ptr<BaseClass> create() final
virtual std::unique_ptr<BaseClass> create() final
{
error_exit("Should not be called. Call create(string) instead!");
return {};
......@@ -56,7 +56,7 @@ namespace AMDiS
* Creates a new instance of the sub class of BaseClass by passing a
* string to the constructor.
*/
virtual std::shared_ptr<BaseClass> create(std::string) = 0;
virtual std::unique_ptr<BaseClass> create(std::string) = 0;
};
......
......@@ -33,7 +33,7 @@ namespace AMDiS
public:
/// Virtual destructor
virtual ~LocalAssemblerBase() {}
virtual ~LocalAssemblerBase() = default;
/// Bind the local-assembler to the grid-element with its corresponding geometry
virtual void bind(Element const& element, Geometry const& geometry) = 0;
......
......@@ -17,7 +17,7 @@ namespace AMDiS
using QuadratureRule = Dune::QuadratureRule<ctype, dimension>;
public:
virtual ~QuadratureFactory() {}
virtual ~QuadratureFactory() = default;
/// Bind the rule to a localFunction
virtual void bind(LocalFunction const& localFct)
......
......@@ -24,7 +24,7 @@ namespace AMDiS
Parameters::get(base + "->name", name_);
}
virtual ~FileWriterInterface() {}
virtual ~FileWriterInterface() = default;
// pure virtual method to be implemented by derived classes
......
......@@ -32,9 +32,9 @@ namespace AMDiS
/// A creator to be used instead of the constructor.
struct Creator : CreatorInterfaceName<Super>
{
virtual std::shared_ptr<Super> create(std::string prefix) override
virtual std::unique_ptr<Super> create(std::string prefix) override
{
return std::make_shared<Self>(prefix);
return std::make_unique<Self>(prefix);
}
};
......
......@@ -30,7 +30,7 @@ namespace AMDiS
using SolverBase = LinearSolverInterface<Matrix, VectorX, VectorB>;
using Scalar = typename Matrix::Scalar;
virtual std::shared_ptr<SolverBase> create(std::string prefix) override
virtual std::unique_ptr<SolverBase> create(std::string prefix) override
{
// get creator string for preconditioner
std::string precon = "no";
......@@ -62,7 +62,7 @@ namespace AMDiS
using IncompleteCholesky =
SolverCreator<Eigen::IncompleteCholesky<Scalar, Eigen::Lower|Eigen::Upper, Ordering>>;
std::shared_ptr<SolverBase> createIncompleteCholesky(std::string const& prefix) const
std::unqiue_ptr<SolverBase> createIncompleteCholesky(std::string const& prefix) const
{
std::string ordering = "amd";
Parameters::get(prefix + "->precon->ordering", ordering);
......
......@@ -30,9 +30,9 @@ namespace AMDiS
struct Creator : CreatorInterfaceName<Super>
{
virtual std::shared_ptr<Super> create(std::string prefix) override
virtual std::unique_ptr<Super> create(std::string prefix) override
{
return std::make_shared<Self>(prefix);
return std::make_unique<Self>(prefix);
}
};
......
......@@ -20,9 +20,9 @@ namespace AMDiS
/// A creator to be used instead of the constructor.
struct Creator : CreatorInterface<Super>
{
virtual std::shared_ptr<Super> create() override
virtual std::unique_ptr<Super> create() override
{
return std::make_shared<Self>();
return std::make_unique<Self>();
}
};
......
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