libMesh
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
libMesh::OldSolutionBase< Output, point_output > Class Template Reference

The OldSolutionBase input functor abstract base class is the root of the OldSolutionValue and OldSolutionCoefs classes which allow a GenericProjector to read old solution values or solution interpolation coefficients for a just-refined-and-coarsened mesh. More...

#include <generic_projector.h>

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

Public Types

typedef TensorTools::MakeReal< Output >::type RealType
 

Public Member Functions

 OldSolutionBase (const libMesh::System &sys_in, const std::vector< unsigned int > *vars)
 
 OldSolutionBase (const OldSolutionBase &in)
 
void init_context (FEMContext &c)
 
bool is_grid_projection ()
 
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)
 

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
 

Detailed Description

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

The OldSolutionBase input functor abstract base class is the root of the OldSolutionValue and OldSolutionCoefs classes which allow a GenericProjector to read old solution values or solution interpolation coefficients for a just-refined-and-coarsened mesh.

Author
Roy H. Stogner
Date
2016

Definition at line 537 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
protected

Definition at line 540 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

Definition at line 542 of file generic_projector.h.

Constructor & Destructor Documentation

◆ OldSolutionBase() [1/2]

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

Definition at line 544 of file generic_projector.h.

545 :
546 last_elem(nullptr),
547 sys(sys_in),
548 old_context(sys_in, vars, /* allocate_local_matrices= */ false)
549 {
550 // We'll be queried for components but we'll typically be looking
551 // up data by variables, and those indices don't always match
552 auto make_lookup = [this](unsigned int v)
553 {
554 const unsigned int vcomp = sys.variable_scalar_number(v,0);
555 if (vcomp >= component_to_var.size())
556 component_to_var.resize(vcomp+1, static_cast<unsigned int>(-1));
557 component_to_var[vcomp] = v;
558 };
559
560 if (vars)
561 for (auto v : *vars)
562 make_lookup(v);
563 else
564 for (auto v : make_range(sys.n_vars()))
565 make_lookup(v);
566 }
unsigned int n_vars
std::vector< unsigned int > component_to_var
unsigned int variable_scalar_number(std::string_view var, unsigned int component) const
Definition system.h:2474
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 libMesh::make_range().

◆ OldSolutionBase() [2/2]

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

Definition at line 568 of file generic_projector.h.

568 :
569 last_elem(nullptr),
570 sys(in.sys),
571 old_context(sys, in.old_context.active_vars(), /* allocate_local_matrices= */ false),
572 component_to_var(in.component_to_var)
573 {
574 }

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)
inlineprotected

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 
)
inlineprotected

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

◆ 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)
static

◆ get_shape_outputs() [2/9]

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

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)
inline

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)
inline

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)
inline

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)
inline

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)
inline

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)
inline

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)
inline

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)
inline

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 dim
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 ( )
inline

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
protected

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
protected

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
protected

Definition at line 712 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
staticprotected

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
protected

Definition at line 711 of file generic_projector.h.


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