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
    {
    public:
        A(const &B b) : b_(b)
    private:
        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.