I use degenerate cells. Ie collapse edges, two nodes becomes one double
node. It seems to work fine. Below is a piece of code handling this for my
case, I hope it can help you.

/N.

*******************
    int *shapeVector = new int[nCellPts*cells.size()];
    i = 0;
    forAll(cells, celli)
    {
        const labelList& shapeLabels = cells[celli].labels();

        switch(shapeLabels.size())
        {
            case 8:  // hex
                shapeVector[i++] = shapeLabels[0];
                shapeVector[i++] = shapeLabels[1];
                shapeVector[i++] = shapeLabels[3];
                shapeVector[i++] = shapeLabels[2];
                shapeVector[i++] = shapeLabels[4];
                shapeVector[i++] = shapeLabels[5];
                shapeVector[i++] = shapeLabels[7];
                shapeVector[i++] = shapeLabels[6];
            break;

            case 7:  // wedge
                shapeVector[i++] = shapeLabels[0];
                shapeVector[i++] = shapeLabels[1];
                shapeVector[i++] = shapeLabels[0];
                shapeVector[i++] = shapeLabels[2];
                shapeVector[i++] = shapeLabels[3];
                shapeVector[i++] = shapeLabels[4];
                shapeVector[i++] = shapeLabels[6];
                shapeVector[i++] = shapeLabels[5];
            break;

            case 6:  // prism
                shapeVector[i++] = shapeLabels[0];
                shapeVector[i++] = shapeLabels[1];
                shapeVector[i++] = shapeLabels[0];
                shapeVector[i++] = shapeLabels[2];
                shapeVector[i++] = shapeLabels[3];
                shapeVector[i++] = shapeLabels[4];
                shapeVector[i++] = shapeLabels[3];
                shapeVector[i++] = shapeLabels[3];
                shapeVector[i++] = shapeLabels[5];
            break;

            case 5:  // pyramid
                shapeVector[i++] = shapeLabels[0];
                shapeVector[i++] = shapeLabels[1];
                shapeVector[i++] = shapeLabels[3];
                shapeVector[i++] = shapeLabels[2];
                shapeVector[i++] = shapeLabels[4];
                shapeVector[i++] = shapeLabels[4];
                shapeVector[i++] = shapeLabels[4];
                shapeVector[i++] = shapeLabels[4];
            break;

            case 4:  // tet
                shapeVector[i++] = shapeLabels[0];
                shapeVector[i++] = shapeLabels[1];
                shapeVector[i++] = shapeLabels[0];
                shapeVector[i++] = shapeLabels[2];
                shapeVector[i++] = shapeLabels[3];
                shapeVector[i++] = shapeLabels[3];
                shapeVector[i++] = shapeLabels[3];
                shapeVector[i++] = shapeLabels[3];
            break;

            default:
                FatalError
                    << "foamToDX: wrong number of vertices in cell\n"
                    << "    expected 4,5,6,7 or 8; found " 
                    << shapeLabels.size()
                    << abort;
            break;
        } 


Reply via email to