This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

After upgrading Fenics from 1.3 to 1.6, FacetIterator can not find connected Facets, Please kindly help!

0 votes

I have following c++ codes:

//get exterior facets connected with a facet.
bool get_exterior( Mesh & mesh, FacetIterator & fi, std::vector & ex)
{
for( FacetIterator a = FacetIterator(fi);!a.end();++a)
{
if(!a->exterior())
continue;
Facet f=Facet(mesh,a->index());
ex.push_back(f);
}
}

It works perfectly on Fenics 1.3. After upgrading to 1.6, The FacetIteractor can only found 1 connected facet which is the facet itself. Can not find other connected facets. Can any one help?

P.S. mesh.init(2,2) was called to make sure face to face connectivity was established.

Thanks!

asked Sep 16, 2015 by alagerald FEniCS Novice (120 points)

1 Answer

0 votes

Connectivity between MeshEntities of the same dimension has been redefined to mean the MeshEntity itself. This is a logical conclusion - the meaning of facet-facet connectivity is ambiguous.

In order to find connections between facets, you can iterate over the vertices (or edges) of the facet, and then over the facets of each vertex (or edge). Probably you will want to use a std::set to collect the indices, as there will be some repetition, and you may wish to delete the original facet itself from the set.

answered Sep 23, 2015 by chris_richardson FEniCS Expert (31,740 points)

Got it.

Thank you!

...