call_epetra.cpp

Go to the documentation of this file.
00001 /*@HEADER
00002 // ***********************************************************************
00003 //
00004 //       Ifpack: Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2009) 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 "call_epetra.h"
00031 #include "Epetra_CrsMatrix.h"
00032 #include "Epetra_Map.h"
00033 #include <vector>
00034 
00035 
00036 int ExtractIndicesView(void* A, int GlobalRow, int *NumEntries, int **Indices){
00037   int ierr = 0;
00038   Epetra_CrsMatrix *mat = (Epetra_CrsMatrix*) A;
00039   int MyRow = mat->LRID(GlobalRow);
00040   if(MyRow == -1) return 0;
00041   int & len = *NumEntries;
00042   int *& ind = *Indices;
00043   ierr += mat->Graph().ExtractMyRowView(MyRow, len, ind);
00044   return ierr;
00045 } 
00046 
00047 int ExtractValuesView(void *A, int GlobalRow, int *NumEntries, double** Values){
00048   int ierr = 0;
00049   Epetra_CrsMatrix *mat = (Epetra_CrsMatrix*) A;
00050   int MyRow = mat->LRID(GlobalRow);
00051   if(MyRow == -1) return 0;
00052   int &len = *NumEntries;
00053   double *& val = *Values;
00054   ierr += mat->ExtractMyRowView(MyRow, len, val);
00055   return ierr;
00056 }
00057 
00058 int MinMaxMyGID(void* A, bool Row, bool min){
00059   Epetra_CrsMatrix* mat = (Epetra_CrsMatrix*) A;
00060   if(Row){
00061     if(min){
00062       return mat->RowMap().MinMyGID();
00063     } else { 
00064       return mat->RowMap().MaxMyGID();
00065     }
00066   } else {
00067     if(min){
00068       return mat->ColMap().MinMyGID();
00069     } else {
00070       return mat->ColMap().MaxMyGID();
00071     }
00072   }
00073 }
00074 
00075 int NumGlobalRowCol(void* A, bool Row){
00076   Epetra_CrsMatrix *mat = (Epetra_CrsMatrix*) A;
00077   if(Row){
00078     return mat->NumGlobalRows();
00079   } else {
00080     return mat->NumGlobalCols();
00081   }
00082 }
00083 
00084 int NumMyRowEntries(void *A, int Row, int *numEntries){
00085   Epetra_CrsMatrix* mat = (Epetra_CrsMatrix*) A;
00086   return mat->NumMyRowEntries(mat->LRID(Row), *numEntries);
00087 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 10:05:33 2011 for Ifpack Package Browser (Single Doxygen Collection) by  doxygen 1.6.3