Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #ifndef XPETRA_PARAMETERS_HPP
00047 #define XPETRA_PARAMETERS_HPP
00048
00049 #include <Teuchos_Describable.hpp>
00050 #include <Teuchos_VerboseObject.hpp>
00051 #include <Teuchos_CommandLineProcessor.hpp>
00052
00053 #include <Xpetra_Map.hpp>
00054 #include <Xpetra_Utils.hpp>
00055
00056 namespace Xpetra {
00057
00058 class Parameters
00059 : public Teuchos::VerboseObject<Parameters>, public Teuchos::Describable
00060 {
00061
00062 public:
00063
00064 Parameters(Teuchos::CommandLineProcessor& clp) {
00065 setCLP(clp);
00066 }
00067
00068 void setCLP(Teuchos::CommandLineProcessor& clp) {
00069 int nOptions=0;
00070 const int maxOptions=2;
00071 Xpetra::UnderlyingLib optionValues[maxOptions];
00072 const char* optionNames [maxOptions];
00073
00074 std::stringstream documentation;
00075 documentation << "linear algebra library (Epetra, Tpetra)";
00076
00077
00078 #if defined(HAVE_XPETRA_EPETRA)
00079 lib_ = Xpetra::UseEpetra;
00080 optionValues[nOptions] = Xpetra::UseEpetra;
00081
00082 optionNames[nOptions] = "Epetra";
00083 nOptions++;
00084 #endif
00085 #if defined(HAVE_XPETRA_TPETRA)
00086 lib_ = Xpetra::UseTpetra;
00087 optionValues[nOptions] = Xpetra::UseTpetra;
00088
00089 optionNames[nOptions] = "Tpetra";
00090 nOptions++;
00091 #endif
00092
00093 clp.setOption<Xpetra::UnderlyingLib>("linAlgebra", &lib_, nOptions, optionValues, optionNames, documentation.str().c_str());
00094
00095 }
00096
00097 void check() const {
00098
00099 }
00100
00101 Xpetra::UnderlyingLib GetLib() const {
00102 check();
00103 return lib_;
00104 }
00105
00107
00108
00110 std::string description() const {
00111 std::ostringstream out;
00112 out << Teuchos::Describable::description();
00113 out << "{lib = " << toString(lib_) << "} ";
00114 return out.str();
00115 }
00116
00118 void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = verbLevel_default) const {
00119 using std::endl;
00120 int vl = (verbLevel == Teuchos::VERB_DEFAULT) ? Teuchos::VERB_LOW : verbLevel;
00121 if (vl == Teuchos::VERB_NONE) return;
00122
00123 if (vl == Teuchos::VERB_LOW) { out << description() << endl; } else { out << Teuchos::Describable::description() << endl; }
00124
00125 if (vl == Teuchos::VERB_MEDIUM || vl == Teuchos::VERB_HIGH || vl == Teuchos::VERB_EXTREME) {
00126 Teuchos::OSTab tab1(out);
00127 out << "Linear algebra library: " << toString(lib_) << endl;
00128 }
00129 }
00130
00132
00133 private:
00134 Xpetra::UnderlyingLib lib_;
00135 };
00136
00137 }
00138
00139 #endif