Commit 245d9d94 authored by Praetorius, Simon's avatar Praetorius, Simon

change return-type of make functions from shared_ptr to unique_ptr

parent e034a097
Pipeline #1442 passed with stage
in 19 minutes and 28 seconds
......@@ -123,13 +123,18 @@ namespace AMDiS
Dune::VTK::OutputType mode_;
};
template <class GlobalBasis, class ValueType, class TreePath>
auto makeFileWriter(std::string const& name,
DiscreteFunction<GlobalBasis,ValueType,TreePath> const& discreteFct)
{
return FileWriter<GlobalBasis,ValueType,TreePath>{name, discreteFct};
}
template <class GlobalBasis, class ValueType, class TreePath>
std::shared_ptr<FileWriter<GlobalBasis,ValueType,TreePath>>
makeFileWriterPtr(std::string const& name,
auto makeFileWriterPtr(std::string const& name,
DiscreteFunction<GlobalBasis,ValueType,TreePath> const& discreteFct)
{
return std::make_shared<FileWriter<GlobalBasis,ValueType,TreePath>>(name, discreteFct);
return std::make_unique<FileWriter<GlobalBasis,ValueType,TreePath>>(name, discreteFct);
}
} // end namespace AMDiS
......@@ -149,13 +149,13 @@ namespace AMDiS
std::enable_if_t<not Traits::IsReferenceWrapper<Operator>::value, int> = 0>
auto makeLocalAssemblerPtr(Operator const& op, Nodes const&...)
{
return std::make_shared<LocalAssembler<LocalContext, Operator, Nodes...>>(op);
return std::make_unique<LocalAssembler<LocalContext, Operator, Nodes...>>(op);
}
template <class LocalContext, class Operator, class... Nodes>
auto makeLocalAssemblerPtr(std::reference_wrapper<Operator> const& op, Nodes const&...)
{
return std::make_shared<LocalAssembler<LocalContext, Operator, Nodes...>>(op);
return std::make_unique<LocalAssembler<LocalContext, Operator, Nodes...>>(op);
}
} // end namespace AMDiS
......@@ -200,7 +200,7 @@ namespace AMDiS
template <class Derived, class LocalContext, class GridView>
auto makeLocalOperatorPtr(LocalOperator<Derived, LocalContext> const& localOp, GridView const& /*gridView*/)
{
return std::make_shared<Derived>(localOp.derived());
return std::make_unique<Derived>(localOp.derived());
}
} // end namespace AMDiS
......@@ -258,8 +258,8 @@ addDirichletBC(Predicate const& predicate, RowTreePath row, ColTreePath col, Val
using Range = RangeType_t<decltype(i)>;
using BcType = DirichletBC<WorldVector,Range>;
auto bc = std::make_shared<BcType>(predicate, valueGridFct);
constraints_[i][j].push_back(bc);
auto bc = std::make_unique<BcType>(predicate, valueGridFct);
constraints_[i][j].push_back(std::move(bc));
// TODO: make DirichletBC an abstract class and add specialization with gridfunction type
}
......
......@@ -85,7 +85,7 @@ namespace AMDiS
auto makeQuadratureFactoryPtr(PreQuadFactoryFromLocalFunction const& /*pre*/)
{
using Factory = QuadFactoryFromLocalFunction<ctype, dimension, LocalFunction>;
return std::shared_ptr<Factory>(new Factory{});
return std::make_unique<Factory>();
}
......@@ -141,7 +141,7 @@ namespace AMDiS
auto makeQuadratureFactoryPtr(PreQuadFactoryFromOrder const& pre)
{
using Factory = QuadFactoryFromOrder<ctype, dimension, LocalFunction>;
return std::make_shared<Factory>(pre.order, pre.qt);
return std::make_unique<Factory>(pre.order, pre.qt);
}
......@@ -191,7 +191,7 @@ namespace AMDiS
auto makeQuadratureFactoryPtr(PreQuadFactoryFromRule<QuadRule> const& pre)
{
using Factory = QuadFactoryFromRule<ctype, dimension, LocalFunction>;
return std::make_shared<Factory>(pre.rule);
return std::make_unique<Factory>(pre.rule);
}
} // end namespace AMDiS
......@@ -62,7 +62,7 @@ addOperator(ContextTag contextTag, Operator const& preOp,
auto op = makeLocalOperator<Context>(preOp, rowBasis_->gridView());
auto localAssembler = makeLocalAssemblerPtr<Context>(std::move(op), i, j);
operators_[i][j].push(contextTag, localAssembler);
operators_[i][j].push(contextTag, std::move(localAssembler));
}
......
......@@ -53,7 +53,7 @@ addOperator(ContextTag contextTag, Operator const& preOp, TreePath path)
auto op = makeLocalOperator<Context>(preOp, basis_->gridView());
auto localAssembler = makeLocalAssemblerPtr<Context>(std::move(op), i);
operators_[i].push(contextTag, localAssembler);
operators_[i].push(contextTag, std::move(localAssembler));
}
......
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