Amesos Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Amesos_Control.cpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Amesos: Direct Sparse Solver Package
5 // Copyright (2004) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 // USA
24 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
25 //
26 // ***********************************************************************
27 // @HEADER
28 
29 #include "Amesos_Control.h"
31 
32  // add zero to diagonal if diagonal element is not present
33  // - not supported for matrices which are missing elements from the diagonal. See bug #1928 for discussion
34  if( ParameterList.isParameter("AddZeroToDiag") )
35  AddZeroToDiag_ = ParameterList.get<bool>("AddZeroToDiag");
36 
37  // add this value to all diagonal elements which are structurally non-zero
38  // no change is made to non-zero structure of the matrix.
39  if( ParameterList.isParameter("AddToDiag") )
40  AddToDiag_ = ParameterList.get<double>("AddToDiag");
41 
42  // Determine whether to Refactorize
43  if( ParameterList.isParameter("Refactorize") )
44  refactorize_ = ParameterList.get<bool>("Refactorize");
45 
46 
47  // threshold for determining if refactorize worked OK
48  // UNUSED at present - KSS June 2004
49  if( ParameterList.isParameter("RcondThreshold") )
50  rcond_threshold_ = ParameterList.get<double>("RcondThreshold");
51 
52  // define how many processes to use in the ScaLAPACK factor and solve
53  // if (-1), a heuristic is used to determine the number of processes to use
54  if( ParameterList.isParameter("MaxProcs") )
55  MaxProcesses_ = ParameterList.get<int>("MaxProcs");
56 
57  // Matrix property, defined internally in Amesos_Mumps as an integer,
58  // whose value can be:
59  // - 0 : general unsymmetric matrix;
60  // - 1 : SPD;
61  // - 2 : general symmetric matrix.
62  if( ParameterList.isParameter("MatrixProperty") ) {
63  std::string MatrixProperty;
64  MatrixProperty = ParameterList.get<std::string>("MatrixProperty");
65  if( MatrixProperty == "SPD" )
66  MatrixProperty_ = 1;
67  else if( MatrixProperty == "symmetric" )
68  MatrixProperty_ = 2;
69  else if( MatrixProperty == "general" )
70  MatrixProperty_ = 0;
71  else {
72  // AMESOS_CHK_ERR( -1 ) ;
73  // if ( verbose_ ) std::cerr << "Amesos : ERROR" << std::endl
74  // << "Amesos : MatrixProperty value not recognized ("
75  // << MatrixProperty << ")" << std::endl;
76  }
77  }
78 
79  // scaling method: 0: none, 1: use method's default, 2: use
80  // the method's 1st alternative, 3: etc.
81  if( ParameterList.isParameter("ScaleMethod") )
82  ScaleMethod_ = ParameterList.get<int>("ScaleMethod");
83 
84 
85  if( ParameterList.isParameter("Reindex") )
86  Reindex_ = ParameterList.get<bool>("Reindex");
87 
88 }
T & get(ParameterList &l, const std::string &name)
double rcond_threshold_
If error is greater than this value, perform symbolic and numeric factorization with full partial piv...
bool AddZeroToDiag_
Adds zero to diagonal of redistributed matrix (some solvers choke on a matrix with a partly empty dia...
bool isParameter(const std::string &name) const
int MatrixProperty_
Set the matrix property.
void SetControlParameters(const Teuchos::ParameterList &ParameterList)
bool Reindex_
If true, the Amesos class should reindex the matrix to standard indexing (i.e.
double AddToDiag_
Add this value to the diagonal.