BasicTools.Linalg.ConstraintsHolder module

class BasicTools.Linalg.ConstraintsHolder.Ainsworth[source]

Bases: BaseOutputObject

Method from https://doi.org/10.1016/S0045-7825(01)00236-5 Because the CleanConstraint(C) matrix is orthonormal then C.dot(C.T) = I this make the P Q R expression simpler

GetCOp(op)[source]
GetCRhs(op, rhs)[source]
GetNumberOfDofs()[source]
RestoreSolution(op, rhs, arg)[source]
RestrictSolution(op, rhs, arg)[source]
UpdateSystem(CH)[source]
matvec(op, arg)[source]
BasicTools.Linalg.ConstraintsHolder.CheckIntegrity(GUI=False)[source]
BasicTools.Linalg.ConstraintsHolder.CheckIntegrityTTC(ttc, GUI=False)[source]
class BasicTools.Linalg.ConstraintsHolder.ConstraintsHolder(nbdof=0)[source]

Bases: BaseOutputObject

Constrained linear problem: Class to store and to enforce constraints for a quadratic system of the form:

minimize 1/2 u.K.u - u.f subject to: A.u = b

This class can store, and manipulate the system Au=b and enforced the constraint on Ku=f by different methods (penalisation, subtitution, lagrange multiplier)

the first set of function is used to fill this class with the system Au=b:

NextEquation must be called after the call of a set of : AddFactor, AddConstant One per constraint

AddEquationSparse, AddEquation, AddEquationsFromIJV to add a full constraint at once

Compact will clean (zeros,and duplicate) entries

AddConstant(constant)[source]
AddConstraint(constraints)[source]
AddEquation(vals, const=0)[source]
AddEquationSparse(index, vals, const)[source]
AddEquationsFromIJV(ei, ej, ev)[source]
AddEquationsFromOperatorAAndb(A, b=None)[source]
AddFactor(ddl, factor)[source]
CleanEmptyColumns(mat)[source]

Function to clean empty columns for a matrix,

this function returns:

res : a sparse matrix with only non zero columns of mat (the last column is always present, event if it is full of zeros) usedDofs : the indices of the columns prensent in res

Compact()[source]
ComputeConstraintsEquations(mesh, unkownFields)[source]
GetCOp()[source]
GetCRhs(rhs=None)[source]
GetCleanConstraintBase(purePython=False)[source]

This function compute the QR decompostion of the augmentd system [A|b] Il will use the self.tol value to detect redundants constrants (rank revealing)

this functions returns:

res : a parse matrix q’ with only the relevant part of the QR decomposition. Q’ containt only the non zero columns of [A|b] and always the last column (the b) usedDofs : the indices of the columns present in Q

option:

purePython: to force scipy for computing the QR decomposition

GetNumberOfConstraints()[source]
GetNumberOfDofsOnCSystem()[source]
GetNumberOfDofsOnOriginalSystem()[source]
NextEquation()[source]
Reset()[source]
RestoreSolution(arg)[source]
RestrictSolution(arg)[source]
SetConstraintsMethod(method)[source]
SetNumberOfDofs(nbdof)[source]
SetOp(op, rhs=None)[source]
ToSparse()[source]

Function to convert to the constraints system Ax=B to a sparse matrix

this function returns:

res : a sparse matrix of [A’|B] , A’ has only the non zero columns of A usedDofs : the indices of the columns present in A’

ToSparseFull()[source]

Function to convert to the constraints system Ax=B to a sparse matrix

this function returns:

res : a sparse matrix of [A|B] ,

UpdateCSystem()[source]
matvec(arg)[source]
rmatvec(arg)[source]
BasicTools.Linalg.ConstraintsHolder.ExpandMatrix(op, mattoglobal, nbdofs, treatrows=True, treatcols=True)[source]
class BasicTools.Linalg.ConstraintsHolder.Lagrange[source]

Bases: BaseOutputObject

GetCOp(op)[source]
GetCRhs(op, rhs)[source]
GetNumberOfDofs()[source]
RestoreSolution(op, rhs, arg)[source]
RestrictSolution(op, rhs, arg)[source]
UpdateSystem(CH)[source]
matvec(op, arg)[source]
class BasicTools.Linalg.ConstraintsHolder.Penalisation[source]

Bases: BaseOutputObject

GetCOp(op)[source]
GetCRhs(op, rhs)[source]
GetNumberOfDofs()[source]
RestoreSolution(op, rhs, arg)[source]
RestrictSolution(op, rhs, arg)[source]
UpdateSystem(CH)[source]
matvec(op, arg)[source]
class BasicTools.Linalg.ConstraintsHolder.Projection[source]

Bases: BaseOutputObject

GetCOp(op)[source]
GetCRhs(op, rhs)[source]
GetNumberOfDofs()[source]
RestoreSolution(op, rhs, arg)[source]
RestrictSolution(op, rhs, arg)[source]
UpdateSystem(CH)[source]
matvec(op, arg)[source]
BasicTools.Linalg.ConstraintsHolder.TestQR()[source]