Skip to content
Snippets Groups Projects
Commit f36fedee authored by Timo Koch's avatar Timo Koch
Browse files

[1d][facet] Make facet feel more like vertex

Instead of storing a nullptr and document undefined behaviour we
can actually store a this pointer and have perfectly defined behaviour.
parent 4a2cadc0
No related branches found
No related tags found
1 merge request!60[1d][facet] Make facet feel more like vertex
Pipeline #19451 passed
......@@ -54,7 +54,8 @@ namespace Dune {
public:
FoamGridEntityImp(int level, const FieldVector<double, dimworld>& pos, unsigned int id)
: FoamGridEntityBase(level, id), pos_(pos), nSons_(0), elements_(), father_(nullptr), isNew_(false)
: FoamGridEntityBase(level, id), pos_(pos), nSons_(0)
, elements_(), vertex_{{this}}, father_(nullptr), isNew_(false)
, growthInsertionIndex_(-1)
{
sons_[0] = nullptr;
......@@ -122,8 +123,8 @@ namespace Dune {
//! Elements the vertex is related to
std::vector<const FoamGridEntityImp<dimgrid, dimgrid ,dimworld>*> elements_;
//! A vertex array for compatibility reasons with edges. Calling results in undefined behaviour.
std::array<const FoamGridEntityImp<0, dimgrid ,dimworld>*, 1> vertex_ = {{ nullptr }};
//! A vertex array for compatibility reasons with edges. Initialized with the this pointer.
std::array<const FoamGridEntityImp<0, dimgrid ,dimworld>*, 1> vertex_;
//! Boundary index if vertex is on boundary
// only used if the vertex is a boundary vertex
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment