Hello,
I want to couple Matlab and Openfoam. Openfoam adapter is OK for me. But Matlab bindings is not OK for me. I am using Matlab 2020b now. I ran compile_matlab_bindings_for_precice.m, which I downloaded from Github. But it comes errors as follwing:
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp: In member function
‘virtual void MexFunction::operator()(matlab::mex::ArgumentList, matlab::mex::ArgumentList)’:
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:176:70: warning: ‘bool
precice::SolverInterface::hasToEvaluateSurrogateModel() const’ is deprecated: The manifold mapping feature is no longer
supported. [-Wdeprecated-declarations]
bool result = interface->hasToEvaluateSurrogateModel();
^
In file included from
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:6:0:
/usr/include/precice/SolverInterface.hpp:260:79: note: declared here
[[deprecated("The manifold mapping feature is no longer supported.")]] bool hasToEvaluateSurrogateModel() const;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:182:65: warning: ‘bool
precice::SolverInterface::hasToEvaluateFineModel() const’ is deprecated: The manifold mapping feature is no longer
supported. [-Wdeprecated-declarations]
bool result = interface->hasToEvaluateFineModel();
^
In file included from
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:6:0:
/usr/include/precice/SolverInterface.hpp:275:79: note: declared here
[[deprecated("The manifold mapping feature is no longer supported.")]] bool hasToEvaluateFineModel() const;
^~~~~~~~~~~~~~~~~~~~~~
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:217:65: warning:
‘std::set<int> precice::SolverInterface::getMeshIDs() const’ is deprecated: Use getMeshID() for specific mesh names instead.
[-Wdeprecated-declarations]
const std::set<int> ids = interface->getMeshIDs();
^
In file included from
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:6:0:
/usr/include/precice/SolverInterface.hpp:350:84: note: declared here
[[deprecated("Use getMeshID() for specific mesh names instead.")]] std::set<int> getMeshIDs() const;
^~~~~~~~~~
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:247:100: warning:
narrowing conversion of ‘matlab::data::TypedArray<T>::operator[](size_t) const [with T = int; size_t = long unsigned
int](0).matlab::data::ArrayElementTypedRef<int, true>::operator matlab::data::ArrayElementTypedRef<int, true>::reference()’
from ‘matlab::data::ArrayElementTypedRef<int, true>::reference {aka int}’ to ‘long unsigned int’ inside { } [-Wnarrowing]
outputs[0] = factory.createArrayFromBuffer<int32_t>({1,size[0]}, std::move(ids_ptr));
^
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:258:105: warning:
narrowing conversion of ‘matlab::data::TypedArray<T>::operator[](size_t) const [with T = int; size_t = long unsigned
int](0).matlab::data::ArrayElementTypedRef<int, true>::operator matlab::data::ArrayElementTypedRef<int, true>::reference()’
from ‘matlab::data::ArrayElementTypedRef<int, true>::reference {aka int}’ to ‘long unsigned int’ inside { } [-Wnarrowing]
outputs[0] = factory.createArrayFromBuffer<double>({1,size[0]}, std::move(positions_ptr));
^
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:269:100: warning:
narrowing conversion of ‘matlab::data::TypedArray<T>::operator[](size_t) const [with T = int; size_t = long unsigned
int](0).matlab::data::ArrayElementTypedRef<int, true>::operator matlab::data::ArrayElementTypedRef<int, true>::reference()’
from ‘matlab::data::ArrayElementTypedRef<int, true>::reference {aka int}’ to ‘long unsigned int’ inside { } [-Wnarrowing]
outputs[0] = factory.createArrayFromBuffer<int32_t>({1,size[0]}, std::move(ids_ptr));
^
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:335:105: warning:
narrowing conversion of ‘matlab::data::TypedArray<T>::operator[](size_t) const [with T = int; size_t = long unsigned
int](0).matlab::data::ArrayElementTypedRef<int, true>::operator matlab::data::ArrayElementTypedRef<int, true>::reference()’
from ‘matlab::data::ArrayElementTypedRef<int, true>::reference {aka int}’ to ‘long unsigned int’ inside { } [-Wnarrowing]
outputs[0] = factory.createArrayFromBuffer<double>({1,size[0]}, std::move(positions_ptr));
^
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:336:96: error: no
matching function for call to ‘matlab::data::ArrayFactory::createArrayFromBuffer<int32_t>(<brace-enclosed initializer list>,
std::remove_reference<int*&>::type)’
outputs[1] = factory.createArrayFromBuffer<int32_t>({1,size[0]}, std::move(ids));
^
In file included from /home/u0148289/software/matlab/R2020b/extern/include/MatlabDataArray.hpp:22:0,
from /home/u0148289/software/matlab/R2020b/extern/include/mexAdapter.hpp:10,
from
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:3:
/home/u0148289/software/matlab/R2020b/extern/include/MatlabDataArray/ArrayFactory.hpp:556:19: note: candidate:
template<class T> matlab::data::TypedArray<T>
matlab::data::ArrayFactory::createArrayFromBuffer(matlab::data::ArrayDimensions, matlab::data::buffer_ptr_t<T>,
matlab::data::MemoryLayout)
TypedArray<T> createArrayFromBuffer(ArrayDimensions dims,
^~~~~~~~~~~~~~~~~~~~~
/home/u0148289/software/matlab/R2020b/extern/include/MatlabDataArray/ArrayFactory.hpp:556:19: note: template argument
deduction/substitution failed:
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:336:91: note: cannot
convert ‘std::move<int*&>(ids)’ (type ‘std::remove_reference<int*&>::type {aka int*}’) to type
‘matlab::data::buffer_ptr_t<int> {aka std::unique_ptr<int [], void (*)(void*)>}’
outputs[1] = factory.createArrayFromBuffer<int32_t>({1,size[0]}, std::move(ids));
~~~~~~~~~^~~~~
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:417:104: warning:
narrowing conversion of ‘dim’ from ‘int32_t {aka int}’ to ‘long unsigned int’ inside { } [-Wnarrowing]
outputs[0] = factory.createArrayFromBuffer<double>({dim,size[0]}, std::move(values_ptr));
^
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:417:104: warning:
narrowing conversion of ‘dim’ from ‘int32_t {aka int}’ to ‘long unsigned int’ inside { } [-Wnarrowing]
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:417:104: warning:
narrowing conversion of ‘matlab::data::TypedArray<T>::operator[](size_t) const [with T = int; size_t = long unsigned
int](0).matlab::data::ArrayElementTypedRef<int, true>::operator matlab::data::ArrayElementTypedRef<int, true>::reference()’
from ‘matlab::data::ArrayElementTypedRef<int, true>::reference {aka int}’ to ‘long unsigned int’ inside { } [-Wnarrowing]
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:428:97: warning:
narrowing conversion of ‘dim’ from ‘int32_t {aka int}’ to ‘long unsigned int’ inside { } [-Wnarrowing]
outputs[0] = factory.createArrayFromBuffer<double>({dim,1}, std::move(value_ptr));
^
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:428:97: warning:
narrowing conversion of ‘dim’ from ‘int32_t {aka int}’ to ‘long unsigned int’ inside { } [-Wnarrowing]
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:449:104: warning:
narrowing conversion of ‘sizeA’ from ‘int32_t {aka int}’ to ‘long unsigned int’ inside { } [-Wnarrowing]
outputs[0] = factory.createArrayFromBuffer<double>({sizeA,sizeB}, std::move(values_ptr));
^
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:449:104: warning:
narrowing conversion of ‘sizeA’ from ‘int32_t {aka int}’ to ‘long unsigned int’ inside { } [-Wnarrowing]
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:449:104: warning:
narrowing conversion of ‘sizeB’ from ‘int32_t {aka int}’ to ‘long unsigned int’ inside { } [-Wnarrowing]
/home/u0148289/openfoam-adapter/matlab-bindings/+precice/@SolverInterface/private/preciceGateway.cpp:449:104: warning:
narrowing conversion of ‘sizeB’ from ‘int32_t {aka int}’ to ‘long unsigned int’ inside { } [-Wnarrowing]
Error in compile_matlab_bindings_for_precice (line 19)
mex(strcat(path_Interface,".cpp"),"-output",path_Interface,flags{:});
Any suggestions to solve this problem?
Best regards,
Jun