yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #09893
[Branch ~yade-pkg/yade/git-trunk] Rev 3714: new attributes in FlowEngine to access low level cholmod/metis data
------------------------------------------------------------
revno: 3714
committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>
timestamp: Fri 2013-08-30 13:10:45 +0200
message:
new attributes in FlowEngine to access low level cholmod/metis data
modified:
pkg/dem/FlowEngine.cpp
pkg/dem/FlowEngine.hpp
--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'pkg/dem/FlowEngine.cpp'
--- pkg/dem/FlowEngine.cpp 2013-07-26 18:16:04 +0000
+++ pkg/dem/FlowEngine.cpp 2013-08-30 11:10:45 +0000
@@ -219,6 +219,19 @@
flow->x_min = 1000.0, flow->x_max = -10000.0, flow->y_min = 1000.0, flow->y_max = -10000.0, flow->z_min = 1000.0, flow->z_max = -10000.0;
}
+
+template<class Solver>
+void FlowEngine::setForceMetis ( Solver& flow, bool force )
+{
+ if (force) {
+ flow->eSolver.cholmod().nmethods=1;
+ flow->eSolver.cholmod().method[0].ordering=CHOLMOD_METIS;
+ } else cholmod_defaults(&(flow->eSolver.cholmod()));
+}
+
+template<class Solver>
+bool FlowEngine::getForceMetis ( Solver& flow ) {return (flow->eSolver.cholmod().nmethods==1);}
+
template<class Solver>
void FlowEngine::Build_Triangulation ( Solver& flow )
{
=== modified file 'pkg/dem/FlowEngine.hpp'
--- pkg/dem/FlowEngine.hpp 2013-08-28 10:39:23 +0000
+++ pkg/dem/FlowEngine.hpp 2013-08-30 11:10:45 +0000
@@ -59,6 +59,8 @@
int ReTrg;
int ellapsedIter;
TPL void initSolver (Solver& flow);
+ TPL void setForceMetis (Solver& flow, bool force);
+ TPL bool getForceMetis (Solver& flow);
TPL void Triangulate (Solver& flow);
TPL void AddBoundary (Solver& flow);
TPL void Build_Triangulation (double P_zero, Solver& flow);
@@ -155,6 +157,13 @@
#ifdef LINSOLV
void _exportMatrix(string filename) {exportMatrix(filename,solver);}
void _exportTriplets(string filename) {exportTriplets(filename,solver);}
+ void _setForceMetis (bool force) {setForceMetis(solver,force);}
+ bool _getForceMetis () {return getForceMetis (solver);}
+ void cholmodStats() {
+ cerr << cholmod_print_common("PFV Cholmod factorization",&(solver->eSolver.cholmod()))<<endl;
+ cerr << "cholmod method:" << solver->eSolver.cholmod().selected<<endl;
+ cerr << "METIS called:"<<solver->eSolver.cholmod().called_nd<<endl;}
+ bool metisUsed() {return bool(solver->eSolver.cholmod().called_nd);}
#endif
python::list _getConstrictions(bool all) {return getConstrictions(all,solver);}
python::list _getConstrictionsFull(bool all) {return getConstrictionsFull(all,solver);}
@@ -217,6 +226,7 @@
#ifdef EIGENSPARSE_LIB
((int, numSolveThreads, 1,,"number of openblas threads in the solve phase."))
((int, numFactorizeThreads, 1,,"number of openblas threads in the factorization phase"))
+// ((bool, forceMetis, 0,,"If true, METIS is used for matrix preconditioning, else Cholmod is free to choose the best method (which may be METIS to, depending on the matrix). See ``nmethods`` in Cholmod documentation"))
#endif
,
/*deprec*/
@@ -261,6 +271,9 @@
#ifdef LINSOLV
.def("exportMatrix",&FlowEngine::_exportMatrix,(python::arg("filename")="matrix"),"Export system matrix to a file with all entries (even zeros will displayed).")
.def("exportTriplets",&FlowEngine::_exportTriplets,(python::arg("filename")="triplets"),"Export system matrix to a file with only non-zero entries.")
+ .def("cholmodStats",&FlowEngine::cholmodStats,"get statistics of cholmod solver activity")
+ .def("metisUsed",&FlowEngine::metisUsed,"check wether metis lib is effectively used")
+ .add_property("forceMetis",&FlowEngine::_getForceMetis,&FlowEngine::_setForceMetis,"If true, METIS is used for matrix preconditioning, else Cholmod is free to choose the best method (which may be METIS to, depending on the matrix). See ``nmethods`` in Cholmod documentation")
#endif
)
DECLARE_LOGGER;