Author: logari81
Date: Wed Oct 12 10:24:03 2016
New Revision: 5406

URL: http://svn.gna.org/viewcvs/getfem?rev=5406&view=rev
Log:
add a new rhs option to add_constraint_with_multipliers and a dense matrix 
linear solver option to the model solvers for debugging purposes

Modified:
    trunk/getfem/src/getfem/getfem_model_solvers.h
    trunk/getfem/src/getfem/getfem_models.h

Modified: trunk/getfem/src/getfem/getfem_model_solvers.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_model_solvers.h?rev=5406&r1=5405&r2=5406&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_model_solvers.h      (original)
+++ trunk/getfem/src/getfem/getfem_model_solvers.h      Wed Oct 12 10:24:03 2016
@@ -154,6 +154,17 @@
     }
   };
 
+  template <typename MAT, typename VECT>
+  struct linear_solver_dense_lu : public abstract_linear_solver<MAT, VECT> {
+    void operator ()(const MAT &M, VECT &x, const VECT &b,
+                     gmm::iteration &iter) const {
+      typedef typename gmm::linalg_traits<MAT>::value_type T;
+      gmm::dense_matrix<T> MM(gmm::mat_nrows(M),gmm::mat_ncols(M));
+      gmm::copy(M, MM);
+      gmm::lu_solve(MM, x, b);
+      iter.enforce_converged(true);
+    }
+  };
 
 #ifdef GMM_USES_MUMPS
   template <typename MAT, typename VECT>
@@ -611,6 +622,8 @@
     std::shared_ptr<abstract_linear_solver<MATRIX, VECTOR>> p;
     if (bgeot::casecmp(name, "superlu") == 0)
       return std::make_shared<linear_solver_superlu<MATRIX, VECTOR>>();
+    else if (bgeot::casecmp(name, "dense_lu") == 0)
+      return std::make_shared<linear_solver_dense_lu<MATRIX, VECTOR>>();
     else if (bgeot::casecmp(name, "mumps") == 0) {
 #ifdef GMM_USES_MUMPS
 # if GETFEM_PARA_LEVEL <= 1

Modified: trunk/getfem/src/getfem/getfem_models.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_models.h?rev=5406&r1=5405&r2=5406&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_models.h     (original)
+++ trunk/getfem/src/getfem/getfem_models.h     Wed Oct 12 10:24:03 2016
@@ -2255,6 +2255,16 @@
     return ind;
   }
 
+  template <typename MAT>
+  size_type add_constraint_with_multipliers
+  (model &md, const std::string &varname, const std::string &multname,
+   const MAT &B, const std::string &Lname) {
+    size_type ind = add_constraint_with_multipliers(md, varname, multname);
+    set_private_data_rhs(md, ind, Lname);
+    set_private_data_matrix(md, ind, B);
+    return ind;
+  }
+
   size_type APIDECL add_explicit_matrix(model &md, const std::string &varname1,
                                         const std::string &varname2,
                                         bool issymmetric, bool iscoercive);


_______________________________________________
Getfem-commits mailing list
Getfem-commits@gna.org
https://mail.gna.org/listinfo/getfem-commits

Reply via email to