IFEM  90A354
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes | Friends | List of all members
MPC Class Reference

A class representing a general multi-point constraint equation. More...

#include <MPC.h>

Collaboration diagram for MPC:
Collaboration graph
[legend]

Classes

struct  DOF
 A struct representing one term in a multi-point constraint equation. More...
 

Public Member Functions

 MPC (int n, int d, Real s=Real(0))
 Constructor creating a constraint for a specified slave DOF. More...
 
void addMaster (const DOF &dof, Real tol=Real(1.0e-8))
 Adds a master DOF to the constraint equation. More...
 
void addMaster (int n, int d, Real c=Real(1), Real tol=Real(1.0e-8))
 Adds a master DOF to the constraint equation. More...
 
void updateMaster (size_t pos, Real c)
 Updates the coefficient of the pos'th master DOF.
 
void updateMaster (size_t pos, MPC *m)
 Updates the next chain element of the pos'th master DOF.
 
void removeMaster (size_t pos)
 Removes the pos'th master DOF from the constraint equation.
 
bool isChained () const
 Returns true if this MPC is chained.
 
bool merge (const MPC *mpc)
 Merges the given MPC equation into this one.
 
int renumberNodes (const std::map< int, int > &old2new, bool msg=false)
 Renumbers all node numbers in the constraint equation. More...
 
void shiftNodes (int nshift)
 Increments node numbers in the constraint equation by nshift.
 
void addOffset (Real offset)
 Increments the c0 coefficient by a given offset.
 
void setSlaveCoeff (Real c0)
 Assigns a new c0 coefficient to the constraint equation.
 
const DOFgetSlave () const
 Returns a reference to the slave DOF.
 
const DOFgetMaster (size_t i) const
 Returns a reference to the i'th master DOF.
 
size_t getNoMaster (bool recursive=false) const
 Returns the number of master DOFs.
 

Public Attributes

int iceq
 Global constraint equation identifier.
 

Protected Member Functions

void printMaster (std::ostream &os) const
 Prints out the master(s) of this constraint equation.
 

Private Attributes

DOF slave
 The slave DOF of this constraint equation.
 
std::vector< DOFmaster
 The master DOFs of this constraint equation.
 

Friends

std::ostream & operator<< (std::ostream &s, const MPC &mpc)
 Global stream operator printing a constraint equation.
 

Detailed Description

A class representing a general multi-point constraint equation.

A multi-point constraint (MPC) equation is used to introduce additional couplings between the degrees of freedom (DOF) in a FE grid.

An MPC equation is in general a linear coupling of one (slave) DOF to a set of master DOFs, and may be expressed as

\[ s = c_0 + c_1 m_1 + c_2 m_2 + \ldots + c_n m_n \]

where

When n = 0, the above equation represents a fixed ( \(c_0=0\)) or prescribed ( \(c_0\ne0\)) DOF.

One or more of the master DOFs may also be a slave in another constraint equation (chained constraints). In this case the two equations are combined during model preprocessing, to eliminate the master DOF that is constrained.

Constructor & Destructor Documentation

◆ MPC()

MPC::MPC ( int  n,
int  d,
Real  s = Real(0) 
)
inline

Constructor creating a constraint for a specified slave DOF.

Parameters
[in]nThe node number of the slave DOF (1...NNOD)
[in]dThe local DOF number of the slave DOF (1...3)
[in]sAssociated constrained value

The created constraint equation will by default constrain the specified slave DOF to zero. To constrain to a non-zero value, the method setSlaveCoeff() has to be invoked with the desired value.

References iceq.

Member Function Documentation

◆ addMaster() [1/2]

void MPC::addMaster ( const DOF dof,
Real  tol = Real(1.0e-8) 
)

Adds a master DOF to the constraint equation.

Parameters
[in]dofThe the master DOF and associated coefficient to be added
[in]tolTolerance for comparison with zero, if the coefficient c is zero, the master DOF is not added

References MPC::DOF::coeff, and master.

Referenced by ASMbase::add2PC(), ASMbase::add3PC(), addMaster(), ASMs2DC1::addRigidCpl(), ASMs1DC1::addRigidCpl(), ASMs2D::constrainEdgeLocal(), ASMs3D::constrainFaceLocal(), ASMstruct::evalSolution(), and merge().

◆ addMaster() [2/2]

void MPC::addMaster ( int  n,
int  d,
Real  c = Real(1),
Real  tol = Real(1.0e-8) 
)
inline

Adds a master DOF to the constraint equation.

Parameters
[in]nThe node number of the master DOF (1...NNOD)
[in]dThe local DOF number of the master DOF (1...3)
[in]cThe coefficient that this master should be scaled with
[in]tolTolerance for comparison with zero

References addMaster().

◆ renumberNodes()

int MPC::renumberNodes ( const std::map< int, int > &  old2new,
bool  msg = false 
)

Renumbers all node numbers in the constraint equation.

Parameters
[in]old2newOld-to-new node number mapping
[in]msgIf true, give error message for each invalid node number
Returns
Number of invalid node numbers detected

References master, MPC::DOF::node, utl::renumber(), and slave.


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