47#ifndef MUELU_MATLABUTILS_DECL_HPP
48#define MUELU_MATLABUTILS_DECL_HPP
52#if !defined(HAVE_MUELU_MATLAB) || !defined(HAVE_MUELU_EPETRA) || !defined(HAVE_MUELU_TPETRA)
53#error "Muemex requires MATLAB, Epetra and Tpetra."
60#include <Teuchos_ParameterList.hpp>
61#include <Teuchos_RCP.hpp>
62#include <Teuchos_DefaultComm.hpp>
69#include "Epetra_MultiVector.h"
70#include "Epetra_CrsMatrix.h"
71#include "Tpetra_CrsMatrix_decl.hpp"
72#include "Xpetra_EpetraCrsMatrix.hpp"
73#include "Xpetra_MapFactory.hpp"
74#include "Xpetra_CrsGraph.hpp"
75#include "Xpetra_VectorFactory.hpp"
76#include <Tpetra_Core.hpp>
78#include "Kokkos_DynRankView.hpp"
106#ifdef HAVE_MUELU_INTREPID2
107, FIELDCONTAINER_ORDINAL
111typedef Kokkos::Compat::KokkosDeviceWrapperNode<Kokkos::Serial, Kokkos::HostSpace>
mm_node_t;
120typedef Xpetra::Map<mm_LocalOrd, mm_GlobalOrd, mm_node_t>
Xpetra_map;
133#ifdef HAVE_MUELU_INTREPID2
134 typedef Kokkos::DynRankView<mm_LocalOrd,typename mm_node_t::device_type> FieldContainer_ordinal;
181template<
typename Scalar =
double,
typename LocalOrdinal = mm_LocalOrd,
typename GlobalOrdinal = mm_GlobalOrd,
typename Node = mm_node_t>
184template<
typename Scalar =
double,
typename LocalOrdinal = mm_LocalOrd,
typename GlobalOrdinal = mm_GlobalOrd,
typename Node = mm_node_t>
185void processProvides(std::vector<Teuchos::RCP<MuemexArg>>& mexOutput,
const Factory* factory, std::string& providesParam,
Level& lvl);
194std::vector<std::string>
tokenizeList(
const std::string& param);
197std::vector<Teuchos::RCP<MuemexArg>>
callMatlab(std::string function,
int numOutputs, std::vector<Teuchos::RCP<MuemexArg>> args);
202static inline std::string &
ltrim(std::string &s) {
203 s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
208static inline std::string &
rtrim(std::string &s) {
209 s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
214static inline std::string &
trim(std::string &s) {
MueLu::DefaultScalar Scalar
Container class for aggregation information.
minimal container class for storing amalgamation information
Base class for factories (e.g., R, P, and A_coarse).
MueLu representation of a graph.
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
Class that holds all level-specific information.
MuemexArg(MuemexType dataType)
mxArray * convertToMatlab()
static const NoFactory * get()
Namespace for MueLu classes and methods.
static std::string & trim(std::string &s)
MuemexType getMuemexType()
Tpetra::CrsMatrix< double, mm_LocalOrd, mm_GlobalOrd, mm_node_t > Tpetra_CrsMatrix_double
Xpetra::Matrix< complex_t, mm_LocalOrd, mm_GlobalOrd, mm_node_t > Xpetra_Matrix_complex
bool isValidMatlabGraph(const mxArray *mxa)
Tpetra::MultiVector< double, mm_LocalOrd, mm_GlobalOrd, mm_node_t > Tpetra_MultiVector_double
Xpetra::Vector< mm_LocalOrd, mm_LocalOrd, mm_GlobalOrd, mm_node_t > Xpetra_ordinal_vector
Teuchos::RCP< Teuchos::ParameterList > getInputParamList()
MueLu::Hierarchy< complex_t, mm_LocalOrd, mm_GlobalOrd, mm_node_t > Hierarchy_complex
mxArray * createMatlabMultiVector(int numRows, int numCols)
Teuchos::RCP< MuemexArg > convertMatlabVar(const mxArray *mxa)
Tpetra::Map ::local_ordinal_type mm_LocalOrd
Xpetra::MultiVector< double, mm_LocalOrd, mm_GlobalOrd, mm_node_t > Xpetra_MultiVector_double
Tpetra::MultiVector< complex_t, mm_LocalOrd, mm_GlobalOrd, mm_node_t > Tpetra_MultiVector_complex
bool isValidMatlabAggregates(const mxArray *mxa)
std::vector< RCP< MuemexArg > > callMatlab(std::string function, int numOutputs, std::vector< RCP< MuemexArg > > args)
Xpetra::CrsGraph< mm_LocalOrd, mm_GlobalOrd, mm_node_t > Xpetra_CrsGraph
@ XPETRA_MULTIVECTOR_DOUBLE
@ XPETRA_MULTIVECTOR_COMPLEX
@ TPETRA_MULTIVECTOR_COMPLEX
@ TPETRA_MULTIVECTOR_DOUBLE
int * mwIndex_to_int(int N, mwIndex *mwi_array)
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)
Xpetra::Matrix< double, mm_LocalOrd, mm_GlobalOrd, mm_node_t > Xpetra_Matrix_double
MueLu::GraphBase< mm_LocalOrd, mm_GlobalOrd, mm_node_t > MGraph
MueLu::Aggregates< mm_LocalOrd, mm_GlobalOrd, mm_node_t > MAggregates
Tpetra::Map muemex_map_type
Tpetra::Map ::global_ordinal_type mm_GlobalOrd
const T & getLevelVariable(std::string &name, Level &lvl)
Xpetra::Map< mm_LocalOrd, mm_GlobalOrd, mm_node_t > Xpetra_map
void fillMatlabArray(Scalar *array, const mxArray *mxa, int n)
std::complex< double > complex_t
void addLevelVariable(const T &data, std::string &name, Level &lvl, const FactoryBase *fact=NoFactory::get())
MueLu::AmalgamationInfo< mm_LocalOrd, mm_GlobalOrd, mm_node_t > MAmalInfo
Tpetra::CrsMatrix< complex_t, mm_LocalOrd, mm_GlobalOrd, mm_node_t > Tpetra_CrsMatrix_complex
std::vector< std::string > tokenizeList(const std::string ¶ms)
Xpetra::MultiVector< complex_t, mm_LocalOrd, mm_GlobalOrd, mm_node_t > Xpetra_MultiVector_complex
T loadDataFromMatlab(const mxArray *mxa)
void callMatlabNoArgs(std::string function)
mxArray * createMatlabSparse(int numRows, int numCols, int nnz)
static std::string & rtrim(std::string &s)
static std::string & ltrim(std::string &s)
template mxArray * saveDataToMatlab(bool &data)
Kokkos::Compat::KokkosDeviceWrapperNode< Kokkos::Serial, Kokkos::HostSpace > mm_node_t
MueLu::Hierarchy< double, mm_LocalOrd, mm_GlobalOrd, mm_node_t > Hierarchy_double