Commit 6fee6491 authored by Janick Gerstenberger's avatar Janick Gerstenberger

[interfacegrid] move `mixedcellmapper.hh` into the interfacegrid files

parent 22bc9d0f
......@@ -17,7 +17,6 @@ set(HEADERS
eoc.hh
evolution.hh
flagging.hh
mixedcellmapper.hh
reconstruction.hh
utility.hh
velocity.hh
......
set(HEADERS
capabilities.hh
datahandle.hh
dataset.hh
declaration.hh
entity.hh
entityseed.hh
......@@ -13,6 +14,7 @@ set(HEADERS
intersection.hh
intersectioniterator.hh
iterator.hh
mixedcellmapper.hh
persistentcontainer.hh
)
......
......@@ -7,15 +7,18 @@
#include <utility>
#include <vector>
#include <dune/common/rangeutilities.hh>
#include <dune/geometry/dimension.hh>
#include <dune/vof/colorfunction.hh>
#include <dune/vof/flagset.hh>
#include <dune/vof/dataset/flag.hh>
#include <dune/vof/dataset/reconstruction.hh>
#include <dune/vof/flagging.hh>
#include <dune/vof/geometry/intersect.hh>
#include <dune/vof/geometry/polytope.hh>
#include <dune/vof/interfacegrid/geometry.hh>
#include <dune/vof/mixedcellmapper.hh>
#include <dune/vof/reconstructionset.hh>
#include <dune/vof/utility.hh>
#include <dune/vof/interfacegrid/mixedcellmapper.hh>
namespace Dune
{
......@@ -40,7 +43,7 @@ namespace Dune
typedef typename GridView::template Codim< 0 >::Entity Element;
typedef typename ReconstructionSet::DataType::Coordinate GlobalCoordinate;
typedef typename ReconstructionSet::DataType::value_type::Coordinate GlobalCoordinate;
template< class ColorFunction, class... Args >
explicit BasicInterfaceGridDataSet ( const ColorFunction &colorFunction, Args &&... args )
......@@ -65,7 +68,11 @@ namespace Dune
reconstruction_( colorFunction, reconstructionSet_, flags_ );
}
const GlobalCoordinate &normal ( const Element &element ) const { return reconstructionSet()[ element ].innerNormal(); }
const GlobalCoordinate &normal ( const Element &element ) const
{
assert( reconstructionSet()[ element ] );
return reconstructionSet()[ element ]->innerNormal();
}
protected:
Reconstruction reconstruction_;
......@@ -91,6 +98,8 @@ namespace Dune
using Base::reconstructionSet;
using Base::normal;
typedef typename Base::ReconstructionSet ReconstructionSet;
typedef typename Base::Element Element;
typedef typename Base::GridView GridView;
typedef typename Base::GlobalCoordinate GlobalCoordinate;
......@@ -108,7 +117,7 @@ namespace Dune
explicit InterfaceGridDataSet ( const ColorFunction &colorFunction, Args &&... args )
: Base( colorFunction, std::forward< Args >( args )... ), indices_( flags() )
{
getInterfaceVertices( reconstructionSet(), flags(), vertices_, offsets_ );
getInterfaceVertices( reconstructionSet(), vertices_, offsets_ );
}
template< class ColorFunction >
......@@ -116,7 +125,7 @@ namespace Dune
{
Base::update( colorFunction );
indices_.update( flags() );
getInterfaceVertices( reconstructionSet(), flags(), vertices_, offsets_ );
getInterfaceVertices( reconstructionSet(), vertices_, offsets_ );
}
void covariantOuterNormal ( const Element &element, std::size_t i, FieldVector< ctype, 2 > &n ) const
......@@ -165,6 +174,30 @@ namespace Dune
const Offsets &offsets () const { return offsets_; }
private:
static inline void getInterfaceVertices (const ReconstructionSet& reconstructions, Vertices& vertices, Offsets& offsets)
{
vertices.clear();
offsets.clear();
std::size_t offset = 0;
offsets.push_back(offset);
for (const auto &entity : elements(reconstructions.gridView()))
{
auto segment = intersect(makePolytope(entity.geometry()), boundary(reconstructions[entity]));
if (!segment)
continue;
auto size = segment->size();
offset += size;
offsets.push_back(offset);
for (auto i : range(size))
vertices.push_back(segment->vertex(i));
}
}
Indices indices_;
Vertices vertices_;
Offsets offsets_;
......
#ifndef DUNE_VOF_MIXEDCELLMAPPER_HH
#define DUNE_VOF_MIXEDCELLMAPPER_HH
#ifndef DUNE_VOF_INTERFACEGRID_MIXEDCELLMAPPER_HH
#define DUNE_VOF_INTERFACEGRID_MIXEDCELLMAPPER_HH
#include <cassert>
#include <cstddef>
......@@ -10,7 +10,7 @@
#include <dune/grid/common/mcmgmapper.hh>
#include <dune/grid/common/partitionset.hh>
#include <dune/vof/flagset.hh>
#include <dune/vof/dataset/flag.hh>
namespace Dune
......@@ -97,4 +97,4 @@ namespace Dune
} // namespace Dune
#endif // #ifndef DUNE_VOF_MIXEDCELLMAPPER_HH
#endif // #ifndef DUNE_VOF_INTERFACEGRID_MIXEDCELLMAPPER_HH
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