libMesh
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
libMesh::PeriodicBoundary Class Reference

The definition of a periodic boundary. More...

#include <periodic_boundary.h>

Inheritance diagram for libMesh::PeriodicBoundary:
[legend]

Public Types

enum  TransformationType { FORWARD =0, INVERSE =1 }
 

Public Member Functions

 PeriodicBoundary ()
 Constructor. More...
 
virtual ~PeriodicBoundary ()
 Destructor. More...
 
 PeriodicBoundary (const PeriodicBoundary &o, TransformationType t=FORWARD)
 Copy constructor, with option for the copy to represent an inverse transformation. More...
 
 PeriodicBoundary (const RealVectorValue &vector)
 Constructor taking a reference to the translation vector. More...
 
virtual Point get_corresponding_pos (const Point &pt) const override
 This function should be overridden by derived classes to define how one finds corresponding nodes on the periodic boundary pair. More...
 
virtual std::unique_ptr< PeriodicBoundaryBaseclone (TransformationType t=FORWARD) const override
 If we want the DofMap to be able to make copies of references and store them in the underlying map, this class must be clone'able, i.e. More...
 
void set_variable (unsigned int var)
 
void merge (const PeriodicBoundaryBase &pb)
 
bool is_my_variable (unsigned int var_num) const
 
bool has_transformation_matrix () const
 
const DenseMatrix< Real > & get_transformation_matrix () const
 Get the transformation matrix, if it is defined. More...
 
void set_transformation_matrix (const DenseMatrix< Real > &matrix)
 Set the transformation matrix. More...
 
const std::set< unsigned int > & get_variables () const
 Get the set of variables for this periodic boundary condition. More...
 

Public Attributes

boundary_id_type myboundary
 The boundary ID of this boundary and its counterpart. More...
 
boundary_id_type pairedboundary
 

Protected Attributes

RealVectorValue translation_vector
 
std::set< unsigned intvariables
 Set of variables for this periodic boundary, empty means all variables possible. More...
 
std::unique_ptr< DenseMatrix< Real > > _transformation_matrix
 A DenseMatrix that defines the mapping of variables on this boundary and the counterpart boundary. More...
 

Detailed Description

The definition of a periodic boundary.

Author
Roy Stogner
Date
2010

Used for implementing periodic BCs via constraints.

Definition at line 44 of file periodic_boundary.h.

Member Enumeration Documentation

◆ TransformationType

Enumerator
FORWARD 
INVERSE 

Definition at line 51 of file periodic_boundary_base.h.

52  { FORWARD=0,
53  INVERSE=1 };

Constructor & Destructor Documentation

◆ PeriodicBoundary() [1/3]

libMesh::PeriodicBoundary::PeriodicBoundary ( )

Constructor.

Definition at line 30 of file periodic_boundary.C.

30  :
33 {
34 }

◆ ~PeriodicBoundary()

virtual libMesh::PeriodicBoundary::~PeriodicBoundary ( )
inlinevirtual

Destructor.

Definition at line 55 of file periodic_boundary.h.

55 {}

◆ PeriodicBoundary() [2/3]

libMesh::PeriodicBoundary::PeriodicBoundary ( const PeriodicBoundary o,
TransformationType  t = FORWARD 
)

Copy constructor, with option for the copy to represent an inverse transformation.

Definition at line 38 of file periodic_boundary.C.

38  :
40  translation_vector(o.translation_vector)
41 {
42  if (t == INVERSE)
43  {
45  translation_vector *= -1.0;
46  }
47 }

References libMesh::PeriodicBoundaryBase::INVERSE, libMesh::PeriodicBoundaryBase::myboundary, libMesh::PeriodicBoundaryBase::pairedboundary, swap(), and translation_vector.

◆ PeriodicBoundary() [3/3]

libMesh::PeriodicBoundary::PeriodicBoundary ( const RealVectorValue vector)

Constructor taking a reference to the translation vector.

Definition at line 51 of file periodic_boundary.C.

51  :
53  translation_vector(vector)
54 {
55 }

Member Function Documentation

◆ clone()

std::unique_ptr< PeriodicBoundaryBase > libMesh::PeriodicBoundary::clone ( TransformationType  t = FORWARD) const
overridevirtual

If we want the DofMap to be able to make copies of references and store them in the underlying map, this class must be clone'able, i.e.

have a kind of virtual construction mechanism.

Implements libMesh::PeriodicBoundaryBase.

Definition at line 66 of file periodic_boundary.C.

67 {
68  return libmesh_make_unique<PeriodicBoundary>(*this, t);
69 }

◆ get_corresponding_pos()

Point libMesh::PeriodicBoundary::get_corresponding_pos ( const Point pt) const
overridevirtual

This function should be overridden by derived classes to define how one finds corresponding nodes on the periodic boundary pair.

Implements libMesh::PeriodicBoundaryBase.

Definition at line 59 of file periodic_boundary.C.

60 {
61  return pt + translation_vector;
62 }

References translation_vector.

◆ get_transformation_matrix()

const DenseMatrix< Real > & libMesh::PeriodicBoundaryBase::get_transformation_matrix ( ) const
inherited

Get the transformation matrix, if it is defined.

Throw an error if it is not defined.

Definition at line 83 of file periodic_boundary_base.C.

84 {
86  {
87  libmesh_error_msg("Transformation matrix is not defined");
88  }
89 
90  return *_transformation_matrix;
91 }

References libMesh::PeriodicBoundaryBase::_transformation_matrix, and libMesh::PeriodicBoundaryBase::has_transformation_matrix().

Referenced by libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints().

◆ get_variables()

const std::set< unsigned int > & libMesh::PeriodicBoundaryBase::get_variables ( ) const
inherited

Get the set of variables for this periodic boundary condition.

Definition at line 108 of file periodic_boundary_base.C.

109 {
110  return variables;
111 }

References libMesh::PeriodicBoundaryBase::variables.

Referenced by libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints().

◆ has_transformation_matrix()

bool libMesh::PeriodicBoundaryBase::has_transformation_matrix ( ) const
inherited

◆ is_my_variable()

bool libMesh::PeriodicBoundaryBase::is_my_variable ( unsigned int  var_num) const
inherited

Definition at line 68 of file periodic_boundary_base.C.

69 {
70  bool a = variables.empty() || (!variables.empty() && variables.find(var_num) != variables.end());
71  return a;
72 }

References libMesh::PeriodicBoundaryBase::variables.

Referenced by libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints().

◆ merge()

void libMesh::PeriodicBoundaryBase::merge ( const PeriodicBoundaryBase pb)
inherited

Definition at line 61 of file periodic_boundary_base.C.

62 {
63  variables.insert(pb.variables.begin(), pb.variables.end());
64 }

References libMesh::PeriodicBoundaryBase::variables.

Referenced by libMesh::DofMap::add_periodic_boundary().

◆ set_transformation_matrix()

void libMesh::PeriodicBoundaryBase::set_transformation_matrix ( const DenseMatrix< Real > &  matrix)
inherited

Set the transformation matrix.

When calling this method we require the following conditions: 1) matrix is square with size that matches this->variables.size() 2) the list of variables in this->variables set must all have the same FE type Both of these conditions are asserted in DBG mode.

Definition at line 95 of file periodic_boundary_base.C.

96 {
97  // Make a deep copy of matrix
98  this->_transformation_matrix = libmesh_make_unique<DenseMatrix<Real>>();
99  *(this->_transformation_matrix) = matrix;
100 
101  // if _transformation_matrix is defined then it must be the same sie as variables.
102  libmesh_assert_equal_to(_transformation_matrix->m(), variables.size());
103  libmesh_assert_equal_to(_transformation_matrix->n(), variables.size());
104 }

References libMesh::PeriodicBoundaryBase::_transformation_matrix, and libMesh::PeriodicBoundaryBase::variables.

◆ set_variable()

void libMesh::PeriodicBoundaryBase::set_variable ( unsigned int  var)
inherited

Definition at line 54 of file periodic_boundary_base.C.

55 {
56  variables.insert(var);
57 }

References libMesh::PeriodicBoundaryBase::variables.

Member Data Documentation

◆ _transformation_matrix

std::unique_ptr<DenseMatrix<Real> > libMesh::PeriodicBoundaryBase::_transformation_matrix
protectedinherited

A DenseMatrix that defines the mapping of variables on this boundary and the counterpart boundary.

This is necessary for periodic-boundaries with vector-valued quantities (e.g. velocity or displacement) on a sector of a circular domain, for exaple, since in that case we must map each variable to a corresponding linear combination of all the variables. We store the DenseMatrix via a unique_ptr, and an uninitialized pointer is treated as equivalent to the identity matrix.

Definition at line 146 of file periodic_boundary_base.h.

Referenced by libMesh::PeriodicBoundaryBase::get_transformation_matrix(), libMesh::PeriodicBoundaryBase::has_transformation_matrix(), libMesh::PeriodicBoundaryBase::PeriodicBoundaryBase(), and libMesh::PeriodicBoundaryBase::set_transformation_matrix().

◆ myboundary

boundary_id_type libMesh::PeriodicBoundaryBase::myboundary
inherited

The boundary ID of this boundary and its counterpart.

Definition at line 58 of file periodic_boundary_base.h.

Referenced by libMesh::DofMap::add_periodic_boundary(), Biharmonic::JR::JR(), main(), and PeriodicBoundary().

◆ pairedboundary

boundary_id_type libMesh::PeriodicBoundaryBase::pairedboundary
inherited

◆ translation_vector

RealVectorValue libMesh::PeriodicBoundary::translation_vector
protected

Definition at line 85 of file periodic_boundary.h.

Referenced by get_corresponding_pos(), and PeriodicBoundary().

◆ variables

std::set<unsigned int> libMesh::PeriodicBoundaryBase::variables
protectedinherited

The documentation for this class was generated from the following files:
libMesh::PeriodicBoundaryBase::has_transformation_matrix
bool has_transformation_matrix() const
Definition: periodic_boundary_base.C:76
libMesh::PeriodicBoundaryBase::variables
std::set< unsigned int > variables
Set of variables for this periodic boundary, empty means all variables possible.
Definition: periodic_boundary_base.h:134
libMesh::PeriodicBoundaryBase::myboundary
boundary_id_type myboundary
The boundary ID of this boundary and its counterpart.
Definition: periodic_boundary_base.h:58
libMesh::PeriodicBoundaryBase::INVERSE
Definition: periodic_boundary_base.h:53
swap
void swap(Iterator &lhs, Iterator &rhs)
swap, used to implement op=
Definition: variant_filter_iterator.h:478
libMesh::PeriodicBoundaryBase::FORWARD
Definition: periodic_boundary_base.h:52
libMesh::PeriodicBoundary::translation_vector
RealVectorValue translation_vector
Definition: periodic_boundary.h:85
libMesh::PeriodicBoundaryBase::PeriodicBoundaryBase
PeriodicBoundaryBase()
Constructor.
Definition: periodic_boundary_base.C:31
libMesh::PeriodicBoundaryBase::_transformation_matrix
std::unique_ptr< DenseMatrix< Real > > _transformation_matrix
A DenseMatrix that defines the mapping of variables on this boundary and the counterpart boundary.
Definition: periodic_boundary_base.h:146
libMesh::PeriodicBoundaryBase::pairedboundary
boundary_id_type pairedboundary
Definition: periodic_boundary_base.h:58