40 static LoggerPtr logger(Logger::getLogger(
"pz.strmatrix.TPZStructMatrixGCTP"));
41 static LoggerPtr loggerel(Logger::getLogger(
"pz.strmatrix.element"));
42 static LoggerPtr loggerel2(Logger::getLogger(
"pz.strmatrix.elementinterface"));
43 static LoggerPtr loggerelmat(Logger::getLogger(
"pz.strmatrix.elementmat"));
44 static LoggerPtr loggerCheck(Logger::getLogger(
"pz.strmatrix.checkconsistency"));
47 #ifdef CHECKCONSISTENCY 74 cout <<
"TPZStructMatrixGCTP::Create should never be called\n";
79 cout <<
"TPZStructMatrixGCTP::Clone should never be called\n";
91 if (stiffness.
Rows() != neqcondense) {
118 if (rhs.
Rows() != neqexpand ||
Norm(rhs) != 0.) {
140 LOGPZ_ERROR(logger,
"Serial_Assemble called without mesh")
144 if (loggerelmat->isDebugEnabled()) {
145 if (dynamic_cast<TPZSubCompMesh *> (
fMesh)) {
146 std::stringstream sout;
147 sout <<
"AllEig = {};";
160 bool globalresult =
true;
161 bool writereadresult =
true;
163 TPZTimer calcstiff(
"Computing the stiffness matrices");
164 TPZTimer assemble(
"Assembling the stiffness matrices");
169 for (int64_t iel = 0; iel < nelem; iel++) {
181 int matid = mat->
Id();
187 if (!(count % 1000)) {
191 if (!(count % 20000)) {
192 std::cout << std::endl;
200 if (guiInterface && guiInterface->
AmIKilled()) {
205 if (loggerelmat->isDebugEnabled()) {
206 if (dynamic_cast<TPZSubCompMesh *> (
fMesh)) {
207 std::stringstream objname;
208 objname <<
"Element" << iel;
209 std::string name = objname.str();
211 std::stringstream sout;
213 sout <<
"AppendTo[AllEig,Eigenvalues[" << name <<
"]];";
221 #ifdef CHECKCONSISTENCY
223 stiffconsist.SetOverWrite(
true);
225 result = stiffconsist.CheckObject(ek.fMat);
227 globalresult =
false;
228 std::stringstream sout;
229 sout <<
"element " << iel <<
" computed differently";
238 if (!ek.HasDependency()) {
239 ek.ComputeDestinationIndices();
241 stiffness.
AddKel(ek.fMat, ek.fSourceIndex, ek.fDestinationIndex);
242 rhs.
AddFel(ef.
fMat, ek.fSourceIndex, ek.fDestinationIndex);
245 if (loggerel->isDebugEnabled()) {
246 std::stringstream sout;
251 gel->
X(center, xcenter);
252 sout <<
"Stiffness for computational element index " << el->
Index() << std::endl;
253 sout <<
"Stiffness for geometric element " << gel->
Index() <<
" center " << xcenter << std::endl;
255 sout <<
"Stiffness for computational element without associated geometric element" << std::endl;
264 ek.ApplyConstraints();
266 ek.ComputeDestinationIndices();
268 stiffness.
AddKel(ek.fConstrMat, ek.fSourceIndex, ek.fDestinationIndex);
272 std::stringstream sout;
277 gel->
X(center, xcenter);
278 sout <<
"Stiffness for geometric element " << gel->
Index() <<
" center " << xcenter << std::endl;
280 sout <<
"Stiffness for computational element index " << iel << std::endl;
292 if (loggerCheck->isDebugEnabled()) {
293 std::stringstream sout;
294 sout <<
"The comparison results are : consistency check " << globalresult <<
" write read check " << writereadresult;
305 TPZTimer calcresidual(
"Computing the residual vector");
306 TPZTimer assemble(
"Assembling the residual vector");
318 int matid = mat->
Id();
322 calcresidual.
start();
347 if (logger->isDebugEnabled()) {
348 std::stringstream sout;
349 sout << calcresidual.
processName() <<
" " << calcresidual << std::endl;
361 int64_t cols =
MAX(1, rhs.
Cols());
363 Assemble(*stiff, rhs, guiInterface);
366 if (loggerel->isDebugEnabled()) {
367 std::stringstream sout;
368 stiff->
Print(
"Stiffness matrix", sout);
369 rhs.
Print(
"Right hand side", sout);
378 if (guiInterface && guiInterface->
AmIKilled()) {
382 auto cmesh = this->
Mesh();
384 std::function<void(TPZStack<int64_t>)> job = [
this, cmesh, &mat, &rhs, &guiInterface] (
TPZStack<int64_t> indices) {
385 for (
auto index : indices){
388 TPZCompEl *el = cmesh->ElementVec()[iel];
396 if (guiInterface && guiInterface->
AmIKilled()) {
425 std::cout <<
"the element in ElColorSequence is negative???\n";
432 for (int64_t color = 0; color <
fNColors; ++color) {
435 int64_t elem_count = 0;
436 for (int64_t i = 0; i < n_elements; ++i) {
441 for (
auto &ind_vec:indices) {
448 if (loggerCheck->isDebugEnabled()) {
449 std::stringstream sout;
458 if (guiInterface && guiInterface->
AmIKilled()) {
462 auto cmesh = this->
Mesh();
464 std::function<void(TPZStack<int64_t>) > job = [
this, cmesh, &rhs, &guiInterface] (
TPZStack<int64_t> indices) {
465 for (
auto index: indices){
468 TPZCompEl *el = cmesh->ElementVec()[iel];
475 if (guiInterface && guiInterface->
AmIKilled()) {
501 std::cout <<
"the element in ElColorSequence is negative???\n";
508 for (int64_t color = 0; color <
fNColors; ++color) {
511 int64_t elem_count = 0;
512 for (int64_t i = 0; i < n_elements; ++i) {
517 for (
auto &ind_vec:indices) {
524 if (loggerCheck->isDebugEnabled()) {
525 std::stringstream sout;
533 int64_t numelconnected = 0;
537 firstelconnect[0] = 0;
538 for (int64_t ic = 0; ic < nconnect; ic++) {
539 numelconnected += cmesh->
ConnectVec()[ic].NElConnected();
540 firstelconnect[ic + 1] = firstelconnect[ic] + cmesh->
ConnectVec()[ic].NElConnected();
548 std::cout << __PRETTY_FUNCTION__ <<
" no element order\n";
553 ElementOrder[count] = el;
556 ElementOrder.
Resize(count);
565 for (int64_t ic = 0; ic < nc; ic++) {
566 int64_t cindex = connectlist[ic];
567 elconnect[firstelconnect[cindex]] = el;
568 firstelconnect[cindex]++;
571 firstelconnect[0] = 0;
572 for (int64_t ic = 0; ic < nconnect; ic++) {
573 firstelconnect[ic + 1] = firstelconnect[ic] + cmesh->
ConnectVec()[ic].NElConnected();
577 ElementOrder.
Fill(-1);
579 firstelconnect[0] = 0;
580 for (int64_t ic = 0; ic < nconnect; ic++) {
581 int64_t seqnum = cmesh->
ConnectVec()[ic].SequenceNumber();
582 if (seqnum >= 0) nodeorder[seqnum] = ic;
584 int64_t elsequence = 0;
586 for (int64_t seq = 0; seq < nconnect; seq++) {
587 int64_t ic = nodeorder[seq];
588 if (ic == -1)
continue;
589 int64_t firstind = firstelconnect[ic];
590 int64_t lastind = firstelconnect[ic + 1];
591 for (int64_t ind = firstind; ind < lastind; ind++) {
596 if (elorderinv[el] == -1) elorderinv[el] = elsequence++;
601 if (elorderinv[seq] == -1)
continue;
602 ElementOrder[elorderinv[seq]] = seq;
606 if (ElementOrder[seq] == -1)
break;
int64_t NElements() const
Number of computational elements allocated.
static RunStatsTable ass_stiff("-ass_stiff", "Assemble Stiffness")
Contains a class to record running statistics on CSV tables.
int fNumThreads
Number of threads in Assemble process.
The timer class. Utility.
Contains TPZAnalysis class which implements the sequence of actions to perform a finite element analy...
void Scatter(const TPZFMatrix< TVar > &vsmall, TPZFMatrix< TVar > &vexpand) const
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.
void Read(TPZStream &buf, void *context) override
read objects from the stream
static RunStatsTable ass_rhs("-ass_rhs", "Assemble Stiffness")
Timing class. Absolutely copied from GNU time. Take a look at
virtual void BuildConnectList(std::set< int64_t > &indepconnectlist, std::set< int64_t > &depconnectlist)
Builds the list of all connectivities related to the element including the connects pointed to by dep...
Contains declaration of TPZGeoNode class which defines a geometrical node.
virtual TPZCompMesh * Mesh() const
Access method for the mesh pointer.
void Filter(TPZVec< int64_t > &orig, TPZVec< int64_t > &dest) const
void AddFel(TPZFMatrix< TVar > &rhs, TPZVec< int64_t > &destination)
Performs a right hand side assemblage.
virtual void Assemble(TPZMatrix< STATE > &mat, TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface) override
Assemble the global system of equations into the matrix which has already been created.
TPZFNMatrix< 1000, STATE > fMat
Pointer to a blocked matrix object.
Contains declaration of TPZCompEl class which defines the interface of a computational element...
Templated vector implementation.
Contains the TPZRenumbering class which defines the behavior to implementing node sequence numbering ...
virtual TPZEquationFilter & EquationFilter()
access method for the equation filter
virtual void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef)
Computes the element stifness matrix and right hand side.
TPZEquationFilter fEquationFilter
Object which will determine which equations will be assembled.
static TPZThreadPool & globalInstance()
Declarates the TPZBlock<REAL>class which implements block matrices.
int64_t NElements() const
Access method to query the number of elements of the vector.
Implements a chunk vector with free store administration. Utility.
#define MAX(a, b)
Gets maxime value between a and b.
virtual int NSides() const =0
Returns the number of connectivities of the element.
static void OrderElement(TPZCompMesh *cmesh, TPZVec< int64_t > &ElementOrder)
Find the order to assemble the elements.
int ClassId() const override
Define the class id associated with the class.
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
virtual void Serial_Assemble(TPZMatrix< STATE > &mat, TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface)
Assemble the global system of equations into the matrix which has already been created.
bool ShouldCompute(int matid) const override
Establish whether the element should be computed.
std::shared_future< void > run(const int priority, TPZAutoPointer< std::packaged_task< void(void) > > &task, TPZTaskGroup *taskGroup=NULL)
submits a task to be executed by TPZThreadPool
TPZManVector< int64_t > fDestinationIndex
void ComputeDestinationIndices()
This abstract class defines the behaviour which each derived class needs to implement.
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
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...
TPZCompMesh * fMesh
Pointer to the computational mesh from which the matrix will be generated.
virtual TPZMaterial * Material() const
Identify the material object associated with the element.
void Print(std::ostream &out)
int64_t size() const
Returns the number of elements of the vector.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
int ClassId() const override
Define the class id associated with the class.
Contains declaration of TPZMesh class which defines a geometrical mesh and contains a corresponding l...
int64_t NActiveEquations() const
Retorna o numero de equacoes ativas do sistema.
std::string & processName()
Gets the process name (for reporting purposes).
void start()
Turns the timer on.
virtual void Write(const bool val)
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
virtual TPZMatrix< STATE > * Create() override
int64_t Index() const
Returns the index of the element within the element vector of the mesh.
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
Contains TPZMatrixclass which implements full matrix (using column major representation).
Implements a group of computational elements as a mesh and an element. Computational Mesh...
#define DebugStop()
Returns a message to user put a breakpoint in.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
It is responsible for a interface between Matrix and Finite Element classes. Structural Matrix This c...
Free store vector implementation.
virtual TPZMatrix< STATE > * CreateAssemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface, unsigned numthreads_assemble, unsigned numthreads_decompose)
int64_t Rows() const
Returns number of rows.
virtual void AddKel(TPZFMatrix< TVar > &elmat, TPZVec< int64_t > &destinationindex)
Add a contribution of a stiffness matrix.
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
int64_t NEqExpand() const
Retorna o numero de equacoes do sistema original.
int64_t NConnects() const
Number of connects allocated including free nodes.
TPZAdmChunkVector< TPZConnect > & ConnectVec()
Return a reference to the connect pointers vector.
int64_t Index() const
Returns element index of the mesh fELementVec list.
Implements an interface to check the consistency of two implementations. Utility. ...
TPZManVector< int64_t > fSourceIndex
std::set< int > fMaterialIds
Set of material ids to be considered. It is a private attribute.
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
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.
bool NeedsComputing(const std::set< int > &matids) override
Verifies if any element needs to be computed corresponding to the material ids.
int32_t Hash(std::string str)
virtual void MultiThread_Assemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface)
Assemble the global right hand side.
static int64_t ColorElements(const TPZCompMesh *cmesh, const TPZVec< int64_t > &elementIndices, TPZVec< int64_t > &elementColors)
Assigns a color to the elements in the elementIndices list such that two elements that share a connec...
This class associates an element matrix with the coeficients of its contribution in the global stiffn...
TPZFNMatrix< 1000, STATE > fConstrMat
Pointer to the constrained matrix object.
void ApplyConstraints()
Apply the constraints applied to the nodes by transforming the tangent matrix and right hand side...
Contains declaration of TPZSubCompMesh class which implements a group of computational elements as a ...
virtual int Dimension() const =0
Returns the dimension of the element.
virtual void CalcResidual(TPZElementMatrix &ef)
Computes the element right hand side.
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 Reset(TPZCompMesh *mesh=NULL, MType type=Unknown)
Reset the data structure.
Implements computational mesh. Computational Mesh.
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
RunStatsTable stat_ass_graph_gctp("-ass_graph_gctp", "Run statistics table for the graph creation and coloring TPZStructMatrixGCTP.")
Contains declaration of TPZInterpolatedElement class which implements computational element of the in...
virtual TPZStructMatrixGCTP * Clone() override
void Fill(const T ©, const int64_t from=0, const int64_t numelem=-1)
Will fill the elements of the vector with a copy object.
int64_t Cols() const
Returns number of cols.
virtual void FilterEquations(TPZVec< int64_t > &origindex, TPZVec< int64_t > &destindex) const
Filter out the equations which are out of the range.
virtual void Print(std::ostream &out) const
Defines the interface for saving and reading data. Persistency.
void stop()
Turns the timer off, and computes the elapsed time.
int64_t NElements() const
Returns the number of elements of the vector.
TPZVec< int64_t > fElementColors
Defines the interface of a computational element. Computational Element.
virtual int HasDependency()
Returns 1 if the element has at least one dependent node. Returns 0 otherwise.
bool HasDependency()
Returns true if the element has at least one dependent node. Returns false otherwise.
void Read(TPZStream &buf, void *context) override
read objects from the stream
Implements an interface to register a class id and a restore function. Persistence.
TPZManVector< int64_t > fElementOrder
Contains TPZSFMatrix class which implements a symmetric full matrix.
virtual void Read(bool &val)