[Paraview] Fortran wrapper of HDF5

I'm forwarding this to the hdf mailing list just in case someone can explain it better, or correct me

You write a Fortran array with dimensions say arr[10,20,30] {x=10,y=20,z=30}, and this goes onto disk as an array with dimension sizes
0 = 10
1 = 20
2 = 30

The convention is simply that the dimensions are listed in row major order, so if you read the data in c into an array
arr[z][y][x]

then everything will look fine. nine times out of ten, I've found that fortran arrays are declared as arr[x,y,z] and c arrays as arr[z][y][x] so the programmer has already flipped the orders of the dimensions and everything works out. All hdf does is say that the dimensions are listed in row major order, you can interpret the data how you like. Hdf doesn't say 'this is X, this is Y, this is Z' - it only says, dim 0 is size 10, dim 1 size 20, dim 2 size 30 - you may add metadata yourself to tell the user which 'should' be X/Y/Z if you wish.

If the OP has data physically stored as fortran array[z,y,x] then the data will be written out transposed relative to what we expect when reading into paraview, then transposing will be necessary (we won't go into coordinate transforms to achieve the same flipping at the graphics end).

Did I get that right?

JB

···

-----Original Message-----
From: paraview-bounces@paraview.org [mailto:paraview-bounces@paraview.org] On Behalf Of Jason Fleming
Sent: 13 March 2013 19:51
To: paraview@paraview.org
Subject: Re: [Paraview] Fortran wrapper of HDF5

I've read the section of the hdf5 page that Pradeep linked to (C vs Fortran ordering) several times, and for the life of me, I can't figure out whether the hdf5 format ordering is transparent to the application or not.

It seems really silly that hdf5 can take care of endianness so that app developers don't have to worry about it, but on the other hand, app developers now have to know whether a particular hdf5 file was written by a C or Fortran app in order to be able to read it properly. And yet
hdf5 seems to work that way. Is that right?

Cheers
Jason

On Thu, 2013-03-14 at 00:08 +0900, Pradeep Jha wrote:

Are you implying that if I use the HDF5 fortran wrapper to convert the
fortran binary data in h5 format and then visualize this h5 file using
Paraview, I am looking at the the actual data with correct dimensions?
Or I have to make some modifications so that I see the data correctly
in Paraview?

I dont want to transpose the data. I just want to visualize what I
wrote using Fortran without any alterations.

Pradeep

2013/3/13 Biddiscombe, John A. <biddisco@cscs.ch>
        “How do I write the h5 file data in exactly the same way as it
        was written in original binary file written by Fortran?”
        
        It is writing the file the same, the problem is that fortran
        stores arrays in column major, and C in row major order. You
        state “it automatically transposes the matrix” – not true – it
        transposes the dimensions so that the data is still stored the
        same, but when you write array[z,y,x] from fortran, you want
        to read it as array[x,y,z] from C. The actual data on disk is
        the same as your binary fortran data, but the dimensions are
        reversed compared to the same data from C.
        
        Does that help? – the short answer is just swap the order of
        the dimensions in your read function in the C version and then
        things should appear the same. (but you must declare your
        arrays with the dimensions flipped).
        
        If you want to actually transpose the data, then I’m sure
        google will provide a code snippet
        
        I hope I’m not remembering this wrong.
        
        JB
        
        From: paraview-bounces@paraview.org
        [mailto:paraview-bounces@paraview.org] On Behalf Of Pradeep
        Jha
        Sent: 13 March 2013 10:58
        To: paraview@paraview.org
        Subject: [Paraview] Fortran wrapper of HDF5
        
        I recently noticed that when I am using the fortran wrapper of
        HDF5 to convert a binary file written by fortran into the "h5"
        format, it automatically transposes the matrix. Apparently,
        this is because HDF5 uses the C convention for writing binary
        files, as explained in section: 7.3.2.5. of this page.
        
        Is anyone aware of this situation? And any solutions for this
        problem? How do I write the h5 file data in exactly the same
        way as it was written in original binary file written by
        Fortran?
        
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

--
Dr. Jason G. Fleming
Chief Engineer, Seahorse Coastal Consulting
3103 Mandy Ln
Morehead City, NC 28557
Tel: (252) 726-6323
Mobile: (252) 269-0962
Web: http://www.seahorsecoastal.com

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

John,

I think you explained it well.

Looks like Jason is not along. Let me try to explain one more time....

To address Jason's
"I've read the section of the hdf5 page that Pradeep linked to (C vs Fortran ordering) several times, and for the life of me, I can't figure out whether the hdf5 format ordering is transparent to the application or not"

Yes, it is transparent.

Think about N-dim array in any language as 1-dim flatten array. Transparency means that one always gets the same 1-dim flatten array of data in any programming language used.

Dimensions of the user's array (dataset dimensions) are stored in HDF5 file as 1-dim array following a convention that the last element of that array has the size of the fastest changing dimension of the user's array. File format is INDEPENDENT from which language an array is written (and yes, it is turned to be a C convention :slight_smile:

When an array is written from Fortran, the value of its first dimension is stored in the last element of the 1-dim array in the HDF5 file.

When Fortran library queries dimensions for an array (dataset dimensions), it knows as does the C library, that the last element of the 1-dim array in the file is the size of the fastest changing dimension of the user's array. It will be the first dimension for the Fortran array and the last dimension for the C array. I.e., Fortran wrappers flip dimensions, but NEVER touch user's data.

If one reads data written by a Fortran application using a C application (and vice versa), data will appear to be transposed, but it will be same data if you think about it as 1-dim flatten array!

Is it even more confusing now? :slight_smile:

Elena

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Mar 13, 2013, at 2:28 PM, Biddiscombe, John A. wrote:

I'm forwarding this to the hdf mailing list just in case someone can explain it better, or correct me

You write a Fortran array with dimensions say arr[10,20,30] {x=10,y=20,z=30}, and this goes onto disk as an array with dimension sizes
0 = 10
1 = 20
2 = 30

The convention is simply that the dimensions are listed in row major order, so if you read the data in c into an array
arr[z][y][x]

then everything will look fine. nine times out of ten, I've found that fortran arrays are declared as arr[x,y,z] and c arrays as arr[z][y][x] so the programmer has already flipped the orders of the dimensions and everything works out. All hdf does is say that the dimensions are listed in row major order, you can interpret the data how you like. Hdf doesn't say 'this is X, this is Y, this is Z' - it only says, dim 0 is size 10, dim 1 size 20, dim 2 size 30 - you may add metadata yourself to tell the user which 'should' be X/Y/Z if you wish.

If the OP has data physically stored as fortran array[z,y,x] then the data will be written out transposed relative to what we expect when reading into paraview, then transposing will be necessary (we won't go into coordinate transforms to achieve the same flipping at the graphics end).

Did I get that right?

JB

-----Original Message-----
From: paraview-bounces@paraview.org [mailto:paraview-bounces@paraview.org] On Behalf Of Jason Fleming
Sent: 13 March 2013 19:51
To: paraview@paraview.org
Subject: Re: [Paraview] Fortran wrapper of HDF5

I've read the section of the hdf5 page that Pradeep linked to (C vs Fortran ordering) several times, and for the life of me, I can't figure out whether the hdf5 format ordering is transparent to the application or not.

It seems really silly that hdf5 can take care of endianness so that app developers don't have to worry about it, but on the other hand, app developers now have to know whether a particular hdf5 file was written by a C or Fortran app in order to be able to read it properly. And yet
hdf5 seems to work that way. Is that right?

Cheers
Jason

On Thu, 2013-03-14 at 00:08 +0900, Pradeep Jha wrote:

Are you implying that if I use the HDF5 fortran wrapper to convert the
fortran binary data in h5 format and then visualize this h5 file using
Paraview, I am looking at the the actual data with correct dimensions?
Or I have to make some modifications so that I see the data correctly
in Paraview?

I dont want to transpose the data. I just want to visualize what I
wrote using Fortran without any alterations.

Pradeep

2013/3/13 Biddiscombe, John A. <biddisco@cscs.ch>
       “How do I write the h5 file data in exactly the same way as it
       was written in original binary file written by Fortran?”

       It is writing the file the same, the problem is that fortran
       stores arrays in column major, and C in row major order. You
       state “it automatically transposes the matrix” – not true – it
       transposes the dimensions so that the data is still stored the
       same, but when you write array[z,y,x] from fortran, you want
       to read it as array[x,y,z] from C. The actual data on disk is
       the same as your binary fortran data, but the dimensions are
       reversed compared to the same data from C.

       Does that help? – the short answer is just swap the order of
       the dimensions in your read function in the C version and then
       things should appear the same. (but you must declare your
       arrays with the dimensions flipped).

       If you want to actually transpose the data, then I’m sure
       google will provide a code snippet

       I hope I’m not remembering this wrong.

       JB

       From: paraview-bounces@paraview.org
       [mailto:paraview-bounces@paraview.org] On Behalf Of Pradeep
       Jha
       Sent: 13 March 2013 10:58
       To: paraview@paraview.org
       Subject: [Paraview] Fortran wrapper of HDF5

       I recently noticed that when I am using the fortran wrapper of
       HDF5 to convert a binary file written by fortran into the "h5"
       format, it automatically transposes the matrix. Apparently,
       this is because HDF5 uses the C convention for writing binary
       files, as explained in section: 7.3.2.5. of this page.

       Is anyone aware of this situation? And any solutions for this
       problem? How do I write the h5 file data in exactly the same
       way as it was written in original binary file written by
       Fortran?

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

--
Dr. Jason G. Fleming
Chief Engineer, Seahorse Coastal Consulting
3103 Mandy Ln
Morehead City, NC 28557
Tel: (252) 726-6323
Mobile: (252) 269-0962
Web: http://www.seahorsecoastal.com

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Years ago, I heard one explanation for the seeming contradiction between the C order and
the Fortran order that the C order is computer science based while the Fortran order is
mathematics based. Here is what it means.

The C order, aka row major order, is "last index changes first". So, a 10 by 10 two dimensional
array is stored in memory like this:
(0,0), (0,1), ..., (0,9), (1,0), (1,1),..., (9,9)
which is as "natural" as "00, 01, ..., 09, 10, 11, ..., 99".

The Fortran order, aka column major order, is "first index changes first". So, a 10 by 10 two dimensional
array is stored in memory like this:
(1,1), (2,1), ..., (10,1), (1, 2), (2,2), ..., (10, 10)
which seems unnatural. But if you recall when you learned
the Cartesian coordination in high school mathematics.
The x-axis is horizontal and y-axis is vertical. Points on the
Cartesian plain are (x, y):
(1,1), (2,1), ..., (10, 1), ...
Since Fortran, was first known as FORTRAN, was derived from
"The IBM Mathematical Formula Translating System", the Fortran
order is "natural" too.

One more comment, the two ordering, though seem like a simple
rotation at two dimensions, are not really the same in physics for higher
dimensions. The C order is in left-hand rule, while the Fortran order is in
right-hand rule. If mixed up, you may attempt to operate the human
heart in the wrong side. :slight_smile:

-Albert

···

On 3/14/13 11:57 PM, Elena Pourmal wrote:

John,

I think you explained it well.

Looks like Jason is not along. Let me try to explain one more time....

To address Jason's
"I've read the section of the hdf5 page that Pradeep linked to (C vs Fortran ordering) several times, and for the life of me, I can't figure out whether the hdf5 format ordering is transparent to the application or not"

Yes, it is transparent.

Think about N-dim array in any language as 1-dim flatten array. Transparency means that one always gets the same 1-dim flatten array of data in any programming language used.

Dimensions of the user's array (dataset dimensions) are stored in HDF5 file as 1-dim array following a convention that the last element of that array has the size of the fastest changing dimension of the user's array. File format is INDEPENDENT from which language an array is written (and yes, it is turned to be a C convention :slight_smile:

When an array is written from Fortran, the value of its first dimension is stored in the last element of the 1-dim array in the HDF5 file.

When Fortran library queries dimensions for an array (dataset dimensions), it knows as does the C library, that the last element of the 1-dim array in the file is the size of the fastest changing dimension of the user's array. It will be the first dimension for the Fortran array and the last dimension for the C array. I.e., Fortran wrappers flip dimensions, but NEVER touch user's data.

If one reads data written by a Fortran application using a C application (and vice versa), data will appear to be transposed, but it will be same data if you think about it as 1-dim flatten array!

Is it even more confusing now? :slight_smile:

Elena

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Mar 13, 2013, at 2:28 PM, Biddiscombe, John A. wrote:

I'm forwarding this to the hdf mailing list just in case someone can explain it better, or correct me

You write a Fortran array with dimensions say arr[10,20,30] {x=10,y=20,z=30}, and this goes onto disk as an array with dimension sizes
0 = 10
1 = 20
2 = 30

The convention is simply that the dimensions are listed in row major order, so if you read the data in c into an array
arr[z][y][x]

then everything will look fine. nine times out of ten, I've found that fortran arrays are declared as arr[x,y,z] and c arrays as arr[z][y][x] so the programmer has already flipped the orders of the dimensions and everything works out. All hdf does is say that the dimensions are listed in row major order, you can interpret the data how you like. Hdf doesn't say 'this is X, this is Y, this is Z' - it only says, dim 0 is size 10, dim 1 size 20, dim 2 size 30 - you may add metadata yourself to tell the user which 'should' be X/Y/Z if you wish.

If the OP has data physically stored as fortran array[z,y,x] then the data will be written out transposed relative to what we expect when reading into paraview, then transposing will be necessary (we won't go into coordinate transforms to achieve the same flipping at the graphics end).

Did I get that right?

JB

-----Original Message-----
From: paraview-bounces@paraview.org <mailto:paraview-bounces@paraview.org> [mailto:paraview-bounces@paraview.org] On Behalf Of Jason Fleming
Sent: 13 March 2013 19:51
To: paraview@paraview.org <mailto:paraview@paraview.org>
Subject: Re: [Paraview] Fortran wrapper of HDF5

I've read the section of the hdf5 page that Pradeep linked to (C vs Fortran ordering) several times, and for the life of me, I can't figure out whether the hdf5 format ordering is transparent to the application or not.

It seems really silly that hdf5 can take care of endianness so that app developers don't have to worry about it, but on the other hand, app developers now have to know whether a particular hdf5 file was written by a C or Fortran app in order to be able to read it properly. And yet
hdf5 seems to work that way. Is that right?

Cheers
Jason

On Thu, 2013-03-14 at 00:08 +0900, Pradeep Jha wrote:

Are you implying that if I use the HDF5 fortran wrapper to convert the
fortran binary data in h5 format and then visualize this h5 file using
Paraview, I am looking at the the actual data with correct dimensions?
Or I have to make some modifications so that I see the data correctly
in Paraview?

I dont want to transpose the data. I just want to visualize what I
wrote using Fortran without any alterations.

Pradeep

2013/3/13 Biddiscombe, John A. <biddisco@cscs.ch <mailto:biddisco@cscs.ch>>
       "How do I write the h5 file data in exactly the same way as it
       was written in original binary file written by Fortran?"

       It is writing the file the same, the problem is that fortran
       stores arrays in column major, and C in row major order. You
       state "it automatically transposes the matrix" -- not true -- it
       transposes the dimensions so that the data is still stored the
       same, but when you write array[z,y,x] from fortran, you want
       to read it as array[x,y,z] from C. The actual data on disk is
       the same as your binary fortran data, but the dimensions are
       reversed compared to the same data from C.

       Does that help? -- the short answer is just swap the order of
       the dimensions in your read function in the C version and then
       things should appear the same. (but you must declare your
       arrays with the dimensions flipped).

       If you want to actually transpose the data, then I'm sure
       google will provide a code snippet

       I hope I'm not remembering this wrong.

       JB

       From: paraview-bounces@paraview.org <mailto:paraview-bounces@paraview.org>
       [mailto:paraview-bounces@paraview.org] On Behalf Of Pradeep
       Jha
       Sent: 13 March 2013 10:58
       To: paraview@paraview.org <mailto:paraview@paraview.org>
       Subject: [Paraview] Fortran wrapper of HDF5

       I recently noticed that when I am using the fortran wrapper of
       HDF5 to convert a binary file written by fortran into the "h5"
       format, it automatically transposes the matrix. Apparently,
       this is because HDF5 uses the C convention for writing binary
       files, as explained in section: 7.3.2.5. of this page.

       Is anyone aware of this situation? And any solutions for this
       problem? How do I write the h5 file data in exactly the same
       way as it was written in original binary file written by
       Fortran?

_______________________________________________
Powered by www.kitware.com <http://www.kitware.com>

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

--
Dr. Jason G. Fleming
Chief Engineer, Seahorse Coastal Consulting
3103 Mandy Ln
Morehead City, NC 28557
Tel: (252) 726-6323
Mobile: (252) 269-0962
Web: http://www.seahorsecoastal.com

_______________________________________________
Powered by www.kitware.com <http://www.kitware.com>

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Hello everyone,

thanks for the responses. I want to confirm the following once with
ParaView users:
1) I write a 3D data in the file "data.dat" using Fortran.
2) I use HDF fortran wrapper to read and convert the file format to
"data.h5"
3) I use and XDMF file to visualize "data.h5" using ParaView
By doing this, will I be visualizing the original data written by Fortran?
Or some transposed form of it?

Regards,
Pradeep

···

2013/3/15 Elena Pourmal <epourmal@hdfgroup.org>

John,

I think you explained it well.

Looks like Jason is not along. Let me try to explain one more time....

To address Jason's
"I've read the section of the hdf5 page that Pradeep linked to (C vs
Fortran ordering) several times, and for the life of me, I can't figure out
whether the hdf5 format ordering is transparent to the application or not"

Yes, it is transparent.

Think about N-dim array in any language as 1-dim flatten array.
Transparency means that one always gets the same 1-dim flatten array of
data in any programming language used.

Dimensions of the user's array (dataset dimensions) are stored in HDF5
file as 1-dim array following a convention that the last element of that
array has the size of the fastest changing dimension of the user's array.
File format is INDEPENDENT from which language an array is written (and
yes, it is turned to be a C convention :slight_smile:

When an array is written from Fortran, the value of its first dimension is
stored in the last element of the 1-dim array in the HDF5 file.

When Fortran library queries dimensions for an array (dataset dimensions),
it knows as does the C library, that the last element of the 1-dim array in
the file is the size of the fastest changing dimension of the user's array.
It will be the first dimension for the Fortran array and the last dimension
for the C array. I.e., Fortran wrappers flip dimensions, but NEVER touch
user's data.

If one reads data written by a Fortran application using a C application
(and vice versa), data will appear to be transposed, but it will be same
data if you think about it as 1-dim flatten array!

Is it even more confusing now? :slight_smile:

Elena

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Mar 13, 2013, at 2:28 PM, Biddiscombe, John A. wrote:

I'm forwarding this to the hdf mailing list just in case someone can
explain it better, or correct me

You write a Fortran array with dimensions say arr[10,20,30]
{x=10,y=20,z=30}, and this goes onto disk as an array with dimension sizes
0 = 10
1 = 20
2 = 30

The convention is simply that the dimensions are listed in row major
order, so if you read the data in c into an array
arr[z][y][x]

then everything will look fine. nine times out of ten, I've found that
fortran arrays are declared as arr[x,y,z] and c arrays as arr[z][y][x] so
the programmer has already flipped the orders of the dimensions and
everything works out. All hdf does is say that the dimensions are listed in
row major order, you can interpret the data how you like. Hdf doesn't say
'this is X, this is Y, this is Z' - it only says, dim 0 is size 10, dim 1
size 20, dim 2 size 30 - you may add metadata yourself to tell the user
which 'should' be X/Y/Z if you wish.

If the OP has data physically stored as fortran array[z,y,x] then the data
will be written out transposed relative to what we expect when reading into
paraview, then transposing will be necessary (we won't go into coordinate
transforms to achieve the same flipping at the graphics end).

Did I get that right?

JB

-----Original Message-----
From: paraview-bounces@paraview.org [mailto:paraview-bounces@paraview.org]
On Behalf Of Jason Fleming
Sent: 13 March 2013 19:51
To: paraview@paraview.org
Subject: Re: [Paraview] Fortran wrapper of HDF5

I've read the section of the hdf5 page that Pradeep linked to (C vs
Fortran ordering) several times, and for the life of me, I can't figure out
whether the hdf5 format ordering is transparent to the application or not.

It seems really silly that hdf5 can take care of endianness so that app
developers don't have to worry about it, but on the other hand, app
developers now have to know whether a particular hdf5 file was written by a
C or Fortran app in order to be able to read it properly. And yet
hdf5 seems to work that way. Is that right?

Cheers
Jason

On Thu, 2013-03-14 at 00:08 +0900, Pradeep Jha wrote:

Are you implying that if I use the HDF5 fortran wrapper to convert the

fortran binary data in h5 format and then visualize this h5 file using

Paraview, I am looking at the the actual data with correct dimensions?

Or I have to make some modifications so that I see the data correctly

in Paraview?

I dont want to transpose the data. I just want to visualize what I

wrote using Fortran without any alterations.

Pradeep

2013/3/13 Biddiscombe, John A. <biddisco@cscs.ch>

       “How do I write the h5 file data in exactly the same way as it

       was written in original binary file written by Fortran?”

       It is writing the file the same, the problem is that fortran

       stores arrays in column major, and C in row major order. You

       state “it automatically transposes the matrix” – not true – it

       transposes the dimensions so that the data is still stored the

       same, but when you write array[z,y,x] from fortran, you want

       to read it as array[x,y,z] from C. The actual data on disk is

        the same as your binary fortran data, but the dimensions are

       reversed compared to the same data from C.

       Does that help? – the short answer is just swap the order of

       the dimensions in your read function in the C version and then

       things should appear the same. (but you must declare your

       arrays with the dimensions flipped).

       If you want to actually transpose the data, then I’m sure

       google will provide a code snippet

       I hope I’m not remembering this wrong.

       JB

       From: paraview-bounces@paraview.org

       [mailto:paraview-bounces@paraview.org] On Behalf Of Pradeep

       Jha

       Sent: 13 March 2013 10:58

       To: paraview@paraview.org

       Subject: [Paraview] Fortran wrapper of HDF5

       I recently noticed that when I am using the fortran wrapper of

       HDF5 to convert a binary file written by fortran into the "h5"

       format, it automatically transposes the matrix. Apparently,

       this is because HDF5 uses the C convention for writing binary

       files, as explained in section: 7.3.2.5. of this page.

       Is anyone aware of this situation? And any solutions for this

       problem? How do I write the h5 file data in exactly the same

       way as it was written in original binary file written by

        Fortran?

_______________________________________________

Powered by www.kitware.com

Visit other Kitware open-source projects at

http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at:

http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:

http://www.paraview.org/mailman/listinfo/paraview

--
Dr. Jason G. Fleming
Chief Engineer, Seahorse Coastal Consulting
3103 Mandy Ln
Morehead City, NC 28557
Tel: (252) 726-6323
Mobile: (252) 269-0962
Web: http://www.seahorsecoastal.com

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org