Commit a9c31c92 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1443 I had to make Node constructor public due to weak_ptr issue.

parent c27e1175
......@@ -104,6 +104,8 @@ namespace MoReFEM
decltype(auto) program_wise_index_per_numbering_subset =
dof.GetProgramWiseIndexPerNumberingSubset();
std::cout << "SIZE ======== " << program_wise_index_per_numbering_subset.size() << std::endl;
const auto it = std::find_if(program_wise_index_per_numbering_subset.cbegin(),
program_wise_index_per_numbering_subset.cend(),
[numbering_subset_id](const auto& pair)
......
......@@ -68,7 +68,7 @@ namespace MoReFEM
//! Friendship to \a NodeBearer (the only class allowed to create \a Node object).
friend class NodeBearer;
private:
public:
/// \name Special members.
///@{
......@@ -76,7 +76,9 @@ namespace MoReFEM
/*!
* \brief Constructor.
*
* It is private as it shoud be called only by \a NodeBearer.
* \attention I had to make it public as std::make_shared doesn't propagate friendship and weak_ptr construction requires to build it directly as
* a smart pointer (rather than converting after the fact a raw one) but for all intents and purposes this constructor should be viewed as private:
* creating \a Node objects is something only \a NodeBearer class is allowed to do.
*
* \param[in] extended_unknown Unknown addressed by all the dofs in the Node
* (e.g. 'displacement', 'pressure'). It is here an extended unknown because when it is created it is
......@@ -87,13 +89,9 @@ namespace MoReFEM
explicit Node(const std::shared_ptr<const NodeBearer>& node_bearer_ptr,
const ExtendedUnknown& extended_unknown);
public:
//! Destructor.
~Node() = default;
private:
//! \copydoc doxygen_hide_copy_constructor
Node(const Node& rhs) = delete;
......
......@@ -60,14 +60,12 @@ namespace MoReFEM
{
assert(Ndof > 0);
auto node_ptr = new Node(shared_from_this(), extended_unknown);
auto node_ptr = std::make_shared<Node>(shared_from_this(), extended_unknown);
node_ptr->Init(Ndof);
auto shared_ptr = std::shared_ptr<Node>(node_ptr);
node_list_.push_back(shared_ptr);
node_list_.push_back(node_ptr);
return shared_ptr;
return node_ptr;
}
......
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