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 3004 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.

3009 {
3010  const auto & JxW = fe.get_JxW();
3011  const auto & phi = fe.get_phi();
3012  const std::vector<std::vector<typename FEGenericBase<typename FFunctor::RealType>::OutputGradient>> * dphi = nullptr;
3013  const std::vector<Point> & xyz_values = fe.get_xyz();
3014  const FEContinuity cont = fe.get_continuity();
3015  const std::unordered_map<dof_id_type, typename FFunctor::ValuePushType> & ids_to_save =
3016  this->projector.ids_to_save;
3017 
3018  if (cont == C_ONE)
3019  dphi = &(fe.get_dphi());
3020 
3021  const unsigned int n_involved_dofs =
3022  cast_int<unsigned int>(involved_dofs.size());
3023 
3024  std::vector<dof_id_type> free_dof_ids;
3025  DenseVector<typename FFunctor::ValuePushType> Uinvolved(n_involved_dofs);
3026  std::vector<char> dof_is_fixed(n_involved_dofs, false); // bools
3027 
3028  for (auto i : make_range(n_involved_dofs))
3029  {
3030  const dof_id_type id = dof_indices_var[involved_dofs[i]];
3031  auto iter = ids_to_save.find(id);
3032  if (iter == ids_to_save.end())
3033  free_dof_ids.push_back(id);
3034  else
3035  {
3036  dof_is_fixed[i] = true;
3037  Uinvolved(i) = iter->second;
3038  }
3039  }
3040 
3041  const unsigned int free_dofs = free_dof_ids.size();
3042 
3043  // There may be nothing to project
3044  if (!free_dofs)
3045  return;
3046 
3047  // The element matrix and RHS for projections.
3048  // Note that Ke is always real-valued, whereas
3049  // Fe may be complex valued if complex number
3050  // support is enabled
3051  DenseMatrix<Real> Ke(free_dofs, free_dofs);
3052  DenseVector<typename FFunctor::ValuePushType> Fe(free_dofs);
3053  // The new degree of freedom coefficients to solve for
3054  DenseVector<typename FFunctor::ValuePushType> Ufree(free_dofs);
3055 
3056  const unsigned int n_qp =
3057  cast_int<unsigned int>(xyz_values.size());
3058 
3059  // Loop over the quadrature points
3060  for (unsigned int qp=0; qp<n_qp; qp++)
3061  {
3062  // solution at the quadrature point
3063  FValue fineval = f.eval_at_point(context,
3064  var_component,
3065  xyz_values[qp],
3066  system.time,
3067  false);
3068  // solution grad at the quadrature point
3069  typename GFunctor::FunctorValue finegrad;
3070  if (cont == C_ONE)
3071  finegrad = g->eval_at_point(context,
3072  var_component,
3073  xyz_values[qp],
3074  system.time,
3075  false);
3076 
3077  // Form edge projection matrix
3078  for (unsigned int sidei=0, freei=0;
3079  sidei != n_involved_dofs; ++sidei)
3080  {
3081  unsigned int i = involved_dofs[sidei];
3082  // fixed DoFs aren't test functions
3083  if (dof_is_fixed[sidei])
3084  continue;
3085  for (unsigned int sidej=0, freej=0;
3086  sidej != n_involved_dofs; ++sidej)
3087  {
3088  unsigned int j = involved_dofs[sidej];
3089  if (dof_is_fixed[sidej])
3090  Fe(freei) -= phi[i][qp] * phi[j][qp] *
3091  JxW[qp] * Uinvolved(sidej);
3092  else
3093  Ke(freei,freej) += phi[i][qp] *
3094  phi[j][qp] * JxW[qp];
3095  if (cont == C_ONE)
3096  {
3097  if (dof_is_fixed[sidej])
3098  Fe(freei) -= ( TensorTools::inner_product((*dphi)[i][qp],
3099  (*dphi)[j][qp]) ) *
3100  JxW[qp] * Uinvolved(sidej);
3101  else
3102  Ke(freei,freej) += ( TensorTools::inner_product((*dphi)[i][qp],
3103  (*dphi)[j][qp]) )
3104  * JxW[qp];
3105  }
3106  if (!dof_is_fixed[sidej])
3107  freej++;
3108  }
3109  Fe(freei) += phi[i][qp] * fineval * JxW[qp];
3110  if (cont == C_ONE)
3111  Fe(freei) += (TensorTools::inner_product(finegrad,
3112  (*dphi)[i][qp]) ) *
3113  JxW[qp];
3114  freei++;
3115  }
3116  }
3117 
3118  Ke.cholesky_solve(Fe, Ufree);
3119 
3120  // Transfer new edge solutions to element
3121  const processor_id_type pid = node ?
3122  node->processor_id() : DofObject::invalid_processor_id;
3123  insert_ids(free_dof_ids, Ufree.get_values(), pid);
3124 }
Real time
For time-dependent problems, this is the time t at the beginning of the current timestep.
Definition: system.h:1677
static constexpr 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:484
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)
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:176
std::enable_if< 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 2845 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::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().

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

◆ 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 2514 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::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::FEType::p_refinement, libMesh::Elem::p_refinement_flag(), libMesh::DofObject::processor_id(), libMesh::Elem::refinement_flag(), libMesh::SCALAR, libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::system, libMesh::System::time, libMesh::Variable::type(), libMesh::System::variable(), and libMesh::System::variable_scalar_number().

2515 {
2516  LOG_SCOPE ("project_sides","GenericProjector");
2517 
2518  const unsigned int sys_num = system.number();
2519 
2520  for (const auto & s_pair : range)
2521  {
2522  const Elem & elem = *std::get<0>(s_pair.second);
2523 
2524  // If this is an unchanged element then we already copied all
2525  // its dofs
2526 #ifdef LIBMESH_ENABLE_AMR
2527  if (f.is_grid_projection() &&
2528  (elem.refinement_flag() != Elem::JUST_REFINED &&
2529  elem.refinement_flag() != Elem::JUST_COARSENED &&
2530  elem.p_refinement_flag() != Elem::JUST_REFINED &&
2531  elem.p_refinement_flag() != Elem::JUST_COARSENED))
2532  continue;
2533 #endif // LIBMESH_ENABLE_AMR
2534 
2535  const Node & side_node = *s_pair.first;
2536  const int dim = elem.dim();
2537  const var_set & side_vars = std::get<2>(s_pair.second);
2538 
2539  const unsigned int side_num = std::get<1>(s_pair.second);
2540  unsigned short node_num = elem.n_vertices()+side_num;
2541  // In 3D only some sides may have nodes
2542  if (dim == 3)
2543  for (auto n : make_range(elem.n_nodes()))
2544  {
2545  if (!elem.is_face(n))
2546  continue;
2547 
2548  if (elem.is_node_on_side(n, side_num))
2549  {
2550  node_num = n;
2551  break;
2552  }
2553  }
2554 
2555  context.side = side_num;
2556  context.pre_fe_reinit(system, &elem);
2557 
2558  this->find_dofs_to_send(side_node, elem, node_num, side_vars);
2559 
2560  // Look at all the variables we're supposed to interpolate from
2561  // this element on this side
2562  for (const auto & var : side_vars)
2563  {
2564  const Variable & variable = system.variable(var);
2565  const FEType & base_fe_type = variable.type();
2566  const unsigned int var_component =
2568 
2569  if (base_fe_type.family == SCALAR)
2570  continue;
2571 
2572  FEType fe_type = base_fe_type;
2573  const bool add_p_level = base_fe_type.p_refinement;
2574 
2575  // This may be a p refined element
2576  fe_type.order = fe_type.order + add_p_level*elem.p_level();
2577 
2578  // If this is a Lagrange element with DoFs on sides then by
2579  // convention we interpolate at the node rather than project
2580  // along the side.
2581  if (fe_type.family == LAGRANGE || fe_type.family == LAGRANGE_VEC)
2582  {
2583  // If order==1 then we only have DoFs on vertices, so
2584  // skip all this.
2585  // If order>1 ... we might still have something tricky
2586  // like order==2 PRISM20, where some side nodes have
2587  // DoFs but others don't. Gotta check.
2588  if (fe_type.order > 1 &&
2589  side_node.n_comp(sys_num, var))
2590  {
2591  const processor_id_type pid =
2592  side_node.processor_id();
2593  FValue fval = f.eval_at_point
2594  (context, var_component, side_node, system.time,
2595  false);
2596 
2597  if (fe_type.family == LAGRANGE_VEC)
2598  {
2599  // We will have a number of nodal value DoFs equal to the elem dim
2600  for (auto i : make_range(elem.dim()))
2601  {
2602  const dof_id_type dof_id = side_node.dof_number(sys_num, var, i);
2603 
2604  // Need this conversion so that this method
2605  // will compile for TYPE_SCALAR instantiations
2606  const auto insert_val =
2607  raw_value<typename ProjectionAction::InsertInput>(fval, i);
2608 
2609  insert_id(dof_id, insert_val, pid);
2610  }
2611  }
2612  else // We are LAGRANGE
2613  {
2614  const dof_id_type dof_id =
2615  side_node.dof_number(sys_num, var, 0);
2616  insert_id(dof_id, fval, pid);
2617  }
2618  }
2619  continue;
2620  }
2621 
2622 #ifdef LIBMESH_ENABLE_AMR
2623  // If this is a low order monomial element which has merely
2624  // been h refined then we already copied all its dofs
2625  if (fe_type.family == MONOMIAL &&
2626  fe_type.order == CONSTANT &&
2627  elem.refinement_flag() != Elem::JUST_COARSENED &&
2628  elem.p_refinement_flag() != Elem::JUST_COARSENED)
2629  continue;
2630 #endif // LIBMESH_ENABLE_AMR
2631 
2632  // FIXME: Need to generalize this to vector-valued elements. [PB]
2633  FEGenericBase<typename FFunctor::RealType> * fe = nullptr;
2634  context.get_element_fe( var, fe, dim );
2635  FEGenericBase<typename FFunctor::RealType> * side_fe = nullptr;
2636  context.get_side_fe( var, side_fe );
2637 
2638  // If we're JUST_COARSENED we'll need a custom
2639  // evaluation, not just the standard side FE
2640  const FEGenericBase<typename FFunctor::RealType> & proj_fe =
2641 #ifdef LIBMESH_ENABLE_AMR
2642  (elem.refinement_flag() == Elem::JUST_COARSENED) ?
2643  *fe :
2644 #endif
2645  *side_fe;
2646 
2647 #ifdef LIBMESH_ENABLE_AMR
2648  if (elem.refinement_flag() == Elem::JUST_COARSENED)
2649  {
2650  std::vector<Point> fine_points;
2651 
2652  std::unique_ptr<FEGenericBase<typename FFunctor::RealType>> fine_fe
2654 
2655  std::unique_ptr<QBase> qrule
2656  (base_fe_type.default_quadrature_rule(1));
2657  fine_fe->attach_quadrature_rule(qrule.get());
2658 
2659  const std::vector<Point> & child_xyz =
2660  fine_fe->get_xyz();
2661 
2662  for (unsigned int c = 0, nc = elem.n_children();
2663  c != nc; ++c)
2664  {
2665  if (!elem.is_child_on_side(c, context.side))
2666  continue;
2667 
2668  fine_fe->reinit(elem.child_ptr(c), context.side);
2669  fine_points.insert(fine_points.end(),
2670  child_xyz.begin(),
2671  child_xyz.end());
2672  }
2673 
2674  std::vector<Point> fine_qp;
2675  FEMap::inverse_map (dim, &elem, fine_points, fine_qp);
2676 
2677  context.elem_fe_reinit(&fine_qp);
2678  }
2679  else
2680 #endif // LIBMESH_ENABLE_AMR
2682 
2683  const std::vector<dof_id_type> & dof_indices =
2684  context.get_dof_indices(var);
2685 
2686  std::vector<unsigned int> side_dofs;
2687  FEInterface::dofs_on_side(&elem, dim, base_fe_type,
2688  context.side, side_dofs, add_p_level);
2689 
2690  this->construct_projection
2691  (dof_indices, side_dofs, var_component,
2692  &side_node, proj_fe);
2693  }
2694  }
2695 }
Real time
For time-dependent problems, this is the time t at the beginning of the current timestep.
Definition: system.h:1677
unsigned int variable_scalar_number(std::string_view var, unsigned int component) const
Definition: system.h:2474
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.C:2704
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:1512
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:1476
uint8_t processor_id_type
unsigned int number() const
Definition: system.h:2393
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:176
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
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:598
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: