13 static LoggerPtr logger(Logger::getLogger(
"pz.mesh.tpzcondensedcompel"));
21 #include <Accelerate/Accelerate.h> 43 for (
int ic=0; ic< ncon ; ic++) {
74 for (
int i=0; i<ncon ; ++i) {
87 for (
int ic=0; ic<ncon ; ic++) {
108 LOGPZ_ERROR(logger,
"SetConnectIndex should never be called")
124 std::map<int64_t,int64_t> & gl2lcConMap,
125 std::map<int64_t,int64_t> & gl2lcElMap)
const 192 std::set<int64_t> depreceive;
194 for (
int ic=0; ic<ncon; ic++) {
202 for (
int i=0; i<ncon ; ++i) {
212 std::cout <<
"Not Implemented yet\n";
220 notcondensed.
Push(i);
227 int ncond = condensed.
size();
228 for (
int i=0; i<ncond; ++i) {
231 for (
int i=0; i<notcondensed.
size(); ++i) {
232 fIndexes[i+ncond] = notcondensed[i];
246 gmrs->
SetGMRES(20, 20, *step, 1.e-20, 0);
263 void TPZCondensedCompEl::TPZCondensedCompEl::Assemble()
276 for (int64_t i=0; i<dim ; ++i) {
277 for (int64_t j=0; j<dim ; ++j) {
303 if (logger->isDebugEnabled()) {
304 std::stringstream sout;
306 sout <<
"Connect indices of element stiffness" << ek.
fConnect << std::endl;
314 if (logger->isDebugEnabled()) {
315 std::stringstream sout;
316 sout <<
"Element connects\n";
318 for (
int ic=0; ic<nc; ic++) {
319 sout <<
"ic = " << ic <<
' ' <<
" index " <<
ConnectIndex(ic) <<
' ';
322 sout <<
"Permutations " <<
fIndexes << std::endl;
323 sout <<
"Connect indices " << ek.
fConnect << std::endl;
340 K00_temp->InitializePivot();
348 for(int64_t i=0; i<rows;i++)
349 for (int64_t j=0; j<cols; j++)
352 KF(i,j) = ek.
fMat(i,j);
354 KF(i,j) = ef.
fMat(i,j-rows);
357 for (int64_t i=0; i<dim1; i++)
358 for (int64_t j=0; j<dim0; j++)
361 for (int64_t i=0; i<dim1; i++)
362 for (int64_t j=0; j<dim1; j++)
368 for (int64_t i=0; i<rows-dim1; i++)
370 for(int64_t j=i+1;j<cols;j++)
382 cblas_dger (CblasColMajor, rows-i-1, cols-i-1,
383 -KF(i,i), &KF(i+1,i), 1,
384 &KF(i,i+1), rows, &KF(i+1,i+1), rows);
390 for (int64_t i=dim0; i< rows; i++)
400 for (int64_t i=0; i<dim0; i++)
401 for (int64_t j=0; j<dim0; j++)
402 K00->operator()(i, j) = KF(i,j);
427 for (int64_t i = dim0; i<dim; i++) {
429 for (int64_t j = dim0; j<dim; j++) {
435 if(logger->isDebugEnabled())
437 std::stringstream sout;
450 for (int64_t i=0; i<dim ; ++i) {
451 for (int64_t j=0; j<dim ; ++j) {
468 if(std::isnan(normk01) || std::isnan(normf0))
476 if(logger->isDebugEnabled())
478 std::stringstream sout;
479 sout <<
"Index = " <<
Index() << std::endl;
488 int64_t dim0 = dim-K11.Rows();
489 for (int64_t i=dim0; i<dim; i++) {
491 for (int64_t j=dim0; j<dim; j++) {
502 K00_temp->InitializePivot();
508 if(logger->isDebugEnabled())
510 std::stringstream sout;
512 for (
int ic=0; ic<nc; ic++) {
513 sout <<
"ic = " << ic <<
' ';
554 int64_t dim1 = f1.Rows();
556 int64_t dim0 = dim-dim1;
557 for (int64_t i= dim0; i<dim; i++) {
571 return has_material_Q;
580 out <<
"Output for a condensed element\n";
586 out <<
"Index of grouped elements: ";
588 for(
int i=0; i<nel-1; i++){
591 out << eg->
GetElGroup()[nel-1]->Index() <<std::endl;
592 out <<
"Connect indexes of the contained elements \n";
593 for(
int i=0; i<nel; i++){
596 out <<
"cel index " << cel->
Index() <<
" cindex ";
598 for (
int ic=0; ic<nc; ic++) {
602 out <<
"\ngelindex " << gel->
Index() <<
" ";
607 out <<
" center x " << xco;
622 out <<
"Internal index resequencing: " <<
fIndexes << std::endl;
654 for (ic=0; ic<nc ; ic++) {
680 for (ic=nc0; ic<nc ; ic++) {
683 int blsize = bl.
Size(seqnum);
684 for (
int ibl=0; ibl<blsize; ibl++) {
685 u1(count++,0) = bl(seqnum,0,ibl,0);
689 if (logger->isDebugEnabled()) {
690 std::stringstream sout;
691 sout <<
"Computing UGlobal Index " <<
Index();
694 for(
int i=0; i<u1vec.size(); i++) u1vec[i] = u1(i,0);
695 sout <<
"u1 " << u1vec;
701 for (ic=0; ic<nc0 ; ic++) {
704 int blsize = bl.
Size(seqnum);
705 for (
int ibl=0; ibl<blsize; ibl++) {
706 bl(seqnum,0,ibl,0) = elsol(count++,0);
710 if (logger->isDebugEnabled()) {
711 std::stringstream sout;
712 sout <<
"After Computing UGlobal Index " <<
Index() ;
715 for(
int i=0; i<u1vec.size(); i++) u1vec[i] = elsol(i,0);
716 sout <<
"elsol " << u1vec;
731 std::set<int64_t> refconn;
733 for (
int ic=0; ic<nc ; ic++) {
737 if (refconn.find(index) != refconn.end()) {
738 connectindexes.insert(index);
virtual void ComputeSolution(TPZVec< REAL > &qsi, TPZSolVec &sol, TPZGradSolVec &dsol, TPZFMatrix< REAL > &axes) override
Computes solution and its derivatives in the local coordinate qsi.
TPZStack< TPZCompEl *, 5 > GetElGroup()
virtual void BuildCornerConnectList(std::set< int64_t > &connectindexes) const =0
adds the connect indexes associated with base shape functions to the set
Represents a set of shape functions associated with a computational element/side. Computational Eleme...
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
int MaterialId() const
Returns the material index of the element.
void SetReduced()
changes the declared dimension of the matrix to fDim1
virtual void resize(const int64_t newsize)
void F1Red(TPZFMatrix< TVar > &F1)
Computes the reduced version of the right hand side .
TPZStack< int64_t > fConnect
Vector of pointers to TPZConnect objects.
void UGlobal(const TPZFMatrix< TVar > &U1, TPZFMatrix< TVar > &result)
Computes the complete vector based on the solution u1.
TPZFMatrix< TVar > & K11()
TPZFNMatrix< 1000, STATE > fMat
Pointer to a blocked matrix object.
Contains the declaration of the TPZElementGroup class, which implements an computational element whic...
Defines step solvers class. Solver.
void SetF(const TPZFMatrix< TVar > &F)
Copies the F vector in the internal data structure.
virtual void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef)
Computes the element stifness matrix and right hand side.
void SetIsDecomposed(int val)
Sets current matrix to decomposed state.
virtual int64_t ConnectIndex(int i) const override
Returns the index of the ith connectivity of the element.
Class which groups elements to characterize dense matrices.
void SetF0IsComputed(bool directive)
Sets F0 as computed.
int NDof(TPZCompMesh &mesh)
Number of degrees of freedom associated with the object.
virtual int NSides() const =0
Returns the number of connectivities of the element.
virtual TPZCompEl * ClonePatchEl(TPZCompMesh &mesh, std::map< int64_t, int64_t > &gl2lcConMap, std::map< int64_t, int64_t > &gl2lcElMap) const =0
Method for creating a copy of the element in a patch mesh.
virtual TPZCompEl * ClonePatchEl(TPZCompMesh &mesh, std::map< int64_t, int64_t > &gl2lcConMap, std::map< int64_t, int64_t > &gl2lcElMap) const override
Method for creating a copy of the element in a patch mesh.
virtual void LoadSolution() override
Loads the solution within the internal data structure of the element.
void SetSolver(TPZAutoPointer< TPZMatrixSolver< TVar > > solver)
virtual int ClassId() const override
Define the class id associated with the class.
virtual void BuildCornerConnectList(std::set< int64_t > &connectindexes) const override
adds the connect indexes associated with base shape functions to the set
TPZMatRed< STATE, TPZFMatrix< STATE > > fCondensed
void SetK01IsComputed(bool directive)
Sets K01 as computed.
virtual void CenterPoint(int side, TPZVec< REAL > &masscent) const =0
It returns the coordinates from the center of the side of the element in the element coordinate space...
void Print(const char *name=NULL, std::ostream &out=std::cout, const MatrixOutputFormat=EFormatted) const override
Prints the object data structure.
int64_t size() const
Returns the number of elements of the vector.
virtual int NConnects() const override
Returns the number of nodes of the element.
void Unwrap()
unwrap the condensed element from the computational element and delete the condensed element ...
virtual TPZCompEl * Clone(TPZCompMesh &mesh) const =0
Method for creating a copy of the element.
TPZFMatrix< TVar > & F0()
int64_t SequenceNumber() const
Returns the Sequence number of the connect object.
void Push(const T object)
Pushes a copy of the object on the stack.
virtual void LoadSolution()
Loads the solution within the internal data structure of the element.
Structure to reference dependency.
TPZCompEl * fReferenceCompEl
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
int64_t Index() const
Returns the index of the element within the element vector of the mesh.
virtual bool HasMaterial(const std::set< int > &materialids) const
Verifies if the material associated with the element is contained in the set.
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
virtual int ClassId() const override
Define the class id associated with the class.
#define DebugStop()
Returns a message to user put a breakpoint in.
virtual void SetConnectIndex(int inode, int64_t index) override
Set the index i to node inode.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
TPZCompMesh * Mesh() const
Return a pointer to the grid of the element.
void SetReference(int64_t referenceindex)
unsigned int NShape() const
int64_t Rows() const
Returns number of rows.
void SetIndex(int64_t index)
Sets element index of the mesh fELementVec list.
virtual void SetReferenceMatrix(TPZAutoPointer< TPZMatrix< TVar > > matrix)
This method gives a preconditioner to share a matrix with the referring solver object.
int HasDependency() const
Returns whether exist dependecy information.
const TPZBlock< STATE > & Block() const
Access the block structure of the solution vector.
virtual bool HasMaterial(const std::set< int > &materialids) const override
Verifies if the material associated with the element is contained in the set.
Class which implements an element which condenses the internal connects.
int64_t Index() const
Returns element index of the mesh fELementVec list.
TPZManVector< int64_t, 27 > fIndexes
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
virtual int Redim(const int64_t newRows, const int64_t newCols)
Redimensions the matrix reinitializing it with zero.
virtual void ComputeSolution(TPZVec< REAL > &qsi, TPZMaterialData &data)
Contains declaration of TPZCompMesh class which is a repository for computational elements...
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
int Redim(const int64_t dim, const int64_t dim00) override
Redim: Set the dimension of the complete matrix and reduced matrix.
virtual TPZConnect & Connect(int i) const
Returns a pointer to the ith node.
void SetCondensed(bool flag)
Set the connect as a condensed connect or not.
unsigned char NState() const
Number of state variables associated with the connect.
int32_t Hash(std::string str)
virtual int64_t ConnectIndex(int i) const =0
Returns the index of the ith connectivity of the element.
This class associates an element matrix with the coeficients of its contribution in the global stiffn...
virtual int NConnects() const =0
Returns the number of nodes of the element.
void PermuteGather(TPZVec< int64_t > &permute)
permute the order of the connects
virtual int Dimension() const =0
Returns the dimension of the element.
virtual void CalcResidual(TPZElementMatrix &ef)
Computes the element right hand side.
TPZAutoPointer< TPZMatrix< TVar > > K00()
TPZGeoEl * Reference() const
Return a pointer to the corresponding geometric element if such exists, return 0 otherwise.
virtual void X(TPZVec< REAL > &qsi, TPZVec< REAL > &result) const =0
Return the coordinate in real space of the point coordinate in the master element space...
void ResetReference()
Reset the element referenced by the geometric element to NULL.
virtual void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef) override
Computes the element stifness matrix and right hand side.
TPZDepend * FirstDepend()
void K11Reduced(TPZFMatrix< TVar > &K11, TPZFMatrix< TVar > &F1)
Computes the K11 reduced .
Implements computational mesh. Computational Mesh.
int Size(const int block_diagonal) const
Returns block dimension.
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
virtual void Print(std::ostream &out=std::cout) const
Prints element data.
int NElConnected() const
Returns fNElConnected.
virtual void Print(std::ostream &out=std::cout) const override
Prints element data.
void SetReference(TPZCompEl *elp)
Make the current element reference to the computational element.
Contains TPZStepSolver class which defines step solvers class.
int64_t Cols() const
Returns number of cols.
virtual void Print(std::ostream &out) const
TPZFMatrix< TVar > & F1()
void SetDirect(const DecomposeType decomp)
TPZCondensedCompEl(TPZCompEl *ref, bool keepmatrix=true)
void Print(const TPZCompMesh &mesh, std::ostream &out=std::cout)
Print the information for the connect element.
Defines the interface of a computational element. Computational Element.
bool IsCondensed() const
Access method to return the indication whether the connect is condensed or not.
Contains the declaration of the TPZCondensedCompEl class, which implements an computational element w...
virtual ~TPZCondensedCompEl()
const TVar & GetVal(const int64_t row, const int64_t col) const override
Get values without bounds checking This method is faster than "Get" if DEBUG is defined.
int64_t fIndex
Element index into mesh element vector.
virtual void CalcResidual(TPZElementMatrix &ef) override
Computes the element right hand side.
virtual int Zero() override
This method will zero all submatrices associated with this reducable matrix class.
virtual int SolveDirect(TPZFMatrix< TVar > &F, const DecomposeType dt, std::list< int64_t > &singular)
Solves the linear system using Direct methods.
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
TPZCompMesh * fMesh
Computational mesh to which the element belongs.
void SetGMRES(const int64_t numiterations, const int numvectors, const TPZMatrixSolver< TVar > &pre, const REAL tol, const int64_t FromCurrent)
This class implements a reference counter mechanism to administer a dynamically allocated object...