libMesh
Loading...
Searching...
No Matches
Public Member Functions | List of all members
libMesh::PeriodicBoundaries Class Reference

We're using a class instead of a typedef to allow forward declarations and future flexibility. More...

#include <periodic_boundaries.h>

Inheritance diagram for libMesh::PeriodicBoundaries:
[legend]

Public Member Functions

PeriodicBoundaryBaseboundary (boundary_id_type id)
 
const PeriodicBoundaryBaseboundary (boundary_id_type id) const
 
 PeriodicBoundaries ()=default
 
 ~PeriodicBoundaries ()
 
const Elemneighbor (boundary_id_type boundary_id, const PointLocatorBase &point_locator, const Elem *e, unsigned int side, unsigned int *neigh_side=nullptr) const
 

Detailed Description

We're using a class instead of a typedef to allow forward declarations and future flexibility.

Author
Roy Stogner
Date
2010

Maps between boundary ids and PeriodicBoundaryBase objects.

Definition at line 49 of file periodic_boundaries.h.

Constructor & Destructor Documentation

◆ PeriodicBoundaries()

libMesh::PeriodicBoundaries::PeriodicBoundaries ( )
default

◆ ~PeriodicBoundaries()

libMesh::PeriodicBoundaries::~PeriodicBoundaries ( )
default

Member Function Documentation

◆ boundary() [1/2]

PeriodicBoundaryBase * libMesh::PeriodicBoundaries::boundary ( boundary_id_type  id)

◆ boundary() [2/2]

const PeriodicBoundaryBase * libMesh::PeriodicBoundaries::boundary ( boundary_id_type  id) const

Definition at line 48 of file periodic_boundaries.C.

49{
50 const_iterator i = this->find(id);
51 if (i == this->end())
52 return nullptr;
53 return i->second.get();
54}

◆ neighbor()

const Elem * libMesh::PeriodicBoundaries::neighbor ( boundary_id_type  boundary_id,
const PointLocatorBase point_locator,
const Elem e,
unsigned int  side,
unsigned int neigh_side = nullptr 
) const

Definition at line 59 of file periodic_boundaries.C.

64{
65 std::unique_ptr<const Elem> neigh_side_proxy;
66
67 // Find a point on that side (and only that side)
68 Point p = e->build_side_ptr(side)->vertex_average();
69
70 const PeriodicBoundaryBase * b = this->boundary(boundary_id);
72 p = b->get_corresponding_pos(p);
73
74 std::set<const Elem *> candidate_elements;
75 point_locator.operator()(p, candidate_elements);
76
77 // We might have found multiple elements, e.g. if two distinct periodic
78 // boundaries are overlapping (see systems_of_equations_ex9, for example).
79 // As a result, we need to search for the element that has boundary_id.
80 const MeshBase & mesh = point_locator.get_mesh();
81 for(const Elem * elem_it : candidate_elements)
82 {
83 std::vector<unsigned int> neigh_sides =
84 mesh.get_boundary_info().sides_with_boundary_id(elem_it, b->pairedboundary);
85
86 for (auto ns : neigh_sides)
87 {
88 if (neigh_side)
89 {
90 elem_it->build_side_ptr(neigh_side_proxy, ns);
91 if (neigh_side_proxy->contains_point(p))
92 {
93 *neigh_side = ns;
94 return elem_it;
95 }
96 }
97 else
98 // checking contains_point is too expensive if we don't
99 // definitely need it to find neigh_side
100 return elem_it;
101 }
102 }
103
104 // If we should have found a periodic neighbor but didn't then
105 // either we're on a ghosted element with a remote periodic neighbor
106 // or we're on a mesh with an inconsistent periodic boundary.
107 libmesh_error_msg_if(mesh.is_serial() ||
108 (e->processor_id() == mesh.processor_id()),
109 "Periodic boundary neighbor not found");
110
111 if (neigh_side)
112 *neigh_side = libMesh::invalid_uint;
113 return remote_elem;
114}
PeriodicBoundaryBase * boundary(boundary_id_type id)
static const Real b
MeshBase & mesh
libmesh_assert(ctx)
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition libmesh.h:303
const RemoteElem * remote_elem
Definition remote_elem.C:57

References b, boundary(), libMesh::Elem::build_side_ptr(), libMesh::MeshBase::get_boundary_info(), libMesh::PointLocatorBase::get_mesh(), libMesh::invalid_uint, libMesh::libmesh_assert(), mesh, libMesh::DofObject::processor_id(), libMesh::remote_elem, and libMesh::BoundaryInfo::sides_with_boundary_id().

Referenced by libMesh::FEGenericBase< OutputType >::compute_periodic_constraints(), libMesh::FEAbstract::compute_periodic_node_constraints(), libMesh::Elem::topological_neighbor(), and libMesh::Elem::topological_neighbor().


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