libMesh
Loading...
Searching...
No Matches
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)
 
Number eval_at_node (const FEMContext &c, unsigned int i, unsigned int, const Node &n, bool extra_hanging_dofs, Real)
 
Gradient eval_at_node (const FEMContext &c, unsigned int i, unsigned int, const Node &n, bool extra_hanging_dofs, Real)
 
Gradient eval_at_node (const FEMContext &c, unsigned int i, unsigned int elem_dim, const Node &n, bool extra_hanging_dofs, Real)
 
Tensor eval_at_node (const FEMContext &, unsigned int, unsigned int, const Node &, bool, Real)
 
void get_shape_outputs (FEAbstract &fe)
 
void get_shape_outputs (FEAbstract &fe)
 
void get_shape_outputs (FEAbstract &fe)
 
void get_shape_outputs (FEAbstract &fe)
 
void get_shape_outputs (FEAbstract &fe)
 
void get_shape_outputs (FEAbstract &fe)
 
void get_shape_outputs (FEAbstract &fe)
 
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 732 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 540 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 737 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 542 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 738 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 740 of file generic_projector.h.

742 :
743 OldSolutionBase<Output, point_output>(sys_in, vars),
744 old_solution(old_sol)
745 {
748 }
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.
void set_algebraic_type(const AlgebraicType atype)
Setting which determines whether to initialize algebraic structures (elem_*) on each element and set ...
const NumericVector< Number > & old_solution

References libMesh::FEMContext::OLD.

◆ 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 750 of file generic_projector.h.

750 :
751 OldSolutionBase<Output, point_output>(in.sys, in.old_context.active_vars()),
752 old_solution(in.old_solution)
753 {
756 }

References libMesh::FEMContext::OLD.

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 609 of file generic_projector.h.

610 {
611 LOG_SCOPE ("check_old_context(c)", "OldSolutionBase");
612 const Elem & elem = c.get_elem();
613 if (last_elem != &elem)
614 {
615 if (elem.refinement_flag() == Elem::JUST_REFINED)
616 {
617 old_context.pre_fe_reinit(sys, elem.parent());
618 }
619 else if (elem.refinement_flag() == Elem::JUST_COARSENED)
620 {
621 libmesh_error();
622 }
623 else
624 {
625 if (!elem.get_old_dof_object())
626 {
627 libmesh_error();
628 }
629
631 }
632
633 last_elem = &elem;
634 }
635 else
636 {
638 }
639 }
@ JUST_COARSENED
Definition elem.h:1450
virtual void pre_fe_reinit(const System &, const Elem *e)
Reinitializes local data vectors/matrices on the current geometric element.
bool has_elem() const
Test for current Elem object.
libmesh_assert(ctx)

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().

◆ 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 642 of file generic_projector.h.

643 {
644 LOG_SCOPE ("check_old_context(c,p)", "OldSolutionBase");
645 const Elem & elem = c.get_elem();
646 if (last_elem != &elem)
647 {
648 if (elem.refinement_flag() == Elem::JUST_REFINED)
649 {
650 old_context.pre_fe_reinit(sys, elem.parent());
651 }
652 else if (elem.refinement_flag() == Elem::JUST_COARSENED)
653 {
654 // Find the child with this point. Use out_of_elem_tol
655 // (in physical space, which may correspond to a large
656 // tolerance in master space!) to allow for out-of-element
657 // finite differencing of mixed gradient terms. Pray we
658 // have no quadrature locations which are within 1e-5 of
659 // the element subdivision boundary but are not exactly on
660 // that boundary.
661 const Real master_tol = out_of_elem_tol / elem.hmax() * 2;
662
663 for (auto & child : elem.child_ref_range())
664 if (child.close_to_point(p, master_tol))
665 {
667 break;
668 }
669
671 (old_context.get_elem().close_to_point(p, master_tol));
672 }
673 else
674 {
675 if (!elem.get_old_dof_object())
676 return false;
677
679 }
680
681 last_elem = &elem;
682 }
683 else
684 {
686
687 const Real master_tol = out_of_elem_tol / elem.hmax() * 2;
688
689 if (!old_context.get_elem().close_to_point(p, master_tol))
690 {
691 libmesh_assert_equal_to
692 (elem.refinement_flag(), Elem::JUST_COARSENED);
693
694 for (auto & child : elem.child_ref_range())
695 if (child.close_to_point(p, master_tol))
696 {
698 break;
699 }
700
702 (old_context.get_elem().close_to_point(p, master_tol));
703 }
704 }
705
706 return true;
707 }
virtual bool close_to_point(const Point &p, Real tol) const
Definition elem.C:2809
const Elem & get_elem() const
Accessor for current Elem object.
static const Real out_of_elem_tol
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

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().

◆ eval_at_node() [1/5]

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

Definition at line 1185 of file generic_projector.h.

1192{
1193 libmesh_error_msg("You shouldn't need to call eval_at_node for the gradient "
1194 "functor for a vector-valued finite element type");
1195 return Tensor();
1196}
NumberTensorValue Tensor

◆ eval_at_node() [2/5]

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 1131 of file generic_projector.h.

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

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().

◆ eval_at_node() [3/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() [4/5]

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 1022 of file generic_projector.h.

1029{
1030 LOG_SCOPE ("Number eval_at_node()", "OldSolutionValue");
1031
1032 // This should only be called on vertices
1033 libmesh_assert_less(c.get_elem().get_node_index(&n),
1034 c.get_elem().n_vertices());
1035
1036 // Handle offset from non-scalar components in previous variables
1037 libmesh_assert_less(i, this->component_to_var.size());
1038 unsigned int var = this->component_to_var[i];
1039
1040 // Optimize for the common case, where this node was part of the
1041 // old solution.
1042 //
1043 // Be sure to handle cases where the variable wasn't defined on
1044 // this node (due to changing subdomain support) or where the
1045 // variable has no components on this node (due to Elem order
1046 // exceeding FE order) or where the old_dof_object dofs might
1047 // correspond to non-vertex dofs (due to extra_hanging_dofs and
1048 // refinement)
1049
1050 const Elem::RefinementState flag = c.get_elem().refinement_flag();
1051
1052 const DofObject * old_dof_object = n.get_old_dof_object();
1053 if (old_dof_object &&
1054 (!extra_hanging_dofs ||
1055 flag == Elem::JUST_COARSENED ||
1056 flag == Elem::DO_NOTHING) &&
1057 old_dof_object->n_vars(sys.number()) &&
1058 old_dof_object->n_comp(sys.number(), var))
1059 {
1060 const dof_id_type old_id =
1061 old_dof_object->dof_number(sys.number(), var, 0);
1062 return old_solution(old_id);
1063 }
1064
1065 return this->eval_at_point(c, i, n, 0, false);
1066}

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().

◆ eval_at_node() [5/5]

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 1071 of file generic_projector.h.

1078{
1079 LOG_SCOPE ("Number eval_at_node()", "OldSolutionValue");
1080
1081 // This should only be called on vertices
1082 libmesh_assert_less(c.get_elem().get_node_index(&n),
1083 c.get_elem().n_vertices());
1084
1085 // Handle offset from non-scalar components in previous variables
1086 libmesh_assert_less(i, this->component_to_var.size());
1087 unsigned int var = this->component_to_var[i];
1088
1089 // Optimize for the common case, where this node was part of the
1090 // old solution.
1091 //
1092 // Be sure to handle cases where the variable wasn't defined on
1093 // this node (due to changing subdomain support) or where the
1094 // variable has no components on this node (due to Elem order
1095 // exceeding FE order) or where the old_dof_object dofs might
1096 // correspond to non-vertex dofs (due to extra_hanging_dofs and
1097 // refinement)
1098
1099 const auto & elem = c.get_elem();
1100
1101 const Elem::RefinementState flag = elem.refinement_flag();
1102
1103 const DofObject * old_dof_object = n.get_old_dof_object();
1104 if (old_dof_object &&
1105 (!extra_hanging_dofs ||
1106 flag == Elem::JUST_COARSENED ||
1107 flag == Elem::DO_NOTHING) &&
1108 old_dof_object->n_vars(sys.number()) &&
1109 old_dof_object->n_comp(sys.number(), var))
1110 {
1111 Gradient return_val;
1112
1113 for (auto dim : make_range(elem.dim()))
1114 {
1115 const dof_id_type old_id =
1116 old_dof_object->dof_number(sys.number(), var, dim);
1117 return_val(dim) = old_solution(old_id);
1118 }
1119
1120 return return_val;
1121 }
1122
1123 return this->eval_at_point(c, i, n, 0, false);
1124}
unsigned int dim
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

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().

◆ 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 766 of file generic_projector.h.

771 {
772 LOG_SCOPE ("eval_at_point()", "OldSolutionValue");
773
774 if (!skip_context_check)
775 if (!this->check_old_context(c, p))
776 return Output(0);
777
778 // Handle offset from non-scalar components in previous variables
779 libmesh_assert_less(i, this->component_to_var.size());
780 unsigned int var = this->component_to_var[i];
781
782 Output n;
783 (this->old_context.*point_output)(var, p, n, this->out_of_elem_tol);
784 return n;
785 }
void check_old_context(const FEMContext &c)

◆ 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 ,
unsigned int  ,
unsigned int  ,
const Node ,
std::vector< Output > &   
)
inline

Definition at line 830 of file generic_projector.h.

832 {
833 libmesh_error_msg("eval_mixed_derivatives should only be applicable for Hermite finite element "
834 "types. I don't know how you got here");
835 }

◆ 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 libmesh_dbg_varc,
unsigned int  i,
unsigned int  dim,
const Node n,
std::vector< Output > &  derivs 
)
inline

Definition at line 789 of file generic_projector.h.

794 {
795 LOG_SCOPE ("eval_mixed_derivatives", "OldSolutionValue");
796
797 // This should only be called on vertices
798 libmesh_assert_less(c.get_elem().get_node_index(&n),
799 c.get_elem().n_vertices());
800
801 // Handle offset from non-scalar components in previous variables
802 libmesh_assert_less(i, this->component_to_var.size());
803 unsigned int var = this->component_to_var[i];
804
805 // We have 1 mixed derivative in 2D, 4 in 3D
806 const unsigned int n_mixed = (dim-1) * (dim-1);
807 derivs.resize(n_mixed);
808
809 // Be sure to handle cases where the variable wasn't defined on
810 // this node (e.g. due to changing subdomain support)
811 const DofObject * old_dof_object = n.get_old_dof_object();
812 if (old_dof_object &&
813 old_dof_object->n_vars(this->sys.number()) &&
814 old_dof_object->n_comp(this->sys.number(), var))
815 {
816 const dof_id_type first_old_id =
817 old_dof_object->dof_number(this->sys.number(), var, dim);
818 std::vector<dof_id_type> old_ids(n_mixed);
819 std::iota(old_ids.begin(), old_ids.end(), first_old_id);
820 old_solution.get(old_ids, derivs);
821 }
822 else
823 {
824 std::fill(derivs.begin(), derivs.end(), 0);
825 }
826 }
virtual void get(const std::vector< numeric_index_type > &index, T *values) const
Access multiple components at once.

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

◆ 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,
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 881 of file generic_projector.h.

887 {
888 LOG_SCOPE ("eval_old_dofs(elem)", "OldSolutionValue");
889
890 // We're only to be asked for old dofs on elements that can copy
891 // them through DO_NOTHING or through refinement.
892 const Elem & old_elem =
893 (elem.refinement_flag() == Elem::JUST_REFINED) ?
894 *elem.parent() : elem;
895
896 // If there are any element-based DOF numbers, get them
897 const unsigned int nc = FEInterface::n_dofs_per_elem(fe_type, &elem);
898
899 indices.resize(nc);
900
901 // We should never have fewer dofs than necessary on an
902 // element unless we're getting indices on a parent element,
903 // which we should never need, or getting indices on a newly
904 // expanded subdomain, in which case we initialize new values to
905 // zero.
906 if (nc != 0)
907 {
908 const DofObject & old_dof_object = old_elem.get_old_dof_object_ref();
909 libmesh_assert_greater(elem.n_systems(), sys_num);
910
911 const std::pair<unsigned int, unsigned int>
912 vg_and_offset = elem.var_to_vg_and_offset(sys_num,var_num);
913 const unsigned int vg = vg_and_offset.first;
914 const unsigned int vig = vg_and_offset.second;
915
916 unsigned int n_comp = old_dof_object.n_comp_group(sys_num,vg);
917 n_comp = std::min(n_comp, nc);
918
919 std::vector<dof_id_type> old_dof_indices(n_comp);
920
921 for (unsigned int i=0; i != n_comp; ++i)
922 {
923 const dof_id_type d_old =
924 old_dof_object.dof_number(sys_num, vg, vig, i, n_comp);
925 const dof_id_type d_new =
926 elem.dof_number(sys_num, vg, vig, i, n_comp);
927 libmesh_assert_not_equal_to (d_old, DofObject::invalid_id);
928 libmesh_assert_not_equal_to (d_new, DofObject::invalid_id);
929
930 old_dof_indices[i] = d_old;
931 indices[i] = d_new;
932 }
933
934 values.resize(n_comp);
935 old_solution.get(old_dof_indices, values);
936
937 for (unsigned int i=n_comp; i != nc; ++i)
938 {
939 const dof_id_type d_new =
940 elem.dof_number(sys_num, vg, vig, i, n_comp);
941 libmesh_assert_not_equal_to (d_new, DofObject::invalid_id);
942 indices[i] = d_new;
943 }
944
945 values.resize(nc, 0);
946 }
947 else
948 values.clear();
949 }
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition dof_object.h:473
static unsigned int n_dofs_per_elem(const unsigned int dim, const FEType &fe_t, const ElemType t)

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().

◆ 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,
unsigned int  node_num,
unsigned int  var_num,
std::vector< dof_id_type > &  indices,
std::vector< DofValueType > &  values 
)
inline

Definition at line 837 of file generic_projector.h.

842 {
843 LOG_SCOPE ("eval_old_dofs(node)", "OldSolutionValue");
844
845 // We may be reusing a std::vector here, but the following
846 // dof_indices call appends without first clearing.
847 indices.clear();
848
849 this->sys.get_dof_map().dof_indices(elem, node_num, indices, var_num);
850
851 std::vector<dof_id_type> old_indices;
852
853 this->sys.get_dof_map().old_dof_indices(elem, node_num, old_indices, var_num);
854
855 libmesh_assert_equal_to (old_indices.size(), indices.size());
856
857 // We may have invalid_id in cases where no old DoF existed, e.g.
858 // due to expansion of a subdomain-restricted variable's subdomain
859 bool invalid_old_index = false;
860 for (const auto & di : old_indices)
861 if (di == DofObject::invalid_id)
862 invalid_old_index = true;
863
864 values.resize(old_indices.size());
865 if (invalid_old_index)
866 {
867 for (auto i : index_range(old_indices))
868 {
869 const dof_id_type di = old_indices[i];
870 if (di == DofObject::invalid_id)
871 values[i] = 0;
872 else
873 values[i] = old_solution(di);
874 }
875 }
876 else
877 old_solution.get(old_indices, values);
878 }
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Definition dof_map.C:2201
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),...
Definition dof_map.C:2478
const DofMap & get_dof_map() const
Definition system.h:2417
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:153

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

◆ 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]

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

Definition at line 957 of file generic_projector.h.

958{
959 fe.request_phi();
960}

References libMesh::FEAbstract::request_phi().

◆ get_shape_outputs() [3/9]

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

Definition at line 965 of file generic_projector.h.

966{
967 fe.request_dphi();
968}

References libMesh::FEAbstract::request_dphi().

◆ get_shape_outputs() [4/9]

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

Definition at line 972 of file generic_projector.h.

973{
974 fe.request_phi();
975}

References libMesh::FEAbstract::request_phi().

◆ get_shape_outputs() [5/9]

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

Definition at line 980 of file generic_projector.h.

981{
982 fe.request_dphi();
983}

References libMesh::FEAbstract::request_dphi().

◆ get_shape_outputs() [6/9]

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

Definition at line 989 of file generic_projector.h.

990{
991 fe.request_phi();
992}

References libMesh::FEAbstract::request_phi().

◆ get_shape_outputs() [7/9]

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

Definition at line 997 of file generic_projector.h.

998{
999 fe.request_dphi();
1000}

References libMesh::FEAbstract::request_dphi().

◆ get_shape_outputs() [8/9]

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

Definition at line 1004 of file generic_projector.h.

1005{
1006 fe.request_phi();
1007}

References libMesh::FEAbstract::request_phi().

◆ get_shape_outputs() [9/9]

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

Definition at line 1012 of file generic_projector.h.

1013{
1014 fe.request_dphi();
1015}

References libMesh::FEAbstract::request_dphi().

◆ 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 580 of file generic_projector.h.

581 {
582 c.set_algebraic_type(FEMContext::DOFS_ONLY);
583
584 const std::set<unsigned char> & elem_dims =
586
587 // Loop over variables and dimensions, to prerequest
588 for (const auto & dim : elem_dims)
589 {
590 FEAbstract * fe = nullptr;
592 for (auto var : *old_context.active_vars())
593 {
596 }
597 else
598 for (auto var : make_range(sys.n_vars()))
599 {
602 }
603 }
604 }
unsigned int n_vars
const std::set< unsigned char > & elem_dimensions() const
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...
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.
static void get_shape_outputs(FEAbstract &fe)

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

◆ 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 606 of file generic_projector.h.

606{ 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 713 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 710 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 712 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 952 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 715 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 711 of file generic_projector.h.


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