SpECTRE  v2022.10.04
Adaptive Mesh Refinement

Functions and classes specific to hp-adaptive mesh refinement. More...

Namespaces

namespace  amr
 Items for adaptive mesh refinement.
 
namespace  amr::domain
 Domain-dependent items for adaptive mesh refinement.
 
namespace  amr::Criteria
 Criteria for deciding how a mesh should be adapted.
 

Classes

class  amr::Criterion
 Base class for something that determines how an adaptive mesh should be changed. More...
 

Enumerations

enum class  amr::domain::Flag {
  amr::domain::Flag::Undefined , amr::domain::Flag::Join , amr::domain::Flag::DecreaseResolution , amr::domain::Flag::DoNothing ,
  amr::domain::Flag::IncreaseResolution , amr::domain::Flag::Split
}
 Flags that represent decisions about mesh refinement. More...
 

Functions

template<size_t VolumeDim>
std::array< size_t, VolumeDim > amr::domain::desired_refinement_levels (const ElementId< VolumeDim > &id, const std::array< Flag, VolumeDim > &flags)
 Computes the desired refinement level of the Element with ElementId id given the desired amr::Flags flags
 
template<size_t VolumeDim>
std::array< size_t, VolumeDim > amr::domain::desired_refinement_levels_of_neighbor (const ElementId< VolumeDim > &neighbor_id, const std::array< Flag, VolumeDim > &neighbor_flags, const OrientationMap< VolumeDim > &orientation)
 Computes the desired refinement level of a neighboring Element with ElementId neighbor_id given its desired amr::Flags neighbor_flags taking into account the OrientationMap orientation of the neighbor. More...
 
template<size_t VolumeDim>
bool amr::domain::has_potential_sibling (const ElementId< VolumeDim > &element_id, const Direction< VolumeDim > &direction)
 Whether or not the Element with element_id can have a sibling in the given direction
 
template<size_t VolumeDim>
bool amr::domain::update_amr_decision (gsl::not_null< std::array< Flag, VolumeDim > * > my_current_amr_flags, const Element< VolumeDim > &element, const ElementId< VolumeDim > &neighbor_id, const std::array< Flag, VolumeDim > &neighbor_amr_flags)
 Updates the AMR decisions my_current_amr_flags of the Element element based on the AMR decisions neighbor_amr_flags of a neighbor Element with ElementId neighbor_id. More...
 

Detailed Description

Functions and classes specific to hp-adaptive mesh refinement.

Enumeration Type Documentation

◆ Flag

enum class amr::domain::Flag
strong

Flags that represent decisions about mesh refinement.

In order to support anisotropic mesh refinement, a flag is specified for each dimension.

Enumerator
Undefined 

used to initialize flags before a decision is made

Join 

join the sibling of an Element

DecreaseResolution 

decrease number of points in an Element

DoNothing 

stay the same

IncreaseResolution 

increase number of points in an Element

Split 

split the Element into two smaller elements

Function Documentation

◆ desired_refinement_levels_of_neighbor()

template<size_t VolumeDim>
std::array< size_t, VolumeDim > amr::domain::desired_refinement_levels_of_neighbor ( const ElementId< VolumeDim > &  neighbor_id,
const std::array< Flag, VolumeDim > &  neighbor_flags,
const OrientationMap< VolumeDim > &  orientation 
)

Computes the desired refinement level of a neighboring Element with ElementId neighbor_id given its desired amr::Flags neighbor_flags taking into account the OrientationMap orientation of the neighbor.

Details

The OrientationMap orientation is that from the Element that has a neighbor with ElementId neighbor_id

◆ update_amr_decision()

template<size_t VolumeDim>
bool amr::domain::update_amr_decision ( gsl::not_null< std::array< Flag, VolumeDim > * >  my_current_amr_flags,
const Element< VolumeDim > &  element,
const ElementId< VolumeDim > &  neighbor_id,
const std::array< Flag, VolumeDim > &  neighbor_amr_flags 
)

Updates the AMR decisions my_current_amr_flags of the Element element based on the AMR decisions neighbor_amr_flags of a neighbor Element with ElementId neighbor_id.

Details

This function is called by each element when it receives the AMR decisions of one of its neighbors. If any of its flags are updated, the element should send its new decisions to each of its neighbors. The following changes are made to the current flags of the element:

  • If the neighbor wants to be two or more refinement levels higher than the element, the flag is updated to bring the element to within one level
  • If the element wants to join, and the neighbor is a potential sibling but wants to be at a different refinement level in any dimension, the flag is updated to not do h-refinement.

Returns: true if any flag is changed

Note
Modifies my_current_amr_flags which are the AMR decisions of element.