在Fortran中实现一组队列的简单方法? [英] Simple way to implement a group of queues in Fortran?

查看:256
本文介绍了在Fortran中实现一组队列的简单方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我需要在一个过程中实现至少5个队列,每个队列都来自不同的定义类型。如何以简单和短的方式来实现这一点?

另一种看待这个问题的方式是我找到的方式:在Fortran中定义我自己的结构之后,我不得不用C ++编写程序,然后我看到使用模板是多么容易......现在,我想用我的母语也是一样......

似乎知识不是总是很舒服



非常感谢! 解决方案

模板,有 Pyf95 ++ 。它为Fortran提供了使用预处理器的模板和STL。 (有关此处



使用 transfer()的泛型链表可以在 FLIBS



(否则,如果您使用流畅的编译器,您可以使用Richard Lozes所建议的无限制多态性。)


Suppose that I need to implement at least 5 queues in one procedure, each of it from a different defined type. How can achive this in a simple and short way?.

Another way to see the question is the way that came to me: after a lot of time of defining my own structures in fortran, I had to make a program in C++, and then I saw how easy is the use of templates... now, I want the same in my mother tongue....

seems that the knowledge is not always confortable

Thanks a lot!

解决方案

If you really want templates, there is Pyf95++. It brings templating and an STL for Fortran using a preprocessor. (for download here)

A generic linked-list that uses transfer() can be found in FLIBS.

(Otherwise with a bleeding edge compiler you can use unlimited polymorphism as suggested by Richard Lozes.)

这篇关于在Fortran中实现一组队列的简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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