← Back to team overview

dolfin team mailing list archive

Re: Mesh topology question

 

On Sun, Oct 7, 2012 at 4:16 PM, Garth N. Wells <gnw20@xxxxxxxxx> wrote:
> On Sun, Oct 7, 2012 at 3:52 PM, Anders Logg <logg@xxxxxxxxx> wrote:
>> On Sat, Oct 06, 2012 at 09:51:24PM +0100, Garth N. Wells wrote:
>>> What does the mesh connectivity (d, d) really mean? This is related
>>> to the bug
>>>
>>>     https://bugs.launchpad.net/dolfin/+bug/1063013
>>>
>>> The code
>>>
>>>     #include <dolfin.h>
>>>     int main()
>>>     {
>>>       // Create mesh
>>>       UnitSquare mesh(1, 1);
>>>       mesh.init(2, 2);
>>>       Cell cell(mesh2, 0);
>>>       for (CellIterator c(cell); !c.end(); ++c)
>>>         cout << "In cell loop" << endl;
>>>     }
>>>
>>> prints
>>>
>>>     In cell loop
>>>     In cell loop
>>>     In cell loop
>>>     In cell loop
>>>     In cell loop
>>>     In cell loop
>>
>> Connectivity d --> d means sharing a vertex for d > 0 and sharing a
>> cell for d = 0.
>>

Is this consistent? I have a feeling that it's not because I'm having
to write a bunch of special cases to make BoundaryMesh and the mesh
partitioning work in 1D because facets and vertices are of the same
topological dimension.

Would it work if

   CellIterator c(cell)

yielded *c == cell? (and likewise for other topological dimensions)

Garth

>> In the above case, each cell will be connected to itself and the other
>> cell, so the loop should print only this:
>>
>>   In cell loop
>>   In cell loop
>>
>> Why do you get 6? I tried this (in Python) and get only 2.
>>
>
> Sorry, try
>
>      UnitSquare mesh(2, 2);
>
> I used mesh(1, 1) in testing, and indeed in only prints twice.
>
>>> In what sense are entities of the same dimension 'connected'? The
>>> present behaviour is causing a problem when computing a BoundaryMesh
>>> in 1D because it picks up the end vertices, but then iterates along
>>> the lines of
>>>
>>>         for (VertexIterator v(vertex); !v.end(); ++v)
>>>         {
>>>
>>>         }
>>>
>>> which then yields the vertex that is one place in from the boundary.
>>
>> The algorithm for BoundaryMesh is to iterate over all facets of the
>> mesh, in this case all vertices, and then check for each one if it is
>> connected to exactly one entity of dimension D (cells) which in this
>> case is edges (intervals). So something clearly goes wrong in
>> TopologyComputation in 1D.
>>
>> I'll look at it later.
>>
>
> The problem is what I describe above with the iterators over the (d,
> d) connectivity with d=0. The BoundaryMesh code finds a facet on the
> boiundary (vertex in the case of 1D), and then iterates over the
> vertices of the facet:
>
>      for (VertexIterator v(facet); !v.end(); ++v)
>      {
>
>      }
>
> When facet is not a vertex, this computes all the vertices that lie on
> the boundary. When facet is a vertex, the above returns vertices that
> share the cell with facet, but which do not lie on the boundary.
>
>
> Garth
>
>> --
>> Anders


Follow ups

References