Commit 43a521cb authored by incardon's avatar incardon

PETSC working version

parent ae9f1ceb
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define UMFPACK_NONE 0 #define UMFPACK_NONE 0
template<typename T> template<typename T>
class petsc_solver class petsc_solver
{ {
...@@ -600,7 +599,7 @@ class petsc_solver<double> ...@@ -600,7 +599,7 @@ class petsc_solver<double>
// We set the pre-conditioner // We set the pre-conditioner
PETSC_SAFE_CALL(KSPGetPC(ksp,&pc)); PETSC_SAFE_CALL(KSPGetPC(ksp,&pc));
PETSC_SAFE_CALL(PCSetType(pc,PCJACOBI)); PETSC_SAFE_CALL(PCSetType(pc,PCNONE));
// if we are on on best solve set-up a monitor function // if we are on on best solve set-up a monitor function
...@@ -783,6 +782,16 @@ public: ...@@ -783,6 +782,16 @@ public:
try_solve = true; try_solve = true;
} }
/*! \brief Set the Petsc solver
*
* \see KSPType in PETSC manual for a list of all PETSC solvers
*
*/
void log_monitor()
{
PetscOptionsSetValue("-ksp_monitor",0);
}
/*! \brief Set the Petsc solver /*! \brief Set the Petsc solver
* *
* \see KSPType in PETSC manual for a list of all PETSC solvers * \see KSPType in PETSC manual for a list of all PETSC solvers
......
...@@ -86,7 +86,7 @@ class Vector<T,PETSC_BASE> ...@@ -86,7 +86,7 @@ class Vector<T,PETSC_BASE>
mutable Vec v; mutable Vec v;
// Mutable row value vector // Mutable row value vector
mutable openfpm::vector<rval<T,PETSC_RVAL>,HeapMemory,typename memory_traits_inte<rval<T,PETSC_RVAL>>::type > row_val; mutable openfpm::vector<rval<PetscScalar,PETSC_RVAL>,HeapMemory,typename memory_traits_inte<rval<PetscScalar,PETSC_RVAL>>::type > row_val;
// Global to local map // Global to local map
mutable std::unordered_map<size_t,size_t> map; mutable std::unordered_map<size_t,size_t> map;
...@@ -210,7 +210,7 @@ public: ...@@ -210,7 +210,7 @@ public:
* \return reference to the element vector * \return reference to the element vector
* *
*/ */
inline T & insert(size_t i) inline PetscScalar & insert(size_t i)
{ {
row_val.add(); row_val.add();
...@@ -228,7 +228,7 @@ public: ...@@ -228,7 +228,7 @@ public:
* \return reference to the element vector * \return reference to the element vector
* *
*/ */
inline const T & insert(size_t i) const inline const PetscScalar & insert(size_t i) const
{ {
row_val.add(); row_val.add();
...@@ -248,7 +248,7 @@ public: ...@@ -248,7 +248,7 @@ public:
* \return reference to the element vector * \return reference to the element vector
* *
*/ */
const T & operator()(size_t i) const const PetscScalar & operator()(size_t i) const
{ {
// Search if exist // Search if exist
...@@ -269,7 +269,7 @@ public: ...@@ -269,7 +269,7 @@ public:
* \return reference to the element vector * \return reference to the element vector
* *
*/ */
T & operator()(size_t i) PetscScalar & operator()(size_t i)
{ {
// Search if exist // Search if exist
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment