Ejemplo n.º 1
0
void MapWidget::setMapSize(int rows, int cols)
{
    if (rows == mRows && cols == mCols) return;

    QVector<int> newCells(rows * cols);
    newCells.fill(-1);
    if (!mCells.isEmpty()) {
        int i, j;
        int mrow = qMin<int>(rows, mRows);
        int mcol = qMin<int>(cols, mCols);
        for(i = 0; i < mcol; ++i) {
            for(j = 0; j < mrow; ++j)
                newCells[i + j * cols] = mCells[i + j * mCols];
        }
    }
    mCells = newCells;
    mRows = rows;
    mCols = cols;
    update();
}
Ejemplo n.º 2
0
    forAllConstIter(Map<point>, cellToMidPoint, iter)
    {
        label celli = iter.key();

        const cell& cFaces = mesh_.cells()[celli];

        // Cells created for this cell.
        labelList newCells(cFaces.size());

        // First pyramid is the original cell
        newCells[0] = celli;

        // Add other pyramids
        for (label i = 1; i < cFaces.size(); i++)
        {
            label addedCelli =
                meshMod.setAction
                (
                    polyAddCell
                    (
                        -1,     // master point
                        -1,     // master edge
                        -1,     // master face
                        celli,  // master cell
                        -1      // zone
                    )
                );

            newCells[i] = addedCelli;
        }

        cellToCells.insert(celli, newCells);

        // Pout<< "Split cell " << celli
        //    << " with centre " << mesh_.cellCentres()[celli] << nl
        //    << " faces:" << cFaces << nl
        //    << " into :" << newCells << endl;
    }