37 static LoggerPtr logger(Logger::getLogger(
"pz.strmatrix.TPZStructMatrixOT"));
38 static LoggerPtr loggerel(Logger::getLogger(
"pz.strmatrix.element"));
39 static LoggerPtr loggerel2(Logger::getLogger(
"pz.strmatrix.elementinterface"));
40 static LoggerPtr loggerelmat(Logger::getLogger(
"pz.strmatrix.elementmat"));
41 static LoggerPtr loggerCheck(Logger::getLogger(
"pz.strmatrix.checkconsistency"));
44 #ifdef CHECKCONSISTENCY 86 cout <<
"TPZStructMatrixOT::Create should never be called\n";
91 cout <<
"TPZStructMatrixOT::Clone should never be called\n";
103 if (stiffness.
Rows() != neqcondense) {
135 if(rhs.
Rows() != neqexpand ||
Norm(rhs) != 0.)
149 REAL norm =
Norm(rhsserial);
150 std::cout <<
"difference between serial and parallel " << norm << std::endl;
168 REAL normrhs =
Norm(rhs);
169 REAL normrhsserial =
Norm(rhsserial);
170 std::cout <<
"normrhs = " << normrhs <<
" normrhsserial " << normrhsserial << std::endl;
172 REAL norm =
Norm(rhsserial);
173 std::cout <<
"difference between serial and parallel " << norm << std::endl;
188 LOGPZ_ERROR(logger,
"Serial_Assemble called without mesh")
192 if(dynamic_cast<TPZSubCompMesh * >(
fMesh))
194 std::stringstream sout;
195 sout <<
"AllEig = {};";
210 bool globalresult =
true;
211 bool writereadresult =
true;
213 TPZTimer calcstiff(
"Computing the stiffness matrices");
214 TPZTimer assemble(
"Assembling the stiffness matrices");
218 for(iel=0; iel < nelem; iel++) {
234 int matid = mat->
Id();
253 if(guiInterface)
if(guiInterface->
AmIKilled()){
258 if(dynamic_cast<TPZSubCompMesh * >(
fMesh))
260 std::stringstream objname;
261 objname <<
"Element" << iel;
262 std::string name = objname.str();
264 std::stringstream sout;
266 sout <<
"AppendTo[AllEig,Eigenvalues[" << name <<
"]];";
281 #ifdef CHECKCONSISTENCY
283 stiffconsist.SetOverWrite(
true);
285 result = stiffconsist.CheckObject(ek.fMat);
288 globalresult =
false;
289 std::stringstream sout;
290 sout <<
"element " << iel <<
" computed differently";
300 ek.ComputeDestinationIndices();
305 stiffness.
AddKel(ek.fMat,ek.fSourceIndex,ek.fDestinationIndex);
306 rhs.
AddFel(ef.
fMat,ek.fSourceIndex,ek.fDestinationIndex);
315 if(loggerel->isDebugEnabled())
317 std::stringstream sout;
323 gel->
X(center, xcenter);
324 sout <<
"Stiffness for computational element index " << el->
Index() << std::endl;
325 sout <<
"Stiffness for geometric element " << gel->
Index() <<
" center " << xcenter << std::endl;
328 sout <<
"Stiffness for computational element without associated geometric element\n";
337 ek.ApplyConstraints();
339 ek.ComputeDestinationIndices();
341 stiffness.
AddKel(ek.fConstrMat,ek.fSourceIndex,ek.fDestinationIndex);
346 std::stringstream sout;
350 gel->
X(center, xcenter);
351 sout <<
"Stiffness for geometric element " << gel->
Index() <<
" center " << xcenter << std::endl;
361 if(count > 20) std::cout << std::endl;
364 if(loggerCheck->isDebugEnabled())
366 std::stringstream sout;
367 sout <<
"The comparaison results are : consistency check " << globalresult <<
" write read check " << writereadresult;
383 TPZTimer calcresidual(
"Computing the residual vector");
384 TPZTimer assemble(
"Assembling the residual vector");
396 for (int64_t index = 0; index < elseqsize; index++) {
403 int matid = mat->
Id();
408 calcresidual.
start();
433 if(logger->isDebugEnabled())
435 std::stringstream sout;
436 sout << calcresidual.
processName() <<
" " << calcresidual << std::endl;
450 int64_t cols =
MAX(1, rhs.
Cols());
455 if(loggerel->isDebugEnabled())
457 std::stringstream sout;
458 stiff->
Print(
"Stiffness matrix",sout);
459 rhs.
Print(
"Right hand side", sout);
472 std::cout <<
"Assemble numthreads = " << numthreads << std::endl;
484 this->fCurrentIndex = 0;
496 std::cout <<
"i = " << i <<
" fElBlocked[i-1] " <<
fElBlocked[i-1] <<
" fElBlocked[i] " <<
fElBlocked[i] << std::endl;
515 &threaddata, __FUNCTION__);
525 delete allthreaddata[itr];
531 if(loggerCheck->isDebugEnabled())
533 std::stringstream sout;
558 this->fCurrentIndex = 0;
579 &threaddata, __FUNCTION__);
589 delete allthreaddata[itr];
596 if(loggerCheck->isDebugEnabled())
598 std::stringstream sout;
613 : fStruct(strmat), fGuiInterface(guiInterface), fGlobMatrix(&mat), fGlobRhs(&rhs), fThreadSeqNum(seqnum)
616 fCurrentIndex = &strmat->fCurrentIndex;
646 std::set<int> &MaterialIds,
648 : fStruct(strmat),fGuiInterface(guiInterface), fGlobMatrix(0), fGlobRhs(&rhs), fThreadSeqNum(seqnum)
651 this->fCurrentIndex = &strmat->fCurrentIndex;
706 int64_t index = data->fCurrentIndex->fetch_add(1);
711 if (logger->isDebugEnabled()) {
712 std::stringstream sout;
713 sout <<
"ThreadData starting with " << data->
fThreadSeqNum <<
" total elements " << numelements << std::endl;
714 sout <<
"index = " << index << std::endl;
720 std::cout <<
"ThreadData starting with " << data->
fThreadSeqNum <<
" total elements " << numelements << std::endl;
721 std::cout <<
"index = " << index << std::endl;
728 for (index = data->
fThreadSeqNum; index < numelements; index += nthreads)
730 while (index < numelements)
736 if (logger->isDebugEnabled()) {
737 std::stringstream sout;
738 sout <<
"Computing element " << index;
743 std::stringstream sout;
744 sout <<
"Element " << index <<
" elapsed time ";
758 if(guiInterface)
if(guiInterface->
AmIKilled()){
769 if(loggerel->isDebugEnabled())
771 std::stringstream sout;
772 ek.
fMat.
Print(
"Element stiffness matrix",sout);
773 ef.
fMat.
Print(
"Element right hand side", sout);
788 if (logger->isDebugEnabled())
790 std::stringstream sout;
791 sout << timeforel.processName() << timeforel;
797 bool localupdated =
false;
798 while (localcompleted < numelements-1 && ComputedElements[localcompleted+1] == 1) {
802 int64_t needscomputed = ElBlocked[index];
804 if (logger->isDebugEnabled())
806 std::stringstream sout;
808 sout <<
"Localcompleted updated without thread lock\n";
811 sout <<
"Element " << index <<
" is computed and can assemble if required " << needscomputed <<
" is smaller than localcompleted " << localcompleted;
818 std::cout <<
"threadEK " << data->
fThreadSeqNum <<
" index " << index <<
" localcompleted " << localcompleted <<
" needscomputed " << needscomputed << std::endl;
822 bool hadtowait =
false;
823 while (needscomputed > localcompleted) {
826 SomeoneIsSleeping = 1;
829 std::cout <<
"threadEK " <<data->
fThreadSeqNum <<
" Index " << index <<
" going to sleep waiting for " << needscomputed << std::endl;
833 if (logger->isDebugEnabled())
835 std::stringstream sout;
836 sout <<
"Element " << index <<
" cannot be assembled - going to sleep";
844 localupdated =
false;
845 while (ComputedElements[localcompleted+1] == 1) {
850 if (logger->isDebugEnabled())
852 std::stringstream sout;
853 sout <<
"thread wakeup for element index " << index << std::endl;
855 sout <<
"Localcompleted updated without thread lock\n";
858 sout <<
"Element " << index <<
" is computed and can assemble if required " << needscomputed <<
" is smaller than localcompleted " << localcompleted;
867 std::cout <<
"threadEK " <<data->
fThreadSeqNum <<
" Index " << index <<
" continuing\n";
889 localupdated =
false;
890 while (localcompleted < numelements-1 && ComputedElements[localcompleted+1] == 1) {
894 if (localcompleted == index-1) {
897 while (localcompleted < numelements-1 && ComputedElements[localcompleted+1] == 1) {
901 bool elementcompletedupdate =
false;
905 elementcompletedupdate =
true;
908 if (logger->isDebugEnabled())
910 std::stringstream sout;
911 sout <<
"Element " << index <<
" has been assembled ";
913 sout <<
"\nLocalcompleted updated without thread lock\n";
915 if (elementcompletedupdate) {
916 sout <<
"\nfElementCompleted updated to localcompleted\n";
918 sout <<
"local completed " << localcompleted;
922 ComputedElements[index] = 1;
923 if (SomeoneIsSleeping) {
926 std::cout <<
"threadEK " <<data->
fThreadSeqNum <<
" Computed index " << index <<
" Waking up ElementsCompleted " << *data->
fElementCompleted << std::endl;
931 if (logger->isDebugEnabled())
936 SomeoneIsSleeping = 0;
944 std::cout <<
"the element in ElColorSequence is negative???\n";
948 index = data->fCurrentIndex->fetch_add(1);
954 bool localupdated =
false;
956 while (localcompleted < numelements-1 && ComputedElements[localcompleted+1] == 1) {
960 if (localcompleted == index-1) {
963 bool elementcompletedupdate =
false;
967 elementcompletedupdate =
true;
971 if (logger->isDebugEnabled())
977 if (elementcompletedupdate) {
980 if (localupdated || elementcompletedupdate) {
981 std::stringstream sout;
982 sout <<
"localcompleted " << localcompleted;
985 LOGPZ_DEBUG(logger,
"finishing and condition broadcast")
989 SomeoneIsSleeping = 0;
997 logger->setLevel(log4cxx::Level::getInfo());
1011 int64_t index = data->fCurrentIndex->fetch_add(1);
1016 if (logger->isDebugEnabled()) {
1017 std::stringstream sout;
1018 sout <<
"ThreadData starting with " << data->
fThreadSeqNum <<
" total elements " << numelements << std::endl;
1019 sout <<
"index = " << index << std::endl;
1025 std::cout <<
"ThreadData starting with " << data->
fThreadSeqNum <<
" total elements " << numelements << std::endl;
1026 std::cout <<
"index = " << index << std::endl;
1033 for (index = data->
fThreadSeqNum; index < numelements; index += nthreads)
1035 while (index < numelements)
1041 if (logger->isDebugEnabled()) {
1042 std::stringstream sout;
1043 sout <<
"Computing element " << index;
1048 std::stringstream sout;
1049 sout <<
"Element " << index <<
" elapsed time ";
1062 if(guiInterface)
if(guiInterface->
AmIKilled()){
1073 if(loggerel->isDebugEnabled())
1075 std::stringstream sout;
1076 ef.
fMat.
Print(
"Element right hand side", sout);
1090 if (logger->isDebugEnabled())
1092 std::stringstream sout;
1093 sout << timeforel.processName() << timeforel;
1099 bool localupdated =
false;
1100 while (localcompleted < numelements-1 && ComputedElements[localcompleted+1] == 1) {
1102 localupdated =
true;
1104 int64_t needscomputed = ElBlocked[index];
1106 if (logger->isDebugEnabled())
1108 std::stringstream sout;
1110 sout <<
"Localcompleted updated without thread lock\n";
1113 sout <<
"Element " << index <<
" is computed and can assemble if required " << needscomputed <<
" is smaller than localcompleted " << localcompleted;
1120 std::cout <<
"threadEK " << data->
fThreadSeqNum <<
" index " << index <<
" localcompleted " << localcompleted <<
" needscomputed " << needscomputed << std::endl;
1124 bool hadtowait =
false;
1126 if (logger->isInfoEnabled() && needscomputed > localcompleted)
1128 std::stringstream sout;
1129 sout <<
"Element " << index <<
" cannot be assembled - going to sleep";
1133 while (needscomputed > localcompleted) {
1136 SomeoneIsSleeping = 1;
1139 std::cout <<
"threadEK " <<data->
fThreadSeqNum <<
" Index " << index <<
" going to sleep waiting for " << needscomputed << std::endl;
1143 if (logger->isDebugEnabled())
1145 std::stringstream sout;
1146 sout <<
"Element " << index <<
" cannot be assembled - going to sleep";
1154 localupdated =
false;
1155 while (ComputedElements[localcompleted+1] == 1) {
1157 localupdated =
true;
1160 if (logger->isDebugEnabled())
1162 std::stringstream sout;
1163 sout <<
"thread wakeup for element index " << index << std::endl;
1165 sout <<
"Localcompleted updated without thread lock\n";
1168 sout <<
"Element " << index <<
" is computed and can assemble if required " << needscomputed <<
" is smaller than localcompleted " << localcompleted;
1176 if (logger->isInfoEnabled() && hadtowait)
1178 std::stringstream sout;
1179 sout <<
"thread wakeup for element index " << index << std::endl;
1188 std::cout <<
"threadEK " <<data->
fThreadSeqNum <<
" Index " << index <<
" continuing\n";
1208 localupdated =
false;
1209 while (localcompleted < numelements-1 && ComputedElements[localcompleted+1] == 1) {
1211 localupdated =
true;
1213 if (localcompleted == index-1) {
1216 while (localcompleted < numelements-1 && ComputedElements[localcompleted+1] == 1) {
1218 localupdated =
true;
1220 bool elementcompletedupdate =
false;
1224 elementcompletedupdate =
true;
1227 if (logger->isDebugEnabled())
1229 std::stringstream sout;
1230 sout <<
"Element " << index <<
" has been assembled ";
1232 sout <<
"\nLocalcompleted updated without thread lock\n";
1234 if (elementcompletedupdate) {
1235 sout <<
"\nfElementCompleted updated to localcompleted\n";
1237 sout <<
"local completed " << localcompleted;
1241 ComputedElements[index] = 1;
1242 if (SomeoneIsSleeping) {
1245 std::cout <<
"threadEK " <<data->
fThreadSeqNum <<
" Computed index " << index <<
" Waking up ElementsCompleted " << *data->
fElementCompleted << std::endl;
1250 if (logger->isDebugEnabled())
1255 SomeoneIsSleeping = 0;
1263 std::cout <<
"the element in ElColorSequence is negative???\n";
1267 index = data->fCurrentIndex->fetch_add(1);
1273 bool localupdated =
false;
1275 while (localcompleted < numelements-1 && ComputedElements[localcompleted+1] == 1) {
1277 localupdated =
true;
1279 if (localcompleted == index-1) {
1282 bool elementcompletedupdate =
false;
1286 elementcompletedupdate =
true;
1290 if (logger->isDebugEnabled())
1296 if (elementcompletedupdate) {
1299 if (localupdated || elementcompletedupdate) {
1300 std::stringstream sout;
1301 sout <<
"localcompleted " << localcompleted;
1304 LOGPZ_DEBUG(logger,
"finishing and condition broadcast")
1308 SomeoneIsSleeping = 0;
1325 for (
auto connect : connectlist) {
1326 elContribute[connect] = el;
1332 for (
auto connect : connectlist) {
1333 auto elBlocked = elContribute[connect];
1334 if (elBlocked == -1)
continue;
1335 auto elBlockedIndex = elSequenceColorInv[elBlocked];
1336 if (el == -1) el = elBlockedIndex;
1337 if (elBlockedIndex > el) el = elBlockedIndex;
1359 int64_t minPassIndex = -1;
1360 for (int64_t i = 0; i < connectlist.
NElements(); i++) {
1361 int64_t elcont = elContribute[connectlist[i]];
1362 int64_t passindex = -1;
1364 passindex = passIndex[elcont];
1365 if (minPassIndex == -1) minPassIndex = passindex;
1367 if (minPassIndex < passindex) minPassIndex = passindex;
1369 return minPassIndex;
1381 const int64_t nnodes = cmesh->
NConnects();
1384 if (nel == 0)
return;
1386 NumelColors.
Resize(nel, -1);
1391 int64_t elsequencesize = elSequence.
size();
1392 elSequenceColor.
Resize(elsequencesize);
1393 elSequenceColor.
Fill(-1);
1394 elBlocked.
Resize(elsequencesize);
1396 int64_t nelProcessed = 0;
1397 int64_t currentPassIndex = 0;
1398 while (nelProcessed < elSequence.
NElements()) {
1399 for (
auto elindex : elSequence) {
1401 if (elSequenceColorInv[elindex] == -1) {
1407 int64_t minPass =
MinPassIndex(connectlist, elContribute, passIndex);
1409 if (minPass == -1) {
1410 passIndex[elindex] = currentPassIndex;
1414 elSequenceColor[nelProcessed] = elindex;
1415 elSequenceColorInv[elindex] = nelProcessed;
1418 else if (minPass == currentPassIndex) {
1420 else if (minPass < currentPassIndex) {
1423 const int64_t el =
WhoBlockedMe(connectlist, elContribute, elSequenceColorInv);
1425 if (elBlocked[nelProcessed] != -1)
DebugStop();
1426 elBlocked[nelProcessed] = el;
1427 passIndex[elindex] = currentPassIndex;
1429 elSequenceColor[nelProcessed] = elindex;
1430 elSequenceColorInv[elindex] = nelProcessed;
1437 NumelColors[currentPassIndex] = nelProcessed;
1441 NumelColors[currentPassIndex] = NumelColors[currentPassIndex - 1] + 1;
1442 NumelColors.
Resize(currentPassIndex + 1);
1445 std::ofstream toto(
"../ColorMeshDebug.txt");
1446 toto <<
"elSequence\n" << elSequence << std::endl;
1447 toto <<
"elSequenceColor\n" << elSequenceColor << std::endl;
1448 toto <<
"elSequenceColorInv\n" << elSequenceColorInv << std::endl;
1449 toto <<
"elBlocked\n" << elBlocked << std::endl;
1450 toto <<
"elContribute\n" << elContribute << std::endl;
1451 toto <<
"passIndex\n" << passIndex << std::endl;
1452 toto <<
"NumelColors\n" << NumelColors << std::endl;
1458 int64_t numelconnected = 0;
1462 firstelconnect[0] = 0;
1463 for (int64_t ic = 0; ic < nconnect; ic++) {
1464 numelconnected += cmesh->
ConnectVec()[ic].NElConnected();
1465 firstelconnect[ic + 1] = firstelconnect[ic] + cmesh->
ConnectVec()[ic].NElConnected();
1476 std::cout << __PRETTY_FUNCTION__ <<
" no element order\n";
1481 ElementOrder[count] = el;
1484 ElementOrder.
Resize(count);
1493 for (int64_t ic = 0; ic < nc; ic++) {
1494 int64_t cindex = connectlist[ic];
1495 elconnect[firstelconnect[cindex]] = el;
1496 firstelconnect[cindex]++;
1500 firstelconnect[0] = 0;
1501 for (int64_t ic = 0; ic < nconnect; ic++) {
1502 firstelconnect[ic + 1] = firstelconnect[ic] + cmesh->
ConnectVec()[ic].NElConnected();
1513 ElementOrder.
Fill(-1);
1515 firstelconnect[0] = 0;
1516 for (int64_t ic = 0; ic < nconnect; ic++) {
1517 int64_t seqnum = cmesh->
ConnectVec()[ic].SequenceNumber();
1518 if (seqnum >= 0) nodeorder[seqnum] = ic;
1524 int64_t elsequence = 0;
1526 for (int64_t seq = 0; seq < nconnect; seq++) {
1527 int64_t ic = nodeorder[seq];
1528 if (ic == -1)
continue;
1529 int64_t firstind = firstelconnect[ic];
1530 int64_t lastind = firstelconnect[ic + 1];
1531 for (int64_t ind = firstind; ind < lastind; ind++) {
1532 el = elconnect[ind];
1536 if (elorderinv[el] == -1) elorderinv[el] = elsequence++;
1544 if (elorderinv[seq] == -1)
continue;
1545 ElementOrder[elorderinv[seq]] = seq;
1549 if (ElementOrder[seq] == -1)
break;
1552 ElementOrder.
Resize(seq);
1627 int64_t fCurrentIndexLong;
1628 buf.
Read(&fCurrentIndexLong);
1629 fCurrentIndex = fCurrentIndexLong;
1641 int64_t fCurrentIndexLong;
1642 fCurrentIndexLong = fCurrentIndex;
1643 buf.
Write(&fCurrentIndexLong);
int64_t NElements() const
Number of computational elements allocated.
Contains a class to record running statistics on CSV tables.
int fNumThreads
Number of threads in Assemble process.
int fSomeoneIsSleeping
variable indicating if a thread is sleeping
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
RunStatsTable stat_ass_graph_ot("-ass_graph_ot", "Run statistics table for the graph creation and coloring TPZStructMatrixOT.")
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.
ThreadData(TPZStructMatrixOT *strmat, int seqnum, TPZMatrix< STATE > &mat, TPZFMatrix< STATE > &rhs, std::set< int > &MaterialIds, TPZAutoPointer< TPZGuiInterface > guiInterface)
Initialize the mutex semaphores and others.
TPZVec< int64_t > * fElSequenceColor
Contains the TPZStructMatrixOT class which responsible for a interface among Matrix and Finite Elemen...
TPZVec< int64_t > * fElBlocked
Vector for mesh coloring.
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...
static void * ThreadWorkResidual(void *datavoid)
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.
TPZVec< int64_t > fElBlocked
Vectors for mesh coloring.
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.
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.
~ThreadData()
Destructor: Destroy the mutex semaphores and others.
int ClassId() const override
Define the class id associated with the class.
Structure to manipulate thread to solve system equations.
virtual void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef)
Computes the element stifness matrix and right hand side.
virtual TPZMatrix< STATE > * CreateAssemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface, unsigned numthreads_assemble, unsigned numthreads_decompose)
void LeaveCriticalSection(pz_critical_section_t &cs)
static void ElementColoring(TPZCompMesh *cmesh, TPZVec< int64_t > &elSequence, TPZVec< int64_t > &elSequenceColor, TPZVec< int64_t > &elBlocked, TPZVec< int64_t > &NumelColors)
Create blocks of elements to parallel processing.
int64_t * fElementCompleted
All elements below or equal this index have been computed.
TPZEquationFilter fEquationFilter
Object which will determine which equations will be assembled.
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.
static void * ThreadWork(void *threaddata)
The function which will compute the matrices.
#define MAX(a, b)
Gets maxime value between a and b.
virtual int NSides() const =0
Returns the number of connectivities of the element.
int ClassId() const override
Define the class id associated with the class.
virtual void FilterEquations(TPZVec< int64_t > &origindex, TPZVec< int64_t > &destindex) const override
Filter out the equations which are out of the range.
void EnterCriticalSection(pz_critical_section_t &cs)
TPZManVector< int64_t > fDestinationIndex
void ComputeDestinationIndices()
Refines geometrical mesh (all the elements) num times.
static int64_t MinPassIndex(TPZStack< int64_t > &connectlist, TPZVec< int64_t > &elContribute, TPZVec< int64_t > &passIndex)
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...
int64_t fElementCompleted
All elements below or equal this index have been 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...
TPZCompMesh * fMesh
Pointer to the computational mesh from which the matrix will be generated.
#define PZ_PTHREAD_JOIN(thread, val, fn)
TPZVec< int64_t > fElSequenceColor
virtual TPZMaterial * Material() const
Identify the material object associated with the element.
virtual void MultiThread_Assemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface)
Assemble the global right hand side.
void Print(std::ostream &out)
pthread_mutex_t fAccessElement
Mutexes (to choose which element is next)
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...
TPZCompEl * Element(int64_t iel)
const std::set< int > & MaterialIds() override
Returns the material ids.
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.
#define LOGPZ_INFO(A, B)
Define log for informations.
static RunStatsTable ass_rhs("-ass_rhs", "Assemble Stiffness")
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...
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.
Free store vector implementation.
TPZAutoPointer< TPZGuiInterface > fGuiInterface
Gui interface object.
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.
static void AssembleColor(int64_t el, TPZStack< int64_t > &connectlist, TPZVec< int64_t > &elContribute)
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
#define PZ_PTHREAD_MUTEX_DESTROY(mutex, fn)
int64_t NEqExpand() const
Retorna o numero de equacoes do sistema original.
TPZMatrix< STATE > * fGlobMatrix
Global matrix.
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
virtual void InitializeElementMatrix(TPZElementMatrix &ek, TPZElementMatrix &ef)
Initialize element matrix in which is computed CalcStiff.
std::set< int > fMaterialIds
Set of material ids to be considered. It is a private attribute.
static int64_t WhoBlockedMe(TPZStack< int64_t > &connectlist, TPZVec< int64_t > &elContribute, TPZVec< int64_t > &elSequenceColorInv)
#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 TPZStructMatrixOT * Clone() override
TPZVec< int64_t > * fComputedElements
vector indicating whether an element has been computed
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.
TPZFMatrix< STATE > * fGlobRhs
Global rhs vector.
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 Read(TPZStream &buf, void *context) override
read objects from the stream
pthread_cond_t fCondition
static RunStatsTable ass_stiff("-ass_stiff", "Assemble Stiffness")
Implements computational mesh. Computational Mesh.
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
#define PZ_PTHREAD_CREATE(thread, attr, routine, args, fn)
virtual int GetNumThreads() const
Contains declaration of TPZInterpolatedElement class which implements computational element of the in...
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.
int fThreadSeqNum
sequence number of the thread
int64_t Cols() const
Returns number of cols.
pthread_mutex_t * fAccessElement
Mutexes (to choose which element is next)
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.
virtual TPZMatrix< STATE > * Create() override
bool ShouldCompute(int matid) const override
Establish whether the element should be computed.
#define PZ_PTHREAD_MUTEX_INIT(mutex, attr, fn)
static void OrderElement(TPZCompMesh *cmesh, TPZVec< int64_t > &ElementOrder)
Find the order to assemble the elements.
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.
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.
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
pthread_cond_t * fCondition
Implements computational element based on an interpolation space. Computational Element.
Implements an interface to register a class id and a restore function. Persistence.
TPZVec< int64_t > fElementsComputed
vector of the size of the elements containing 0 or 1 if the element has been computed (in the order o...
Contains TPZSFMatrix class which implements a symmetric full matrix.
TPZStructMatrixOT * fStruct
Current structmatrix object.
virtual void Read(bool &val)