一种Fortran和C++混合编程规范化方法  

A Normalization Method of Mixed-programming with FORTRAN and C++

在线阅读下载全文

作  者:陈磊[1] 徐烂 CHEN Lei, XU Lan (College of Computer Science and Technology, University of South China, Hengyang 421001, China)

机构地区:[1]南华大学计算机科学与技术学院,湖南衡阳421001

出  处:《电脑知识与技术》2014年第5期2962-2966,共5页Computer Knowledge and Technology

基  金:本课题得到湖南省自然科学基金(11JJ6047,13JJ4076);湖南省教育厅优秀青年项目(138101);南华大学重点学科和创新团队建设基金资助项目;衡阳市科技局科技计划项目(2013KG66,2013KG67)

摘  要:目前,在科学计算领域有不少程序采用了Fortran和C++两种语言进行混合编程(即“混编”),但现有混编的程序代码可读性差,可维护性差,严重影响了软件的可移植性和可重用性。针对此现状,笔者总结了自己在核电软件开发中的实际经验,分三步阐述了Fortran和C++混合编程的规范化:首先,用宏定义等方法实现C++类型与Fortran类型的映射;然后,对于简单类型的参数传递,提出规范性意见;最后,对于Fortran中的特殊类型,提出在C++中用封装类型进行定义。经过对比验证,证明规范化的混合编程确实增加了代码的鲁棒性,可维护性。Nowadays in scientific computing, a mixed-programming technology with FORTRAN and C++program language is adopted in many programs. While lots of mixed programs have the problems of bad readability and maintainability, so it have a bad influence on the reusability of software. According to the situation, author sum up experiences and come up with a solution how to improve the mix-programming by three step. Firstly, use a macro definition method to realize the type-map between FORTRAN and C++. Secondly, to the base-type parameter passing, propose an idea about normalization. At last, propose a solution that use a C++use-defined type for the special type in FORTRAN. By validating the results of before the normalization and after it, mixed-programming with normalization did improve the maintainability and robustness of the code.

关 键 词:混合编程 FORTRAN C++ 

分 类 号:TP311[自动化与计算机技术—计算机软件与理论;自动化与计算机技术—计算机科学与技术]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象