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.


No comments:

Post a Comment