Commit 32ae6036 authored by Kenneth Leiter's avatar Kenneth Leiter

ENH: Add Fortran updates into trunk.

parent 45377509
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
!! 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
IMPLICIT NONE
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 XDMFSETGEOMETRY(obj, foo, 36, XDMF_ARRAY_TYPE_FLOAT64, 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 XDMFADDGRID(obj, 'TestGrid'//CHAR(0))
! CALL XDMFWRITETOFILE(obj)
! CALL XDMFSERIALIZE(obj)
CALL XDMFCLOSE(obj)
END PROGRAM XdmfFortranExample
......@@ -2,12 +2,17 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
option(XDMF_BUILD_EXODUS_IO OFF)
option(XDMF_BUILD_PARTITIONER OFF)
option(XDMF_BUILD_FORTRAN OFF)
set(XdmfUtilsSources
XdmfDiff
XdmfTopologyConverter)
set(XdmfUtilsLinkLibraries Xdmf)
if(XDMF_BUILD_FORTRAN)
set(XdmfUtilsSources ${XdmfUtilsSources} XdmfFortran)
endif(XDMF_BUILD_FORTRAN)
if(XDMF_BUILD_EXODUS_IO)
set(XDMF_SWIG_FLAGS ${XDMF_SWIG_FLAGS} -DXDMF_BUILD_EXODUS_IO)
find_package(Exodus REQUIRED)
......@@ -81,6 +86,10 @@ foreach(source ${XdmfUtilsSources})
set(XdmfUtilsHeaders ${XdmfUtilsHeaders} ${source}.hpp)
endforeach(source ${XdmfUtilsSources})
if(XDMF_BUILD_FORTRAN)
set(XdmfUtilsHeaders ${XdmfUtilsHeaders} Xdmf.f)
endif(XDMF_BUILD_FORTRAN)
install(FILES ${XdmfUtilsHeaders} DESTINATION include)
install(TARGETS XdmfUtils
RUNTIME DESTINATION bin
......
! Array Type
integer XDMF_ARRAY_TYPE_INT8
integer XDMF_ARRAY_TYPE_INT16
integer XDMF_ARRAY_TYPE_INT32
integer XDMF_ARRAY_TYPE_INT64
integer XDMF_ARRAY_TYPE_UINT8
integer XDMF_ARRAY_TYPE_UINT16
integer XDMF_ARRAY_TYPE_UINT32
integer XDMF_ARRAY_TYPE_FLOAT32
integer XDMF_ARRAY_TYPE_FLOAT64
! Attribute Center
integer XDMF_ATTRIBUTE_CENTER_GRID
integer XDMF_ATTRIBUTE_CENTER_CELL
integer XDMF_ATTRIBUTE_CENTER_FACE
integer XDMF_ATTRIBUTE_CENTER_EDGE
integer XDMF_ATTRIBUTE_CENTER_NODE
! Attribute Type
integer XDMF_ATTRIBUTE_TYPE_SCALAR
integer XDMF_ATTRIBUTE_TYPE_VECTOR
integer XDMF_ATTRIBUTE_TYPE_TENSOR
integer XDMF_ATTRIBUTE_TYPE_MATRIX
integer XDMF_ATTRIBUTE_TYPE_TENSOR6
integer XDMF_ATTRIBUTE_TYPE_GLOBALID
integer XDMF_ATTRIBUTE_TYPE_NOTYPE
! Geometry Type
integer XDMF_GEOMETRY_TYPE_XYZ
integer XDMF_GEOMETRY_TYPE_XY
! Grid Collection Type
integer XDMF_GRID_COLLECTION_TYPE_SPATIAL
integer XDMF_GRID_COLLECTION_TYPE_TEMPORAL
! Topology Type
integer XDMF_TOPOLOGY_TYPE_POLYVERTEX
integer XDMF_TOPOLOGY_TYPE_POLYLINE
integer XDMF_TOPOLOGY_TYPE_POLYGON
integer XDMF_TOPOLOGY_TYPE_TRIANGLE
integer XDMF_TOPOLOGY_TYPE_QUADRILATERAL
integer XDMF_TOPOLOGY_TYPE_TETRAHEDRON
integer XDMF_TOPOLOGY_TYPE_PYRAMID
integer XDMF_TOPOLOGY_TYPE_WEDGE
integer XDMF_TOPOLOGY_TYPE_HEXAHEDRON
integer XDMF_TOPOLOGY_TYPE_EDGE_3
integer XDMF_TOPOLOGY_TYPE_TRIANGLE_6
integer XDMF_TOPOLOGY_TYPE_QUADRILATERAL_8
integer XDMF_TOPOLOGY_TYPE_QUADRILATERAL_9
integer XDMF_TOPOLOGY_TYPE_TETRAHEDRON_10
integer XDMF_TOPOLOGY_TYPE_PYRAMID_13
integer XDMF_TOPOLOGY_TYPE_WEDGE_15
integer XDMF_TOPOLOGY_TYPE_WEDGE_18
integer XDMF_TOPOLOGY_TYPE_HEXAHEDRON_20
integer XDMF_TOPOLOGY_TYPE_HEXAHEDRON_24
integer XDMF_TOPOLOGY_TYPE_HEXAHEDRON_27
integer XDMF_TOPOLOGY_TYPE_HEXAHEDRON_64
integer XDMF_TOPOLOGY_TYPE_HEXAHEDRON_125
integer XDMF_TOPOLOGY_TYPE_HEXAHEDRON_216
integer XDMF_TOPOLOGY_TYPE_HEXAHEDRON_343
integer XDMF_TOPOLOGY_TYPE_HEXAHEDRON_512
integer XDMF_TOPOLOGY_TYPE_HEXAHEDRON_729
integer XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1000
integer XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1331
integer XDMF_TOPOLOGY_TYPE_MIXED
!------------------------------------------------------
parameter (XDMF_ARRAY_TYPE_INT8 = 0)
parameter (XDMF_ARRAY_TYPE_INT16 = 1)
parameter (XDMF_ARRAY_TYPE_INT32 = 2)
parameter (XDMF_ARRAY_TYPE_INT64 = 3)
parameter (XDMF_ARRAY_TYPE_UINT8 = 4)
parameter (XDMF_ARRAY_TYPE_UINT16 = 5)
parameter (XDMF_ARRAY_TYPE_UINT32 = 6)
parameter (XDMF_ARRAY_TYPE_FLOAT32 = 7)
parameter (XDMF_ARRAY_TYPE_FLOAT64 = 8)
parameter (XDMF_ATTRIBUTE_CENTER_GRID = 100)
parameter (XDMF_ATTRIBUTE_CENTER_CELL = 101)
parameter (XDMF_ATTRIBUTE_CENTER_FACE = 102)
parameter (XDMF_ATTRIBUTE_CENTER_EDGE = 103)
parameter (XDMF_ATTRIBUTE_CENTER_NODE = 104)
parameter (XDMF_ATTRIBUTE_TYPE_SCALAR = 200)
parameter (XDMF_ATTRIBUTE_TYPE_VECTOR = 201)
parameter (XDMF_ATTRIBUTE_TYPE_TENSOR = 202)
parameter (XDMF_ATTRIBUTE_TYPE_MATRIX = 203)
parameter (XDMF_ATTRIBUTE_TYPE_TENSOR6 = 204)
parameter (XDMF_ATTRIBUTE_TYPE_GLOBALID = 205)
parameter (XDMF_ATTRIBUTE_TYPE_NOTYPE = 206)
parameter (XDMF_GEOMETRY_TYPE_XYZ = 301)
parameter (XDMF_GEOMETRY_TYPE_XY = 302)
parameter (XDMF_GRID_COLLECTION_TYPE_SPATIAL = 400)
parameter (XDMF_GRID_COLLECTION_TYPE_TEMPORAL = 401)
parameter (XDMF_TOPOLOGY_TYPE_POLYVERTEX = 500)
parameter (XDMF_TOPOLOGY_TYPE_POLYLINE = 501)
parameter (XDMF_TOPOLOGY_TYPE_POLYGON = 502)
parameter (XDMF_TOPOLOGY_TYPE_TRIANGLE = 503)
parameter (XDMF_TOPOLOGY_TYPE_QUADRILATERAL = 504)
parameter (XDMF_TOPOLOGY_TYPE_TETRAHEDRON = 505)
parameter (XDMF_TOPOLOGY_TYPE_PYRAMID = 506)
parameter (XDMF_TOPOLOGY_TYPE_WEDGE = 507)
parameter (XDMF_TOPOLOGY_TYPE_HEXAHEDRON = 508)
parameter (XDMF_TOPOLOGY_TYPE_EDGE_3 = 509)
parameter (XDMF_TOPOLOGY_TYPE_TRIANGLE_6 = 510)
parameter (XDMF_TOPOLOGY_TYPE_QUADRILATERAL_8 = 511)
parameter (XDMF_TOPOLOGY_TYPE_QUADRILATERAL_9 = 512)
parameter (XDMF_TOPOLOGY_TYPE_TETRAHEDRON_10 = 513)
parameter (XDMF_TOPOLOGY_TYPE_PYRAMID_13 = 514)
parameter (XDMF_TOPOLOGY_TYPE_WEDGE_15 = 515)
parameter (XDMF_TOPOLOGY_TYPE_WEDGE_18 = 516)
parameter (XDMF_TOPOLOGY_TYPE_HEXAHEDRON_20 = 517)
parameter (XDMF_TOPOLOGY_TYPE_HEXAHEDRON_24 = 518)
parameter (XDMF_TOPOLOGY_TYPE_HEXAHEDRON_27 = 519)
parameter (XDMF_TOPOLOGY_TYPE_HEXAHEDRON_64 = 520)
parameter (XDMF_TOPOLOGY_TYPE_HEXAHEDRON_125 = 521)
parameter (XDMF_TOPOLOGY_TYPE_HEXAHEDRON_216 = 522)
parameter (XDMF_TOPOLOGY_TYPE_HEXAHEDRON_343 = 523)
parameter (XDMF_TOPOLOGY_TYPE_HEXAHEDRON_512 = 524)
parameter (XDMF_TOPOLOGY_TYPE_HEXAHEDRON_729 = 525)
parameter (XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1000 = 526)
parameter (XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1331 = 527)
parameter (XDMF_TOPOLOGY_TYPE_MIXED = 528)
This diff is collapsed.
/*******************************************************************/
/* XDMF */
/* eXtensible Data Model and Format */
/* */
/* Id : Id */
/* Date : $Date$ */
/* Version : $Revision$ */
/* */
/* Author: */
/* John Vines */
/* john.m.vines@us.army.mil */
/* US Army Research Laboratory */
/* Aberdeen Proving Ground, MD */
/* */
/* Copyright @ 2012 US Army Research Laboratory */
/* All Rights Reserved */
/* See Copyright.txt or http://www.arl.hpc.mil/ice for details */
/* */
/* This software is distributed WITHOUT ANY WARRANTY; without */
/* even the implied warranty of MERCHANTABILITY or FITNESS */
/* FOR A PARTICULAR PURPOSE. See the above copyright notice */
/* for more information. */
/* */
/*******************************************************************/
#ifndef XDMFFORTRAN_HPP_
#define XDMFFORTRAN_HPP_
// Forward Declarations
class XdmfAttribute;
class XdmfDomain;
class XdmfGeometry;
class XdmfGridCollection;
class XdmfInformation;
class XdmfTime;
class XdmfTopology;
//Includes
#include <stack>
#include <vector>
#include "XdmfUtils.hpp"
#include "XdmfSharedPtr.hpp"
/**
* Array Type
*/
#define XDMF_ARRAY_TYPE_INT8 0
#define XDMF_ARRAY_TYPE_INT16 1
#define XDMF_ARRAY_TYPE_INT32 2
#define XDMF_ARRAY_TYPE_INT64 3
#define XDMF_ARRAY_TYPE_UINT8 4
#define XDMF_ARRAY_TYPE_UINT16 5
#define XDMF_ARRAY_TYPE_UINT32 6
#define XDMF_ARRAY_TYPE_FLOAT32 7
#define XDMF_ARRAY_TYPE_FLOAT64 8
/**
* Attribute Center
*/
#define XDMF_ATTRIBUTE_CENTER_GRID 100
#define XDMF_ATTRIBUTE_CENTER_CELL 101
#define XDMF_ATTRIBUTE_CENTER_FACE 102
#define XDMF_ATTRIBUTE_CENTER_EDGE 103
#define XDMF_ATTRIBUTE_CENTER_NODE 104
/**
* Attribute Type
*/
#define XDMF_ATTRIBUTE_TYPE_SCALAR 200
#define XDMF_ATTRIBUTE_TYPE_VECTOR 201
#define XDMF_ATTRIBUTE_TYPE_TENSOR 202
#define XDMF_ATTRIBUTE_TYPE_MATRIX 203
#define XDMF_ATTRIBUTE_TYPE_TENSOR6 204
#define XDMF_ATTRIBUTE_TYPE_GLOBALID 205
#define XDMF_ATTRIBUTE_TYPE_NOTYPE 206
/**
* Geometry Type
*/
#define XDMF_GEOMETRY_TYPE_XYZ 301
#define XDMF_GEOMETRY_TYPE_XY 302
/**
* Grid Collection Type
*/
#define XDMF_GRID_COLLECTION_TYPE_SPATIAL 400
#define XDMF_GRID_COLLECTION_TYPE_TEMPORAL 401
/**
* Topology Type
*/
#define XDMF_TOPOLOGY_TYPE_POLYVERTEX 500
#define XDMF_TOPOLOGY_TYPE_POLYLINE 501
#define XDMF_TOPOLOGY_TYPE_POLYGON 502
#define XDMF_TOPOLOGY_TYPE_TRIANGLE 503
#define XDMF_TOPOLOGY_TYPE_QUADRILATERAL 504
#define XDMF_TOPOLOGY_TYPE_TETRAHEDRON 505
#define XDMF_TOPOLOGY_TYPE_PYRAMID 506
#define XDMF_TOPOLOGY_TYPE_WEDGE 507
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON 508
#define XDMF_TOPOLOGY_TYPE_EDGE_3 509
#define XDMF_TOPOLOGY_TYPE_TRIANGLE_6 510
#define XDMF_TOPOLOGY_TYPE_QUADRILATERAL_8 511
#define XDMF_TOPOLOGY_TYPE_QUADRILATERAL_9 512
#define XDMF_TOPOLOGY_TYPE_TETRAHEDRON_10 513
#define XDMF_TOPOLOGY_TYPE_PYRAMID_13 514
#define XDMF_TOPOLOGY_TYPE_WEDGE_15 515
#define XDMF_TOPOLOGY_TYPE_WEDGE_18 516
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_20 517
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_24 518
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_27 519
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_64 520
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_125 521
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_216 522
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_343 523
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_512 524
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_729 525
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1000 526
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1331 527
#define XDMF_TOPOLOGY_TYPE_MIXED 528
// This works with g77. Different compilers require different
// name mangling.
#if !defined(WIN32)
#define XdmfInit xdmfinit_
#define XdmfClose xdmfclose_
#define XdmfAddAttribute xdmfaddattribute_
#define XdmfAddGrid xdmfaddgrid_
#define XdmfAddGridCollection xdmfaddgridcollection_
#define XdmfAddInformation xdmfaddinformation_
#define XdmfCloseGridCollection xdmfclosegridcollection_
#define XdmfSetGeometry xdmfsetgeometry_
#define XdmfSetTime xdmfsettime_
#define XdmfSetTopology xdmfsettopology_
#define XdmfWrite xdmfwrite_
#endif
/**
* @brief XdmfFortran provides an interface to outputting xdmf files
* from Fortran.
*
* Fortran programs will include Xdmf.f and link against libXdmfUtils.
*/
class XDMFUTILS_EXPORT XdmfFortran {
public:
/**
* Create a new xdmf file from fortran.
*
* @return constructed XdmfFortran.
*/
XdmfFortran();
virtual ~XdmfFortran();
/**
* Add an attribute that will be inserted into the next grid or grid
* collection.
*
* @param name of the attribute.
* @param attributeCenter the attribute center.
* @param attributeType the attribute type.
* @param numValues number of attribute values to copy.
* @param arrayType type of attribute values.
* @param values array of attribute values.
*/
void addAttribute(const char * const name,
const int attributeCenter,
const int attributeType,
const unsigned int numValues,
const int arrayType,
const void * const values);
/**
* Add grid to domain or collection. Inserts geometry, topology,
* attributes, and informations into grid. If no geometry or
* topology is set, an error is generated.
*
* @param name of the grid.
*/
void addGrid(const char * const name);
/**
* Add grid collection to domain or collection. Inserts attributes
* and informations into collection.
*
* @param name of the collection.
* @param gridCollectionType the grid collection type.
*/
void addGridCollection(const char * const name,
const int gridCollectionType);
/**
* Add an information that will be inserted into the next added
* grid or grid collection.
*
* @param key string containing the key of the information to
* create.
* @param value string containing the value of the information to
* create.
*/
void addInformation(const char * const key,
const char * const value);
/**
* Closes grid collection. No additional grids or collections can be
* added to the current collection.
*/
void closeGridCollection();
/**
* Set the geometry (point data) that will be added to the next grid.
*
* @param geometryType the geometry type.
* @param numValues number of point values to copy.
* @param arrayType type of point values.
* @param pointValues array of point values.
*/
void setGeometry(const int geometryType,
const unsigned int numValues,
const int arrayType,
const void * const pointValues);
/**
* Set the time that will be added to the next grid or grid
* collection.
*
* @param time time value to insert.
*/
void setTime(const double time);
/**
* Set the topology (connectivity data) that will be added to the
* next grid.
*
* @param topologyType the topology type.
* @param numValues number of connectivity values to copy.
* @param arrayType type of connectivity values.
* @param connectivityValues array of connectivity values.
*/
void setTopology(const int topologyType,
const unsigned int numValues,
const int arrayType,
const void * const connectivityValues);
/**
* Write constructed file to disk.
*
* @param xmlFilePath the path to the xml file to write to.
*/
void write(const char * const xmlFilePath);
private:
shared_ptr<XdmfDomain> mDomain;
shared_ptr<XdmfGeometry> mGeometry;
shared_ptr<XdmfTime> mTime;
shared_ptr<XdmfTopology> mTopology;
std::vector<shared_ptr<XdmfAttribute> > mAttributes;
std::stack<shared_ptr<XdmfGridCollection> > mGridCollections;
std::vector<shared_ptr<XdmfInformation> > mInformations;
};
#endif /* XDMFFORTRAN_HPP_ */
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
!! 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 XdmfUtils library to compile.
!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
PROGRAM XdmfFortranExample
IMPLICIT NONE
INCLUDE 'Xdmf.f'
INTEGER*8 obj
character*256 filename
REAL*4 myPoints(3,3,4)
INTEGER myConnections(8,2)
REAL*8 myCellAttribute(2), myNodeAttribute(3,4), myTime
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
myTime = 1.0
CALL XDMFINIT(obj, filename)
CALL XDMFADDGRIDCOLLECTION(obj, "Temporal"//CHAR(0), &
XDMF_GRID_COLLECTION_TYPE_TEMPORAL)
CALL XDMFSETTIME(obj, myTime)
CALL XDMFSETTOPOLOGY(obj, XDMF_TOPOLOGY_TYPE_HEXAHEDRON, 16, &
XDMF_ARRAY_TYPE_INT32, myConnections)
CALL XDMFSETGEOMETRY(obj, XDMF_GEOMETRY_TYPE_XYZ, 36, &
XDMF_ARRAY_TYPE_FLOAT32, myPoints)
CALL XDMFADDATTRIBUTE(obj, 'NodeValues'//CHAR(0), &
XDMF_ATTRIBUTE_CENTER_NODE, XDMF_ATTRIBUTE_TYPE_SCALAR, 12, &
XDMF_ARRAY_TYPE_FLOAT64, myNodeAttribute)
CALL XDMFADDATTRIBUTE(obj, 'CellValues'//CHAR(0), &
XDMF_ATTRIBUTE_CENTER_CELL, XDMF_ATTRIBUTE_TYPE_SCALAR, 2, &
XDMF_ARRAY_TYPE_FLOAT64, myCellAttribute)
CALL XDMFADDINFORMATION(obj, 'Key'//CHAR(0), 'Value'//CHAR(0))
CALL XDMFADDGRID(obj, 'TestGrid'//CHAR(0))
myTime = 2.0
CALL XDMFSETTIME(obj, myTime)
CALL XDMFADDGRID(obj, 'Identical'//CHAR(0))
CALL XDMFCLOSEGRIDCOLLECTION(obj)
CALL XDMFWRITE(obj, filename)
CALL XDMFCLOSE(obj)
END PROGRAM XdmfFortranExample
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment