sanyibacsi
Programmer
Hi There,
I am new to this forum as well as to Fortran. I code in C++ for over ten years and now I received an assignment what requires me to provide an interface to a Fortran code to pass struct data back and forth.
The background is that both applications are mathematic ones and the Fortran should utilize some of the computations done in the C++ code as here (not very usual as far as I understand) the Fortran code is the alive and maintained code while the C++ code is the closed and no longer update one.
The C++ code is single threaded and normally instantiated and use somehow like this:
where
It looks that I can pretty much manage the setup and the solve change, at least based on the information I read so far. My problem is that I have no idea how to instantiate the class in Fortran and call the methods of it; or make it in a way that it works when put into the C++ code.
Do you know what would be the right way to do that?
Thanks
I am new to this forum as well as to Fortran. I code in C++ for over ten years and now I received an assignment what requires me to provide an interface to a Fortran code to pass struct data back and forth.
The background is that both applications are mathematic ones and the Fortran should utilize some of the computations done in the C++ code as here (not very usual as far as I understand) the Fortran code is the alive and maintained code while the C++ code is the closed and no longer update one.
The C++ code is single threaded and normally instantiated and use somehow like this:
Code:
struct StructElements {
int a, b, c, d;
real a1, b1, c1, d1;
};
vector<StructElements> vecStructElements;
...
CCppComp Application("/var/etc/logxy.txt);
Application.setup(vecStructElements);
Application.solve("<derivation, integration, laplace, whatever>");
where
Code:
void CCppComp::Application.setup(vector<StructElements> &data);
void CCppComp::solve(const string Equ);
It looks that I can pretty much manage the setup and the solve change, at least based on the information I read so far. My problem is that I have no idea how to instantiate the class in Fortran and call the methods of it; or make it in a way that it works when put into the C++ code.
Do you know what would be the right way to do that?
Thanks