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_SubstractingSnapshotPreprocessor.hpp" 00008 00009 #include "Teuchos_Assert.hpp" 00010 00011 namespace MOR { 00012 00013 SubstractingSnapshotPreprocessor::SubstractingSnapshotPreprocessor( 00014 const Teuchos::RCP<const Epetra_Vector> &origin_in) : 00015 modifiedSnapshots_(), 00016 origin_(origin_in) 00017 {} 00018 00019 Teuchos::RCP<const Epetra_MultiVector> 00020 SubstractingSnapshotPreprocessor::modifiedSnapshotSet() const 00021 { 00022 return modifiedSnapshots_; 00023 } 00024 00025 Teuchos::RCP<const Epetra_Vector> 00026 SubstractingSnapshotPreprocessor::origin() const 00027 { 00028 return origin_; 00029 } 00030 00031 void 00032 SubstractingSnapshotPreprocessor::rawSnapshotSetIs(const Teuchos::RCP<Epetra_MultiVector> &rs) 00033 { 00034 if (Teuchos::nonnull(rs) && Teuchos::nonnull(origin_)) { 00035 const int vecCount = rs->NumVectors(); 00036 for (int iVec = 0; iVec < vecCount; ++iVec) { 00037 (*rs)(iVec)->Update(-1.0, *origin_, 1.0); 00038 } 00039 } 00040 modifiedSnapshots_ = rs; 00041 } 00042 00043 } // namespace MOR