|
IFPACK Development
|
00001 /*@HEADER 00002 // *********************************************************************** 00003 // 00004 // Ifpack: Object-Oriented Algebraic Preconditioner Package 00005 // Copyright (2002) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 //@HEADER 00028 */ 00029 00030 #include "Ifpack_OverlapFactor.h" 00031 #include "Epetra_Comm.h" 00032 #include "Epetra_Map.h" 00033 #include "Epetra_CrsGraph.h" 00034 #include "Epetra_CrsMatrix.h" 00035 #include "Epetra_VbrMatrix.h" 00036 #include "Epetra_RowMatrix.h" 00037 #include "Epetra_Vector.h" 00038 #include "Epetra_MultiVector.h" 00039 00040 //============================================================================== 00041 Ifpack_OverlapFactor::Ifpack_OverlapFactor(const Ifpack_OverlapGraph * OverlapGraph) 00042 : Factored_(false), 00043 Allocated_(false), 00044 ValuesInitialized_(false), 00045 OverlapGraph_(OverlapGraph), 00046 UserMatrix_(0) 00047 { 00048 } 00049 //============================================================================== 00050 Ifpack_OverlapFactor::Ifpack_OverlapFactor(const Epetra_RowMatrix * UserMatrix) 00051 : Factored_(false), 00052 Allocated_(false), 00053 ValuesInitialized_(false), 00054 OverlapGraph_(0), 00055 UserMatrix_(UserMatrix) 00056 { 00057 } 00058 //============================================================================== 00059 Ifpack_OverlapFactor::Ifpack_OverlapFactor(const Ifpack_OverlapFactor & Source) 00060 : Factored_(Source.Factored_), 00061 Allocated_(Source.Allocated_), 00062 ValuesInitialized_(Source.ValuesInitialized_), 00063 OverlapGraph_(Source.OverlapGraph_), 00064 UserMatrix_(Source.UserMatrix_) 00065 { 00066 } 00067 //============================================================================== 00068 int Ifpack_OverlapFactor::InitValues(const Epetra_RowMatrix * UserMatrix) { 00069 00070 00071 if (OverlapGraph_!=0) { 00072 00073 Epetra_CrsMatrix * CrsMatrix = dynamic_cast<Epetra_CrsMatrix *>(UserMatrix); 00074 if (CrsMatrix!=0) 00075 if (!Allocated()) EPETRA_CHK_ERR(-1); //Must be allocated 00076 if (ValuesInitialized()) EPETRA_CHK_ERR(1); // Values already init'ed, warn caller 00077 00078 EPETRA_CHK_ERR(DerivedFactor()); // Call Derived class factorization 00079 SetValuesInitialized(false); 00080 SetFactored(true); 00081 return(0); 00082 } 00083 //============================================================================== 00084 int Ifpack_OverlapFactor::Factor() { 00085 00086 if (!ValuesInitialized()) EPETRA_CHK_ERR(-1); // Values must be initialized 00087 if (Factored()) EPETRA_CHK_ERR(1); // Return with a warning that factor already done 00088 00089 EPETRA_CHK_ERR(DerivedFactor()); // Call Derived class factorization 00090 SetValuesInitialized(false); 00091 SetFactored(true); 00092 return(0); 00093 }
1.7.4