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 #include "MOR_IdentityBasisSource.hpp" 00007 00008 #include "Epetra_MultiVector.h" 00009 00010 #include "Teuchos_Ptr.hpp" 00011 00012 namespace MOR { 00013 00014 IdentityBasisSource::IdentityBasisSource(const Epetra_Map &basisMap) : 00015 basisMap_(basisMap) 00016 {} 00017 00018 ReducedBasisElements 00019 IdentityBasisSource::operator()(const Teuchos::RCP<Teuchos::ParameterList> ¶ms) { 00020 const Teuchos::RCP<Epetra_MultiVector> basis = 00021 Teuchos::rcp(new Epetra_MultiVector(basisMap_, basisMap_.NumGlobalElements(), /* zeroOut =*/ true)); 00022 00023 for (int i = 0; i < basis->NumVectors(); ++i) { 00024 const int lid = basisMap_.LID(i); 00025 if (lid != -1) { 00026 basis->ReplaceMyValue(lid, i, 1.0); 00027 } 00028 } 00029 00030 return ReducedBasisElements(basis); 00031 } 00032 00033 } // namespace MOR