libMesh
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides Struct Reference

#include <generic_projector.h>

Inheritance diagram for libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides:
[legend]

Public Member Functions

 ProjectSides (GenericProjector &p)
 
 ProjectSides (ProjectSides &p_s, Threads::split)
 
void operator() (const node_range &range)
 
template<typename InsertInput , typename std::enable_if< std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type = 0>
void insert_id (dof_id_type id, const InsertInput &val, processor_id_type pid)
 
template<typename InsertInput , typename std::enable_if< !std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type = 0>
void insert_id (dof_id_type id, const InsertInput &val, processor_id_type pid)
 
template<typename InsertInput , typename std::enable_if< std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type = 0>
void insert_ids (const std::vector< dof_id_type > &ids, const std::vector< InsertInput > &vals, processor_id_type pid)
 
template<typename InsertInput , typename std::enable_if< !std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type = 0>
void insert_ids (const std::vector< dof_id_type > &ids, const std::vector< InsertInput > &vals, processor_id_type pid)
 
template<typename InsertInput , typename std::enable_if< std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type = 0>
void insert_id (dof_id_type id, const InsertInput &val, processor_id_type pid)
 
template<typename InsertInput , typename std::enable_if< std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type = 0>
void insert_ids (const std::vector< dof_id_type > &ids, const std::vector< InsertInput > &vals, processor_id_type pid)
 
void find_dofs_to_send (const Node &node, const Elem &elem, unsigned short node_num, const var_set &vars)
 
void join (const SubFunctor &other)
 

Public Attributes

ProjectionAction action
 
FFunctor f
 
std::unique_ptr< GFunctor > g
 
const Systemsystem
 
FEMContext context
 
std::vector< FEContinuityconts
 
std::vector< FEFieldTypefield_types
 
GenericProjectorprojector
 
std::unordered_map< dof_id_type, std::pair< typename FFunctor::ValuePushType, processor_id_type > > new_ids_to_push
 
std::unordered_map< dof_id_type, typename FFunctor::ValuePushType > new_ids_to_save
 

Protected Member Functions

void construct_projection (const std::vector< dof_id_type > &dof_indices_var, const std::vector< unsigned int > &involved_dofs, unsigned int var_component, const Node *node, const FEGenericBase< typename FFunctor::RealType > &fe)
 

Detailed Description

template<typename FFunctor, typename GFunctor, typename FValue, typename ProjectionAction>
struct libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides

Definition at line 346 of file generic_projector.h.

Constructor & Destructor Documentation

◆ ProjectSides() [1/2]

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides::ProjectSides ( GenericProjector p)
inline

Definition at line 347 of file generic_projector.h.

347 : SubProjector(p) {}

◆ ProjectSides() [2/2]

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides::ProjectSides ( ProjectSides p_s,
Threads::split   
)
inline

Definition at line 349 of file generic_projector.h.

349 : SubProjector(p_s.projector) {}

Member Function Documentation

◆ construct_projection()

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
void libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubProjector::construct_projection ( const std::vector< dof_id_type > &  dof_indices_var,
const std::vector< unsigned int > &  involved_dofs,
unsigned int  var_component,
const Node node,
const FEGenericBase< typename FFunctor::RealType > &  fe 
)
protectedinherited

Definition at line 2998 of file generic_projector.h.

References libMesh::C_ONE, libMesh::DenseMatrix< T >::cholesky_solve(), libMesh::FEAbstract::get_continuity(), libMesh::FEGenericBase< OutputType >::get_dphi(), libMesh::FEAbstract::get_JxW(), libMesh::FEGenericBase< OutputType >::get_phi(), libMesh::DenseVector< T >::get_values(), libMesh::FEAbstract::get_xyz(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ids_to_save, libMesh::TensorTools::inner_product(), libMesh::DofObject::invalid_processor_id, libMesh::make_range(), libMesh::DofObject::processor_id(), libMesh::DenseVector< T >::size(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::system, and libMesh::System::time.

3003 {
3004  const auto & JxW = fe.get_JxW();
3005  const auto & phi = fe.get_phi();
3006  const std::vector<std::vector<typename FEGenericBase<typename FFunctor::RealType>::OutputGradient>> * dphi = nullptr;
3007  const std::vector<Point> & xyz_values = fe.get_xyz();
3008  const FEContinuity cont = fe.get_continuity();
3009  const std::unordered_map<dof_id_type, typename FFunctor::ValuePushType> & ids_to_save =
3010  this->projector.ids_to_save;
3011 
3012  if (cont == C_ONE)
3013  dphi = &(fe.get_dphi());
3014 
3015  const unsigned int n_involved_dofs =
3016  cast_int<unsigned int>(involved_dofs.size());
3017 
3018  std::vector<dof_id_type> free_dof_ids;
3019  DenseVector<typename FFunctor::ValuePushType> Uinvolved(n_involved_dofs);
3020  std::vector<char> dof_is_fixed(n_involved_dofs, false); // bools
3021 
3022  for (auto i : make_range(n_involved_dofs))
3023  {
3024  const dof_id_type id = dof_indices_var[involved_dofs[i]];
3025  auto iter = ids_to_save.find(id);
3026  if (iter == ids_to_save.end())
3027  free_dof_ids.push_back(id);
3028  else
3029  {
3030  dof_is_fixed[i] = true;
3031  Uinvolved(i) = iter->second;
3032  }
3033  }
3034 
3035  const unsigned int free_dofs = free_dof_ids.size();
3036 
3037  // There may be nothing to project
3038  if (!free_dofs)
3039  return;
3040 
3041  // The element matrix and RHS for projections.
3042  // Note that Ke is always real-valued, whereas
3043  // Fe may be complex valued if complex number
3044  // support is enabled
3045  DenseMatrix<Real> Ke(free_dofs, free_dofs);
3046  DenseVector<typename FFunctor::ValuePushType> Fe(free_dofs);
3047  // The new degree of freedom coefficients to solve for
3048  DenseVector<typename FFunctor::ValuePushType> Ufree(free_dofs);
3049 
3050  const unsigned int n_qp =
3051  cast_int<unsigned int>(xyz_values.size());
3052 
3053  // Loop over the quadrature points
3054  for (unsigned int qp=0; qp<n_qp; qp++)
3055  {
3056  // solution at the quadrature point
3057  FValue fineval = f.eval_at_point(context,
3058  var_component,
3059  xyz_values[qp],
3060  system.time,
3061  false);
3062  // solution grad at the quadrature point
3063  typename GFunctor::FunctorValue finegrad;
3064  if (cont == C_ONE)
3065  finegrad = g->eval_at_point(context,
3066  var_component,
3067  xyz_values[qp],
3068  system.time,
3069  false);
3070 
3071  // Form edge projection matrix
3072  for (unsigned int sidei=0, freei=0;
3073  sidei != n_involved_dofs; ++sidei)
3074  {
3075  unsigned int i = involved_dofs[sidei];
3076  // fixed DoFs aren't test functions
3077  if (dof_is_fixed[sidei])
3078  continue;
3079  for (unsigned int sidej=0, freej=0;
3080  sidej != n_involved_dofs; ++sidej)
3081  {
3082  unsigned int j = involved_dofs[sidej];
3083  if (dof_is_fixed[sidej])
3084  Fe(freei) -= phi[i][qp] * phi[j][qp] *
3085  JxW[qp] * Uinvolved(sidej);
3086  else
3087  Ke(freei,freej) += phi[i][qp] *
3088  phi[j][qp] * JxW[qp];
3089  if (cont == C_ONE)
3090  {
3091  if (dof_is_fixed[sidej])
3092  Fe(freei) -= ( TensorTools::inner_product((*dphi)[i][qp],
3093  (*dphi)[j][qp]) ) *
3094  JxW[qp] * Uinvolved(sidej);
3095  else
3096  Ke(freei,freej) += ( TensorTools::inner_product((*dphi)[i][qp],
3097  (*dphi)[j][qp]) )
3098  * JxW[qp];
3099  }
3100  if (!dof_is_fixed[sidej])
3101  freej++;
3102  }
3103  Fe(freei) += phi[i][qp] * fineval * JxW[qp];
3104  if (cont == C_ONE)
3105  Fe(freei) += (TensorTools::inner_product(finegrad,
3106  (*dphi)[i][qp]) ) *
3107  JxW[qp];
3108  freei++;
3109  }
3110  }
3111 
3112  Ke.cholesky_solve(Fe, Ufree);
3113 
3114  // Transfer new edge solutions to element
3115  const processor_id_type pid = node ?
3116  node->processor_id() : DofObject::invalid_processor_id;
3117  insert_ids(free_dof_ids, Ufree.get_values(), pid);
3118 }
Real time
For time-dependent problems, this is the time t at the beginning of the current timestep.
Definition: system.h:1615
uint8_t processor_id_type
std::unordered_map< dof_id_type, typename FFunctor::ValuePushType > ids_to_save
void insert_ids(const std::vector< dof_id_type > &ids, const std::vector< InsertInput > &vals, processor_id_type pid)
static const processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition: dof_object.h:493
template class LIBMESH_EXPORT DenseMatrix< Real >
Definition: dense_matrix.C:35
FEContinuity
defines an enum for finite element types to libmesh_assert a certain level (or type? Hcurl?) of continuity.
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:140
boostcopy::enable_if_c< ScalarTraits< T >::value &&ScalarTraits< T2 >::value, typename CompareTypes< T, T2 >::supertype >::type inner_product(const T &a, const T2 &b)
Definition: tensor_tools.h:51
uint8_t dof_id_type
Definition: id_types.h:67

◆ find_dofs_to_send()

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
void libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::find_dofs_to_send ( const Node node,
const Elem elem,
unsigned short  node_num,
const var_set vars 
)
inherited

Definition at line 2839 of file generic_projector.h.

References libMesh::Elem::active(), libMesh::Variable::active_on_subdomain(), libMesh::DofMap::dof_indices(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::DofObject::id(), libMesh::DofObject::invalid_processor_id, libMesh::Parallel::Utils::is_sorted(), libMesh::libmesh_assert(), mesh, libMesh::Elem::node_ptr(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::Elem::subdomain_id(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::system, and libMesh::System::variable().

2840 {
2841  libmesh_assert (&node == elem.node_ptr(node_num));
2842 
2843  // Any ghosted node in our range might have an owner who needs our
2844  // data
2845  const processor_id_type owner = node.processor_id();
2846  if (owner != system.processor_id())
2847  {
2848  const MeshBase & mesh = system.get_mesh();
2849  const DofMap & dof_map = system.get_dof_map();
2850 
2851  // But let's check and see if we can be certain the owner can
2852  // compute any or all of its own dof coefficients on that node.
2853  std::vector<dof_id_type> node_dof_ids, patch_dof_ids;
2854  for (const auto & var : vars)
2855  {
2856  const Variable & variable = system.variable(var);
2857 
2858  if (!variable.active_on_subdomain(elem.subdomain_id()))
2859  continue;
2860 
2861  dof_map.dof_indices(elem, node_num, node_dof_ids, var);
2862  }
2863  libmesh_assert(std::is_sorted(node_dof_ids.begin(),
2864  node_dof_ids.end()));
2865  const std::vector<dof_id_type> & patch =
2866  (*this->projector.nodes_to_elem)[node.id()];
2867  for (const auto & elem_id : patch)
2868  {
2869  const Elem & patch_elem = mesh.elem_ref(elem_id);
2870  if (!patch_elem.active() || owner != patch_elem.processor_id())
2871  continue;
2872  dof_map.dof_indices(&patch_elem, patch_dof_ids);
2873  std::sort(patch_dof_ids.begin(), patch_dof_ids.end());
2874 
2875  // Remove any node_dof_ids that we see can be calculated on
2876  // this element
2877  std::vector<dof_id_type> diff_ids(node_dof_ids.size());
2878  auto it = std::set_difference(node_dof_ids.begin(), node_dof_ids.end(),
2879  patch_dof_ids.begin(), patch_dof_ids.end(), diff_ids.begin());
2880  diff_ids.resize(it-diff_ids.begin());
2881  node_dof_ids.swap(diff_ids);
2882  if (node_dof_ids.empty())
2883  break;
2884  }
2885 
2886  // Give ids_to_push default invalid pid: not yet computed
2887  for (auto id : node_dof_ids)
2889  }
2890 }
std::unordered_map< dof_id_type, std::pair< typename FFunctor::ValuePushType, processor_id_type > > new_ids_to_push
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.h:2458
NodesToElemMap * nodes_to_elem
MeshBase & mesh
const MeshBase & get_mesh() const
Definition: system.h:2358
uint8_t processor_id_type
bool is_sorted(const std::vector< KeyType > &v)
static const processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition: dof_object.h:493
libmesh_assert(ctx)
processor_id_type processor_id() const
const DofMap & get_dof_map() const
Definition: system.h:2374

◆ insert_id() [1/3]

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
template<typename InsertInput , typename std::enable_if< std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type >
void libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::insert_id ( dof_id_type  id,
const InsertInput &  val,
processor_id_type  pid 
)
inherited

Definition at line 1378 of file generic_projector.h.

1380 {
1381  libmesh_error_msg("ID insertion should only occur when the provided input matches that "
1382  "expected by the ProjectionAction");
1383 }

◆ insert_id() [2/3]

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
template<typename InsertInput , typename std::enable_if< !std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type = 0>
void libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::insert_id ( typename InsertInput  ,
typename std::enable_if< !std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type  = 0 
)

◆ insert_id() [3/3]

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
template<typename InsertInput , typename std::enable_if< std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type = 0>
void libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::insert_id ( typename InsertInput  ,
typename std::enable_if< std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type  = 0 
)

Definition at line 1378 of file generic_projector.h.

1380 {
1381  libmesh_error_msg("ID insertion should only occur when the provided input matches that "
1382  "expected by the ProjectionAction");
1383 }

◆ insert_ids() [1/3]

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
template<typename InsertInput , typename std::enable_if< std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type >
void libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::insert_ids ( const std::vector< dof_id_type > &  ids,
const std::vector< InsertInput > &  vals,
processor_id_type  pid 
)
inherited

Definition at line 1420 of file generic_projector.h.

1424 {
1425  libmesh_error_msg("ID insertion should only occur when the provided input matches that "
1426  "expected by the ProjectionAction");
1427 }

◆ insert_ids() [2/3]

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
template<typename InsertInput , typename std::enable_if< !std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type = 0>
void libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::insert_ids ( typename InsertInput  ,
typename std::enable_if< !std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type  = 0 
)

◆ insert_ids() [3/3]

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
template<typename InsertInput , typename std::enable_if< std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type = 0>
void libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::insert_ids ( typename InsertInput  ,
typename std::enable_if< std::is_same< typename ProjectionAction::InsertInput, InsertInput >::value, int >::type  = 0 
)

Definition at line 1420 of file generic_projector.h.

1424 {
1425  libmesh_error_msg("ID insertion should only occur when the provided input matches that "
1426  "expected by the ProjectionAction");
1427 }

◆ join()

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
void libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::join ( const SubFunctor other)
inherited

Definition at line 1471 of file generic_projector.h.

References libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::new_ids_to_push, and libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::new_ids_to_save.

Referenced by libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SortAndCopy::join().

1472 {
1473  new_ids_to_push.insert(other.new_ids_to_push.begin(), other.new_ids_to_push.end());
1474  new_ids_to_save.insert(other.new_ids_to_save.begin(), other.new_ids_to_save.end());
1475 }
std::unordered_map< dof_id_type, std::pair< typename FFunctor::ValuePushType, processor_id_type > > new_ids_to_push
std::unordered_map< dof_id_type, typename FFunctor::ValuePushType > new_ids_to_save

◆ operator()()

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
void libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides::operator() ( const node_range range)

Definition at line 2505 of file generic_projector.h.

References libMesh::Elem::child_ptr(), libMesh::CONSTANT, libMesh::FEType::default_quadrature_rule(), dim, libMesh::Elem::dim(), libMesh::DofObject::dof_number(), libMesh::FEInterface::dofs_on_side(), libMesh::FEType::family, libMesh::System::get_dof_map(), libMesh::FEMap::inverse_map(), libMesh::Elem::is_child_on_side(), libMesh::Elem::is_face(), libMesh::Elem::is_node_on_side(), libMesh::Elem::JUST_COARSENED, libMesh::Elem::JUST_REFINED, libMesh::LAGRANGE, libMesh::LAGRANGE_VEC, libMesh::make_range(), libMesh::MONOMIAL, libMesh::Elem::n_children(), libMesh::DofObject::n_comp(), libMesh::Elem::n_nodes(), libMesh::Elem::n_vertices(), libMesh::System::number(), libMesh::FEType::order, libMesh::Elem::p_level(), libMesh::Elem::p_refinement_flag(), libMesh::DofObject::processor_id(), libMesh::Elem::refinement_flag(), libMesh::SCALAR, libMesh::DofMap::should_p_refine_var(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::system, libMesh::System::time, libMesh::Variable::type(), libMesh::System::variable(), and libMesh::System::variable_scalar_number().

2506 {
2507  LOG_SCOPE ("project_sides","GenericProjector");
2508 
2509  const unsigned int sys_num = system.number();
2510 
2511  for (const auto & s_pair : range)
2512  {
2513  const Elem & elem = *std::get<0>(s_pair.second);
2514 
2515  // If this is an unchanged element then we already copied all
2516  // its dofs
2517 #ifdef LIBMESH_ENABLE_AMR
2518  if (f.is_grid_projection() &&
2519  (elem.refinement_flag() != Elem::JUST_REFINED &&
2520  elem.refinement_flag() != Elem::JUST_COARSENED &&
2521  elem.p_refinement_flag() != Elem::JUST_REFINED &&
2522  elem.p_refinement_flag() != Elem::JUST_COARSENED))
2523  continue;
2524 #endif // LIBMESH_ENABLE_AMR
2525 
2526  const Node & side_node = *s_pair.first;
2527  const int dim = elem.dim();
2528  const var_set & side_vars = std::get<2>(s_pair.second);
2529 
2530  const unsigned int side_num = std::get<1>(s_pair.second);
2531  unsigned short node_num = elem.n_vertices()+side_num;
2532  // In 3D only some sides may have nodes
2533  if (dim == 3)
2534  for (auto n : make_range(elem.n_nodes()))
2535  {
2536  if (!elem.is_face(n))
2537  continue;
2538 
2539  if (elem.is_node_on_side(n, side_num))
2540  {
2541  node_num = n;
2542  break;
2543  }
2544  }
2545 
2546  context.side = side_num;
2547  context.pre_fe_reinit(system, &elem);
2548 
2549  this->find_dofs_to_send(side_node, elem, node_num, side_vars);
2550 
2551  // Look at all the variables we're supposed to interpolate from
2552  // this element on this side
2553  for (const auto & var : side_vars)
2554  {
2555  const Variable & variable = system.variable(var);
2556  const FEType & base_fe_type = variable.type();
2557  const unsigned int var_component =
2559 
2560  if (base_fe_type.family == SCALAR)
2561  continue;
2562 
2563  FEType fe_type = base_fe_type;
2564  const auto & dof_map = system.get_dof_map();
2565  const bool add_p_level = dof_map.should_p_refine_var(var);
2566 
2567  // This may be a p refined element
2568  fe_type.order = fe_type.order + add_p_level*elem.p_level();
2569 
2570  // If this is a Lagrange element with DoFs on sides then by
2571  // convention we interpolate at the node rather than project
2572  // along the side.
2573  if (fe_type.family == LAGRANGE || fe_type.family == LAGRANGE_VEC)
2574  {
2575  // If order==1 then we only have DoFs on vertices, so
2576  // skip all this.
2577  // If order>1 ... we might still have something tricky
2578  // like order==2 PRISM20, where some side nodes have
2579  // DoFs but others don't. Gotta check.
2580  if (fe_type.order > 1 &&
2581  side_node.n_comp(sys_num, var))
2582  {
2583  const processor_id_type pid =
2584  side_node.processor_id();
2585  FValue fval = f.eval_at_point
2586  (context, var_component, side_node, system.time,
2587  false);
2588 
2589  if (fe_type.family == LAGRANGE_VEC)
2590  {
2591  // We will have a number of nodal value DoFs equal to the elem dim
2592  for (auto i : make_range(elem.dim()))
2593  {
2594  const dof_id_type dof_id = side_node.dof_number(sys_num, var, i);
2595 
2596  // Need this conversion so that this method
2597  // will compile for TYPE_SCALAR instantiations
2598  const auto insert_val =
2599  raw_value<typename ProjectionAction::InsertInput>(fval, i);
2600 
2601  insert_id(dof_id, insert_val, pid);
2602  }
2603  }
2604  else // We are LAGRANGE
2605  {
2606  const dof_id_type dof_id =
2607  side_node.dof_number(sys_num, var, 0);
2608  insert_id(dof_id, fval, pid);
2609  }
2610  }
2611  continue;
2612  }
2613 
2614 #ifdef LIBMESH_ENABLE_AMR
2615  // If this is a low order monomial element which has merely
2616  // been h refined then we already copied all its dofs
2617  if (fe_type.family == MONOMIAL &&
2618  fe_type.order == CONSTANT &&
2619  elem.refinement_flag() != Elem::JUST_COARSENED &&
2620  elem.p_refinement_flag() != Elem::JUST_COARSENED)
2621  continue;
2622 #endif // LIBMESH_ENABLE_AMR
2623 
2624  // FIXME: Need to generalize this to vector-valued elements. [PB]
2625  FEGenericBase<typename FFunctor::RealType> * fe = nullptr;
2626  context.get_element_fe( var, fe, dim );
2627  FEGenericBase<typename FFunctor::RealType> * side_fe = nullptr;
2628  context.get_side_fe( var, side_fe );
2629 
2630  // If we're JUST_COARSENED we'll need a custom
2631  // evaluation, not just the standard side FE
2632  const FEGenericBase<typename FFunctor::RealType> & proj_fe =
2633 #ifdef LIBMESH_ENABLE_AMR
2634  (elem.refinement_flag() == Elem::JUST_COARSENED) ?
2635  *fe :
2636 #endif
2637  *side_fe;
2638 
2639 #ifdef LIBMESH_ENABLE_AMR
2640  if (elem.refinement_flag() == Elem::JUST_COARSENED)
2641  {
2642  std::vector<Point> fine_points;
2643 
2644  std::unique_ptr<FEGenericBase<typename FFunctor::RealType>> fine_fe
2646 
2647  std::unique_ptr<QBase> qrule
2648  (base_fe_type.default_quadrature_rule(1));
2649  fine_fe->attach_quadrature_rule(qrule.get());
2650 
2651  const std::vector<Point> & child_xyz =
2652  fine_fe->get_xyz();
2653 
2654  for (unsigned int c = 0, nc = elem.n_children();
2655  c != nc; ++c)
2656  {
2657  if (!elem.is_child_on_side(c, context.side))
2658  continue;
2659 
2660  fine_fe->reinit(elem.child_ptr(c), context.side);
2661  fine_points.insert(fine_points.end(),
2662  child_xyz.begin(),
2663  child_xyz.end());
2664  }
2665 
2666  std::vector<Point> fine_qp;
2667  FEMap::inverse_map (dim, &elem, fine_points, fine_qp);
2668 
2669  context.elem_fe_reinit(&fine_qp);
2670  }
2671  else
2672 #endif // LIBMESH_ENABLE_AMR
2674 
2675  const std::vector<dof_id_type> & dof_indices =
2676  context.get_dof_indices(var);
2677 
2678  std::vector<unsigned int> side_dofs;
2679  FEInterface::dofs_on_side(&elem, dim, base_fe_type,
2680  context.side, side_dofs, add_p_level);
2681 
2682  this->construct_projection
2683  (dof_indices, side_dofs, var_component,
2684  &side_node, proj_fe);
2685  }
2686  }
2687 }
Real time
For time-dependent problems, this is the time t at the beginning of the current timestep.
Definition: system.h:1615
unsigned int variable_scalar_number(std::string_view var, unsigned int component) const
Definition: system.h:2489
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.h:2458
void get_side_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for edge/face (2D/3D) finite element object for variable var for the largest dimension in th...
Definition: fem_context.h:317
virtual void pre_fe_reinit(const System &, const Elem *e)
Reinitializes local data vectors/matrices on the current geometric element.
Definition: fem_context.C:1683
void construct_projection(const std::vector< dof_id_type > &dof_indices_var, const std::vector< unsigned int > &involved_dofs, unsigned int var_component, const Node *node, const FEGenericBase< typename FFunctor::RealType > &fe)
unsigned int dim
static Point inverse_map(const unsigned int dim, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true, const bool extra_checks=true)
Definition: fe_map.C:1628
void insert_id(dof_id_type id, const InsertInput &val, processor_id_type pid)
virtual void elem_fe_reinit(const std::vector< Point > *const pts=nullptr)
Reinitializes interior FE objects on the current geometric element.
Definition: fem_context.C:1477
bool should_p_refine_var(unsigned int var) const
Whether the given variable should be p-refined.
Definition: dof_map.h:2437
uint8_t processor_id_type
unsigned int number() const
Definition: system.h:2350
virtual void side_fe_reinit()
Reinitializes side FE objects on the current geometric element.
Definition: fem_context.C:1498
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
const std::vector< dof_id_type > & get_dof_indices() const
Accessor for element dof indices.
Definition: diff_context.h:363
void find_dofs_to_send(const Node &node, const Elem &elem, unsigned short node_num, const var_set &vars)
unsigned char side
Current side for side_* to examine.
Definition: fem_context.h:1013
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:140
std::set< unsigned int > var_set
void get_element_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for interior finite element object for variable var for the largest dimension in the mesh...
Definition: fem_context.h:277
const DofMap & get_dof_map() const
Definition: system.h:2374
static void dofs_on_side(const Elem *const elem, const unsigned int dim, const FEType &fe_t, unsigned int s, std::vector< unsigned int > &di, const bool add_p_level=true)
Fills the vector di with the local degree of freedom indices associated with side s of element elem A...
Definition: fe_interface.C:597
uint8_t dof_id_type
Definition: id_types.h:67
const FEType & type() const
Definition: variable.h:144

Member Data Documentation

◆ action

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
ProjectionAction libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::action

Definition at line 231 of file generic_projector.h.

◆ context

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
FEMContext libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::context

Definition at line 236 of file generic_projector.h.

◆ conts

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
std::vector<FEContinuity> libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::conts

Definition at line 239 of file generic_projector.h.

◆ f

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
FFunctor libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::f

Definition at line 232 of file generic_projector.h.

◆ field_types

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
std::vector<FEFieldType> libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::field_types

Definition at line 240 of file generic_projector.h.

◆ g

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
std::unique_ptr<GFunctor> libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubProjector::g

Definition at line 267 of file generic_projector.h.

◆ new_ids_to_push

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
std::unordered_map<dof_id_type, std::pair<typename FFunctor::ValuePushType, processor_id_type> > libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::new_ids_to_push
inherited

◆ new_ids_to_save

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
std::unordered_map<dof_id_type, typename FFunctor::ValuePushType> libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::new_ids_to_save
inherited

◆ projector

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
GenericProjector& libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::projector
inherited

Definition at line 170 of file generic_projector.h.

◆ system

template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
const System& libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::system

Definition at line 242 of file generic_projector.h.


The documentation for this struct was generated from the following file: