Access SMath file from within C++ app

Access SMath file from within C++ app - Can a C++ program access variables and results of a SMath file? - Сообщения

#1 Опубликовано: 23.10.2017 05:03:14
florian.kosche@difk.no

florian.kosche@difk.no

0 сообщений из 8 понравились пользователям.

Группа: User


Hi,

I wounder if it is possible to access SMath files from within C++ app to provide values for variables and get back results. The reason is that it is easier to develop and check analysis for ever changing tasks in SMath but include it in our general analysis solving application.

Thanks!
#2 Опубликовано: 23.10.2017 12:55:24
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

I wounder if it is possible to access SMath files from within C app to provide values for variables and get back results. The reason is that it is easier to develop and check analysis for ever changing tasks in SMath but include it in our general analysis solving application.



Not clear what you are asking for:

If you C++ application can generate vector of values and if it can write to NotePad,
you can read NotePad from Smath and proceed to the maths you wish, that Smath can digest.

Maybe the other way around ?

Read NotePad.PNG
#3 Опубликовано: 23.10.2017 13:15:39
florian.kosche@difk.no

florian.kosche@difk.no

0 сообщений из 8 понравились пользователям.

Группа: User

In principle yes, but not exchange values through text files, rather than an api towards specific SMath files. You could imagine the SMath file includes operations that can be accessed by a C++ function.

I then could write a program in C++ which would connect to a SMath file and feed it with values and get back results.

Was that maybe clearer?
#4 Опубликовано: 23.10.2017 17:05:14
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Ah ! got it ... Application C++ read Smath data ,<= [data generated by Smath from some function(s)]
... then Smath <= read back application . Bidirectional means both in some universal code.
The real question is: could Smath do same as the "Application" ? ... you give no hint.
#5 Опубликовано: 23.10.2017 21:36:51
florian.kosche@difk.no

florian.kosche@difk.no

0 сообщений из 8 понравились пользователям.

Группа: User

I have no hints, but I think you understand. In a way you would integrate SMath files into the C++ application during execution as if they were C++ functions. This would not happen at compile time but during execution.

#6 Опубликовано: 23.10.2017 22:42:49
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

I have no hints, but I think you understand. In a way you would integrate SMath files into the C application during execution as if they were C functions. This would not happen at compile time but during execution.



That's what Mathcad is doing with the extension packs.
You can work solely from the respective extension pack or from the normal Mathcad work sheet
that calls the functions from the pack. But functions in the pack(s) are coded in Mathcad style.
In other words, the Smath functions would have to be coded C++ for the application to read
at execution time... And from the C++ application, were to you feed that to plot, tabulate
and else project demand ?

Smath has already some stuff from "Dot Numerics, Matlab..."

Cheers, Jean ... Hope you get more professional reply.
#7 Опубликовано: 24.10.2017 01:48:52
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

Wrote

I then could write a program in C++ which would connect to a SMath file and feed it with values and get back results.



There is no direct way for this. Theoretically, you can use shared memory for this. But still there is no direct access from the unmanaged memory to the managed one. Also you will need a way to calculate the document from the outside.

For now there is no API to control SMath Studio from own application. And Andrey was against using separate parts of the program as a worksheet calculator.
Russia ☭ forever, Viacheslav N. Mezentsev
#8 Опубликовано: 24.10.2017 05:04:07
florian.kosche@difk.no

florian.kosche@difk.no

0 сообщений из 8 понравились пользователям.

Группа: User


I see! Would be a very powerful tool for practical engineering though. A work around could be that SMath sheets can be exported as C or C++ code, which than could be linked into the application.

I shall think a bit more.

Thank you for your answers!
#9 Опубликовано: 24.10.2017 05:26:03
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

Wrote


A work around could be that SMath sheets can be exported as C or C++ code, which than could be linked into the application.


It's impossible. SMath Studio is a .Net application and worksheets (which including visual components) also depend on .Net assemblies. So, you can't do that.
But you can add your code as plugin like Mathcad EFI or CPPPlugin.
Russia ☭ forever, Viacheslav N. Mezentsev
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений