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