Commit 0bc28af8 authored by Oliver Sander's avatar Oliver Sander

[!45] Cleanup/seed

Merge branch 'cleanup/seed' into 'master'

Fix indent, remove unnecessary friendship with grid implementation, add public
function target returning what the protected getImplementationPointer() member
function returned before.

See merge request [!45]

  [!45]: gitlab.dune-project.org/extensions/dune-foamgrid/merge_requests/45
parents ccf975b8 6b9c7c1c
Pipeline #16194 failed with stage
in 4 minutes and 5 seconds
......@@ -299,7 +299,7 @@ class FoamGrid :
{
const int codim = EntitySeed::codimension;
typedef typename Traits::template Codim<codim>::Entity Entity;
return Entity(FoamGridEntity<codim, dimgrid, const FoamGrid>(seed.impl().getImplementationPointer()));
return Entity(FoamGridEntity<codim, dimgrid, const FoamGrid>(seed.impl().target()));
}
......
......@@ -19,52 +19,45 @@ namespace Dune {
template<int codim, class GridImp>
class FoamGridEntitySeed
{
template<int dimgrid, int dimworld>
friend class FoamGrid;
enum { dimgrid = GridImp::dimension };
enum { dimworld = GridImp::dimensionworld };
enum { mydim = dimgrid-codim };
protected:
// Entity type of the underlying implementation
using EntityImplType = FoamGridEntityImp<mydim, dimgrid, dimworld> ;
enum {dimgrid = GridImp::dimension};
enum {dimworld = GridImp::dimensionworld};
enum {mydim = dimgrid-codim};
public:
// Entity type of the hostgrid
typedef FoamGridEntityImp<mydim, dimgrid, dimworld> EntityImplType;
enum {codimension = codim};
public:
//! default construct an invalid entity seed
FoamGridEntitySeed()
: target_(nullptr)
{}
enum {codimension = codim};
//! construct entity seed from entity
FoamGridEntitySeed(const FoamGridEntity<codim, dimgrid, GridImp>& entity)
: target_(entity.target_)
{}
//! default construct an invalid entity seed
FoamGridEntitySeed() :
target_(nullptr)
{}
FoamGridEntitySeed(const FoamGridEntity<codim, dimgrid, GridImp>* target)
: target_(target)
{}
//! construct entity seed from entity
FoamGridEntitySeed(const FoamGridEntity<codim, dimgrid, GridImp>& entity) :
target_(entity.target_)
{}
/** \brief check whether it is safe to create an Entity from this Seed */
bool isValid() const
{
return target_ != nullptr;
}
FoamGridEntitySeed(const FoamGridEntity<codim, dimgrid, GridImp>* target) :
target_(target)
{}
/** \brief Access to the underlying FoamGrid data structure */
const EntityImplType* target() const
{
return target_;
}
/** \brief check whether it is safe to create an Entity from this Seed */
bool isValid() const
{
return target_ != nullptr;
}
protected:
const EntityImplType* getImplementationPointer() const
{
return target_;
}
private:
const EntityImplType* target_;
private:
const EntityImplType* target_;
};
} // namespace Dune
......
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