我需要推荐/帮助我选择的解决方案! [英] I Need Recommandation/Help For The Solution I Chose !

查看:64
本文介绍了我需要推荐/帮助我选择的解决方案!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



也许我的帖子很长,我感谢所有可以阅读到最后的人。但我需要更好地描述我的情况。



1)背景:

所以,首先我有一个用Fortran 90(科学领域)编写的模拟软件。该仿真软件需要集成在一个框架中(用c#编写的仿真平台)。为此我没有选择,如果我想在这个模拟平台中使用我的Fortran 90,我需要用C#重写它。

在这个平台上,你可以通过构建组件(策略组件)来构建一个建模解决方案组件耦合在一起以构建建模解决方案。

另一方面,它存在相同的仿真平台,但是用C ++编写。原则上这两个平台是相似的,除了使用的技术内容(C#vs C ++)。

这两个平台的目标是重用代码,模块化方法和可扩展性。



2)选择的解决方案:

我们试图找到一个解决方案,我们可以在两个平台上集成我们的仿真模型。关键是我们必须重写我们的Fortran 90代码。所以我们想象一个允许我们在两个平台上集成模拟的解决方案。

解决方案如下:

我们的Fortran 90仿真模型是一组数学方程式使用全局变量在几个模块中组装。我们的想法是构建一个本机C ++库,在该库中我们使用面向对象的范例收集Fortran 90代码的所有等式。构建此本机C ++库后,解决方案是使用C ++ / CLI创建此库的包装器。在这种情况下,将通过策略组件在C#平台中实现的方程式可以使用先前构建的本机C ++库来实现。然后可以在用C ++编写的第二个仿真平台中使用该库。



3)问题:

你认为这个解决方案是正确的吗?或者也许是不可能的,唯一的解决方案是直接用C#重写Fortran 90.



感谢所有阅读此消息的人,直到最后并尝试回答。



naeco

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

推荐答案

这取决于您认为的主要平台,C ++或C ++ / CLI什么是性能问题。您可以在两个选项之间进行选择1)在C ++ / CLI中实现所有内容,2)在非托管C ++中实现内核并将其包装在C ++ / CLIref类中。本机代码和托管代码的组合也可以工作:您甚至可以创建一个混合模式模块,它可以像任何非托管DLL一样公开非托管API,同时也可以作为常规.NET程序集的主模块。同样,此选项取决于您的主要平台。如果你需要.NET和非托管API,你可以增加一些额外的工作来实现它。



最重要的是,我要说的是消除任何痕迹FORTRAN。让我们跳过讨论为什么会这样。



我想,你的解决方案是我认为合理的选项之一,所以答案是:是的,这个这将是一个很好的解决方案。



-SA
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


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


这篇关于我需要推荐/帮助我选择的解决方案!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆