IFEM  90A354
Public Member Functions | Private Attributes | List of all members
SAMpatchPETSc Class Reference

This is a sub-class of SAMpatch with support for parallel processing. More...

#include <SAMpatchPETSc.h>

Inheritance diagram for SAMpatchPETSc:
Inheritance graph
[legend]
Collaboration diagram for SAMpatchPETSc:
Collaboration graph
[legend]

Public Member Functions

 SAMpatchPETSc (const std::map< int, int > &g2ln, const ProcessAdm &padm)
 The constructor initializes the l2gn array. More...
 
virtual ~SAMpatchPETSc ()
 The destructor destroys the index set arrays.
 
virtual Real dot (const Vector &x, const Vector &y, char dofType='D') const
 Computes the dot-product of two vectors. More...
 
virtual Real normL2 (const Vector &x, char dofType='D') const
 Computes the L2-norm of a vector. More...
 
virtual Real normInf (const Vector &x, size_t &comp, char dofType='D') const
 Computes the inf-norm of a vector. More...
 
virtual bool expandSolution (const SystemVector &solVec, Vector &dofVec, Real scaleSD) const
 Expands a solution vector from equation-ordering to DOF-ordering. More...
 
- Public Member Functions inherited from SAMpatch
 SAMpatch ()
 Empty default constructor.
 
virtual ~SAMpatch ()
 Empty destructor.
 
bool init (const std::vector< ASMbase * > &patches, int numNod, const std::vector< char > &dTypes)
 Allocates the dynamic arrays and populates them with data. More...
 
bool updateConstraintEqs (const Vector *prevSol=nullptr)
 Updates the multi-point constraint array TTCC. More...
 
std::vector< ASMbase * >::const_iterator begin () const
 Returns the start iterator of the patch container.
 
std::vector< ASMbase * >::const_iterator end () const
 Returns the end iterator of the patch container.
 
size_t getNoPatches () const
 Returns the number of patches in model.
 
virtual bool merge (const SAM *other, const std::map< int, int > *old2new)
 Merges the assembly data from another SIM with this.
 
- Public Member Functions inherited from SAM
 SAM ()
 The constructor initializes an empty object.
 
virtual ~SAM ()
 The destructor frees the dynamically allocated arrays.
 
void print (std::ostream &os) const
 Prints out the key data to the given stream.
 
template<class T >
void printVector (T &os, const RealArray &vec, const char *heading=nullptr) const
 Prints out a nodal DOF vector to the given stream.
 
int getNoElms () const
 Returns the number of elements in the model.
 
int getNoNodes (char dofType='A') const
 Returns the number of FE nodes in the model. More...
 
int getNoDOFs () const
 Returns the total number of DOFs in the model.
 
int getNoSpecifiedDOFs () const
 Returns the number of specified DOFs in the model.
 
int getNoConstraints () const
 Returns the total number of constraint equations in the model.
 
int getNoEquations () const
 Returns the number of equations (free DOFs) in the model.
 
IntSet getEquations (char dType, int dof=0) const
 Returns the equations numbers for a given DOF type. More...
 
const int * getMADOF () const
 Returns the Matrix of Accumulated DOFs.
 
const int * getMEQN () const
 Returns the Matrix of EQuation Numbers.
 
void getDofCouplings (IntVec &irow, IntVec &jcol) const
 Computes the sparse structure (DOF couplings) in the system matrix. More...
 
void getDofCouplings (std::vector< IntSet > &dofc) const
 Finds the set of free DOFs coupled to each free DOF.
 
bool assembleSystem (SystemMatrix &sysK, SystemVector &sysRHS, const Matrix &eK, int iel=0, RealArray *reactionForces=nullptr) const
 Adds an element stiffness matrix into the system stiffness matrix. More...
 
bool assembleSystem (SystemMatrix &sysM, const Matrix &eM, int iel=0) const
 Adds an element matrix into the corresponding system matrix. More...
 
bool assembleSystem (SystemVector &sysRHS, const Matrix &eK, int iel=0, RealArray *reactionForces=nullptr) const
 Adds element stiffness contributions to the system load vector. More...
 
bool assembleSystem (SystemVector &sysRHS, const RealArray &eS, int iel=0, RealArray *reactionForces=nullptr) const
 Adds an element load vector into the system load vector. More...
 
bool assembleSystem (SystemVector &sysRHS, const Real *nS, int inod=0, RealArray *reactionForces=nullptr) const
 Adds a node load vector into the system load vector. More...
 
bool assembleSystem (SystemVector &sysRHS, Real S, const std::pair< int, int > &dof) const
 Adds a node load vector into the system load vector. More...
 
void addToRHS (SystemVector &sysRHS, const RealArray &S) const
 Adds a global load vector into the system load vector. More...
 
bool getElmNodes (IntVec &mnpc, int iel) const
 Finds the matrix of nodal point correspondance for an element. More...
 
bool getElmEqns (IntVec &meen, int iel, size_t nedof=0) const
 Finds the matrix of equation numbers for an element. More...
 
void getUniqueEqns (IntSet &meen, int iel) const
 Finds the set of unique equation numbers for an element. More...
 
bool getNodeEqns (IntVec &mnen, int inod) const
 Finds the matrix of equation numbers for a node. More...
 
char getNodeType (int inod) const
 Returns the DOF classification of a given node. More...
 
std::pair< int, int > getNodeDOFs (int inod) const
 Returns the first and last DOFs for a node. More...
 
std::pair< int, int > getNodeAndLocalDof (int idof, bool eqno=false) const
 Returns the internal node number and local index for a global DOF. More...
 
int getEquation (int inod, int ldof) const
 Finds the equation number corresponding to a local nodal DOF. More...
 
Real getDofVal (const RealArray &dofVec, int inod, int ldof) const
 Returns specified solution component from a global solution vector. More...
 
bool expandVector (const Vector &solVec, Vector &dofVec) const
 Expands a solution vector from equation-ordering to DOF-ordering. More...
 
bool getSolVec (RealArray &solVec, const RealArray &dofVec) const
 Extracts equation-ordered solution vector from DOF-ordered vector. More...
 
bool applyDirichlet (Vector &dofVec) const
 Applies the non-homogenous Dirichlet BCs to the given vector. More...
 
Real norm2 (const Vector &x, char dofType='D') const
 Computes the l2-norm of a vector of length NDOF. More...
 
virtual Real normReact (const RealArray &u, const RealArray &rf) const
 Computes the energy norm contributions from nodal reaction forces. More...
 
Real getReaction (int dir, const RealArray &rf, const IntVec *nodes=nullptr) const
 Returns the total reaction force in the given coordinate direction. More...
 
bool haveReaction (int dir, const IntVec *nodes=nullptr) const
 Checks for total reaction force in the given coordinate direction. More...
 
bool getNodalReactions (int inod, const RealArray &rf, RealArray &nrf) const
 Returns a vector of reaction forces for a given node. More...
 

Private Attributes

int nProc
 Number of processes.
 
IntVec ghostNodes
 Indices for the ghost nodes.
 
IntVec l2gn
 Local-to-global node numbers for this processor.
 
const ProcessAdmadm
 Parallel process administrator.
 

Additional Inherited Members

- Protected Member Functions inherited from SAMpatch
bool initNodeDofs (const std::vector< char > &dTypes)
 Initializes the nodal arrays MINEX, MADOF and MSC.
 
bool initElementConn ()
 Initializes the element topology arrays MPMNPC and MMNPC.
 
bool initConstraintEqs ()
 Initializes the multi-point constraint arrays MPMCEQ, MMCEQ and TTCC.
 
- Protected Member Functions inherited from SAM
bool initSystemEquations ()
 Initializes the DOF-to-equation connectivity array MEQN.
 
void assembleRHS (Real *RHS, Real value, int ieq) const
 Adds a scalar value into a system right hand-side vector. More...
 
void assembleReactions (RealArray &rf, const RealArray &eS, int iel) const
 Assembles reaction forces for the fixed and prescribed DOFs. More...
 
bool expandVector (const Real *solVec, Vector &dofVec, Real scaleSD) const
 Expands a solution vector from equation-ordering to DOF-ordering. More...
 
void printStatusCodes (std::ostream &os) const
 Prints out the DOF status codes to the given stream.
 
void printCEQ (std::ostream &os, int iceq) const
 Prints out a constraint equation to the given stream.
 
void printMEQN (std::ostream &os) const
 Prints out the equation number mapping to the given stream.
 
- Protected Attributes inherited from SAM
int & nnod
 Number of nodes.
 
int & nel
 Number of elements.
 
int & ndof
 Number of DOFs.
 
int & nspdof
 Number of specified DOFs.
 
int & nceq
 Number of constraint equations.
 
int & neq
 Number of system equations.
 
int & nmmnpc
 Number of elements in MMNPC.
 
int & nmmceq
 Number of elements in MMCEQ.
 
int * mpmnpc
 Matrix of pointers to MNPCs in MMNPC.
 
int * mmnpc
 Matrix of matrices of nodal point correspondances.
 
int * madof
 Matrix of accumulated DOFs.
 
int * msc
 Matrix of status codes.
 
int * mpmceq
 Matrix of pointers to MCEQs in MMCEQ.
 
int * mmceq
 Matrix of matrices of constraint equation definitions.
 
Realttcc
 Table of tables of constraint equation coefficients.
 
int * minex
 Matrix of internal to external node numbers.
 
int * meqn
 Matrix of equation numbers.
 
std::vector< char > nodeType
 Nodal DOF classification.
 
std::vector< char > dof_type
 Individual DOF classification.
 

Detailed Description

This is a sub-class of SAMpatch with support for parallel processing.

Constructor & Destructor Documentation

◆ SAMpatchPETSc()

SAMpatchPETSc::SAMpatchPETSc ( const std::map< int, int > &  g2ln,
const ProcessAdm padm 
)

The constructor initializes the l2gn array.

Parameters
[in]g2lnGlobal-to-local node numbers for this processor
[in]padmParallel process administrator

References adm, ProcessAdm::getNoProcs(), LinAlgInit::increfs(), and nProc.

Member Function Documentation

◆ dot()

Real SAMpatchPETSc::dot ( const Vector x,
const Vector y,
char  dofType = 'D' 
) const
virtual

Computes the dot-product of two vectors.

Parameters
[in]xFirst vector in dot-product
[in]ySecond vector in dot-product
[in]dofTypeOnly consider DOFs of this type
Returns
Value of dot-product

Both vectors are defined over all nodes in the patch, i.e. for parallel vectors the ghost entries are also included.

Reimplemented from SAM.

References adm, ProcessAdm::dd, SAM::dot(), ProcessAdm::isParallel(), DomainDecomposition::isPartitioned(), utl::vector< T >::ptr(), and utl::vector< T >::size().

◆ expandSolution()

bool SAMpatchPETSc::expandSolution ( const SystemVector solVec,
Vector dofVec,
Real  scaleSD 
) const
virtual

Expands a solution vector from equation-ordering to DOF-ordering.

Parameters
[in]solVecSolution vector, length = NEQ
[out]dofVecDegrees of freedom vector, length = NDOF
[in]scaleSDScaling factor for specified (slave) DOFs
Returns
false if the length of solVec is invalid, otherwise true

The size of the solution vector that comes out of the linear equation solver equals the number of free DOFs in the system (=NEQ). That is, all fixed or constrained (slave) DOFs are not present. Before we can compute derived element quantities we therefore need to extract the resulting solution values also for the constrained DOFs.

Reimplemented from SAM.

References adm, ProcessAdm::dd, StdVector::dim(), SAM::expandSolution(), DomainDecomposition::getG2LEQ(), DomainDecomposition::getMLGEQ(), StdVector::getPtr(), PETScVector::getVector(), ProcessAdm::isParallel(), and DomainDecomposition::isPartitioned().

◆ normInf()

Real SAMpatchPETSc::normInf ( const Vector x,
size_t &  comp,
char  dofType = 'D' 
) const
virtual

Computes the inf-norm of a vector.

Parameters
[in]xVector for norm computation
compLocal nodal DOF on input, index of the largest value on output
[in]dofTypeOnly consider DOFs of this type
Returns
Value of inf-norm

The vector is defined over all nodes in the patch, i.e. for parallel vectors the ghost entries are also included.

Reimplemented from SAM.

References adm, ProcessAdm::dd, ProcessAdm::isParallel(), DomainDecomposition::isPartitioned(), SAM::normInf(), and Real.

◆ normL2()

Real SAMpatchPETSc::normL2 ( const Vector x,
char  dofType = 'D' 
) const
virtual

Computes the L2-norm of a vector.

Parameters
[in]xVector for norm computation
[in]dofTypeOnly consider DOFs of this type
Returns
Value of L2-norm

The vector is defined over all nodes in the patch, i.e. for parallel vectors the ghost entries are also included.

Reimplemented from SAM.

References adm, ProcessAdm::dd, ProcessAdm::isParallel(), DomainDecomposition::isPartitioned(), SAM::normL2(), utl::vector< T >::ptr(), and utl::vector< T >::size().


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