libMesh
Public Types | Public Member Functions | Public Attributes | Protected Attributes | Private Attributes | List of all members
AzimuthalPeriodicBoundary Class Reference
Inheritance diagram for AzimuthalPeriodicBoundary:
[legend]

Public Types

enum  TransformationType { FORWARD =0, INVERSE =1 }
 

Public Member Functions

 AzimuthalPeriodicBoundary (Point center, Point axis, Real angle)
 Constructor. More...
 
 AzimuthalPeriodicBoundary (const AzimuthalPeriodicBoundary &o, TransformationType t=FORWARD)
 Copy constructor, with option for the copy to represent an inverse transformation. More...
 
virtual ~AzimuthalPeriodicBoundary ()
 Destructor. More...
 
DenseMatrix< Real > get_rotation_matrix () const
 Get the rotation matrix for this transformation. 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

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

Private Attributes

Point _center
 
Point _axis
 
Real _theta
 

Detailed Description

Definition at line 75 of file systems_of_equations_ex9.C.

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

◆ AzimuthalPeriodicBoundary() [1/2]

AzimuthalPeriodicBoundary::AzimuthalPeriodicBoundary ( Point  center,
Point  axis,
Real  angle 
)
inline

Constructor.

Definition at line 81 of file systems_of_equations_ex9.C.

85  :
87  _center(center),
88  _axis(axis),
89  _theta(angle)
90  {
91  set_variable(0);
92  set_variable(1);
93  set_variable(2);
95  }

◆ AzimuthalPeriodicBoundary() [2/2]

AzimuthalPeriodicBoundary::AzimuthalPeriodicBoundary ( const AzimuthalPeriodicBoundary o,
TransformationType  t = FORWARD 
)
inline

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

Definition at line 100 of file systems_of_equations_ex9.C.

101  :
103  _center(o._center),
104  _axis(o._axis),
105  _theta(o._theta)
106  {
107  if (t == INVERSE)
108  {
110  _theta *= -1.0;
111  }
112 
113  set_variable(0);
114  set_variable(1);
115  set_variable(2);
117  }

References swap().

◆ ~AzimuthalPeriodicBoundary()

virtual AzimuthalPeriodicBoundary::~AzimuthalPeriodicBoundary ( )
inlinevirtual

Destructor.

Definition at line 122 of file systems_of_equations_ex9.C.

122 {}

Member Function Documentation

◆ clone()

virtual std::unique_ptr<PeriodicBoundaryBase> AzimuthalPeriodicBoundary::clone ( TransformationType  t = FORWARD) const
inlineoverridevirtual

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 183 of file systems_of_equations_ex9.C.

184  {
185  return libmesh_make_unique<AzimuthalPeriodicBoundary>(*this, t);
186  }

◆ get_corresponding_pos()

virtual Point AzimuthalPeriodicBoundary::get_corresponding_pos ( const Point pt) const
inlineoverridevirtual

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 156 of file systems_of_equations_ex9.C.

157  {
158  DenseVector<Real> translated_pt(3);
159  for(unsigned int i=0; i<3; i++)
160  {
161  translated_pt(i) = pt(i) - _center(i);
162  }
163 
164  // Note that since _theta defines the angle from "paired boundary" to
165  // "my boundary", and we want the inverse of that here, we must use
166  // vector_mult_transpose below.
167  DenseVector<Real> rotated_pt;
168  get_transformation_matrix().vector_mult_transpose(rotated_pt, translated_pt);
169 
170  Point corresponding_pos;
171  for(unsigned int i=0; i<3; i++)
172  {
173  corresponding_pos(i) = rotated_pt(i) + _center(i);
174  }
175  return corresponding_pos;
176  }

◆ get_rotation_matrix()

DenseMatrix<Real> AzimuthalPeriodicBoundary::get_rotation_matrix ( ) const
inline

Get the rotation matrix for this transformation.

Definition at line 127 of file systems_of_equations_ex9.C.

128  {
129  // Formula for rotation matrix about an axis is given on wikipedia:
130  // en.wikipedia.org/wiki/Rotation_matrix
131  // We rotate by angle theta about the axis defined by u, which is a
132  // unit vector in the direction of _axis.
133  Point u = _axis.unit();
134  Real u_x = u(0);
135  Real u_y = u(1);
136  Real u_z = u(2);
137  DenseMatrix<Real> R(3,3);
138  R(0,0) = cos(_theta) + u_x*u_x*(1.0 - cos(_theta));
139  R(0,1) = u_x*u_y*(1.0 - cos(_theta)) - u_z*sin(_theta);
140  R(0,2) = u_x*u_z*(1.0 - cos(_theta)) + u_y*sin(_theta);
141  R(1,0) = u_y*u_x*(1.0 - cos(_theta)) + u_z*sin(_theta);
142  R(1,1) = cos(_theta) + u_y*u_y*(1.0 - cos(_theta));
143  R(1,2) = u_y*u_z*(1.0 - cos(_theta)) - u_x*sin(_theta);
144  R(2,0) = u_z*u_x*(1.0 - cos(_theta)) - u_y*sin(_theta);
145  R(2,1) = u_z*u_y*(1.0 - cos(_theta)) + u_x*sin(_theta);
146  R(2,2) = cos(_theta) + u_z*u_z*(1.0 - cos(_theta));
147 
148  return R;
149  }

References libMesh::Real, and libMesh::TypeVector< T >::unit().

◆ 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

◆ _axis

Point AzimuthalPeriodicBoundary::_axis
private

Definition at line 194 of file systems_of_equations_ex9.C.

◆ _center

Point AzimuthalPeriodicBoundary::_center
private

Definition at line 193 of file systems_of_equations_ex9.C.

◆ _theta

Real AzimuthalPeriodicBoundary::_theta
private

Definition at line 195 of file systems_of_equations_ex9.C.

◆ _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 libMesh::PeriodicBoundary::PeriodicBoundary().

◆ pairedboundary

boundary_id_type libMesh::PeriodicBoundaryBase::pairedboundary
inherited

◆ variables

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

The documentation for this class was generated from the following file:
libMesh::PeriodicBoundaryBase::has_transformation_matrix
bool has_transformation_matrix() const
Definition: periodic_boundary_base.C:76
libMesh::PeriodicBoundaryBase::set_variable
void set_variable(unsigned int var)
Definition: periodic_boundary_base.C:54
libMesh::DenseMatrix< Real >
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
AzimuthalPeriodicBoundary::_center
Point _center
Definition: systems_of_equations_ex9.C:193
AzimuthalPeriodicBoundary::_theta
Real _theta
Definition: systems_of_equations_ex9.C:195
libMesh::Point
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
libMesh::PeriodicBoundaryBase::myboundary
boundary_id_type myboundary
The boundary ID of this boundary and its counterpart.
Definition: periodic_boundary_base.h:58
libMesh::DenseMatrix::vector_mult_transpose
void vector_mult_transpose(DenseVector< T > &dest, const DenseVector< T > &arg) const
Performs the matrix-vector multiplication, dest := (*this)^T * arg.
Definition: dense_matrix_impl.h:459
AzimuthalPeriodicBoundary::get_rotation_matrix
DenseMatrix< Real > get_rotation_matrix() const
Get the rotation matrix for this transformation.
Definition: systems_of_equations_ex9.C:127
libMesh::PeriodicBoundaryBase::get_transformation_matrix
const DenseMatrix< Real > & get_transformation_matrix() const
Get the transformation matrix, if it is defined.
Definition: periodic_boundary_base.C:83
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::TypeVector::unit
TypeVector< T > unit() const
Definition: type_vector.h:1158
libMesh::PeriodicBoundaryBase::FORWARD
Definition: periodic_boundary_base.h:52
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::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::PeriodicBoundaryBase::pairedboundary
boundary_id_type pairedboundary
Definition: periodic_boundary_base.h:58
AzimuthalPeriodicBoundary::_axis
Point _axis
Definition: systems_of_equations_ex9.C:194
libMesh::PeriodicBoundaryBase::set_transformation_matrix
void set_transformation_matrix(const DenseMatrix< Real > &matrix)
Set the transformation matrix.
Definition: periodic_boundary_base.C:95
libMesh::DenseVector
Defines a dense vector for use in Finite Element-type computations.
Definition: meshless_interpolation_function.h:39