10#ifndef MUELU_SINGLELEVELMATLABFACTORY_DEF_HPP
11#define MUELU_SINGLELEVELMATLABFACTORY_DEF_HPP
12#include <Xpetra_Matrix.hpp>
13#include <Xpetra_MultiVector.hpp>
16#include "MueLu_Aggregates.hpp"
17#include "MueLu_AmalgamationInfo.hpp"
21#ifdef HAVE_MUELU_MATLAB
25template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
29template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
32 validParamList->set<std::string>(
"Provides",
"",
"A comma-separated list of objects provided by the SingleLevelMatlabFactory");
33 validParamList->set<std::string>(
"Needs",
"",
"A comma-separated list of objects needed by the SingleLevelMatlabFactory");
34 validParamList->set<std::string>(
"Function",
"",
"The name of the Matlab MEX function to call for Build()");
35 return validParamList;
38template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
43 for (
size_t i = 0; i <
needs_.size(); i++) {
50template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
58 string needsList = pL.get<
string>(
"Needs");
60 string providesList = pL.get<std::string>(
"Provides");
63 string matlabFunction = pL.get<std::string>(
"Function");
64 if (!matlabFunction.length())
65 throw std::runtime_error(
"Invalid matlab function name");
66 vector<Teuchos::RCP<MuemexArg>> mexOutput =
callMatlab(matlabFunction, numProvides, InputArgs);
71template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
73 std::ostringstream out;
75 out <<
"SingleLevelMatlabFactory[" << pL.get<std::string>(
"Function") <<
"]";
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)