libMesh
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | List of all members
libMesh::OldSolutionValue< Output, point_output > Class Template Reference

The OldSolutionValue input functor class can be used with GenericProjector to read values from a solution on a just-refined-and-coarsened mesh. More...

#include <generic_projector.h>

Inheritance diagram for libMesh::OldSolutionValue< Output, point_output >:
[legend]

Public Types

typedef Output FunctorValue
 
typedef DofValueType ValuePushType
 
typedef TensorTools::MakeReal< Output >::type RealType
 

Public Member Functions

 OldSolutionValue (const libMesh::System &sys_in, const NumericVector< Number > &old_sol, const std::vector< unsigned int > *vars)
 
 OldSolutionValue (const OldSolutionValue &in)
 
Output eval_at_node (const FEMContext &c, unsigned int i, unsigned int elem_dim, const Node &n, bool, Real=0.)
 
Output eval_at_point (const FEMContext &c, unsigned int i, const Point &p, Real, bool skip_context_check)
 
template<typename T = Output, typename std::enable_if< std::is_same< T, Number >::value, int >::type = 0>
void eval_mixed_derivatives (const FEMContext &libmesh_dbg_var(c), unsigned int i, unsigned int dim, const Node &n, std::vector< Output > &derivs)
 
template<typename T = Output, typename std::enable_if<!std::is_same< T, Number >::value, int >::type = 0>
void eval_mixed_derivatives (const FEMContext &, unsigned int, unsigned int, const Node &, std::vector< Output > &)
 
void eval_old_dofs (const Elem &elem, unsigned int node_num, unsigned int var_num, std::vector< dof_id_type > &indices, std::vector< DofValueType > &values)
 
void eval_old_dofs (const Elem &elem, const FEType &fe_type, unsigned int sys_num, unsigned int var_num, std::vector< dof_id_type > &indices, std::vector< DofValueType > &values)
 
template<>
Number eval_at_node (const FEMContext &c, unsigned int i, unsigned int, const Node &n, bool extra_hanging_dofs, Real)
 
template<>
Gradient eval_at_node (const FEMContext &c, unsigned int i, unsigned int, const Node &n, bool extra_hanging_dofs, Real)
 
template<>
Gradient eval_at_node (const FEMContext &c, unsigned int i, unsigned int elem_dim, const Node &n, bool extra_hanging_dofs, Real)
 
template<>
Tensor eval_at_node (const FEMContext &, unsigned int, unsigned int, const Node &, bool, Real)
 
template<>
void get_shape_outputs (FEAbstract &fe)
 
template<>
void get_shape_outputs (FEAbstract &fe)
 
template<>
void get_shape_outputs (FEAbstract &fe)
 
template<>
void get_shape_outputs (FEAbstract &fe)
 
template<>
void get_shape_outputs (FEAbstract &fe)
 
template<>
void get_shape_outputs (FEAbstract &fe)
 
template<>
void get_shape_outputs (FEAbstract &fe)
 
template<>
void get_shape_outputs (FEAbstract &fe)
 
void init_context (FEMContext &c)
 
bool is_grid_projection ()
 

Static Public Member Functions

static void get_shape_outputs (FEAbstract &fe)
 

Protected Types

typedef TensorTools::MakeBaseNumber< Output >::type DofValueType
 

Protected Member Functions

void check_old_context (const FEMContext &c)
 
bool check_old_context (const FEMContext &c, const Point &p)
 

Protected Attributes

const Elemlast_elem
 
const Systemsys
 
FEMContext old_context
 
std::vector< unsigned intcomponent_to_var
 

Static Protected Attributes

static const Real out_of_elem_tol = 10 * TOLERANCE
 

Private Attributes

const NumericVector< Number > & old_solution
 

Detailed Description

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
class libMesh::OldSolutionValue< Output, point_output >

The OldSolutionValue input functor class can be used with GenericProjector to read values from a solution on a just-refined-and-coarsened mesh.

Author
Roy H. Stogner
Date
2016

Definition at line 719 of file generic_projector.h.

Member Typedef Documentation

◆ DofValueType

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
typedef TensorTools::MakeBaseNumber<Output>::type libMesh::OldSolutionBase< Output, point_output >::DofValueType
protectedinherited

Definition at line 527 of file generic_projector.h.

◆ FunctorValue

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
typedef Output libMesh::OldSolutionValue< Output, point_output >::FunctorValue

Definition at line 724 of file generic_projector.h.

◆ RealType

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
typedef TensorTools::MakeReal<Output>::type libMesh::OldSolutionBase< Output, point_output >::RealType
inherited

Definition at line 529 of file generic_projector.h.

◆ ValuePushType

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
typedef DofValueType libMesh::OldSolutionValue< Output, point_output >::ValuePushType

Definition at line 725 of file generic_projector.h.

Constructor & Destructor Documentation

◆ OldSolutionValue() [1/2]

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
libMesh::OldSolutionValue< Output, point_output >::OldSolutionValue ( const libMesh::System sys_in,
const NumericVector< Number > &  old_sol,
const std::vector< unsigned int > *  vars 
)
inline

Definition at line 727 of file generic_projector.h.

References libMesh::FEMContext::OLD.

729  :
730  OldSolutionBase<Output, point_output>(sys_in, vars),
731  old_solution(old_sol)
732  {
735  }
const NumericVector< Number > & old_solution
void set_algebraic_type(const AlgebraicType atype)
Setting which determines whether to initialize algebraic structures (elem_*) on each element and set ...
Definition: fem_context.h:986
void set_custom_solution(const NumericVector< Number > *custom_sol)
Set a NumericVector to be used in place of current_local_solution for calculating elem_solution...
Definition: fem_context.h:1001

◆ OldSolutionValue() [2/2]

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
libMesh::OldSolutionValue< Output, point_output >::OldSolutionValue ( const OldSolutionValue< Output, point_output > &  in)
inline

Definition at line 737 of file generic_projector.h.

References libMesh::FEMContext::OLD.

737  :
738  OldSolutionBase<Output, point_output>(in.sys, in.old_context.active_vars()),
739  old_solution(in.old_solution)
740  {
743  }
const NumericVector< Number > & old_solution
void set_algebraic_type(const AlgebraicType atype)
Setting which determines whether to initialize algebraic structures (elem_*) on each element and set ...
Definition: fem_context.h:986
void set_custom_solution(const NumericVector< Number > *custom_sol)
Set a NumericVector to be used in place of current_local_solution for calculating elem_solution...
Definition: fem_context.h:1001

Member Function Documentation

◆ check_old_context() [1/2]

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
void libMesh::OldSolutionBase< Output, point_output >::check_old_context ( const FEMContext c)
inlineprotectedinherited

Definition at line 596 of file generic_projector.h.

References libMesh::FEMContext::get_elem(), libMesh::DofObject::get_old_dof_object(), libMesh::Elem::JUST_COARSENED, libMesh::Elem::JUST_REFINED, libMesh::libmesh_assert(), libMesh::Elem::parent(), and libMesh::Elem::refinement_flag().

597  {
598  LOG_SCOPE ("check_old_context(c)", "OldSolutionBase");
599  const Elem & elem = c.get_elem();
600  if (last_elem != &elem)
601  {
602  if (elem.refinement_flag() == Elem::JUST_REFINED)
603  {
604  old_context.pre_fe_reinit(sys, elem.parent());
605  }
606  else if (elem.refinement_flag() == Elem::JUST_COARSENED)
607  {
608  libmesh_error();
609  }
610  else
611  {
612  if (!elem.get_old_dof_object())
613  {
614  libmesh_error();
615  }
616 
617  old_context.pre_fe_reinit(sys, &elem);
618  }
619 
620  last_elem = &elem;
621  }
622  else
623  {
625  }
626  }
virtual void pre_fe_reinit(const System &, const Elem *e)
Reinitializes local data vectors/matrices on the current geometric element.
Definition: fem_context.C:1678
libmesh_assert(ctx)
bool has_elem() const
Test for current Elem object.
Definition: fem_context.h:902

◆ check_old_context() [2/2]

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
bool libMesh::OldSolutionBase< Output, point_output >::check_old_context ( const FEMContext c,
const Point p 
)
inlineprotectedinherited

Definition at line 629 of file generic_projector.h.

References libMesh::Elem::child_ref_range(), libMesh::FEMContext::get_elem(), libMesh::DofObject::get_old_dof_object(), libMesh::Elem::hmax(), libMesh::Elem::JUST_COARSENED, libMesh::Elem::JUST_REFINED, libMesh::libmesh_assert(), libMesh::Elem::parent(), libMesh::Real, and libMesh::Elem::refinement_flag().

630  {
631  LOG_SCOPE ("check_old_context(c,p)", "OldSolutionBase");
632  const Elem & elem = c.get_elem();
633  if (last_elem != &elem)
634  {
635  if (elem.refinement_flag() == Elem::JUST_REFINED)
636  {
637  old_context.pre_fe_reinit(sys, elem.parent());
638  }
639  else if (elem.refinement_flag() == Elem::JUST_COARSENED)
640  {
641  // Find the child with this point. Use out_of_elem_tol
642  // (in physical space, which may correspond to a large
643  // tolerance in master space!) to allow for out-of-element
644  // finite differencing of mixed gradient terms. Pray we
645  // have no quadrature locations which are within 1e-5 of
646  // the element subdivision boundary but are not exactly on
647  // that boundary.
648  const Real master_tol = out_of_elem_tol / elem.hmax() * 2;
649 
650  for (auto & child : elem.child_ref_range())
651  if (child.close_to_point(p, master_tol))
652  {
653  old_context.pre_fe_reinit(sys, &child);
654  break;
655  }
656 
658  (old_context.get_elem().close_to_point(p, master_tol));
659  }
660  else
661  {
662  if (!elem.get_old_dof_object())
663  return false;
664 
665  old_context.pre_fe_reinit(sys, &elem);
666  }
667 
668  last_elem = &elem;
669  }
670  else
671  {
673 
674  const Real master_tol = out_of_elem_tol / elem.hmax() * 2;
675 
676  if (!old_context.get_elem().close_to_point(p, master_tol))
677  {
678  libmesh_assert_equal_to
679  (elem.refinement_flag(), Elem::JUST_COARSENED);
680 
681  for (auto & child : elem.child_ref_range())
682  if (child.close_to_point(p, master_tol))
683  {
684  old_context.pre_fe_reinit(sys, &child);
685  break;
686  }
687 
689  (old_context.get_elem().close_to_point(p, master_tol));
690  }
691  }
692 
693  return true;
694  }
virtual void pre_fe_reinit(const System &, const Elem *e)
Reinitializes local data vectors/matrices on the current geometric element.
Definition: fem_context.C:1678
const Elem & get_elem() const
Accessor for current Elem object.
Definition: fem_context.h:908
libmesh_assert(ctx)
virtual bool close_to_point(const Point &p, Real tol) const
Definition: elem.C:2400
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const Real out_of_elem_tol
bool has_elem() const
Test for current Elem object.
Definition: fem_context.h:902

◆ eval_at_node() [1/5]

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
Output libMesh::OldSolutionValue< Output, point_output >::eval_at_node ( const FEMContext c,
unsigned int  i,
unsigned int  elem_dim,
const Node n,
bool  ,
Real  = 0. 
)

◆ eval_at_node() [2/5]

template<>
Number libMesh::OldSolutionValue< Number, &FEMContext::point_value >::eval_at_node ( const FEMContext c,
unsigned int  i,
unsigned  int,
const Node n,
bool  extra_hanging_dofs,
Real   
)
inline

Definition at line 1010 of file generic_projector.h.

References libMesh::Elem::DO_NOTHING, libMesh::DofObject::dof_number(), libMesh::FEMContext::get_elem(), libMesh::Elem::get_node_index(), libMesh::DofObject::get_old_dof_object(), libMesh::Elem::JUST_COARSENED, libMesh::DofObject::n_comp(), libMesh::DofObject::n_vars(), libMesh::Elem::n_vertices(), and libMesh::Elem::refinement_flag().

1016 {
1017  LOG_SCOPE ("Number eval_at_node()", "OldSolutionValue");
1018 
1019  // This should only be called on vertices
1020  libmesh_assert_less(c.get_elem().get_node_index(&n),
1021  c.get_elem().n_vertices());
1022 
1023  // Handle offset from non-scalar components in previous variables
1024  libmesh_assert_less(i, this->component_to_var.size());
1025  unsigned int var = this->component_to_var[i];
1026 
1027  // Optimize for the common case, where this node was part of the
1028  // old solution.
1029  //
1030  // Be sure to handle cases where the variable wasn't defined on
1031  // this node (due to changing subdomain support) or where the
1032  // variable has no components on this node (due to Elem order
1033  // exceeding FE order) or where the old_dof_object dofs might
1034  // correspond to non-vertex dofs (due to extra_hanging_dofs and
1035  // refinement)
1036 
1037  const Elem::RefinementState flag = c.get_elem().refinement_flag();
1038 
1039  const DofObject * old_dof_object = n.get_old_dof_object();
1040  if (old_dof_object &&
1041  (!extra_hanging_dofs ||
1042  flag == Elem::JUST_COARSENED ||
1043  flag == Elem::DO_NOTHING) &&
1044  old_dof_object->n_vars(sys.number()) &&
1045  old_dof_object->n_comp(sys.number(), var))
1046  {
1047  const dof_id_type old_id =
1048  old_dof_object->dof_number(sys.number(), var, 0);
1049  return old_solution(old_id);
1050  }
1051 
1052  return this->eval_at_point(c, i, n, 0, false);
1053 }
const NumericVector< Number > & old_solution
RefinementState
Enumeration of possible element refinement states.
Definition: elem.h:1305
unsigned int number() const
Definition: system.h:2269
std::vector< unsigned int > component_to_var
uint8_t dof_id_type
Definition: id_types.h:67
Output eval_at_point(const FEMContext &c, unsigned int i, const Point &p, Real, bool skip_context_check)

◆ eval_at_node() [3/5]

template<>
Gradient libMesh::OldSolutionValue< Gradient, &FEMContext::point_value >::eval_at_node ( const FEMContext c,
unsigned int  i,
unsigned  int,
const Node n,
bool  extra_hanging_dofs,
Real   
)
inline

Definition at line 1059 of file generic_projector.h.

References dim, libMesh::Elem::DO_NOTHING, libMesh::DofObject::dof_number(), libMesh::FEMContext::get_elem(), libMesh::Elem::get_node_index(), libMesh::DofObject::get_old_dof_object(), libMesh::Elem::JUST_COARSENED, libMesh::make_range(), libMesh::DofObject::n_comp(), libMesh::DofObject::n_vars(), libMesh::Elem::n_vertices(), and libMesh::Elem::refinement_flag().

1065 {
1066  LOG_SCOPE ("Number eval_at_node()", "OldSolutionValue");
1067 
1068  // This should only be called on vertices
1069  libmesh_assert_less(c.get_elem().get_node_index(&n),
1070  c.get_elem().n_vertices());
1071 
1072  // Handle offset from non-scalar components in previous variables
1073  libmesh_assert_less(i, this->component_to_var.size());
1074  unsigned int var = this->component_to_var[i];
1075 
1076  // Optimize for the common case, where this node was part of the
1077  // old solution.
1078  //
1079  // Be sure to handle cases where the variable wasn't defined on
1080  // this node (due to changing subdomain support) or where the
1081  // variable has no components on this node (due to Elem order
1082  // exceeding FE order) or where the old_dof_object dofs might
1083  // correspond to non-vertex dofs (due to extra_hanging_dofs and
1084  // refinement)
1085 
1086  const auto & elem = c.get_elem();
1087 
1088  const Elem::RefinementState flag = elem.refinement_flag();
1089 
1090  const DofObject * old_dof_object = n.get_old_dof_object();
1091  if (old_dof_object &&
1092  (!extra_hanging_dofs ||
1093  flag == Elem::JUST_COARSENED ||
1094  flag == Elem::DO_NOTHING) &&
1095  old_dof_object->n_vars(sys.number()) &&
1096  old_dof_object->n_comp(sys.number(), var))
1097  {
1098  Gradient return_val;
1099 
1100  for (auto dim : make_range(elem.dim()))
1101  {
1102  const dof_id_type old_id =
1103  old_dof_object->dof_number(sys.number(), var, dim);
1104  return_val(dim) = old_solution(old_id);
1105  }
1106 
1107  return return_val;
1108  }
1109 
1110  return this->eval_at_point(c, i, n, 0, false);
1111 }
const NumericVector< Number > & old_solution
unsigned int dim
RefinementState
Enumeration of possible element refinement states.
Definition: elem.h:1305
unsigned int number() const
Definition: system.h:2269
NumberVectorValue Gradient
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:134
std::vector< unsigned int > component_to_var
uint8_t dof_id_type
Definition: id_types.h:67
Output eval_at_point(const FEMContext &c, unsigned int i, const Point &p, Real, bool skip_context_check)

◆ eval_at_node() [4/5]

template<>
Gradient libMesh::OldSolutionValue< Gradient, &FEMContext::point_gradient >::eval_at_node ( const FEMContext c,
unsigned int  i,
unsigned int  elem_dim,
const Node n,
bool  extra_hanging_dofs,
Real   
)
inline

Definition at line 1119 of file generic_projector.h.

References libMesh::Elem::DO_NOTHING, libMesh::DofObject::dof_number(), libMesh::FEMContext::get_elem(), libMesh::Elem::get_node_index(), libMesh::DofObject::get_old_dof_object(), libMesh::Elem::JUST_COARSENED, libMesh::DofObject::n_comp(), libMesh::DofObject::n_vars(), libMesh::Elem::n_vertices(), and libMesh::Elem::refinement_flag().

1125 {
1126  LOG_SCOPE ("Gradient eval_at_node()", "OldSolutionValue");
1127 
1128  // This should only be called on vertices
1129  libmesh_assert_less(c.get_elem().get_node_index(&n),
1130  c.get_elem().n_vertices());
1131 
1132  // Handle offset from non-scalar components in previous variables
1133  libmesh_assert_less(i, this->component_to_var.size());
1134  unsigned int var = this->component_to_var[i];
1135 
1136  // Optimize for the common case, where this node was part of the
1137  // old solution.
1138  //
1139  // Be sure to handle cases where the variable wasn't defined on
1140  // this node (due to changing subdomain support) or where the
1141  // variable has no components on this node (due to Elem order
1142  // exceeding FE order) or where the old_dof_object dofs might
1143  // correspond to non-vertex dofs (due to extra_hanging_dofs and
1144  // refinement)
1145 
1146  const Elem::RefinementState flag = c.get_elem().refinement_flag();
1147 
1148  const DofObject * old_dof_object = n.get_old_dof_object();
1149  if (old_dof_object &&
1150  (!extra_hanging_dofs ||
1151  flag == Elem::JUST_COARSENED ||
1152  flag == Elem::DO_NOTHING) &&
1153  old_dof_object->n_vars(sys.number()) &&
1154  old_dof_object->n_comp(sys.number(), var))
1155  {
1156  Gradient g;
1157  for (unsigned int d = 0; d != elem_dim; ++d)
1158  {
1159  const dof_id_type old_id =
1160  old_dof_object->dof_number(sys.number(), var, d+1);
1161  g(d) = old_solution(old_id);
1162  }
1163  return g;
1164  }
1165 
1166  return this->eval_at_point(c, i, n, 0, false);
1167 }
const NumericVector< Number > & old_solution
RefinementState
Enumeration of possible element refinement states.
Definition: elem.h:1305
unsigned int number() const
Definition: system.h:2269
NumberVectorValue Gradient
std::vector< unsigned int > component_to_var
uint8_t dof_id_type
Definition: id_types.h:67
Output eval_at_point(const FEMContext &c, unsigned int i, const Point &p, Real, bool skip_context_check)

◆ eval_at_node() [5/5]

template<>
Tensor libMesh::OldSolutionValue< Tensor, &FEMContext::point_gradient >::eval_at_node ( const FEMContext ,
unsigned  int,
unsigned  int,
const Node ,
bool  ,
Real   
)
inline

Definition at line 1173 of file generic_projector.h.

1179 {
1180  libmesh_error_msg("You shouldn't need to call eval_at_node for the gradient "
1181  "functor for a vector-valued finite element type");
1182  return Tensor();
1183 }
NumberTensorValue Tensor

◆ eval_at_point()

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
Output libMesh::OldSolutionValue< Output, point_output >::eval_at_point ( const FEMContext c,
unsigned int  i,
const Point p,
Real  ,
bool  skip_context_check 
)
inline

Definition at line 753 of file generic_projector.h.

758  {
759  LOG_SCOPE ("eval_at_point()", "OldSolutionValue");
760 
761  if (!skip_context_check)
762  if (!this->check_old_context(c, p))
763  return Output(0);
764 
765  // Handle offset from non-scalar components in previous variables
766  libmesh_assert_less(i, this->component_to_var.size());
767  unsigned int var = this->component_to_var[i];
768 
769  Output n;
770  (this->old_context.*point_output)(var, p, n, this->out_of_elem_tol);
771  return n;
772  }
void check_old_context(const FEMContext &c)
static const Real out_of_elem_tol
std::vector< unsigned int > component_to_var

◆ eval_mixed_derivatives() [1/2]

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
template<typename T = Output, typename std::enable_if< std::is_same< T, Number >::value, int >::type = 0>
void libMesh::OldSolutionValue< Output, point_output >::eval_mixed_derivatives ( const FEMContext libmesh_dbg_varc,
unsigned int  i,
unsigned int  dim,
const Node n,
std::vector< Output > &  derivs 
)
inline

Definition at line 776 of file generic_projector.h.

References dim, libMesh::DofObject::dof_number(), libMesh::DofObject::get_old_dof_object(), libMesh::Utility::iota(), libMesh::DofObject::n_comp(), and libMesh::DofObject::n_vars().

781  {
782  LOG_SCOPE ("eval_mixed_derivatives", "OldSolutionValue");
783 
784  // This should only be called on vertices
785  libmesh_assert_less(c.get_elem().get_node_index(&n),
786  c.get_elem().n_vertices());
787 
788  // Handle offset from non-scalar components in previous variables
789  libmesh_assert_less(i, this->component_to_var.size());
790  unsigned int var = this->component_to_var[i];
791 
792  // We have 1 mixed derivative in 2D, 4 in 3D
793  const unsigned int n_mixed = (dim-1) * (dim-1);
794  derivs.resize(n_mixed);
795 
796  // Be sure to handle cases where the variable wasn't defined on
797  // this node (e.g. due to changing subdomain support)
798  const DofObject * old_dof_object = n.get_old_dof_object();
799  if (old_dof_object &&
800  old_dof_object->n_vars(this->sys.number()) &&
801  old_dof_object->n_comp(this->sys.number(), var))
802  {
803  const dof_id_type first_old_id =
804  old_dof_object->dof_number(this->sys.number(), var, dim);
805  std::vector<dof_id_type> old_ids(n_mixed);
806  std::iota(old_ids.begin(), old_ids.end(), first_old_id);
807  old_solution.get(old_ids, derivs);
808  }
809  else
810  {
811  std::fill(derivs.begin(), derivs.end(), 0);
812  }
813  }
const NumericVector< Number > & old_solution
virtual void get(const std::vector< numeric_index_type > &index, T *values) const
Access multiple components at once.
unsigned int dim
void iota(ForwardIter first, ForwardIter last, T value)
Utility::iota was created back when std::iota was just an SGI STL extension.
Definition: utility.h:229
unsigned int number() const
Definition: system.h:2269
std::vector< unsigned int > component_to_var
uint8_t dof_id_type
Definition: id_types.h:67

◆ eval_mixed_derivatives() [2/2]

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
template<typename T = Output, typename std::enable_if<!std::is_same< T, Number >::value, int >::type = 0>
void libMesh::OldSolutionValue< Output, point_output >::eval_mixed_derivatives ( const FEMContext ,
unsigned  int,
unsigned  int,
const Node ,
std::vector< Output > &   
)
inline

Definition at line 817 of file generic_projector.h.

819  {
820  libmesh_error_msg("eval_mixed_derivatives should only be applicable for Hermite finite element "
821  "types. I don't know how you got here");
822  }

◆ eval_old_dofs() [1/2]

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
void libMesh::OldSolutionValue< Output, point_output >::eval_old_dofs ( const Elem elem,
unsigned int  node_num,
unsigned int  var_num,
std::vector< dof_id_type > &  indices,
std::vector< DofValueType > &  values 
)
inline

Definition at line 824 of file generic_projector.h.

References libMesh::index_range(), and libMesh::DofObject::invalid_id.

829  {
830  LOG_SCOPE ("eval_old_dofs(node)", "OldSolutionValue");
831 
832  // We may be reusing a std::vector here, but the following
833  // dof_indices call appends without first clearing.
834  indices.clear();
835 
836  this->sys.get_dof_map().dof_indices(elem, node_num, indices, var_num);
837 
838  std::vector<dof_id_type> old_indices;
839 
840  this->sys.get_dof_map().old_dof_indices(elem, node_num, old_indices, var_num);
841 
842  libmesh_assert_equal_to (old_indices.size(), indices.size());
843 
844  // We may have invalid_id in cases where no old DoF existed, e.g.
845  // due to expansion of a subdomain-restricted variable's subdomain
846  bool invalid_old_index = false;
847  for (const auto & di : old_indices)
848  if (di == DofObject::invalid_id)
849  invalid_old_index = true;
850 
851  values.resize(old_indices.size());
852  if (invalid_old_index)
853  {
854  for (auto i : index_range(old_indices))
855  {
856  const dof_id_type di = old_indices[i];
857  if (di == DofObject::invalid_id)
858  values[i] = 0;
859  else
860  values[i] = old_solution(di);
861  }
862  }
863  else
864  old_solution.get(old_indices, values);
865  }
const NumericVector< Number > & old_solution
virtual void get(const std::vector< numeric_index_type > &index, T *values) const
Access multiple components at once.
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Fills the vector di with the global degree of freedom indices for the element.
Definition: dof_map.C:1992
static const dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:477
const DofMap & get_dof_map() const
Definition: system.h:2293
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111
void old_dof_indices(const Elem &elem, unsigned int n, std::vector< dof_id_type > &di, const unsigned int vn) const
Appends to the vector di the old global degree of freedom indices for elem.node_ref(n), for one variable vn.
Definition: dof_map.C:2283
uint8_t dof_id_type
Definition: id_types.h:67

◆ eval_old_dofs() [2/2]

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
void libMesh::OldSolutionValue< Output, point_output >::eval_old_dofs ( const Elem elem,
const FEType fe_type,
unsigned int  sys_num,
unsigned int  var_num,
std::vector< dof_id_type > &  indices,
std::vector< DofValueType > &  values 
)
inline

Definition at line 868 of file generic_projector.h.

References libMesh::DofObject::dof_number(), libMesh::DofObject::get_old_dof_object_ref(), libMesh::DofObject::invalid_id, libMesh::Elem::JUST_REFINED, libMesh::DofObject::n_comp_group(), libMesh::FEInterface::n_dofs_per_elem(), libMesh::DofObject::n_systems(), libMesh::Elem::parent(), libMesh::Elem::refinement_flag(), and libMesh::DofObject::var_to_vg_and_offset().

874  {
875  LOG_SCOPE ("eval_old_dofs(elem)", "OldSolutionValue");
876 
877  // We're only to be asked for old dofs on elements that can copy
878  // them through DO_NOTHING or through refinement.
879  const Elem & old_elem =
880  (elem.refinement_flag() == Elem::JUST_REFINED) ?
881  *elem.parent() : elem;
882 
883  // If there are any element-based DOF numbers, get them
884  const unsigned int nc = FEInterface::n_dofs_per_elem(fe_type, &elem);
885 
886  indices.resize(nc);
887 
888  // We should never have fewer dofs than necessary on an
889  // element unless we're getting indices on a parent element,
890  // which we should never need, or getting indices on a newly
891  // expanded subdomain, in which case we initialize new values to
892  // zero.
893  if (nc != 0)
894  {
895  const DofObject & old_dof_object = old_elem.get_old_dof_object_ref();
896  libmesh_assert_greater(elem.n_systems(), sys_num);
897 
898  const std::pair<unsigned int, unsigned int>
899  vg_and_offset = elem.var_to_vg_and_offset(sys_num,var_num);
900  const unsigned int vg = vg_and_offset.first;
901  const unsigned int vig = vg_and_offset.second;
902 
903  unsigned int n_comp = old_dof_object.n_comp_group(sys_num,vg);
904  n_comp = std::min(n_comp, nc);
905 
906  std::vector<dof_id_type> old_dof_indices(n_comp);
907 
908  for (unsigned int i=0; i != n_comp; ++i)
909  {
910  const dof_id_type d_old =
911  old_dof_object.dof_number(sys_num, vg, vig, i, n_comp);
912  const dof_id_type d_new =
913  elem.dof_number(sys_num, vg, vig, i, n_comp);
914  libmesh_assert_not_equal_to (d_old, DofObject::invalid_id);
915  libmesh_assert_not_equal_to (d_new, DofObject::invalid_id);
916 
917  old_dof_indices[i] = d_old;
918  indices[i] = d_new;
919  }
920 
921  values.resize(n_comp);
922  old_solution.get(old_dof_indices, values);
923 
924  for (unsigned int i=n_comp; i != nc; ++i)
925  {
926  const dof_id_type d_new =
927  elem.dof_number(sys_num, vg, vig, i, n_comp);
928  libmesh_assert_not_equal_to (d_new, DofObject::invalid_id);
929  indices[i] = d_new;
930  }
931 
932  values.resize(nc, 0);
933  }
934  else
935  values.clear();
936  }
static unsigned int n_dofs_per_elem(const unsigned int dim, const FEType &fe_t, const ElemType t)
Definition: fe_interface.C:772
const NumericVector< Number > & old_solution
virtual void get(const std::vector< numeric_index_type > &index, T *values) const
Access multiple components at once.
static const dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:477
uint8_t dof_id_type
Definition: id_types.h:67

◆ get_shape_outputs() [1/9]

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
static void libMesh::OldSolutionBase< Output, point_output >::get_shape_outputs ( FEAbstract fe)
staticinherited

◆ get_shape_outputs() [2/9]

template<>
void libMesh::OldSolutionBase< Number, &FEMContext::point_value >::get_shape_outputs ( FEAbstract fe)
inlineinherited

Definition at line 944 of file generic_projector.h.

References libMesh::FEAbstract::request_phi().

945 {
946  fe.request_phi();
947 }

◆ get_shape_outputs() [3/9]

template<>
void libMesh::OldSolutionBase< Gradient, &FEMContext::point_gradient >::get_shape_outputs ( FEAbstract fe)
inlineinherited

Definition at line 952 of file generic_projector.h.

References libMesh::FEAbstract::request_dphi().

953 {
954  fe.request_dphi();
955 }

◆ get_shape_outputs() [4/9]

template<>
void libMesh::OldSolutionBase< Gradient, &FEMContext::point_value >::get_shape_outputs ( FEAbstract fe)
inlineinherited

Definition at line 959 of file generic_projector.h.

References libMesh::FEAbstract::request_phi().

960 {
961  fe.request_phi();
962 }

◆ get_shape_outputs() [5/9]

template<>
void libMesh::OldSolutionBase< Tensor, &FEMContext::point_gradient >::get_shape_outputs ( FEAbstract fe)
inlineinherited

Definition at line 967 of file generic_projector.h.

References libMesh::FEAbstract::request_dphi().

968 {
969  fe.request_dphi();
970 }

◆ get_shape_outputs() [6/9]

template<>
void libMesh::OldSolutionBase< Real, &FEMContext::point_value >::get_shape_outputs ( FEAbstract fe)
inlineinherited

Definition at line 976 of file generic_projector.h.

References libMesh::FEAbstract::request_phi().

977 {
978  fe.request_phi();
979 }

◆ get_shape_outputs() [7/9]

template<>
void libMesh::OldSolutionBase< RealGradient, &FEMContext::point_gradient >::get_shape_outputs ( FEAbstract fe)
inlineinherited

Definition at line 984 of file generic_projector.h.

References libMesh::FEAbstract::request_dphi().

985 {
986  fe.request_dphi();
987 }

◆ get_shape_outputs() [8/9]

template<>
void libMesh::OldSolutionBase< RealGradient, &FEMContext::point_value >::get_shape_outputs ( FEAbstract fe)
inlineinherited

Definition at line 991 of file generic_projector.h.

References libMesh::FEAbstract::request_phi().

992 {
993  fe.request_phi();
994 }

◆ get_shape_outputs() [9/9]

template<>
void libMesh::OldSolutionBase< RealTensor, &FEMContext::point_gradient >::get_shape_outputs ( FEAbstract fe)
inlineinherited

Definition at line 999 of file generic_projector.h.

References libMesh::FEAbstract::request_dphi().

1000 {
1001  fe.request_dphi();
1002 }

◆ init_context()

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
void libMesh::OldSolutionBase< Output, point_output >::init_context ( FEMContext c)
inlineinherited

Definition at line 567 of file generic_projector.h.

References dim, libMesh::FEMContext::DOFS_ONLY, libMesh::make_range(), and libMesh::FEMContext::set_algebraic_type().

568  {
569  c.set_algebraic_type(FEMContext::DOFS_ONLY);
570 
571  const std::set<unsigned char> & elem_dims =
573 
574  // Loop over variables and dimensions, to prerequest
575  for (const auto & dim : elem_dims)
576  {
577  FEAbstract * fe = nullptr;
578  if (old_context.active_vars())
579  for (auto var : *old_context.active_vars())
580  {
581  old_context.get_element_fe(var, fe, dim);
582  get_shape_outputs(*fe);
583  }
584  else
585  for (auto var : make_range(sys.n_vars()))
586  {
587  old_context.get_element_fe(var, fe, dim);
588  get_shape_outputs(*fe);
589  }
590  }
591  }
unsigned int dim
static void get_shape_outputs(FEAbstract &fe)
const std::vector< unsigned int > * active_vars() const
Return a pointer to the vector of active variables being computed for, or a null pointer if all varia...
Definition: fem_context.h:1034
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:134
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
unsigned int n_vars() const
Definition: system.h:2349
const std::set< unsigned char > & elem_dimensions() const
Definition: fem_context.h:951

◆ is_grid_projection()

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
bool libMesh::OldSolutionBase< Output, point_output >::is_grid_projection ( )
inlineinherited

Definition at line 593 of file generic_projector.h.

593 { return true; }

Member Data Documentation

◆ component_to_var

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
std::vector<unsigned int> libMesh::OldSolutionBase< Output, point_output >::component_to_var
protectedinherited

Definition at line 700 of file generic_projector.h.

◆ last_elem

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
const Elem* libMesh::OldSolutionBase< Output, point_output >::last_elem
protectedinherited

Definition at line 697 of file generic_projector.h.

◆ old_context

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
FEMContext libMesh::OldSolutionBase< Output, point_output >::old_context
protectedinherited

Definition at line 699 of file generic_projector.h.

◆ old_solution

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
const NumericVector<Number>& libMesh::OldSolutionValue< Output, point_output >::old_solution
private

Definition at line 939 of file generic_projector.h.

◆ out_of_elem_tol

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
const Real libMesh::OldSolutionBase< Output, point_output >::out_of_elem_tol = 10 * TOLERANCE
staticprotectedinherited

Definition at line 702 of file generic_projector.h.

◆ sys

template<typename Output, void(FEMContext::*)(unsigned int, const Point &, Output &, const Real) const point_output>
const System& libMesh::OldSolutionBase< Output, point_output >::sys
protectedinherited

Definition at line 698 of file generic_projector.h.


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