3 #include "RBGen_MSPreprocessor.h"
4 #include "Epetra_MultiVector.h"
12 preproc_types_.push_back(
"Input File");
14 preproc_types_.push_back(
"Arithmetic Mean");
27 std::string preprocMethod = Teuchos::getParameter< std::string >( preproc_params,
"Method" );
31 preprocType_ = Teuchos::getParameter< std::string >( preproc_params,
"Type" );
34 bool typeValid =
false;
35 std::vector<std::string>::iterator p = preproc_types_.begin();
36 while ( p != preproc_types_.end() && !typeValid ) {
37 if ( *p == preprocType_ )
43 if (preprocType_ ==
"Input File") {
48 input_file_ = Teuchos::getParameter< std::string >( preproc_params,
"Filename" );
50 catch (std::exception &e) {
51 std::cout<<
"The modified snapshot input file has not been specified"<<std::endl;
58 if ( preproc_params.isParameter(
"Scaling Factor") ) {
59 scale_ = Teuchos::getParameter< double >( preproc_params,
"Scaling Factor" );
78 if ( scalings_.size() != scaling_idx_.size() ) {
79 std::cout<<
"The scaling vector is not the same size as the number of index pairs!"<< std::endl;
84 isInitialized_ =
true;
91 if (preprocType_ ==
"Input File") {
95 std::vector< std::string > steady_file( 1, input_file_ );
96 msVector_ = fileio_->Read( steady_file );
101 for (
int i=0; i<ss->NumVectors(); i++) {
103 colMV->Update( -1.0*scale_, *msVector_, 1.0 );
107 else if (preprocType_ ==
"Arithmetic Mean") {
116 for (
int i=0; i<ss->NumVectors(); i++) {
118 msVector_->Update( 1.0, *colMV, 1.0 );
121 msVector_->Scale( 1.0 / ss->NumVectors() );
125 for (
int i=0; i<ss->NumVectors(); i++) {
127 colMV->Update( -1.0*scale_, *msVector_, 1.0 );
MSPreprocessor()
Default constructor.
void Initialize(const Teuchos::RCP< Teuchos::ParameterList > ¶ms, const Teuchos::RCP< FileIOHandler< Epetra_MultiVector > > &fileio=Teuchos::null)
Initialize preprocessor.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void Preprocess(Teuchos::RCP< Epetra_MultiVector > &ss)
Preprocess the snapshot set passed in.
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")