[Dune-devel] [GSoC]VTKWriter debugging
Oliver Sander
Oliver.Sander at tu-dresden.de
Wed Sep 7 14:26:05 CEST 2016
Hi Xinyun,
> I fixed some errors and pushed the latest version to my remote
> repository. It's still not working but the number of errors were
> reduced.
great!
> I have some doubts with the remaining errors so I would like to
> discuss with you.
>
> The remaining errors can be classified into three groups:
>
> 1.GridTraits
> A trait class is needed in the gridView class. The error message
> indicated that at least a /Codim/ struct should be provided. I found
> most existing gird managers used template struct /GridTraits
> /implemented//in /dune/common/grid.hh. /But as I don't have the
> complete grid traits, I think it's not possible to use it directly;
> I plan to make my own trait class with all necessary traits.
Have a look at how it is dune in OneDGrid. At the top of onedgrid.hh,
there is a
class OneDGridFamily:
struct OneDGridFamily
{
typedef GridTraits<1, // Grid dimension
1, // Dimension of the physical space
Dune::OneDGrid,
OneDGridGeometry,
OneDGridEntity,
OneDGridLevelIterator,
OneDGridLeafIntersection,
OneDGridLevelIntersection,
OneDGridLeafIntersectionIterator,
OneDGridLevelIntersectionIterator,
OneDGridHierarchicIterator,
OneDGridLeafIterator,
OneDGridLevelIndexSet<const OneDGrid>,
OneDGridLeafIndexSet<const OneDGrid>,
OneDGridIdSet<const OneDGrid>,
unsigned int,
OneDGridIdSet<const OneDGrid>,
unsigned int,
CollectiveCommunication<Dune::OneDGrid>,
DefaultLevelGridViewTraits,
DefaultLeafGridViewTraits,
OneDGridEntitySeed>
Traits;
};
All it does is to export a 'Traits' type, which is an alias for
GridTraits. The GridTraits
type has a long list of template parameters, and these are the ones
that make up your
implementation. There have to at least be stubs for all of them.
Then, let your grid class inherit from GridDefaultImplementation
[this may actually be unnecessary]
class OneDGrid : public GridDefaultImplementation <1, 1,double,
OneDGridFamily>
Finally, export the Traits class in your grid class:
typedef OneDGridFamily::Traits Traits; // line 139 in onedgrid.hh
This should provide the Codim struct automatically.
>
> 2.Subentities
> Currently I only have independent element entity which is of codim
> 0. But from the errors, it seems that subentities are required. Does
> it mean that for each element, *four* vertex entity of codim 1
> should be bound.
Yes, but beware of the details. In a two-dimensional grid, vertices
have codim _2_.
In a three-dimensional grid, the vertex codimension is 3, and so on.
> So at first, I need to implement a vertex entity.
Yes. You need elements, vertices, and nothing else.
> I assume only the vertex position is essential for this entity.
Vertices have a Geometry object just like elements have. But, yes,
they really only
have a point position, and therefore all Geometry methods are pretty easy.
> And the position should be the knot position after B-Spline mapping.
yes
> In other words, the four subentities are actually the four corners
> of the element geometry.
yes
>
> 3.Iterators
> This is the most error-prone part. My /begin/ and /end /function in
> gridView could not be matched, I guess it was because they were not
> template functions. Currently I didn't dive too deep into this part,
> but any information is welcome. I plan to examine the iterator
> problem after solving the former two.
Okay. I'll have a look at that part of your code the next time you ask.
>
> Additionally, I made some changes that I would like to confirm with
> you. Is is fine to set the /PartitionType/ as /InteriorEntity/ and
> the /GeometryType/ as /cube?/
Yes, that is both correct.
Enjoy,
Oliver
>
> Best regards,
> Xinyun Li
More information about the Dune-devel
mailing list