| 1 |
/* |
| 2 |
* Advanced Simulation Library <http://asl.org.il> |
| 3 |
* |
| 4 |
* Copyright 2015 Avtech Scientific <http://avtechscientific.com> |
| 5 |
* |
| 6 |
* |
| 7 |
* This file is part of Advanced Simulation Library (ASL). |
| 8 |
* |
| 9 |
* ASL is free software: you can redistribute it and/or modify it |
| 10 |
* under the terms of the GNU Affero General Public License as |
| 11 |
* published by the Free Software Foundation, version 3 of the License. |
| 12 |
* |
| 13 |
* ASL is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU Affero General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU Affero General Public License |
| 19 |
* along with ASL. If not, see <http://www.gnu.org/licenses/>. |
| 20 |
* |
| 21 |
*/ |
| 22 |
|
| 23 |
|
| 24 |
#ifndef ASLMATLABCASTERS_H |
| 25 |
#define ASLMATLABCASTERS_H |
| 26 |
|
| 27 |
#include <memory> |
| 28 |
#include <string> |
| 29 |
#include <vector> |
| 30 |
|
| 31 |
/** |
| 32 |
\defgroup MATLABInterfacing MATLAB Interfacing |
| 33 |
\ingroup Interfacing |
| 34 |
*/ |
| 35 |
|
| 36 |
namespace acl{ |
| 37 |
class ElementBase; |
| 38 |
typedef std::shared_ptr<ElementBase> Element; |
| 39 |
} |
| 40 |
|
| 41 |
struct matvar_t; |
| 42 |
namespace asl{ |
| 43 |
template <class T> class AVec; |
| 44 |
} |
| 45 |
|
| 46 |
/// the matio c++ wrapper \ingroup MATLABInterfacing |
| 47 |
namespace matiocpp{ |
| 48 |
class Var{ |
| 49 |
private: |
| 50 |
template <class T> matvar_t* init(T *d, const asl::AVec<int> & size, const std::string &name=""); |
| 51 |
public: |
| 52 |
matvar_t* var; |
| 53 |
bool freeArray; |
| 54 |
inline Var(matvar_t* v,bool freeArr=false):var(v){} |
| 55 |
template <class T> Var(std::vector<T> & d, const std::string &name=""); |
| 56 |
template <class T> Var(T *d, unsigned int size, const std::string &name="",bool freeArr=true); |
| 57 |
template <class T> Var(T *d, const asl::AVec<int> & size, const std::string &name="",bool freeArr=true); |
| 58 |
// Var(T *matiocpp, const asl::AVec<int> & size, const std::string &name=""); ///!!! |
| 59 |
~Var(); |
| 60 |
}; |
| 61 |
} |
| 62 |
|
| 63 |
namespace asl{ |
| 64 |
class Block; |
| 65 |
class AbstractData; |
| 66 |
class Probe; |
| 67 |
|
| 68 |
/// @{ |
| 69 |
/// \ingroup MATLABInterfacing |
| 70 |
typedef std::shared_ptr<matiocpp::Var> SPMatVar; |
| 71 |
|
| 72 |
SPMatVar castMATLABCellArray(acl::Element source, const std::string &name=""); |
| 73 |
SPMatVar castMATLABCellArray(acl::Element source, const AVec<int> & size, const std::string &name=""); |
| 74 |
SPMatVar castMATLABCellArray(const AbstractData & d, const std::vector<std::string> &names= |
| 75 |
std::vector<std::string>(0)); |
| 76 |
SPMatVar castMATLABCellArray(Probe & p, unsigned int component, const std::string &name=""); |
| 77 |
/// }@ |
| 78 |
} //namespace acl |
| 79 |
|
| 80 |
|
| 81 |
#endif // ASLMATLABCASTERS_H |