Amesos Package Browser (Single Doxygen Collection) Development
Loading...
Searching...
No Matches
Amesos_CSparse.h
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#ifndef AMESOS_CSPARSE_H
30#define AMESOS_CSPARSE_H
31#ifdef HAVE_AMESOS_CSPARSE
32
33#include "Amesos_ConfigDefs.h"
34#include "Amesos_BaseSolver.h"
35#include "Amesos_NoCopiable.h"
36#include "Amesos_Utils.h"
37#include "Amesos_Time.h"
38#include "Amesos_Status.h"
39#include "Amesos_Control.h"
40#include "Amesos_Support.h"
41#include "Epetra_LinearProblem.h"
42#include "Epetra_Time.h"
43#include "Epetra_Map.h"
44#include "Epetra_Import.h"
45#include "Epetra_Comm.h"
46#include "Epetra_RowMatrix.h"
47#include "Epetra_CrsMatrix.h"
48#include "Teuchos_ParameterList.hpp"
49#include "Teuchos_RCP.hpp"
50
51#include "cs.h"
52
54
61class Amesos_CSparse: public Amesos_BaseSolver,
62 private Amesos_Time,
63 private Amesos_NoCopiable,
64 private Amesos_Utils,
65 private Amesos_Control,
66 private Amesos_Status {
67
68public:
69
71
72 Amesos_CSparse(const Epetra_LinearProblem& LinearProblem );
73
75 ~Amesos_CSparse();
77
79
81 int SymbolicFactorization() ;
82
84 int NumericFactorization() ;
85
87 int Solve();
89
91
93 const Epetra_LinearProblem* GetProblem() const { return(Problem_); }
94
96
99 bool MatrixShapeOK() const;
100
102
106 int SetUseTranspose(bool UseTranspose) { UseTranspose_ = UseTranspose; return(0); }
107
109 bool UseTranspose() const { return(UseTranspose_); }
110
112 const Epetra_Comm& Comm() const { return(GetProblem()->GetOperator()->Comm()); }
113
115 int SetParameters( Teuchos::ParameterList &ParameterList );
116
118 int NumSymbolicFact() const { return( Amesos_Status::NumSymbolicFact_ ); }
119
121 int NumNumericFact() const { return( Amesos_Status::NumNumericFact_ ); }
122
124 int NumSolve() const { return( Amesos_Status::NumSolve_ ); }
125
127 void PrintTiming() const;
128
130 void PrintStatus() const;
131
133 void GetTiming( Teuchos::ParameterList &TimingParameterList ) const { Amesos_Time::GetTiming(TimingParameterList); }
134
136
137private:
138
139 int CheckError(const int error) const;
140
141 inline const Epetra_Map& Map() const
142 {
143 return(Matrix_->RowMatrixRowMap());
144 }
145
146 inline const Epetra_RowMatrix& Matrix() const
147 {
148 return(*Matrix_);
149 }
150
151 inline Epetra_Map& SerialMap()
152 {
153 return(*(SerialMap_.get()));
154 }
155
156 inline Epetra_RowMatrix& SerialMatrix()
157 {
158 return(*(SerialMatrix_.get()));
159 }
160
161 inline Epetra_CrsMatrix& SerialCrsMatrix()
162 {
163 return(*(SerialCrsMatrix_.get()));
164 }
165
166 inline Epetra_Import& Importer()
167 {
168 return(*(Importer_.get()));
169 }
170
171 int ConvertToSerial();
172 int ConvertToCSparse();
173 int PerformSymbolicFactorization();
174 int PerformNumericFactorization();
175
176 Teuchos::RCP<Epetra_Map> SerialMap_;
177 Teuchos::RCP<Epetra_CrsMatrix> SerialCrsMatrix_;
178 Teuchos::RCP<Epetra_RowMatrix> SerialMatrix_;
179 Teuchos::RCP<Epetra_Import> Importer_;
180 Teuchos::RCP<Amesos_StandardIndex> StdIndex_;
181 Teuchos::RCP<Amesos_StandardIndex> StdIndexRange_;
182 Teuchos::RCP<Amesos_StandardIndex> StdIndexDomain_;
183
184 const Epetra_Map* Map_;
185 const Epetra_RowMatrix* Matrix_;
186
188 bool UseTranspose_;
190 const Epetra_LinearProblem* Problem_;
191
193 int MtxConvTime_, MtxRedistTime_, VecRedistTime_;
194 int SymFactTime_, NumFactTime_, SolveTime_;
195
196#ifdef HAVE_AMESOS_CSPARSE
197 // Data for CSparse
198 cs csMatrix;
199 cs *csTranMatrix;
200 css *csSymbolic;
201 csn *csNumeric;
202#endif
203
204 //int mtype_;
205 //void* pt_[64];
206
207 //int iparm_[64];
208 //int maxfct_; // Maximal number of factors with idential nonzero pattern (always 1)
209 //int mnum_; //! Actual matrix for solution phase (always 1)
210 //int msglvl_; //! Output level
211 //int nrhs_; // Number of RHS
212
213}; // class Amesos_CSparse
214
215#endif
216#endif // AMESOS_CSPARSE_H
bool CheckError(const std::string SolverType, const std::string Descriptor, const Epetra_RowMatrix &A, const Epetra_MultiVector &x, const Epetra_MultiVector &b, const Epetra_MultiVector &x_exact)
Amesos_BaseSolver: A pure virtual class for direct solution of real-valued double-precision operators...
Amesos_Control: Container for some control variables.
Amesos_NoCopiable: Simple class to prevent the usage of copy constructor and operator =.
Amesos_Status: Container for some status variables.
int NumSymbolicFact_
Number of symbolic factorization phases.
int NumSolve_
Number of solves.
int NumNumericFact_
Number of numeric factorization phases.
Amesos_Time: Container for timing information.
Definition Amesos_Time.h:51
void GetTiming(Teuchos::ParameterList &list) const
Load up the current timing information into the parameter list.
Amesos_Utils: Collections of basic utilities.