RBGen  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RBGen_EpetraMVPreprocessorFactory.cpp
1 #include "RBGen_EpetraMVPreprocessorFactory.h"
2 
3 #include "Epetra_MultiVector.h"
4 
5 #include "Teuchos_Assert.hpp"
6 
7 namespace RBGen {
8 
10  {
11  preproc_types.push_back("None");
12  preproc_types.push_back("Modified Snapshot");
13  }
14 
16  EpetraMVPreprocessorFactory::create( const Teuchos::ParameterList& params )
17  {
18  // See if the "Preprocessing" sublist exists
19  TEUCHOS_TEST_FOR_EXCEPTION(!params.isSublist( "Preprocessing Method" ), std::invalid_argument, "Preprocessing Method sublist does not exist!");
20 
21  // Get the preprocessing method sublist.
22  const Teuchos::ParameterList& preproc_params = params.sublist( "Preprocessing Method" );
23 
24  // Get the preprocessing parameter.
25  std::string method = Teuchos::getParameter<std::string>( const_cast<Teuchos::ParameterList&>(preproc_params),
26  "Method" );
27 
28  // Create the preprocessor.
30 
31  // Basic preprocessor does nothing
32  if ( method == "None" ) {
33  RBPreprocessor = Teuchos::rcp( new NoPreprocessor<Epetra_MultiVector>() );
34  } else
35  // Modified snapshot preprocessor
36  if ( method == "Modified Snapshot" ) {
37  RBPreprocessor = Teuchos::rcp( new MSPreprocessor() );
38  } else
39  {
40  // Throw an exception because the preprocessing method was not recognized by this factory.
41  }
42  //
43  // Return the preprocessor created
44  //
45  return RBPreprocessor;
46 
47  }
48 
49 } // end of RBGen namespace
50 
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Null preprocessor concrete class.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
bool isSublist(const std::string &name) const
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")