9#include <kernel/shape.hpp> 
   10#include <kernel/geometry/attribute_set.hpp> 
   11#include <kernel/geometry/intern/standard_refinement_traits.hpp> 
   23      struct StandardAttribRefiner;
 
   30      template<
typename AttribSet_>
 
   31      struct StandardAttribRefiner<Shape::Vertex, AttribSet_>
 
   33        typedef AttribSet_ AttribSetType;
 
   37          AttribSetType& attrib_set_out,
 
   38          const AttribSetType& attrib_set_in)
 
   40          XASSERT(attrib_set_out.get_dimension() == attrib_set_in.get_dimension());
 
   43          const Index num_values = attrib_set_in.get_num_values();
 
   44          const int dim_attrib = attrib_set_in.get_dimension();
 
   46          XASSERT(attrib_set_out.get_num_values() >= offset + num_values);
 
   49          FEAT_PRAGMA_OMP(parallel 
for)
 
   50          for(Index i = 0; i < num_values; ++i)
 
   52            for(
int j(0); j < dim_attrib; ++j)
 
   54              attrib_set_out(offset+i, j) = attrib_set_in(i, j);
 
   68      template<
int cell_dim_, 
typename AttribSet_>
 
   69      struct StandardAttribRefiner<Shape::Hypercube<cell_dim_>, AttribSet_>
 
   71        typedef Shape::Hypercube<cell_dim_> ShapeType;
 
   72        typedef IndexSet<Shape::FaceTraits<ShapeType, 0>::count> IndexSetType;
 
   73        typedef AttribSet_ AttribSetType;
 
   77          AttribSetType& attrib_set_out,
 
   78          const AttribSetType& attrib_set_in,
 
   79          const IndexSetType& index_set_in)
 
   82          XASSERT(attrib_set_out.get_dimension() == attrib_set_in.get_dimension());
 
   84          typedef typename AttribSetType::DataType DataType;
 
   87          static const DataType scale = DataType(1) / DataType(IndexSetType::num_indices);
 
   90          const Index num_cells = index_set_in.get_num_entities();
 
   91          const int dim_attrib = attrib_set_in.get_dimension();
 
   93          XASSERT(attrib_set_out.get_num_values() >= offset + num_cells);
 
   96          FEAT_PRAGMA_OMP(parallel 
for)
 
   97          for(Index i = 0; i < num_cells; ++i)
 
  100            const auto& idx_in = index_set_in[i];
 
  103            for(
int j(0); j < dim_attrib; ++j)
 
  104              attrib_set_out(offset+i, j) = DataType(0);
 
  107            for(
int k(0); k < IndexSetType::num_indices; ++k)
 
  109              for(
int j(0); j < dim_attrib; ++j)
 
  110                attrib_set_out(offset+i, j) += attrib_set_in(idx_in[k], j);
 
  114            for(
int j(0); j < dim_attrib; ++j)
 
  115              attrib_set_out(offset+i, j) *= scale;
 
  128      template<
int cell_dim_, 
typename AttribSet_>
 
  129      struct StandardAttribRefiner<Shape::Simplex<cell_dim_>, AttribSet_>
 
  131        typedef Shape::Simplex<cell_dim_> ShapeType;
 
  132        typedef IndexSet<Shape::FaceTraits<ShapeType, 0>::count> IndexSetType;
 
  133        typedef AttribSet_ AttribSetType;
 
  137          AttribSetType& attrib_set_out,
 
  138          const AttribSetType& attrib_set_in,
 
  139          const IndexSetType& index_set_in)
 
  142          XASSERT(attrib_set_out.get_dimension() == attrib_set_in.get_dimension());
 
  144          typedef typename AttribSetType::DataType DataType;
 
  147          static const DataType scale = DataType(1) / DataType(IndexSetType::num_indices);
 
  150          const Index num_cells = index_set_in.get_num_entities();
 
  151          const int dim_attrib = attrib_set_in.get_dimension();
 
  153          XASSERT(attrib_set_out.get_num_values() >= offset + num_cells);
 
  156          FEAT_PRAGMA_OMP(parallel 
for)
 
  157          for(Index i = 0; i < num_cells; ++i)
 
  160            const auto& idx_in = index_set_in[i];
 
  163            for(
int j(0); j < dim_attrib; ++j)
 
  164              attrib_set_out(offset+i, j) = DataType(0);
 
  167            for(
int k(0); k < IndexSetType::num_indices; ++k)
 
  169              for(
int j(0); j < dim_attrib; ++j)
 
  170                attrib_set_out(offset+i, j) += attrib_set_in(idx_in[k], j);
 
  174            for(
int j(0); j < dim_attrib; ++j)
 
  175              attrib_set_out(offset+i, j) *= scale;
 
  188      template<
typename AttribSet_>
 
  189      struct StandardAttribRefiner<Shape::Simplex<2>, AttribSet_>
 
  191        typedef Shape::Simplex<2> ShapeType;
 
  192        typedef IndexSet<Shape::FaceTraits<ShapeType, 0>::count> IndexSetType;
 
  193        typedef AttribSet_ AttribSetType;
 
  198          const AttribSetType& ,
 
  199          const IndexSetType& )
 
  214      struct StandardAttribRefineWrapper
 
  216        typedef AttribSet_ AttribSetType;
 
  217        typedef IndexSetHolder<Shape_> IndexSetHolderType;
 
  218        typedef IndexSet<Shape::FaceTraits<Shape_, 0>::count> IndexSetType;
 
  221          AttribSetType& attrib_set_out,
 
  222          const AttribSetType& attrib_set_in,
 
  223          const IndexSetHolderType& index_set_holder_in)
 
  225          typedef typename Shape::FaceTraits<Shape_, Shape_::dimension-1>::ShapeType FacetType;
 
  228          Index offset = StandardAttribRefineWrapper<FacetType, AttribSet_>
 
  229            ::refine(attrib_set_out, attrib_set_in, index_set_holder_in);
 
  232          const IndexSetType& index_set_in = index_set_holder_in.
 
  233            template get_index_set_wrapper<Shape_::dimension>().template get_index_set<0>();
 
  236          Index num_values = StandardAttribRefiner<Shape_, AttribSet_>
 
  237            ::refine(offset, attrib_set_out, attrib_set_in, index_set_in);
 
  240          XASSERTM(num_values == (StandardRefinementTraits<Shape_, 0>::count * index_set_in.get_num_entities()),
 
  241            "AttribRefiner output does not match StdRefTraits prediction");
 
  244          return offset + num_values;
 
  248      template<
typename AttribSet_>
 
  249      struct StandardAttribRefineWrapper<Shape::Vertex, AttribSet_>
 
  251        typedef AttribSet_ AttribSetType;
 
  252        typedef IndexSetHolder<Shape::Vertex> IndexSetHolderType;
 
  255          AttribSetType& attrib_set_out,
 
  256          const AttribSetType& attrib_set_in,
 
  257          const IndexSetHolderType& )
 
  260          Index num_values =  StandardAttribRefiner<Shape::Vertex,AttribSet_>
 
  261            ::refine(0, attrib_set_out, attrib_set_in);
 
  264          XASSERTM(num_values == (StandardRefinementTraits<Shape::Vertex, 0>::count * attrib_set_in.get_num_values()),
 
  265            "AttribRefiner output does not match StdRefTraits prediction");
 
#define XASSERT(expr)
Assertion macro definition.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
std::uint64_t Index
Index data type.