Skip to content

Commit

Permalink
Removed references to TPZGuiInterface for the NeoPZ library
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeDevloo committed May 27, 2024
1 parent 1085182 commit 93a7287
Show file tree
Hide file tree
Showing 46 changed files with 385 additions and 526 deletions.
3 changes: 0 additions & 3 deletions Analysis/TPZAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ void TPZAnalysis::CleanUp()
fSolution.Redim(0,0);
fStructMatrix = nullptr;
fRenumber = nullptr;
fGuiInterface = nullptr;

}

Expand Down Expand Up @@ -1437,7 +1436,6 @@ void TPZAnalysis::Write(TPZStream &buf, int withclassid) const{
buf.Write(&fNthreadsError);
TPZPersistenceManager::WritePointer(fStructMatrix.operator ->(), &buf);
TPZPersistenceManager::WritePointer(fRenumber.operator ->(), &buf);
TPZPersistenceManager::WritePointer(fGuiInterface.operator ->(), &buf);
fTable.Write(buf,withclassid);
buf.Write(fTensorNames[0]);
buf.Write(fTensorNames[1]);
Expand Down Expand Up @@ -1467,7 +1465,6 @@ void TPZAnalysis::Read(TPZStream &buf, void *context){
buf.Read(&fNthreadsError);
fStructMatrix = TPZAutoPointerDynamicCast<TPZStructMatrix>(TPZPersistenceManager::GetAutoPointer(&buf));
fRenumber = TPZAutoPointerDynamicCast<TPZRenumbering>(TPZPersistenceManager::GetAutoPointer(&buf));
fGuiInterface = TPZAutoPointerDynamicCast<TPZGuiInterface>(TPZPersistenceManager::GetAutoPointer(&buf));
fTable.Read(buf,context);
buf.Read(fTensorNames[0]);
buf.Read(fTensorNames[1]);
Expand Down
26 changes: 0 additions & 26 deletions Analysis/TPZAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <mutex> // for mutex
#include <set> // for set
#include <functional> // for function
#include "TPZGuiInterface.h" // for TPZGuiInterface
#include "pzerror.h" // for DebugStop
#include "pzmatrix.h" // for TPZFMatrix, TPZMatrix
#include "TPZSolutionMatrix.h"// for TPZSolutionMatrix
Expand Down Expand Up @@ -86,8 +85,6 @@ class TPZAnalysis : public TPZSavable {
TPZAutoPointer<TPZStructMatrix> fStructMatrix{nullptr};
/** @brief Renumbering scheme */
TPZAutoPointer<TPZRenumbering> fRenumber{nullptr};
/** @brief Pointer for gui interface object */
TPZAutoPointer<TPZGuiInterface> fGuiInterface{nullptr};
/** @brief Datastructure which defines postprocessing for one dimensional meshes */
class TTablePostProcess : public TPZSavable {
public :
Expand Down Expand Up @@ -125,29 +122,6 @@ class TPZAnalysis : public TPZSavable {
/** @brief Destructor: deletes all protected dynamic allocated objects */
virtual ~TPZAnalysis(void);

/** @name GUI
Methods useful when running in a GUI*/
/** @{ */
/** @brief Defines gui interface object */
void SetGuiInterface(TPZAutoPointer<TPZGuiInterface> gui){
fGuiInterface = gui;
}

/** @brief Gets gui interface object */
TPZAutoPointer<TPZGuiInterface> GetGuiInterface() const{
return fGuiInterface;
}

/** @brief Returns if the process was canceled through gui interface */
bool AmIKilled(){
if(fGuiInterface){
return fGuiInterface->AmIKilled();
}
else return false;
}

/** @} */

/** @name MainFEM
Main methods of the TPZAnalysis for controlling a FEM simulation.*/
/** @{ */
Expand Down
4 changes: 2 additions & 2 deletions Analysis/TPZEigenAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ void TPZEigenAnalysis::AssembleT()

if (mat && mat->Rows() == sz) {
mat->Zero();
fStructMatrix->Assemble(*mat, dummyRhs, fGuiInterface);
fStructMatrix->Assemble(*mat, dummyRhs);
} else {
TPZAutoPointer<TPZMatrix<TVar>> mat =
dynamic_cast<TPZMatrix<TVar>*>(
fStructMatrix->CreateAssemble(dummyRhs, fGuiInterface));
fStructMatrix->CreateAssemble(dummyRhs));

if constexpr (MAT==TPZEigenAnalysis::Mat::A){
eigSolver.SetMatrixA(mat);
Expand Down
6 changes: 3 additions & 3 deletions Analysis/TPZLinearAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ void TPZLinearAnalysis::AssembleT()
if(mySolver->Matrix() && mySolver->Matrix()->Rows()==sz)
{
mySolver->Matrix()->Zero();
fStructMatrix->Assemble(*(mySolver->Matrix().operator ->()),fRhs,fGuiInterface);
fStructMatrix->Assemble(*(mySolver->Matrix().operator ->()),fRhs);
}
else
{
auto *mat = fStructMatrix->CreateAssemble(fRhs,fGuiInterface);
auto *mat = fStructMatrix->CreateAssemble(fRhs);
mySolver->SetMatrix(mat);
}
#ifdef PZ_LOG
Expand Down Expand Up @@ -122,7 +122,7 @@ void TPZLinearAnalysis::AssembleResidual()
int64_t sz = this->Mesh()->NEquations();
this->Rhs().Redim(sz,numloadcases);
//int64_t othersz = fStructMatrix->Mesh()->NEquations();
fStructMatrix->Assemble(this->Rhs(),fGuiInterface);
fStructMatrix->Assemble(this->Rhs());
}//void

void TPZLinearAnalysis::Solve()
Expand Down
4 changes: 2 additions & 2 deletions Analysis/TPZNLMultGridAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ void TPZNonLinMultGridAnalysis::TwoGridAlgorithm(std::ostream &out,int nummat){
if(residuo == 1){// forma 1
coarsean.Solution().Zero();
fSolvers[1]->SetMatrix(0);
fSolvers[1]->SetMatrix(coarsean.StructMatrix()->CreateAssemble(coarsean.Rhs(),NULL));
fSolvers[1]->SetMatrix(coarsean.StructMatrix()->CreateAssemble(coarsean.Rhs()));
CalcResidual(projfinesol,coarsean,"LDLt",rhs);//rhs = Stiffcoar * projfinesol
//no assemble ser�adicionado +fRhs por isso: rhs = rhs - fRhs
rhs = rhs + projfineres;
Expand All @@ -752,7 +752,7 @@ void TPZNonLinMultGridAnalysis::TwoGridAlgorithm(std::ostream &out,int nummat){
coarsean.Solution().Zero();
fSolvers[1]->SetMatrix(0);
//argumento 1 espera? adicionar o res�uo anterior ao atual calculado
fSolvers[1]->SetMatrix(coarsean.StructMatrix()->CreateAssemble(coarsean.Rhs(),NULL));
fSolvers[1]->SetMatrix(coarsean.StructMatrix()->CreateAssemble(coarsean.Rhs()));
TPZFMatrix<STATE> &coarseanrhs = coarsean.Rhs();
TPZFMatrix<STATE> coarres = coarseanrhs + projfineres;
coarsean.Rhs() = coarres;//res�uo
Expand Down
16 changes: 8 additions & 8 deletions Analysis/pzeuleranalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void TPZEulerAnalysis::BufferLastStateAssemble()
fRhsLast.Zero();
fRhsLast.Redim(fCompMesh->NEquations(),1);
SetLastState();
fStructMatrix->Assemble(fRhsLast,NULL);
fStructMatrix->Assemble(fRhsLast);
// TPZStructMatrix::Assemble(fRhsLast, *fFlowCompMesh);
SetAdvancedState();
UpdateHistory();
Expand All @@ -143,12 +143,12 @@ REAL TPZEulerAnalysis::EvaluateFluxEpsilon()
Flux.Zero();
// contribution of last state
SetLastState();
fStructMatrix->Assemble(Flux,NULL);
fStructMatrix->Assemble(Flux);
// TPZStructMatrix::Assemble(Flux, *fFlowCompMesh);

// constribution of adv state
SetAdvancedState();
fStructMatrix->Assemble(Flux,NULL);
fStructMatrix->Assemble(Flux);
// TPZStructMatrix::Assemble(Flux, *fFlowCompMesh);

// reseting the residual type to residual
Expand Down Expand Up @@ -190,7 +190,7 @@ void TPZEulerAnalysis::AssembleInternal()

if(!pTangentMatrix || dynamic_cast<TPZParFrontStructMatrix <TPZFrontNonSym<TVar> > *>(fStructMatrix.operator->()))
{
pTangentMatrix = fStructMatrix->CreateAssemble(fRhs,NULL);
pTangentMatrix = fStructMatrix->CreateAssemble(fRhs);
mySolver.SetMatrix(pTangentMatrix);
}
else
Expand All @@ -207,7 +207,7 @@ void TPZEulerAnalysis::AssembleInternal()

// Contributing referring to the advanced state
// (n+1 index)
fStructMatrix->Assemble(pTangentMatrix, fRhs,NULL);
fStructMatrix->Assemble(pTangentMatrix, fRhs);
}

if(fpBlockDiag)
Expand All @@ -230,7 +230,7 @@ void TPZEulerAnalysis::AssembleRhs()

// Contributing referring to the advanced state
// (n+1 index)
fStructMatrix->Assemble(fRhs,NULL);
fStructMatrix->Assemble(fRhs);
// TPZStructMatrix::Assemble(fRhs, *fFlowCompMesh);

}
Expand Down Expand Up @@ -269,7 +269,7 @@ int TPZEulerAnalysis::RunNewton(REAL & epsilon, int & numIter)
{
TPZFrontStructMatrix <TPZFrontNonSym<STATE> > StrMatrix(Mesh());
StrMatrix.SetQuiet(1);
auto *front = StrMatrix.CreateAssemble(fRhs,NULL);
auto *front = StrMatrix.CreateAssemble(fRhs);
TPZStepSolver<STATE> FrontSolver;
FrontSolver.SetDirect(ELU);
FrontSolver.SetMatrix(front);
Expand Down Expand Up @@ -617,7 +617,7 @@ void TPZEulerAnalysis::SetGMResFront(REAL tol, int numiter, int numvectors)
{
TPZFrontStructMatrix <TPZFrontNonSym<STATE> > strfront(Mesh());
strfront.SetQuiet(1);
auto *front = strfront.CreateAssemble(fRhs,NULL);
auto *front = strfront.CreateAssemble(fRhs);

TPZStepSolver<STATE> FrontSolver;
FrontSolver.SetDirect(ELU);
Expand Down
3 changes: 1 addition & 2 deletions Analysis/pzmganalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ void TPZMGAnalysis::AppendMesh(TPZCompMesh * mesh){
TPZMatrixSolver<STATE> *prec;
prec = fPrecondition[nmeshes-1];
if(!prec) prec = fSolvers[nmeshes-1];
TPZAutoPointer<TPZGuiInterface> guiInterface = new TPZGuiInterface;
TPZAutoPointer<TPZMatrix<STATE> > skauto =
dynamic_cast<TPZMatrix<STATE>*>(skstr.CreateAssemble(fRhs, guiInterface));
dynamic_cast<TPZMatrix<STATE>*>(skstr.CreateAssemble(fRhs));
TPZMGSolver<STATE> s2(trauto,*prec,nvar,skauto);
TPZSequenceSolver<STATE> s3;
s3.SetMatrix(s2.Matrix());
Expand Down
4 changes: 2 additions & 2 deletions Analysis/pznonlinanalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ void TPZNonLinearAnalysis::ComputeTangent(TPZFMatrix<STATE> &tangent, TPZVec<REA
int neq = fCompMesh->NEquations();
tangent.Redim(neq,neq);
TPZFMatrix<STATE> rhs(neq,1);
fStructMatrix->Assemble(tangent,rhs,NULL);
fStructMatrix->Assemble(tangent,rhs);
}

int TPZNonLinearAnalysis::NumCases() {
Expand All @@ -234,7 +234,7 @@ void TPZNonLinearAnalysis::Residual(TPZFMatrix<STATE> &residual, int icase){
int neq = fCompMesh->NEquations();
TPZFMatrix<STATE> tangent(neq,neq);
residual.Redim(neq,1);
fStructMatrix->Assemble(tangent,residual,NULL);
fStructMatrix->Assemble(tangent,residual);
residual *= -1.;
}

Expand Down
2 changes: 1 addition & 1 deletion Analysis/pzsmanal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void TPZSubMeshAnalysis::AssembleInternal()
matred->SetSolver(dynamic_cast<TPZMatrixSolver<STATE> *>(mySolver.Clone()));
// TPZStructMatrix::Assemble(fReducableStiff,fRhs, *fMesh);
// time_t before = time (NULL);
fStructMatrix->Assemble(fReducableStiff,fRhs,fGuiInterface);
fStructMatrix->Assemble(fReducableStiff,fRhs);

if (fStructMatrix->HasRange()) {
TPZFMatrix<TVar> rhsloc(fStructMatrix->EquationFilter().NActiveEquations(),fRhs.Cols(),0.);
Expand Down
7 changes: 3 additions & 4 deletions Analysis/pztransientanalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,14 @@ void TPZTransientAnalysis<TRANSIENTCLASS>::AssembleInternal()

bool exist = false;
if(solverMat) if (solverMat->Rows()==sz) exist = true;
TPZAutoPointer<TPZGuiInterface> inter = new TPZGuiInterface;
if (exist){
if (fIsLinearProblem){
// TPZStructMatrix::Assemble(fRhs, *Mesh());
fStructMatrix->Assemble(fRhs,inter);
fStructMatrix->Assemble(fRhs);
}
else{
solverMat->Zero();
fStructMatrix->Assemble((TPZMatrix<TVar>&)solverMat,fRhs,inter);
fStructMatrix->Assemble((TPZMatrix<TVar>&)solverMat,fRhs);
}
}
else{
Expand All @@ -307,7 +306,7 @@ void TPZTransientAnalysis<TRANSIENTCLASS>::AssembleInternal()
<< " methodTPZTransientAnalysis::ComputeLinearTangentMatrix()"
<< " when (this->fIsLinearProblem == true)\n";
}
auto *mat = fStructMatrix->CreateAssemble(fRhs,NULL);
auto *mat = fStructMatrix->CreateAssemble(fRhs);
mySolver.SetMatrix(mat);
}
mySolver.UpdateFrom(solverMat);
Expand Down
6 changes: 2 additions & 4 deletions Material/Plasticity/pzelastoplasticanalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,7 @@ void TPZElastoPlasticAnalysis::ComputeTangent(TPZFMatrix<REAL> &tangent, TPZVec<
tangent.Redim(neq,neq);
TPZFMatrix<REAL> rhs(neq,1);
TPZFStructMatrix<STATE> substitute(Mesh());
TPZAutoPointer<TPZGuiInterface> guiInterface(0);
substitute.Assemble(tangent,rhs,guiInterface);
substitute.Assemble(tangent,rhs);
// TPZStructMatrix::Assemble(tangent, rhs, *Mesh());
}

Expand All @@ -632,8 +631,7 @@ void TPZElastoPlasticAnalysis::Residual(TPZFMatrix<REAL> &residual, int icase){
// TPZFMatrix<REAL> tangent(neq,neq);
residual.Redim(neq,1);
TPZFStructMatrix<STATE> substitute(Mesh());
TPZAutoPointer<TPZGuiInterface> guiInterface(0);
substitute.Assemble(residual,guiInterface);
substitute.Assemble(residual);
// TPZStructMatrix::Assemble(/*tangent,*/ residual, *Mesh());
residual *= -1;
}
Expand Down
15 changes: 3 additions & 12 deletions Mesh/pzsubcmesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1163,19 +1163,11 @@ void TPZSubCompMesh::CalcStiffInternal(TPZElementMatrixT<TVar> &ek, TPZElementMa
if (! fAnalysis){
TPZFStructMatrix<TVar> local(this);
TPZAutoPointer<TPZMatrix<TVar> > stiff =
dynamic_cast<TPZMatrix<TVar>*>(local.CreateAssemble(ef.fMat,nullptr));
dynamic_cast<TPZMatrix<TVar>*>(local.CreateAssemble(ef.fMat));
ek.fMat = *(stiff.operator->());
// TPZStructMatrix::Assemble(ek.fMat,ef.fMat,*this,-1,-1);
}
else{
//if(!fAnalysis->Solver().Matrix())
{
fAnalysis->Run(std::cout);
if(fAnalysis->AmIKilled()){
return;
}
}

else{
TPZSubMeshFrontalAnalysis *sman = dynamic_cast<TPZSubMeshFrontalAnalysis *> (fAnalysis.operator->());
if(sman)
{
Expand Down Expand Up @@ -1497,10 +1489,9 @@ void TPZSubCompMesh::SetAnalysisSkyline(int numThreads, int preconditioned, TPZA

}

void TPZSubCompMesh::SetAnalysisFrontal(int numThreads, TPZAutoPointer<TPZGuiInterface> guiInterface){
void TPZSubCompMesh::SetAnalysisFrontal(int numThreads){

fAnalysis = new TPZSubMeshFrontalAnalysis(this);
fAnalysis->SetGuiInterface(guiInterface);

#ifdef PZDEBUG2
{
Expand Down
7 changes: 1 addition & 6 deletions Mesh/pzsubcmesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
class TPZSubMeshFrontalAnalysis;
class TPZSubMeshAnalysis;
class TPZLinearAnalysis;
class TPZGuiInterface;

/**
* @brief Implements a group of computational elements as a mesh and an element. \ref CompMesh "Computational Mesh"
Expand Down Expand Up @@ -110,7 +109,7 @@ public TPZCompEl
}

/** @brief Sets the analysis type. */
void SetAnalysisFrontal(int numThreads, TPZAutoPointer<TPZGuiInterface> guiInterface);
void SetAnalysisFrontal(int numThreads);

/** @brief Sets the analysis type. */
void SetAnalysisSparse(int numThreads);
Expand Down Expand Up @@ -142,10 +141,6 @@ public TPZCompEl
* the preconditioned argument indicates whether the equations are condensed with a direct method (0) or
* with a GMRes solver preconditioned by the decomposed matrix
*/
[[deprecated("phasing out guiInterface")]] void SetAnalysisSkyline(int numThreads, int preconditioned, TPZAutoPointer<TPZGuiInterface> guiInterface)
{
SetAnalysisSkyline(numThreads,preconditioned);
}
void SetAnalysisSkyline(int numThreads = 0, int preconditioned = 0);

/**
Expand Down
5 changes: 2 additions & 3 deletions PerfTests/SubStruct/substruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,11 @@ int main(int argc, char *argv[])
dohrstruct->SetNumThreads(nThreads);

PERF_START(assemble_rst);
TPZAutoPointer<TPZGuiInterface> gui;
rhs = new TPZFMatrix<STATE>(cmeshauto->NEquations(),1,0.);
if(useTBB)
dohrstruct->AssembleTBB(*matptr,*rhs, gui);
dohrstruct->AssembleTBB(*matptr,*rhs);
else
dohrstruct->Assemble(*matptr,*rhs, gui, nThreads, nThreads);
dohrstruct->Assemble(*matptr,*rhs, nThreads, nThreads);
PERF_STOP(assemble_rst);
PERF_PRINT(assemble_rst);
PERF_START(precond_rst);
Expand Down
5 changes: 2 additions & 3 deletions PerfTests/progs/substruct/substruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,13 +522,12 @@ int main(int argc, char *argv[])
}

PERF_START(assemble_rst);
TPZAutoPointer<TPZGuiInterface> gui;
rhs = new TPZFMatrix<STATE>(cmeshauto->NEquations(),1,0.);
VERBOSE(1,"dohrstruct->Assemble()" << endl);
if (dohr_tbb.was_set())
dohrstruct->AssembleTBB(*matptr,*rhs, gui);
dohrstruct->AssembleTBB(*matptr,*rhs);
else
dohrstruct->Assemble(*matptr,*rhs, gui, nt_sm.get_value(), nt_d.get_value());
dohrstruct->Assemble(*matptr,*rhs, nt_sm.get_value(), nt_d.get_value());
PERF_STOP(assemble_rst);

PERF_START(precond_rst);
Expand Down
3 changes: 1 addition & 2 deletions Pre/TPZMHMeshControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1508,8 +1508,7 @@ void TPZMHMeshControl::SubStructure()
LOGPZ_DEBUG(logger, sout.str())
}
#endif
TPZAutoPointer<TPZGuiInterface> guiInterface;
submesh->SetAnalysisSkyline(numthreads, preconditioned, guiInterface);
submesh->SetAnalysisSkyline(numthreads, preconditioned);
itsub++;
}

Expand Down
3 changes: 1 addition & 2 deletions Pre/TPZMHMixedHybridMeshControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,8 @@ void TPZMHMixedHybridMeshControl::GroupandCondenseElements()
subcmesh->CleanUpUnconnectedNodes();
int numthreads = 0;
int preconditioned = 0;
TPZAutoPointer<TPZGuiInterface> guiInterface;

subcmesh->SetAnalysisSkyline(numthreads, preconditioned, guiInterface);
subcmesh->SetAnalysisSkyline(numthreads, preconditioned);
}
fCMesh->ComputeNodElCon();
fCMesh->CleanUpUnconnectedNodes();
Expand Down
Loading

0 comments on commit 93a7287

Please sign in to comment.