Monday, September 23, 2013

DUNE Final Review

This summer I was writting the input/ouput code for psurface object in DUNE.  I have added several classes into psurface folder(Hdf5IO.h, GmshIO.h and VtkIO.h) . To compile psurface with hdf5 file, I have also changed the configure.ac.

To get the files, you can down load it from gitorious:
git clone git://gitorious.org/psurface/psurface_convert.git

To install the package on you computer, you have to first install amiramesh and hdf5 on your computer.

You can download hdf5 software from this page:
http://www.hdfgroup.org/HDF5/release/obtain5.html. Then follow the guide in /release_docs/INSTALL. Please do not parallel build hdf5 on your computer because the compiler psurface uses is not parallel compiler.

Then compile the psurface with the commend:
1. autoreconf -isf
2. ./configure --prefix=/psurface/install/folder  --with-amiramesh=/amiramesh/install/folder  --with-hdf5=/hdf5/install/folder --disable-shared
3. make
4. make install

After compilation, you can have a executable file psurface_convert.( You can type ./psurface_convert to see a description of how to use that file).

Using commend:
./psurface_convert -i inputfile -o outputfile (-t type)
you can read psurface parametrization  from inputfile and then store the psurface into output type.
Available input file type are gmsh , hdf5 and amiramesh type files and available output file type are vtu, hdf5 and amiramsh type.

If the output file type is vtu, you can choose to add "-t b" to display only basegrid triangles in vtu. If you do not add anything, the default vtu output would contain both base grid triangles and the planar graphs on each triangle.

If the output file type is hdf5, you can choose to add "-t r" so you can display hdf5 file in paraviw. If you do not add anything, the default hdf5 output would contain some information with amiramesh file. It does not include node coordinates in global coordinate so you could not display it in paraview. 

For example, if you have a psurface stored in femur_distal_15mm.am. You can use
./psurface_convert -i femur_distal_15mm.am -o femur_distal_15mm.h5 -t r
to store the psurface into hdf5 file femur_distal_15mm.h5 

To display psurface in paraview, open the femur_distal_15mm.xdmf in the same folder  in paraview and choose "Xdmf Reader". 


You can choose only to display base grid triangles by only checking "basegrid" in Blocks on the left.  


We can also create psurface from gmsh file. The gmshreader in GmshIO class can select triangles from a gmsh file and create psurface parametrization from these base grid triangles.
For example we choose curved2d.msh and sphere2.msh from dune-grid-master/doc/grids/gmsh, create psurface parametrization from them and store it in hdf5 file by using commend
./psurface_convert -i sphere2.msh -o sphere2.h5 -t r
./psurface_convert -i curved2d.msh -o curved2d.h5 -t r


The psurface convert code is also included into the libpsuface.la. You can call functions in psurface convert when needed.