9#include "FunctionSpace.h" 
   13#include <dolfinx/common/IndexMap.h> 
   14#include <dolfinx/common/types.h> 
   15#include <dolfinx/mesh/Mesh.h> 
   26template <dolfinx::scalar T>
 
   28template <dolfinx::scalar T, std::
floating_po
int U>
 
   64          std::floating_point U = dolfinx::scalar_value_type_t<T>>
 
   89                      std::vector<std::tuple<
 
   91                          std::function<
void(T*, 
const T*, 
const T*,
 
   92                                             const scalar_value_type_t<T>*,
 
   93                                             const int*, 
const std::uint8_t*)>,
 
   94                          std::vector<std::int32_t>>>>& integrals,
 
  103    if (!_mesh and !V.empty())
 
  104      _mesh = V[0]->mesh();
 
  105    for (
auto& space : V)
 
  107      if (_mesh != space->mesh())
 
  108        throw std::runtime_error(
"Incompatible mesh");
 
  111      throw std::runtime_error(
"No mesh could be associated with the Form.");
 
  114    for (
auto& [type, kernels] : integrals)
 
  116      auto& integrals = _integrals[
static_cast<std::size_t
>(type)];
 
  117      for (
auto& [
id, kern, e] : kernels)
 
  118        integrals.insert({
id, {kern, std::vector(e.begin(), e.end())}});
 
 
  134  int rank()
 const { 
return _function_spaces.size(); }
 
  138  std::shared_ptr<const mesh::Mesh<U>> 
mesh()
 const { 
return _mesh; }
 
  142  const std::vector<std::shared_ptr<const FunctionSpace<U>>>&
 
  145    return _function_spaces;
 
 
  153  std::function<void(T*, 
const T*, 
const T*, 
const scalar_value_type_t<T>*,
 
  154                     const int*, 
const std::uint8_t*)>
 
  157    auto integrals = _integrals[
static_cast<std::size_t
>(type)];
 
  158    if (
auto it = integrals.find(i); it != integrals.end())
 
  159      return it->second.first;
 
  161      throw std::runtime_error(
"No kernel for requested domain index.");
 
 
  168    std::set<IntegralType> set;
 
  169    for (std::size_t i = 0; i < _integrals.size(); ++i)
 
  171      if (!_integrals[i].empty())
 
 
  183    return _integrals[
static_cast<std::size_t
>(type)].size();
 
 
  194    std::vector<int> ids;
 
  195    auto& integrals = _integrals[
static_cast<std::size_t
>(type)];
 
  196    std::transform(integrals.begin(), integrals.end(), std::back_inserter(ids),
 
  197                   [](
auto& integral) { return integral.first; });
 
 
  220    auto& integral = _integrals[
static_cast<std::size_t
>(type)];
 
  221    if (
auto it = integral.find(i); it != integral.end())
 
  222      return it->second.second;
 
  224      throw std::runtime_error(
"No mesh entities for requested domain index.");
 
 
  228  const std::vector<std::shared_ptr<const Function<T, U>>>& 
coefficients()
 const 
  230    return _coefficients;
 
 
  243    std::vector<int> n = {0};
 
  244    for (
auto& c : _coefficients)
 
  247        throw std::runtime_error(
"Not all form coefficients have been set.");
 
  248      n.push_back(n.back() + c->function_space()->element()->space_dimension());
 
 
  254  const std::vector<std::shared_ptr<const Constant<T>>>& 
constants()
 const 
 
  260  using kern = std::function<void(T*, 
const T*, 
const T*,
 
  261                                  const scalar_value_type_t<T>*, 
const int*,
 
  262                                  const std::uint8_t*)>;
 
  265  std::vector<std::shared_ptr<const FunctionSpace<U>>> _function_spaces;
 
  268  std::vector<std::shared_ptr<const Function<T, U>>> _coefficients;
 
  271  std::vector<std::shared_ptr<const Constant<T>>> _constants;
 
  274  std::shared_ptr<const mesh::Mesh<U>> _mesh;
 
  278  std::array<std::map<int, std::pair<kern, std::vector<std::int32_t>>>, 4>
 
  282  bool _needs_facet_permutations;
 
 
Constant value which can be attached to a Form.
Definition Constant.h:23
 
This class represents a finite element function space defined by a mesh, a finite element,...
Definition FunctionSpace.h:35
 
This class represents a function  in a finite element function space , given by.
Definition Function.h:45
 
A Mesh consists of a set of connected and numbered mesh topological entities, and geometry data.
Definition Mesh.h:23
 
This concept is used to constrain the a template type to floating point real or complex types....
Definition types.h:20
 
Finite element method functionality.
Definition assemble_matrix_impl.h:25
 
IntegralType
Type of integral.
Definition Form.h:33
 
@ interior_facet
Interior facet.
 
@ exterior_facet
Exterior facet.