void GRID::setRminRmaxStretched() { GRID::setCsiminCsimax(); for (int c = 0; c < 3; c++) { // =========== definition of local minima maxima for integer indexes and real extrems for (int pp = 0; pp < rnproc[c]; pp++) { rproc_rmin[c][pp] = stretchGrid(rproc_csimin[c][pp], c); rproc_rmax[c][pp] = stretchGrid(rproc_csimax[c][pp], c); } } }
void GRID::computeExtremsStretchedGrid(int c) { if (!flagStretchedAlong[c]) return; //csimin[c] = unStretchGrid(rmin[c], c); csimin[c] = rminUniformGrid[c] - dr[c] * NLeftStretcheGrid[c]; csimax[c] = csimin[c] + dr[c] * (NGridNodes[c] - 1); rmax[c] = stretchGrid(csimax[c], c); rmin[c] = stretchGrid(csimin[c], c); }
void GRID::computeExtremsStretchedGrid(int c) { if (!flagStretchedAlong[c]) return; //csimin[c] = unStretchGrid(rmin[c], c); csimin[c] = rminUniformGrid[c] - dr[c] * NLeftStretcheGrid[c]; csimax[c] = csimin[c] + dr[c] * (NGridNodes[c] - 1); rmax[c] = stretchGrid(csimax[c], c); rmin[c] = stretchGrid(csimin[c], c); // printf("\tdr= %g NGridNodes=%i \n",dr[c],NGridNodes[c]); // printf("\tcsi=[ %g:%g] \n",csimin[c],csimax[c]); // printf("\tr=[ %g:%g] \n",rmin[c],rmax[c]); }
QList<QRect> QwtDynGridLayout::layoutItems( const QRect &rect, uint numCols ) const { QList<QRect> itemGeometries; if ( numCols == 0 || isEmpty() ) return itemGeometries; uint numRows = itemCount() / numCols; if ( numRows % itemCount() ) numRows++; QVector<int> rowHeight( numRows ); QVector<int> colWidth( numCols ); layoutGrid( numCols, rowHeight, colWidth ); bool expandH, expandV; expandH = expandingDirections() & Qt::Horizontal; expandV = expandingDirections() & Qt::Vertical; if ( expandH || expandV ) stretchGrid( rect, numCols, rowHeight, colWidth ); const int maxCols = d_data->maxCols; d_data->maxCols = numCols; const QRect alignedRect = alignmentRect( rect ); d_data->maxCols = maxCols; const int xOffset = expandH ? 0 : alignedRect.x(); const int yOffset = expandV ? 0 : alignedRect.y(); QVector<int> colX( numCols ); QVector<int> rowY( numRows ); const int xySpace = spacing(); rowY[0] = yOffset + margin(); for ( int r = 1; r < ( int )numRows; r++ ) rowY[r] = rowY[r-1] + rowHeight[r-1] + xySpace; colX[0] = xOffset + margin(); for ( int c = 1; c < ( int )numCols; c++ ) colX[c] = colX[c-1] + colWidth[c-1] + xySpace; const int itemCount = d_data->itemList.size(); for ( int i = 0; i < itemCount; i++ ) { const int row = i / numCols; const int col = i % numCols; QRect itemGeometry( colX[col], rowY[row], colWidth[col], rowHeight[row] ); itemGeometries.append( itemGeometry ); } return itemGeometries; }
void GRID::finalize() { int c; for (c = 0; c < dimensions; c++) { cir[c] = (double*)malloc(NGridNodes[c] * sizeof(double)); chr[c] = (double*)malloc(NGridNodes[c] * sizeof(double)); cirloc[c] = (double*)malloc(Nloc[c] * sizeof(double)); chrloc[c] = (double*)malloc(Nloc[c] * sizeof(double)); if (flagStretchedAlong[c]) { for (int i = 0; i < NGridNodes[c]; i++) { cir[c][i] = stretchGrid((csimin[c] + dr[c] * i), c); chr[c][i] = stretchGrid((csimin[c] + dr[c] * (i + 0.5)), c); } for (int i = 0; i < Nloc[c]; i++) { cirloc[c][i] = stretchGrid((csiminloc[c] + dr[c] * i), c); chrloc[c][i] = stretchGrid((csiminloc[c] + dr[c] * (i + 0.5)), c); } } else { for (int i = 0; i < NGridNodes[c]; i++) { cir[c][i] = rmin[c] + dr[c] * i; chr[c][i] = cir[c][i] + 0.5*dr[c]; } for (int i = 0; i < Nloc[c]; i++) { cirloc[c][i] = rminloc[c] + dr[c] * i; chrloc[c][i] = cirloc[c][i] + 0.5*dr[c]; } } } for (; c < 3; c++) { cir[c] = (double*)malloc(1 * sizeof(double)); chr[c] = (double*)malloc(1 * sizeof(double)); cirloc[c] = (double*)malloc(1 * sizeof(double)); chrloc[c] = (double*)malloc(1 * sizeof(double)); cir[c][0] = 0.5*(rmin[c] + rmax[c]); chr[c][0] = 0.5*(rmin[c] + rmax[c]); cirloc[c][0] = 0.5*(rmin[c] + rmax[c]); chrloc[c][0] = 0.5*(rmin[c] + rmax[c]); } }