EpetraExt Package Browser (Single Doxygen Collection) Development
EpetraExt_Dirichlet_CrsMatrix.cpp
Go to the documentation of this file.
00001 #if 0 // dead source
00002 // @HEADER
00003 // ***********************************************************************
00004 // 
00005 //     EpetraExt: Epetra Extended - Linear Algebra Services Package
00006 //                 Copyright (2001) Sandia Corporation
00007 // 
00008 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 // license for use of this work by or on behalf of the U.S. Government.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //  
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA
00025 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00026 // 
00027 // ***********************************************************************
00028 // @HEADER
00029 
00030 #include <EpetraExt_Dirichlet_CrsMatrix.h>
00031 
00032 #include <Epetra_CrsMatrix.h>
00033 #include <Epetra_IntVector.h>
00034 #include <Epetra_Import.h>
00035 #include <Epetra_Map.h>
00036 
00037 namespace EpetraExt {
00038 
00039 bool
00040 CrsMatrix_Dirichlet::
00041 fwd()
00042 {
00043   Epetra_CrsMatrix & Matrix = *origObj_;
00044 
00045   const Epetra_Map & RowMap = Matrix.RowMap();
00046   const Epetra_Map & ColMap = Matrix.ColMap();
00047 
00048   int NumMyElements = RowMap.NumMyElements();
00049   int NumMyColElements = ColMap.NumMyElements();
00050 
00051   if( symmetric_ && colSet_.empty() ) // get non-local column info
00052   {
00053     if( Matrix.IndicesAreGlobal() )
00054     {
00055       Epetra_Import Importer( ColMap, RowMap );
00056       Epetra_IntVector colLocations( ColMap );
00057       colLocations.Import( locations_, Importer, Insert );
00058       for( int i = 0; i < NumMyColElements; ++ i )
00059         if( colLocations[i] ) colSet_.insert(i);
00060     }
00061     else
00062     {
00063       for( int i = 0; i < NumMyElements; ++i )
00064         if( locations_[i] ) colSet_.insert(i);
00065     }
00066   }
00067 
00068   for( int i = 0; i < NumMyElements; ++i ) 
00069   {
00070     int * Indices;
00071     double * Vals;
00072     int NumIndices;
00073     if( locations_[i] ) //this is a Dirichlet BC location
00074     {
00075       Matrix.ExtractMyRowView( i, NumIndices, Vals, Indices );
00076       for( int j = 0; j < NumIndices; ++j )
00077       {
00078         if( Indices[j] == i ) Vals[i] = 1.0;
00079         else                  Vals[i] = 0.0;
00080       }
00081     }
00082     else if( symmetric_ )
00083     {
00084       Matrix.ExtractMyRowView( i, NumIndices, Vals, Indices );
00085       for( int j = 0; j < NumIndices; ++j )
00086         if( colSet_.count( Indices[j] ) ) Vals[j] = 0.0;
00087     }
00088   }
00089 
00090   return true;
00091 }
00092 
00093 bool
00094 CrsMatrix_Dirichlet::
00095 rvs()
00096 {
00097   return true;
00098 }
00099 
00100 } //namespace EpetraExt
00101 
00102 #endif // if 0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines