首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏自学气象人

    fortran中三种数组传递方式

    看下面的代码: Program www_fcode_cn Implicit None Real a(2, 3) Interface Subroutine fun3(a) 方法1 Subroutine fun1(a) Real a(*) a(1:6) = 1 End Subroutine fun1 ! 方法2 Subroutine fun2(a, m, n) Integer m, n Real a(m, n) a = 2 End Subroutine fun2 ! 方法3 Subroutine fun3(a) Real a(:, :) a = 3 End Subroutine fun3 执行结果: 三种方法的形参数组,第一种称假定大小数组(assumed-size 方法4 Subroutine fun4(a) Real a(1) a(1:6)=4 !全部6个元素赋值为4 a = 0 !

    1.6K30编辑于 2023-01-11
  • 来自专栏Tech Explorer

    【旧代码】fortran中的指针实现链表的代码

    subroutine del_node(pos) type(node),pointer ::pos,next next=>pos%next if(associated(next%next)) then pos%next=>next%next deallocate(next) else nullify(pos%next) deallocate(next) end if end subroutine subroutine show_all(pos) type(node),pointer ::pos,tmp integer ::cnt cnt=1 print*,"all students are:" subroutine init_all(pos,num) type(node),pointer ::pos,tmp,walk integer num integer i allocate(tmp) pos=>tmp%next deallocate(tmp) walk=>pos do i=1,num-1 call add_node(walk) walk=>walk%next end do end subroutine

    1K30发布于 2021-06-25
  • 来自专栏caoayu的分享

    JS Flowchart Diagrams

    end: End:>http://www.google.com op1=>operation: My Operation|past op2=>operation: Stuff|current sub1=>subroutine : My Subroutine|invalid cond=>condition: Yes or No? : My Subroutine|invalid cond=>condition: Yes or No? : My Subroutine|invalid cond=>condition: Yes or No? : My Subroutine|invalid cond=>condition: Yes or No?

    62942发布于 2020-09-23
  • 来自专栏赵俊的Java专栏

    Hexo优化 --- 利用 Markdown 语法画流程图

    Start:>http://www.google.com[blank] e=>end:>http://www.google.com op1=>operation: My Operation sub1=>subroutine : My Subroutine cond=>condition: Yes or No? Start:>http://www.google.com[blank] e=>end:>http://www.google.com op1=>operation: My Operation sub1=>subroutine : My Subroutine cond=>condition: Yes or No? : My Subroutine cond=>condition: Yes or No?

    2.7K30发布于 2018-06-04
  • 来自专栏量子化学

    Fortran调用C函数

    先上示例: test.f90: program main implicit none real(kind=4)::a,b,c interface subroutine calc(a,b,c) bind(c,name='calC') use iso_c_binding real(kind=c_float)::a,b,c end subroutine calc end 在Fortran程序中需要给C函数写一个interface,在subroutine XXX后面跟上bind(c, name='YYY')语句,表示XXX这个子程序链接的是C语言中的YYY函数。 iso_c_binding use data_types type(my_type)::test_struct character(kind=c_char),dimension(20)::c interface subroutine use data_types type(my_type)::my_struct character(kind=c_char),dimension(20)::msg end subroutine

    4.1K20发布于 2020-07-27
  • 来自专栏自学气象人

    Fortran 与 C 数组传递的三种方式

    } Fortran 语言代码: module demo implicit none real(8), bind(c) :: x(3) interface subroutine init() bind(c) end subroutine init end interface interface subroutine prt() bind(c) end subroutine prt end interface end module demo ! init2() bind(c) end subroutine init2 end interface interface subroutine prt2 () bind(c) end subroutine prt2 end interface end module demo2 !

    1.8K10编辑于 2023-01-11
  • 来自专栏我在本科期间写的文章

    3.9 控制转移指令

    语法: CALL 标号 示例: MAIN: ; 一些主程序代码 CALL SUBROUTINE ; 调用子程序 SUBROUTINE ; 子程序执行完毕后,程序会回到这里继续执行 SUBROUTINE: ; 子程序的代码 RET ; 返回到调用点 示例详解: 在上述代码中,CALL SUBROUTINE 使得程序跳转到 SUBROUTINESUBROUTINE 执行完 RET 指令时,程序返回到 CALL SUBROUTINE 之后的代码,继续执行主程序。 总结: CALL 指令用于实现子程序的调用,使得代码模块化、便于复用。 语法: RET 示例: MAIN: ; 一些主程序代码 CALL SUBROUTINE ; 调用子程序 SUBROUTINE ; 子程序执行完毕后,程序会回到这里继续执行 SUBROUTINE: ; 子程序的代码 RET ; 返回到调用点 示例详解: 在这个示例中,CALL SUBROUTINE 指令调用了一个名为 SUBROUTINE

    77710编辑于 2024-09-13
  • 来自专栏剑指工控

    PLC如何产生一个随机数(含代码)

    Random 有了个最大范围参数,可以限制生成的随机数的最大范围,比如我只需要4位随机数,所以一般这样调用 CALL Random, 10000, vw0,生成的数就在 0-9999 范围内 下面是代码: SUBROUTINE_BLOCK VB1990 Network 2 LD SM0.0 BTI VB1994, AC1 SLW AC1, 8 BTI VB1995, AC3 +I AC3, AC1 MOVW AC1, LW0 END_SUBROUTINE_BLOCK SUBROUTINE_BLOCK Random:SBR16 TITLE=随机数发生器 // // 线性同余法获取伪随机数,范围:0~32767 // // seed = (seed * 3373 + DTR AC1, AC1 /R 32768.0, AC1 ITD LW0, AC3 DTR AC3, AC3 *R AC3, AC1 ROUND AC1, AC1 DTI AC1, LW2 END_SUBROUTINE_BLOCK

    3.9K20发布于 2021-11-09
  • 来自专栏算法微时光

    使用Markdown画流程图

    先来看个例子: st=>start: 开始 e=>end: 结束 op=>operation: 操作 sub1=>subroutine: 子程序 cond=>condition: Yes or io=>inputoutput: catchsomething... sub1=>subroutine: My Subroutine e=>点击本结束跳转:>https://blog.csdn.net

    2.3K31发布于 2020-09-28
  • 来自专栏ABAQUS二次开发

    【阿信子程序学习笔记(5)】DLOAD(附代码)

    ABAQUS帮助文档中的介绍如下(我就不翻译了,道友英语都比我好): User subroutine DLOAD: can be used to define the variation of the 子程序的接口(User subroutine interface)如下 SUBROUTINE DLOAD(F,KSTEP,KINC,TIME,NOEL,NPT,LAYER,KSPT,

    1.5K20编辑于 2022-05-17
  • 来自专栏后端系统和架构

    Go 单测入门篇:Golang 单元测试基本使用

    func main() { var i int = 0 go func() { for { i++ fmt.Println("subroutine workspace/goDev/Applications/src/base-code-example/system/testrace/testrace.go:10 +0x7a ================== subroutine : i = 2 mainroutine: i = 3 subroutine: i = 4 mainroutine: i = 5 subroutine: i = 6 mainroutine: i = 7 subroutine: i = 8 subroutine: i = 9 mainroutine: i = 10

    1.8K10编辑于 2023-03-01
  • 来自专栏GPUS开发者

    对于CUDA Fortran开发者来说,函数传参真这么麻烦么?

    有天,有人在论坛上问了一个问题: 我想创建一个data区域来减少subroutine之间的数据传递(阅读原文查看楼主的代码),这样就不必在subroutine之间进行一次次的数据拷贝到设备再拷贝回主机再拷贝回设备计算 我只知道present导语能够告知编译器该变量已经存在于数据区域中,那么如何让GPU计算得出的变量滞留在设备内存中,直接供给下一个subroutine使用呢?

    1K60发布于 2018-04-02
  • 来自专栏从流域到海域

    Kosaraju算法

    For each vertex u of the graph do Visit(u), where Visit(u) is the recursive subroutine: If u is unvisited For each element u of L in order, do Assign(u,u) where Assign(u,root) is the recursive subroutine: If

    89220发布于 2019-05-28
  • 来自专栏自学气象人

    fortran中的数组

    subroutine fun(x1,x2,x3) ... end subroutine fun ! 使用fun(a,b,c)调用,则默认按照顺序对应 ! x1=a x2=b x3=c ! fun(x1=a,x3=b,x2=c) 数组作为参数传递 和c语言类似,直接把数组a作为实参传递给子程序subroutine或者函数function等,相当于把第一个元素的内存地址传递过去。 把a当作一个尺寸为2*2的二维数值传过去 end program main 三个子程序为 subroutine sub_num(a) implicit none integer :: 读出的是a(1)的内存地址 end subroutine sub_num subroutine sub_array5(a) implicit none integer :: a(5) a(1) a(2) a(3) a(4) a(5) end subroutine sub_array5 subroutine sub_array22(a) implicit none integer

    2.4K10编辑于 2023-06-20
  • 来自专栏IT开发技术与工作效率

    公式流程图时序图.md 测试

    b \pm \sqrt{b^2 - 4ac}}{2a} $$ flow st=>start: Start e=>end: End op1=>operation: My Operation sub1=>subroutine : My Subroutine cond=>condition: Yes or No?

    1K30发布于 2018-06-27
  • 来自专栏ABAQUS二次开发

    【阿信ABAQUS子程序(7)】USDFLD

    ABAQUS子程序USDFLD(User subroutine to redefine field variables at a material point.) ABAQUS子程序USDFLD的接口如下: SUBROUTINE USDFLD(FIELD,STATEV,PNEWDT,DIRECT,T,CELENT, 1 TIME,DTIME, increment, as specified with initial condition definitions, predefined field variable definitions, or user subroutine 本文USDFLD子程序具体代码如下: SUBROUTINE USDFLD(FIELD,STATEV,PNEWDT,DIRECT,T,CELENT, 1 TIME,DTIME,CMNAME

    5.9K10编辑于 2022-05-17
  • 来自专栏农民工前端

    md语法学习

    sub=>subroutine: your subroutinee=>endst->io->op->condcond(yes)->econd(no)->sub->io写法: ```flow st=>start sub=>subroutine: your subroutine e=>end //关系链 st->io->op->cond cond(yes)->e cond(no)->sub->io ``` 语法格式

    67540编辑于 2023-02-17
  • 来自专栏小闫笔记

    Markdown语法奇奇怪怪小知识

    end: End:>http://www.google.com op1=>operation: My Operation|past op2=>operation: Stuff|current sub1=>subroutine : My Subroutine|invalid cond=>condition: Yes or No?

    48410发布于 2020-05-22
  • 来自专栏量子化学

    GFN-xTB的编译与API使用

    subroutine gfn2_calculation(iunit,env,opt,mol,gfn,pcem,wfn,hl_gap,energy,gradient) iunit: fortran 文件的 test_gfn2_scc call test_gfn2_scc call test_gfn2_api call test_gfn2_api end program test 这些subroutine , subroutine test_gfn2_scc subroutine test_gfn2_api 是从xTB自带的test文件中拷过来的,我把一些没用的代码剔除掉,这样xTB就以API形式接入主程序了

    1.5K20发布于 2020-07-27
  • 来自专栏緣來來來

    Markdown的安装以及简单使用教程

    sub= subroutine: Your Subroutine e= end ``` #### 下面是使用效果: st= start: Start io= inputoutput: verification sub= subroutine: Your Subroutine e= end ## 2.8 文字图片居中 ```bash

    **你的名字**type: content:>url tag:是元素名字 type:元素的类型,有6中类型,分别为: start # 开始 end # 结束 operation # 操作 subroutine cond(yes)->io->e cond(no)->op2->e 简单的实例 ```flow st=>start: 开始 e=>end: 结束 op=>operation: 操作 sub=>subroutine

    3.3K10发布于 2020-01-02
领券