问题描述
我的任务是将几个Fortran文件转换为C#。我真的没有选择,在这种情况下不能使用Dot net驱动程序来读取Fortran。对于C#而言,我是一名业余爱好者,并且在1983年使用Fortran作为我唯一的一次。
我有几个条款,我似乎无法弄清楚如何在C#中联系,如果有人能让我指出正确的方向请。
我尝试了什么:
我有很多实例Fortran使用ALLOCATABLE命令分配数组。我不知道如何在C#中做类似的事情,稍后在代码中,我需要引用这个分配作为检查。
我有类型声明:
I have been tasked with converting several Fortran files over to C#. I really do not have a choice and in this situation cannot use a Dot net driver to read Fortran. I am an amateur when it comes to C# and used Fortran in 1983 as my one and only time.
I have a couple of clauses which I can't seem to figure out how to relate in C#, if someone could get me pointed in the right direction please.
What I have tried:
I have a lot of instances in Fortran where an array is Allocated using an ALLOCATABLE command. I do not know how to do similar in C#, later on, in code, I need to reference this allocation as a check as well.
I have a Type declaration:
TYPE Cell
DOUBLE PRECISION, POINTER :: column(:)
END TYPE Cell
如何将此声明转换为C#?
我使用上述声明进行作业:
How do I convert this Declaration to C#?
I have assignments using the above declaration:
TYPE(Cell), POINTER :: PMAT(:)
TYPE(Cell), POINTER :: PMATD(:)
TYPE(Cell), POINTER :: NMATD(:)
如何在C#中声明这些变量?
How do I declare these variables in C#?
推荐答案
To be or not to be, that is the question
에 있다 또는 아니 에 있다 그 ~이다. 그만큼 문제
其翻译为:
Which translates back as:
It is in or is not in. That problem
而翻译整个短语给出了这个:
Whereas translating the whole phrase gives this:
존재하거나 존재하지 않기 위해서, 그것은 질문입니다.
这至少会带来一些更富有诗意的东西!
Which at least comes back with something a little more poetic!
To exist or not exist, it is a question.
但我确信一个流利使用这两种语言的人可以产生一个更好的结果。 :笑:
你最好的解决方案是使用原始应用程序作为规范重写代码,而不是翻译现有代码,特别是如果你不熟悉源语言!
But I'm sure that a person fluent in both languages could produce a much better result. :laugh:
Your best solution is to rewrite the code using the original application as a specification, not translate the existing code, particularly if you are unfamiliar with the source language!
这篇关于寻求将Fortran转换为C#的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!