libMesh
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
libMesh::PeriodicBoundaryBase Class Referenceabstract

The base class for defining periodic boundaries. More...

#include <periodic_boundary_base.h>

Inheritance diagram for libMesh::PeriodicBoundaryBase:
[legend]

Public Types

enum  TransformationType { FORWARD =0, INVERSE =1 }
 

Public Member Functions

 PeriodicBoundaryBase ()
 Constructor. More...
 
 PeriodicBoundaryBase (const PeriodicBoundaryBase &other)
 Copy constructor. More...
 
virtual ~PeriodicBoundaryBase ()=default
 Destructor. More...
 
virtual Point get_corresponding_pos (const Point &pt) const =0
 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 =0
 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

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 base class for defining periodic boundaries.

Author
Roy Stogner
Date
2010 Base class for all PeriodicBoundary implementations.

Definition at line 48 of file periodic_boundary_base.h.

Member Enumeration Documentation

◆ TransformationType

Constructor & Destructor Documentation

◆ PeriodicBoundaryBase() [1/2]

libMesh::PeriodicBoundaryBase::PeriodicBoundaryBase ( )

Constructor.

Definition at line 34 of file periodic_boundary_base.C.

34  :
37 {
38 }
boundary_id_type myboundary
The boundary ID of this boundary and its counterpart.
static const boundary_id_type invalid_id
Number used for internal use.

◆ PeriodicBoundaryBase() [2/2]

libMesh::PeriodicBoundaryBase::PeriodicBoundaryBase ( const PeriodicBoundaryBase other)

Copy constructor.

Definition at line 42 of file periodic_boundary_base.C.

References _transformation_matrix.

42  :
43  myboundary(o.myboundary),
44  pairedboundary(o.pairedboundary),
45  variables(o.variables)
46 {
47  // Make a deep copy of _transformation_matrix, if it's not null
48  if(o._transformation_matrix)
49  {
50  this->_transformation_matrix = std::make_unique<DenseMatrix<Real>>();
51  *(this->_transformation_matrix) = *(o._transformation_matrix);
52  }
53 }
boundary_id_type myboundary
The boundary ID of this boundary and its counterpart.
std::set< unsigned int > variables
Set of variables for this periodic boundary, empty means all variables possible.
std::unique_ptr< DenseMatrix< Real > > _transformation_matrix
A DenseMatrix that defines the mapping of variables on this boundary and the counterpart boundary...

◆ ~PeriodicBoundaryBase()

virtual libMesh::PeriodicBoundaryBase::~PeriodicBoundaryBase ( )
virtualdefault

Destructor.

Member Function Documentation

◆ clone()

virtual std::unique_ptr<PeriodicBoundaryBase> libMesh::PeriodicBoundaryBase::clone ( TransformationType  t = FORWARD) const
pure virtual

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. The user can also pass a flag to enable an 'inverse transformation' to be cloned from a forward transformation. The simplest way to implement a clone function like this is in terms of a copy constructor, see periodic_boundary.h.

Note
Not every transformation needs to provide an automatic way to clone an inverse: you can simply add a pair of PeriodicBoundaryBase objects using the appropriate DofMap interface instead.

Implemented in AzimuthalPeriodicBoundary, and libMesh::PeriodicBoundary.

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

◆ get_corresponding_pos()

virtual Point libMesh::PeriodicBoundaryBase::get_corresponding_pos ( const Point pt) const
pure virtual

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

Implemented in AzimuthalPeriodicBoundary, and libMesh::PeriodicBoundary.

Referenced by libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::FEAbstract::compute_periodic_node_constraints(), and libMesh::PeriodicBoundaries::neighbor().

◆ get_transformation_matrix()

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

Get the transformation matrix, if it is defined.

Throw an error if it is not defined.

Definition at line 86 of file periodic_boundary_base.C.

References _transformation_matrix, and has_transformation_matrix().

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

87 {
88  libmesh_error_msg_if(!has_transformation_matrix(),
89  "Transformation matrix is not defined");
90 
91  return *_transformation_matrix;
92 }
std::unique_ptr< DenseMatrix< Real > > _transformation_matrix
A DenseMatrix that defines the mapping of variables on this boundary and the counterpart boundary...

◆ get_variables()

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

Get the set of variables for this periodic boundary condition.

Definition at line 109 of file periodic_boundary_base.C.

References variables.

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

110 {
111  return variables;
112 }
std::set< unsigned int > variables
Set of variables for this periodic boundary, empty means all variables possible.

◆ has_transformation_matrix()

bool libMesh::PeriodicBoundaryBase::has_transformation_matrix ( ) const
Returns
true if _transformation_matrix is not null.

Definition at line 79 of file periodic_boundary_base.C.

References _transformation_matrix.

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

80 {
81  return bool(_transformation_matrix);
82 }
std::unique_ptr< DenseMatrix< Real > > _transformation_matrix
A DenseMatrix that defines the mapping of variables on this boundary and the counterpart boundary...

◆ is_my_variable()

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

Definition at line 71 of file periodic_boundary_base.C.

References variables.

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

72 {
73  bool a = variables.empty() || (!variables.empty() && variables.find(var_num) != variables.end());
74  return a;
75 }
std::set< unsigned int > variables
Set of variables for this periodic boundary, empty means all variables possible.

◆ merge()

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

Definition at line 64 of file periodic_boundary_base.C.

References variables.

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

65 {
66  variables.insert(pb.variables.begin(), pb.variables.end());
67 }
std::set< unsigned int > variables
Set of variables for this periodic boundary, empty means all variables possible.

◆ set_transformation_matrix()

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

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 96 of file periodic_boundary_base.C.

References _transformation_matrix, and variables.

97 {
98  // Make a deep copy of matrix
99  this->_transformation_matrix = std::make_unique<DenseMatrix<Real>>();
100  *(this->_transformation_matrix) = matrix;
101 
102  // if _transformation_matrix is defined then it must be the same sie as variables.
103  libmesh_assert_equal_to(_transformation_matrix->m(), variables.size());
104  libmesh_assert_equal_to(_transformation_matrix->n(), variables.size());
105 }
std::set< unsigned int > variables
Set of variables for this periodic boundary, empty means all variables possible.
std::unique_ptr< DenseMatrix< Real > > _transformation_matrix
A DenseMatrix that defines the mapping of variables on this boundary and the counterpart boundary...

◆ set_variable()

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

Definition at line 57 of file periodic_boundary_base.C.

References variables.

58 {
59  variables.insert(var);
60 }
std::set< unsigned int > variables
Set of variables for this periodic boundary, empty means all variables possible.

Member Data Documentation

◆ _transformation_matrix

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

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 example, 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 get_transformation_matrix(), has_transformation_matrix(), PeriodicBoundaryBase(), and set_transformation_matrix().

◆ myboundary

boundary_id_type libMesh::PeriodicBoundaryBase::myboundary

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(), libMesh::PeriodicBoundary::PeriodicBoundary(), and PeriodicBCTest::testPeriodicBC().

◆ pairedboundary

boundary_id_type libMesh::PeriodicBoundaryBase::pairedboundary

◆ variables

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

Set of variables for this periodic boundary, empty means all variables possible.

Definition at line 134 of file periodic_boundary_base.h.

Referenced by get_variables(), is_my_variable(), merge(), set_transformation_matrix(), and set_variable().


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