• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

MOR_SnapshotBlockingUtils.cpp

Go to the documentation of this file.
00001 //*****************************************************************//
00002 //    Albany 2.0:  Copyright 2012 Sandia Corporation               //
00003 //    This Software is released under the BSD license detailed     //
00004 //    in the file "license.txt" in the top-level Albany directory  //
00005 //*****************************************************************//
00006 
00007 #include "MOR_SnapshotBlockingUtils.hpp"
00008 
00009 #include "MOR_EpetraUtils.hpp"
00010 
00011 namespace MOR {
00012 
00013 Teuchos::RCP<Epetra_Vector> isolateUniformBlock(
00014     const Teuchos::ArrayView<const int> &myBlockLIDs,
00015     Epetra_MultiVector &snapshots)
00016 {
00017   typedef Teuchos::ArrayView<const int>::const_iterator LIDIter;
00018 
00019   // Extract an orthogonal vector with non-zero entries corresponding to the block
00020   const Teuchos::RCP<Epetra_Vector> result(new Epetra_Vector(snapshots.Map(), /* zeroOut = */ true));
00021   for (LIDIter it = myBlockLIDs.begin(); it != myBlockLIDs.end(); ++it) {
00022     result->ReplaceMyValue(*it, 0, 1.0);
00023   }
00024   normalize(*result);
00025 
00026   // Zero-out the entries of the snapshots corresponding to the block
00027   const int vectorCount = snapshots.NumVectors();
00028   for (int iVec = 0; iVec < vectorCount; ++iVec) {
00029     for (LIDIter it = myBlockLIDs.begin(); it != myBlockLIDs.end(); ++it) {
00030       snapshots.ReplaceMyValue(*it, iVec, 0.0);
00031     }
00032   }
00033 
00034   return result;
00035 }
00036 
00037 } // end namespace MOR

Generated on Wed Mar 26 2014 18:36:40 for Albany: a Trilinos-based PDE code by  doxygen 1.7.1