Amesos Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Amesos_Support.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_Klu.h"
30 #include "Amesos_Support.h"
31 
33 {
34 
35 #ifdef HAVE_AMESOS_EPETRAEXT
36  int NumMyElements = OriginalMap.NumMyElements();
37 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
38  if(OriginalMap.GlobalIndicesInt()) {
39  int NumGlobalElements = OriginalMap.NumGlobalElements();
40  StdIndexMap_ = rcp( new Epetra_Map( NumGlobalElements, NumMyElements, 0, OriginalMap.Comm() ) );
41  }
42  else
43 #endif
44 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
45  if(OriginalMap.GlobalIndicesLongLong()) {
46  long long NumGlobalElements = OriginalMap.NumGlobalElements64();
47  StdIndexMap_ = rcp( new Epetra_Map( NumGlobalElements, NumMyElements, 0LL, OriginalMap.Comm() ) );
48  }
49  else
50 #endif
51  throw "Amesos_StandardIndex::Amesos_StandardIndex: ERROR, GlobalIndices type unknown.";
52 
53  MatTrans_ = rcp( new EpetraExt::CrsMatrix_Reindex( *StdIndexMap_ ) );
54  VecTrans_ = rcp( new EpetraExt::MultiVector_Reindex( *StdIndexMap_ ) );
55 #endif
56 
57 }
58 
59 #ifdef HAVE_AMESOS_EPETRAEXT
60 Epetra_MultiVector* Amesos_StandardIndex::StandardizeIndex( Epetra_MultiVector* OriginalMultiVector ) {
62 
63  return ( &((*VecTrans_)( *OriginalMultiVector )) );
64 
65 }
66 
68 Teuchos::RCP<Epetra_MultiVector> Amesos_StandardIndex::StandardizeIndex( Epetra_MultiVector & OriginalMultiVector ) {
69 
70  return VecTrans_->transform(OriginalMultiVector);
71 }
72 
73 
75 Epetra_CrsMatrix* Amesos_StandardIndex::StandardizeIndex( Epetra_CrsMatrix* OriginalCrsMatrix ) {
76 
77  return &((*MatTrans_)( *OriginalCrsMatrix ));
78 }
79 #endif
80 
int NumGlobalElements() const
bool GlobalIndicesLongLong() const
long long NumGlobalElements64() const
Amesos_StandardIndex(const Epetra_Map &OriginalMap)
Default constructor.
bool GlobalIndicesInt() const
int NumMyElements() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
const Epetra_Comm & Comm() const