コード例 #1
0
ファイル: readCells.C プロジェクト: AmaneShino/OpenFOAM-2.0.x
void sammMesh::addSAMMcell
(
    const label typeFlag,
    const labelList& globalLabels,
    const label nCreatedCells
)
{

    // grab the shape from the table
    if (!sammShapeLookup[typeFlag] || !sammAddressingTable[typeFlag])
    {
        FatalErrorIn
        (
            "sammMesh::addRegularCell(const labelList& labels, "
            "const label nCreatedCells)"
        )   << "SAMM type " << typeFlag << " has no registered label. BUG!"
            << abort(FatalError);
    }

     const cellModel& curModel = *(sammShapeLookup[typeFlag]);

    // get reference to the addressing list
    const label* addressing = sammAddressingTable[typeFlag];

    // make a list of labels
    labelList sammCellLabels(curModel.nPoints(), -1);

    forAll(sammCellLabels, labelI)
    {
        sammCellLabels[labelI] = globalLabels[addressing[labelI]];
    }

    cellShapes_[nCreatedCells] = cellShape(curModel, sammCellLabels);
}
void starMesh::addSAMMcell
(
    const labelList& labels,
    const label nCreatedCells
)
{
    // get type, reg and permutation flag
    label typeFlag = labels[21];
//     label regularityFlag = labels[22];  // Not used. 
    label permutationFlag = labels[23];

    // grab the shape from the table
    label sammTypeFlag = -1;
    const cellModel* curModelPtr = reinterpret_cast<cellModel*>(NULL);

    switch (typeFlag)
    {
        case 1:
        {
            sammTypeFlag = 1;
            curModelPtr = sammTrim1Ptr_;
            break;
        }

        case 2:
        {
            sammTypeFlag = 2;
            curModelPtr = sammTrim2Ptr_;
            break;
        }

        case 7:
        {
            if (labels[0] != -1)
            {
                sammTypeFlag = 3;
                curModelPtr = sammTrim3Ptr_;
            }
            else
            {
                sammTypeFlag = 5;
                curModelPtr = sammTrim5Ptr_;
            }

            break;
        }

        case 8:
        {
            sammTypeFlag = 4;
            curModelPtr = sammTrim4Ptr_;
            break;
        }

        case 85:
        {
            sammTypeFlag = 8;
            curModelPtr = sammTrim8Ptr_;
            break;
        }

        default:
        {
            FatalErrorIn
            (
                "starMesh::addSAMMcell"
                "(const labelList& labels, const label nCreatedCells)"
            )   << "SAMM type " << sammTypeFlag << " is invalid"
                << abort(FatalError);
        }
    }

    // make a list of labels
    labelList sammCellLabels(curModelPtr->nPoints(), -1);
    // get reference to the addressing list
    const label* addressing = sammAddressingTable[sammTypeFlag];

    forAll (sammCellLabels, labelI)
    {
        sammCellLabels[labelI] = labels[addressing[labelI]];
    }

    cellShapes_[nCreatedCells] = cellShape(*curModelPtr, sammCellLabels);

    // set permutation flag for cell
    starCellPermutation_[nCreatedCells] = permutationFlag;
}