- Notifications
You must be signed in to change notification settings - Fork64
Open
Description
Hello,
I was wondering if it is possible to manually set entries of the matrix in the linear system.
If I look at the example given at the main page, I would like to manually change the sparse matrixAA
.
# Form the linear system of equations (AX=B)A=mfem.OperatorPtr()B=mfem.Vector()X=mfem.Vector()a.FormLinearSystem(ess_tdof_list,x,b,A,X,B)print("Size of linear system: "+str(A.Height()))# Solve the linear system using PCG and store the solution in xAA=mfem.OperatorHandle2SparseMatrix(A)# worksAA.Set(0,0,1)# does not workAA.Set(0,10,1)
While changinging the entry (0,0) works, because it is already present, adding a new entry at (0,10) gives the following error:
MFEMabort:Couldnotfindentryforrow=0,col=10 ...infunction:mfem::real_t&mfem::SparseMatrix::SearchRow(int,int) ...infile:/__w/PyMFEM/PyMFEM/PyMFEM/external/mfem/linalg/sparsemat.hpp:930Traceback (mostrecentcalllast):File"/usr2/mkofler/PyMFEM/examplefrom_git.py",line43,in<module>AA.Set(0,10,1)RuntimeError:PyMFEMerror (mfem::ErrorException):MFEMabort:Couldnotfindentryforrow=0,col=10 ...infunction:mfem::real_t&mfem::SparseMatrix::SearchRow(int,int) ...infile:/__w/PyMFEM/PyMFEM/PyMFEM/external/mfem/linalg/sparsemat.hpp:930
Is there another possibility of how I could do this? I was also looking for a way to convert the sparse matrix to a dense matrix and changing the entries there, but I have not found a way of doing this.
I would be happy if someone could help me out here and thanks for the great work.
Metadata
Metadata
Assignees
Labels
No labels