9#include <kernel/assembly/asm_traits.hpp> 
   10#include <kernel/geometry/mesh_part.hpp> 
   11#include <kernel/geometry/intern/face_ref_trafo.hpp> 
   12#include <kernel/geometry/intern/congruency_sampler.hpp> 
   13#include <kernel/geometry/intern/congruency_trafo.hpp> 
   14#include <kernel/geometry/intern/index_representative.hpp> 
   15#include <kernel/lafem/dense_vector.hpp> 
   16#include <kernel/lafem/dense_vector_blocked.hpp> 
   27      template<
typename Outer_, 
typename Shape_, 
int cell_dim_>
 
   35        explicit CompIndexMap(
const Outer_& outer, 
int idx) : _outer(outer), _idx(idx) {}
 
   37        Index operator[](
int i)
 const 
   39          return _outer[Geometry::Intern::FaceIndexMapping<Shape_, cell_dim_, 0>::map(_idx,i)];
 
  270        void prepare(
Index facet, 
Index cell_a, 
Index cell_b, 
int local_facet_a, 
int local_facet_b, 
int facet_ori_a, 
int facet_ori_b);
 
  371    template<
typename Trafo_>
 
  375      typedef Trafo_ TrafoType;
 
  376      typedef typename TrafoType::MeshType MeshType;
 
  377      typedef typename TrafoType::ShapeType ShapeType;
 
  379      static constexpr int shape_dim = ShapeType::dimension;
 
  380      static constexpr int facet_dim = shape_dim-1;
 
  399        _facet_mask(trafo.get_mesh().get_num_entities(facet_dim), 0)
 
  418        for(
auto& f : _facets)
 
  442        const auto& trg = mesh_part.template get_target_set<facet_dim>();
 
  443        for(
Index i(0); i < trg.get_num_entities(); ++i)
 
  466          _trafo.get_mesh().template get_index_set<shape_dim, facet_dim>());
 
  485            int loc_face(0), face_ori(0);
 
  487              XABORTM(
"failed to find local facet");
 
  490            _facets.push_back(iface);
 
  492            _cell_facet.push_back(loc_face);
 
  493            _facet_ori.push_back(face_ori);
 
  517          _trafo.get_mesh().template get_index_set<shape_dim, facet_dim>());
 
  523          const int degree = int(elem_at_facet.
degree(iface));
 
  528          if((degree == 1) && !outer)
 
  532          if((degree == 2) && !inner)
 
  541            int loc_face(0), face_ori(0);
 
  543              XABORTM(
"failed to find local facet");
 
  546            _facets.push_back(iface);
 
  548            _cell_facet.push_back(loc_face);
 
  549            _facet_ori.push_back(face_ori);
 
  561      template<
typename Job_>
 
  564        typedef typename Job_::Task TaskType;
 
  569        if(this->_facets.empty())
 
  573        std::unique_ptr<TaskType> task(
new TaskType(job));
 
  580        for(
Index fi(0); fi < 
Index(_facets.size()); ++fi)
 
  583          if constexpr(TaskType::assemble_pairwise)
 
  587            if((fj < 
Index(_facets.size())) && (_facets[fi] == _facets[fj]))
 
  590              task->prepare(_facets[fi], 
_cells[fi], 
_cells[fj], _cell_facet[fi], _cell_facet[fj], _facet_ori[fi], _facet_ori[fj]);
 
  598              task->prepare(_facets[fi], 
_cells[fi], _cell_facet[fi], _facet_ori[fi]);
 
  604            task->prepare(_facets[fi], 
_cells[fi], _cell_facet[fi], _facet_ori[fi]);
 
  611          if(task->need_scatter)
 
  621        if(task->need_combine)
 
  655        static constexpr int num_facets = 
Shape::FaceTraits<ShapeType, shape_dim-1>::count;
 
  658        typedef Geometry::Intern::IndexRepresentative<FacetType> FacetRepr;
 
  660        const auto& vert_at_elem = 
_trafo.get_mesh().template get_index_set<shape_dim, 0>();
 
  661        const auto& vert_at_face = 
_trafo.get_mesh().template get_index_set<facet_dim, 0>();
 
  663        Index face_verts[num_vaf];
 
  664        FacetRepr::compute(face_verts, vert_at_face[face]);
 
  666        for(
int li(0); li < num_facets; ++li)
 
  668          Intern::CompIndexMap<
decltype(vert_at_elem[0]), ShapeType, shape_dim-1> cim(vert_at_elem[cell], li);
 
  669          Index lf_verts[num_vaf];
 
  670          FacetRepr::compute(lf_verts, cim);
 
  672          for(
int k(0); k < num_vaf; ++k)
 
  674            if(lf_verts[k] != face_verts[k])
 
  682            ori = Geometry::Intern::CongruencySampler<FacetType>::compare(vert_at_face[face], cim);
 
#define XABORTM(msg)
Abortion macro definition with custom message.
#define ASSERTM(expr, msg)
Debug-Assertion macro definition with custom message.
#define XASSERT(expr)
Assertion macro definition.
Adjacency Graph implementation.
ImageIterator image_begin(Index domain_node) const
Returns an iterator for the first adjacent image node.
ImageIterator image_end(Index domain_node) const
Returns an iterator for the first position past the last adjacent image node.
Index degree(Index domain_node) const
Returns the degree of a domain node.
Trace Integral Assembler class template.
void assemble(Job_ &job)
Executes a trace assembly job.
void add_mesh_part(const Geometry::MeshPart< MeshType > &mesh_part)
Adds all facets of a mesh part to the assembler.
bool _find_local_facet(Index face, Index cell, int &facet, int &ori)
Helper function: tries to find the local facet index for a given facet/cell pair.
std::vector< Index > _cells
the indices of all cells and facets to loop over during assembly
void compile_all_facets(bool inner, bool outer)
Compiles the assembler for all inner and/our outer facets of the underlying mesh.
void add_facet(Index ifacet)
Adds a single facet to the assembler.
TraceAssembler(const TrafoType &trafo)
Constructor.
std::vector< int > _facet_mask
the facet masks, local cell facet indices and facet orientation codes
const TrafoType & get_trafo() const
const TrafoType & _trafo
a reference to the trafo
void compile()
Compiles the assembler for all facets that have been added manually.
void clear()
Clears the assembler.
Trace assembly task class.
Task(TraceAssemblyJob &job)
Mandatory Constructor.
void prepare(Index facet, Index cell_a, Index cell_b, int local_facet_a, int local_facet_b, int facet_ori_a, int facet_ori_b)
Prepares the task for assembly for a facet on both of its adjacent elements.
static constexpr bool need_combine
Specifies whether this task fas a combine() function, which is required to be called from within a cr...
void prepare(Index facet, Index cell, int local_facet, int facet_ori)
Prepares the task for assembly for a facet on a single one of its adjacent elements.
static constexpr bool assemble_pairwise
Specifies whether this task assembles element pairs on inner facets simultaenously.
void assemble()
Performs the local assembly on the current facet.
void scatter()
Scatters the local assembly into the global system.
static constexpr bool need_scatter
Specifies whether this task has a scatter() function, which is required to be called from within a cr...
void combine()
Finishes the overall assembly and combines all local results.
void finish()
Finishes the task on the current cell.
Interface description of a trace assembly job.
Class template for partial meshes.
@ injectify_transpose
Render-Injectified-Transpose mode.
std::uint64_t Index
Index data type.
Face traits tag struct template.