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.

Tuesday, August 6, 2013

Updates on the PSurface project


Last week I modified the vtu and hdf5 io code according to Markus'  guide to make it  looks better:
1. Changed the method and class names according to Camel-case  to adhere to dune guidelines.
2. Remove all the indent and trailing white space in the code.
3. Put all the functions that deals with io into one class(vtkPWriter). 
4.Extend the template parameters of vtkPWriter. It could only deal with 2 dimensional psurface and float. Not it support 1 dimensional psurface, and the float.
5. Use command line parameters to get the input filename. 
The modified code have been pushed to git://gitorious.org/gcos/psurface-convert.git
6.document the code using doxygen syntax.
Issues that I have not solved includes:
+ Moving headers
"Some your headers seem to be usable by other programs. E.g. one might want to read xmf files in one's own applications. This headers should be under dune and be installed, the cpp file should become part of a library. You can see how this is done in dune-common/dune/common. "
+The include path issue
  What is up with the weired AC_ARG_WITH clauses in configure.ac? I do not
   think that they are needed and doubt that they serve their intended
   purpose.

I will address these issues in the next week  and then move to task #3.1: construct a PSurface object from HDF5 file.

Sunday, July 14, 2013

Update on GSoC DUNE psurface work #2

Last week I am writing the code that take psurface object and writes its domain surface in vtk format. You can find the code  here git://gitorious.org/~xiaoxueiris/psurface/xiaoxueiriss-psurface.git.
It is a C-style code.  I only create some functions to treat the psurface subject.
The input is the psurface with format:
1.Patches
2.BaseGridVertexCoordss
3.BaseGridTriangles
and Plane graphs on each base grid triangles, saved as a list of nodes and a list of edges:
5. nodes
6.ParameterEdges
7.EdgePoint.
The out put is  the legency unstructured grid vtk file. The corner nodes of the triangles and the other nodes(intersection node, touching nodes, and interior nodes) are represented by d-dimensional float. The vtk file contain two kinds of cells: the triangle cell represent the BaseGridTriangle and the edge cell represent the list of edges on the triangle.  The information of the patches number and image position is not stored into vtk.

I have not test this code yet. I will use the 3 .am file to test if it works. 
There is two place that the code can be improved: 1)write it in a more object-oriented way, like dune-grid/dune/grid/io/file/vtk/vtkwriter.hh 2)write the output as XML File Formats instead of a legency one.



Tuesday, July 9, 2013

Update on GSoC DUNE psurface work

Last week my mentor Oliver Sander gives me a very detailed working plan on my project. Current I am working on the first point of the detailed plan.

"1. Write a command-line tool that can take a psurface object and write its domain surface in vtk format (which can be read by paraview). 
- Please call the program 'psurface-convert' - VTK seems to be pretty big, and I don't think I want a vtk dependence for psurface. In dune-grid/dune/grid/io/file/vtk/vtkwriter.hh there is code that writes grids in vtk format withoutexternal dependencies. That should get you started. 
 - You'll need a psurface object to tesTriangleTypet with. The easiest way toe sh=path, and use the code in AmiraMeshIO.cpp"

The file dune-grid/dune/grid/io/file/vtk/vtkwriter.hh have the class VTKWritter which takes data from class template GridView and write it into vtu format with 4 output choice( ascii, base64,appended raw, appended base 64). It fills the cell data, vertex data, position of the vertices and connectivity arrays into vtu files. 

We can read psurface subject from the Amiramesh file. Psurface project have the members triangular array, vertex array and edge array which store, the information needed to create vtk files. I created the class VTUp. In VTUp class, functions are defined to read psurface elements by elements. 

we have two vtk output file choice, the unstructured grid vtk file or the polygonal data vtk file.The polygonal dataset consists of arbitrary combinations 
of vertices, points, lines and triangular strips. The unstructured grid dataset consists of arbitrary combinations of any possible cell type. So this two is chosen to be the output format of vtk file.

I have not finished the code for #1 yet.  I hope I can make it work by Thursday. 

I have some trouble in clone the git code from
/gitorious.org/psurface/psurface.git. makedist.sh is missing in the code downloaded. The version I am using the psurface code from the DUNE website.


Thursday, June 27, 2013

[GSoc] project time lines

This summer I am going to work with DUNE -- a modular toolbox for solving partial differential equations (PDEs) with grid-based methods. My work focus on visualizing psurface objects used in DUNE in Paraview.

Previously Amira is used to displaying psurface object and to manipulate the surfaces and mappings before it is distributed commercially. This is realized by plug-in infrastructure of Amira and the Tcl scripting language integrated into Amira.

Now the idea is to use paraview to realize the same work of Amira.

The time line of my work should be like this:
1.Write the command-line tool that can take psurface object and writes its domain surface in vtk format(which can be read by paraview). Then write the tool that takes the vtk format surface into psuface object. (2 weeks).
2.Wrap the PSurface surface simplification algorithm and other relevent code
in PSurface and hxpsurface in python to create a new filter for paraview.
With this filter we can interactively modify the domain surface using paraview GUI.(5 weeks)
3. Adding the new filter into paraview using server manager configuration XML.
write a CMakeLists.txt file to package the new filter into a plugin.(1 week).

Now I am working on #1. I hope I can finish it by next Wednesday.