CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Post-Processing (
-   -   Problems with cellSets and their contents (

bfa July 6, 2009 05:49

Problems with cellSets and their contents
Hi All,

I have a mesh generated with polyDualMesh and checkMesh identifies lots of wrongOrientedFaces. I got the impression that it has to do with the geometry of my domain. To prove this, I want to write all the owner cells of the wrongOrientedFaces into a cellSet and transform this to VTK.
So far, so easy. I wrote the following code:


faceSet woFaces(mesh, "wrongOrientedFaces", mesh.nFaces()/100 + 1);
cellSet concaveCells(mesh, "concaveCells", mesh.nCells()/100 + 1); // more than enough
    if (mesh.checkFacePyramids(false, -SMALL, &woFaces))
      forAll(woFaces, faceI) {

That looks quite right to me, but unfortunately the results in the concaveCell-file are just numbers from 0 to woFaces.size(). The entries have nothing to do with the actual owner-labels i thought i was putting into the set.

I tried and added mesh.faceOwner[faceI] to a labelList instead of a cellSet and *magic* it worked there.
So how do i insert values into a cellSet (or a labelHashSet to be specific)??

Help would be appreciated. Maybe you could try out the code snippet.

bfa July 6, 2009 10:55

after browsing FOAM source code for some time I discovered the true functionality of a labelHashList. The correct version of above code uses no forAll loop, but a constant list iterator:


for(faceSet::const_iterator faceI = woFaces.begin(); faceI != woFaces.end(); faceI++) {

I noticed, that polyDualMesh does not yield very good results (i.e. "pac-man"-shaped polyhedra) if you have acute angles in the geometry, but I'm trying to find a solution for that.


All times are GMT -4. The time now is 20:50.