Tuesday, August 16, 2016


It's exciting that the GSoC project is going to the end. 
My code is available via this link.

During the whole periods, the following milestones are achieved:

  • A DUNE-style B-Spline geometry interface including
    GlobalCoordinate center () const
    int corners () const
    GlobalCoordinate corner (int i) constDune::GeometryType type () const
    bool  affine () const
    GlobalCoordinate  global (const LocalCoordinate &local) const
    const JacobianTransposed & jacobianTransposed (const LocalCoordinate &local) const
    const JacobianInverseTransposed &  jacobianInverseTransposed (const LocalCoordinate &local) const
    ctype  integrationElement (const LocalCoordinate &local) const
    Among these functions, the 
    global and jacobianTransposed are the two key functions.

  • A DUNE-style NURBS geometry interface(same as the previous one)
  • A basic DUNE grid manager for B-Spline patch including the follwoing components(classes):
  • A basic DUNE grid manager for NURBS patch(same as the previous one)

The following task is not completed yet,
  • Make the VTKwriter applicable for the B-Spline and NURBS grid view
    This task involves creating a vertex entity and iterator. I'm still debugging on it.
During the three months, my mentors and the whole community as well were very helpful. They answered my basic question with great patience and always tried to help me with all their effort. I would like to thank for their patience and help first.

Previously I was mainly dealing with algorithms implementation with the help of existing libraries. This is the first time to think from the developer perspective, which requires much more programming skills. It's a good opportunity for me to practice my hands-on skills(meta-programming, interfaces), foster good programming habits(programming style, comments, consistency). As a result, for the first two milestone regarding spline algorithms, although more codes were involves, I faces less challenges. But I encountered much more difficulty for the gird structure construction. On the one hand, this is due to my skill inefficiency; on the other hand, I feel it's the requirement are not quite clear. So in the future, it would be more beneficial for new developer to have a tutorial on how to make a basic DUNE gird. This is my suggestion.

In the end, thanks for google for organizing this awesome event!

Thursday, August 4, 2016

Continue NURBS gird manager with entity and iterator class

This week I continue my work with NURBS gird manager. The following work have been done
  • Created the NURBSGridLeafIterator class
     template<int codim, typename NURBSGridView, typename NURBSEntity>
    class NURBSGridLeafIterato
    which allows iteration over all entities of a NURBSGridView
  • Modified the NURBSPatch class and NURBSGrid
    to fit the newly-add features
  • Created a NURBSGridLeafIndexSet
    template<class GridImp>
    class NURBSGridLeafIndexSet
    to return the index of a given entity
  • Added test case for NURBS grid
The implementation details are hidden as it is analogous to what I did for BSpline grid.

The next step is to test whether what we had is enough for a VTKwriter. Now in our test code, we iterate over all elements of a BSpline/NURBS grid we created, and writes the resulting geometry manually to a VTK file. DUNE provides a VTKwriter which is able to write the elements of a gridView automatically to a VTK file. But we don't know yet what interfaces are required to make the VTKwriter work expected. So we will try to debug into and see what new classes and functions are needed.

Friday, July 29, 2016

Start making a grid manger for NURBS

This week, I started make the grid manager for the NURBS patch. The idea is the same as the BSpline grid manager, so I am not elaborating the details again.

The following classes were implemented and available in my remote respiratory now:

  • NURBSGrid
  • NURBSLeafGridView
  • NURBSGridEntity

Wednesday, July 20, 2016

Add IndexSet class for BSpline Grid

Last week was mainly spent on debugging. It would be boring to note all my mistakes down. But some of them are worth mentioning and may be useful for others.

  • For the deference function in an iterator class which requires return by reference, the best solution is to have a container of the entities the iterator points to. Creating an entity object in the function which is a temporal object cannot be returned by reference and thus should be avoided. Also, make the iterator class to hold a entity pointer is also problematic as the point can be altered by some iterator functionalities, e.g. "++" operator.
  • If a class takes an object of other class as member, it's better to make it a reference.
    For example,
    Class A
        A(const &B b) : b_(b)
        const &B b;
In addition, a IndexSet class was made to get the index of a given entity.
template<class GridImp>
class BSplineGridLeafIndexSet
with constructor and index function.

Wednesday, July 13, 2016

Make B-Spline Grid iterators work

Form last week I continued with the other important features of a DUNE like gird for B-Spline.
  • A BSplineGridEntity class
    template<int codim, class GridViewImp> class BSplineGridEntity
  • represents each valid knot hypercube of a BSpline patch. It wraps a BSplineLeafGridView pointer and a direct index of the knot hypercube.  The  index i indicated the ith valid knot span of all valid knot spans. A geometry function is provides to access the B-Spline geometry operated on this entity(knot span). 
  • Completed the BSplineGridLeafIterator class
    Made it a subclass of the ForwardIteratorFacade class using the Barton-Nackman trick. Implemented the deference, equals and increment function which corresponds to the operand overloading of *, == and ++ separately.
  • Completed the BSplineLeafGridView class
    with a begin and end function which returns the corresponding BSplineGridLeafIterator object to support range-based for loop.
  • Added some new members in the BSplinePatch class
    Namely, a MultiDimensionNet of all valid knots. Pay attention here, each valid knot hypercube is a point of the MultiDimensionNet. The purpose of making such a net is to easily transfer a global knot index into a multidimensional index which is required by the geometry function of BSplinePatch.
Currently, I still have problem with compling the code of above changes. To be specific, the ForwardIteratorFacade class overloads the increment function in a way where a reference of the entity should be returned. But I created an entity locally, which is not possible to return by reference. I will talk to mentor and try to solve this problem.

  • Wednesday, July 6, 2016

    Preparation for a B-Spline grid manager

    As I said in the previous post, we decided to skip the inverse mapping temporarily and move towards to the construction of a B-Spline DUNE grid. The final goal is to have all necessary grid components and interfaces to make the VTKwriter work.

    For the past two weeks, I spent quite some time to understand the dune gird interface. My original plan was to imitate the OneDGrid. So I read almost all the source code of  the OneDGrid and the common grid interface. Then I found it was a too ambitious plan. DefaultGridView requires a rather complete gird traits which is not easy for me to achieve in a short time. After a late discussion with my mentor, I realized I took a lot of detours and it's important to report my problems and doubts directly when I had them.

    Then we tried to build a rather basic B-Spline gird manager. Here I list what I achieved last week:

    • A BSplineGrid class
      which wraps the BSplineLeafGridView
    • A BSplineLeafGridView class
      which wraps the BSplinePatch and offers access to BSplineGirdLeafIterator
    • A BSplineGirdLeafIterator class
      which is a iterator to visit all leaf element(knot spans)
    For this week, I'm going to continue with BSplineGridEntity class and more contents of BSplineGirdLeafIterator class.