46#ifndef MUELU_SINGLELEVELMATLABFACTORY_DEF_HPP
47#define MUELU_SINGLELEVELMATLABFACTORY_DEF_HPP
48#include <Xpetra_Matrix.hpp>
49#include <Xpetra_MultiVector.hpp>
52#include "MueLu_Aggregates.hpp"
53#include "MueLu_AmalgamationInfo.hpp"
58#ifdef HAVE_MUELU_MATLAB
63 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
67 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
71 validParamList->set<std::string>(
"Provides" ,
"" ,
"A comma-separated list of objects provided by the SingleLevelMatlabFactory");
72 validParamList->set<std::string>(
"Needs" ,
"",
"A comma-separated list of objects needed by the SingleLevelMatlabFactory");
73 validParamList->set<std::string>(
"Function" ,
"" ,
"The name of the Matlab MEX function to call for Build()");
74 return validParamList;
77 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
83 for(
size_t i = 0; i <
needs_.size(); i++)
88 hasDeclaredInput_ =
true;
91 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
101 string needsList = pL.get<
string>(
"Needs");
103 string providesList = pL.get<std::string>(
"Provides");
106 string matlabFunction = pL.get<std::string>(
"Function");
107 if(!matlabFunction.length())
108 throw std::runtime_error(
"Invalid matlab function name");
109 vector<Teuchos::RCP<MuemexArg> > mexOutput =
callMatlab(matlabFunction, numProvides, InputArgs);
114 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
116 std::ostringstream out;
118 out <<
"SingleLevelMatlabFactory["<<pL.get<std::string>(
"Function")<<
"]";
125#define MUELU_SINGLELEVELMATLABFACTORY_SHORT
Timer to be used in factories. Similar to Monitor but with additional timers.
void Input(Level &level, const std::string &varName) const
Class that holds all level-specific information.
virtual const Teuchos::ParameterList & GetParameterList() const
std::string description() const
@ name Description
SingleLevelMatlabFactory()
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
void DeclareInput(Level ¤tLevel) const
Specifies the data that this class needs, and the factories that generate that data.
void Build(Level ¤tLevel) const
Build an object with this factory.
std::vector< std::string > needs_
List of arguments to the MATLAB function, in order. These args must correspond to MueLu "Needs" objec...
Namespace for MueLu classes and methods.
bool IsParamMuemexVariable(const std::string &name)
Teuchos::RCP< Teuchos::ParameterList > getInputParamList()
std::vector< RCP< MuemexArg > > callMatlab(std::string function, int numOutputs, std::vector< RCP< MuemexArg > > args)
std::vector< Teuchos::RCP< MuemexArg > > processNeeds(const Factory *factory, std::string &needsParam, Level &lvl)
void processProvides(std::vector< Teuchos::RCP< MuemexArg > > &mexOutput, const Factory *factory, std::string &providesParam, Level &lvl)
std::vector< std::string > tokenizeList(const std::string ¶ms)