/usr/share/doc/libxdmf-dev/examples/Cxx/XdmfFortranExample.f90 is in libxdmf-dev 2.1.dfsg.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
!! AUTHOR: Kenneth Leiter (kenneth.leiter@arl.army.mil)
!!
!! Use the Xdmf Fortran Bindings to write out a simple mesh consisting of
!! two hexahedrons. Link against the XdmfFortran library to compile.
!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
PROGRAM XdmfFortranExample
!DEC$ ATTRIBUTES DLLIMPORT, ALIAS:'_XdmfInit'::XdmfInit
!DEC$ ATTRIBUTES DLLIMPORT, ALIAS:'_XdmfSetGridTopology'::XdmfSetGridTopology
!DEC$ ATTRIBUTES DLLIMPORT, ALIAS:'_XdmfSetGridGeometry'::XdmfSetGridGeometry
!DEC$ ATTRIBUTES DLLIMPORT, ALIAS:'_XdmfSetGridAttribute'::XdmfSetGridAttribute
!DEC$ ATTRIBUTES DLLIMPORT, ALIAS:'_XdmfAddGridAttribute'::XdmfAddGridAttribute
!DEC$ ATTRIBUTES DLLIMPORT, ALIAS:'_XdmfWriteGrid'::XdmfWriteGrid
!DEC$ ATTRIBUTES DLLIMPORT, ALIAS:'_XdmfWriteToFile'::XdmfWriteToFile
!DEC$ ATTRIBUTES DLLIMPORT, ALIAS:'_XdmfSerialize'::XdmfSerialize
!DEC$ ATTRIBUTES DLLIMPORT, ALIAS:'_XdmfClose'::XdmfClose
INTEGER*8 obj
character*256 filename
REAL*4 myPoints(3,3,4)
INTEGER myConnections(8,2)
REAL*8 myCellAttribute(2), myNodeAttribute(3,4)
filename = 'my_output'//CHAR(0)
myPoints(1,1,1) = 0
myPoints(2,1,1) = 0
myPoints(3,1,1) = 1
myPoints(1,2,1) = 1
myPoints(2,2,1) = 0
myPoints(3,2,1) = 1
myPoints(1,3,1) = 3
myPoints(2,3,1) = 0
myPoints(3,3,1) = 2
myPoints(1,1,2) = 0
myPoints(2,1,2) = 1
myPoints(3,1,2) = 1
myPoints(1,2,2) = 1
myPoints(2,2,2) = 1
myPoints(3,2,2) = 1
myPoints(1,3,2) = 3
myPoints(2,3,2) = 2
myPoints(3,3,2) = 2
myPoints(1,1,3) = 0
myPoints(2,1,3) = 0
myPoints(3,1,3) = -1
myPoints(1,2,3) = 1
myPoints(2,2,3) = 0
myPoints(3,2,3) = -1
myPoints(1,3,3) = 3
myPoints(2,3,3) = 0
myPoints(3,3,3) = -2
myPoints(1,1,4) = 0
myPoints(2,1,4) = 1
myPoints(3,1,4) = -1
myPoints(1,2,4) = 1
myPoints(2,2,4) = 1
myPoints(3,2,4) = -1
myPoints(1,3,4) = 3
myPoints(2,3,4) = 2
myPoints(3,3,4) = -2
myConnections(1,1) = 0
myConnections(2,1) = 1
myConnections(3,1) = 7
myConnections(4,1) = 6
myConnections(5,1) = 3
myConnections(6,1) = 4
myConnections(7,1) = 10
myConnections(8,1) = 9
myConnections(1,2) = 1
myConnections(2,2) = 2
myConnections(3,2) = 8
myConnections(4,2) = 7
myConnections(5,2) = 4
myConnections(6,2) = 5
myConnections(7,2) = 11
myConnections(8,2) = 10
myNodeAttribute(1,1) = 100
myNodeAttribute(1,2) = 300
myNodeAttribute(1,3) = 300
myNodeAttribute(1,4) = 500
myNodeAttribute(2,1) = 200
myNodeAttribute(2,2) = 400
myNodeAttribute(2,3) = 400
myNodeAttribute(2,4) = 600
myNodeAttribute(3,1) = 300
myNodeAttribute(3,2) = 500
myNodeAttribute(3,3) = 500
myNodeAttribute(3,4) = 700
myCellAttribute(1) = 100
myCellAttribute(2) = 200
CALL XDMFINIT(obj, filename)
CALL XDMFSETGRIDTOPOLOGY(obj, 'Hexahedron'//CHAR(0), 2, myConnections)
CALL XDMFSETGRIDGEOMETRY(obj, 'XYZ'//CHAR(0), 'XDMF_FLOAT32_TYPE'//CHAR(0), 12, myPoints)
CALL XDMFADDGRIDATTRIBUTE(obj, 'NodeValues'//CHAR(0),'XDMF_FLOAT64_TYPE'//CHAR(0), 'NODE'//CHAR(0), &
'SCALAR'//CHAR(0), 12, myNodeAttribute)
CALL XDMFADDGRIDATTRIBUTE(obj, 'CellValues'//CHAR(0),'XDMF_FLOAT64_TYPE'//CHAR(0), 'CELL'//CHAR(0), &
'SCALAR'//CHAR(0), 2, myCellAttribute)
CALL XDMFWRITEGRID(obj, 'TestGrid'//CHAR(0))
CALL XDMFWRITETOFILE(obj)
CALL XDMFSERIALIZE(obj)
CALL XDMFCLOSE(obj)
END
|