Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everybody,

Maybe my post will be long and i thanks all the person that could read until the end. But i need describe my situation the better i can.

1) Context :
So, First I have a simulation software written in Fortran 90 (science domain). This simulation software need to be integrate in a framework (simulation platform written in c#). For this i have no choice if i want use my Fortran 90 within this simulation platform i need to rewrite it in C#.
On this platform you build a modeling solution by building components (strategy components) and these components are coupled together for build the modeling solution.
On the other hand it exist the same simulation platform but written in C++. In the principle these two platform are similar except the technical stuff used (C# vs C++).
The goal of these two platform is reuse code, modular approach and extensibility.

2) solution chosen :
We try to find a solution for which we could integrate our simulation model on both platform. The point is we have to rewrite our Fortran 90 code. So we imagine a solution that permit us to integrate our simulation on both platform.
The solution is the following :
Our Fortran 90 simulation model is a set of mathematical equations that are assembled in several modules using global variables. The idea is to build a native C++ library in which we collect all the equation of the Fortran 90 code using the object oriented paradigm. Once this native C++ library is build, the solution is to create a wrapper of this library using the C++/CLI. In this case equations that go to be implemented in the C# platform via strategy components could be implemented using the native C++ library previously build. This library could then be use in the second simulation platform written in C++.

3) Question :
Do you think that this solution is correct ? Or maybe is impossible and the only solution is to rewrite the Fortran 90 directly in C#.

Thanks to all the people that read this message until the end and try to answer.

naeco
Posted

It depends on what you consider a major platform, C++ or C++/CLI and what are the performance issues. You can choose between the two options 1) implement everything in C++/CLI, 2) implement the core in unmanaged C++ and wrap it in C++/CLI "ref" classes. A combination of the native and managed code will also work: you can even create a mixed-mode module which exposes unmanaged API, as any unmanaged DLL and, at the same time, behaves as a main module of a regular .NET assembly. Again, this option depends on what are your main platforms. If you need both .NET and unmanaged APIs, you can add some extra effort to achieve that.

Most important thing, I would say, is to eliminate any trace of FORTRAN. Let's skip the discussion on why is it so.

I guess, your solution is one of the options I described as reasonable, so the answer would be: yes, this would be a good solution.

—SA
 
Share this answer
 
CSS
Thanks a lot for your complete answer. Yes i follow the solution that you describe : write the core within a native C++ library that gather all the equation from the Fortran. Then write a c++/CLI wrapper and then build my modeling solution on the c# platform using my library C++.

Thanks a lot for your help.

Naeco
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900