void t13(void){ double temp1[LEN], temp2[LEN]; printf("\n*** Split\n"); printMatrix(4,4,4,a); splitColumns(4,4,4,temp1,temp2,a); printf("columns\n"); printMatrix(4,2,4,temp1); printMatrix(4,2,4,temp2); splitRows(4,4,4,temp1,temp2,a); printf("rows\n"); printMatrix(2,4,4,temp1); printMatrix(2,4,4,temp2); splitZLayers(4,4,4,temp1,temp2,a); printf("zLayers\n"); printMatrix(4,4,2,temp1); printMatrix(4,4,2,temp2); }
void PartCorresponder::matchGridChunk(const QVector< QVector<SliceChunk> > & chunk, bool isGrid2D, const QVector<ParticleMesh *> & input, QVector<Particles> & particles) { if( !isGrid2D ) { // Sort chunks along 1D grid QVector< QVector<SliceChunk> > sorted; for(auto gridChunk : chunk) { // Sort based on coordinates of chunk center std::sort(gridChunk.begin(), gridChunk.end(), [&]( const SliceChunk& a, const SliceChunk& b ){ double ma = (a.box.center().x() * 1e6) + a.box.center().y(); double mb = (b.box.center().x() * 1e6) + b.box.center().y(); return ma < mb; }); sorted.push_back( gridChunk ); } // match 1D grid chunks match1DGridChunk( sorted, input, particles ); } else { // Compute slice bounding box QVector< Eigen::AlignedBox3d > sliceChunk(2); for(size_t i = 0; i < input.size(); i++){ auto & inputchunks = chunk[i]; for(auto & chunk : inputchunks) sliceChunk[i].extend(chunk.box); } // Split on 'y' into two rows of 1D grids QVector< QVector< QVector<SliceChunk> > > splitRows(input.size()); for(size_t i = 0; i < input.size(); i++) { splitRows[i].resize(2); auto & inputchunks = chunk[i]; for(size_t ci = 0; ci < inputchunks.size(); ci++) { if( inputchunks[ci].box.center().y() < sliceChunk[i].center().y() ) splitRows[i].front().push_back( inputchunks[ci] ); else splitRows[i].back().push_back( inputchunks[ci] ); } } // For each row for(int r = 0; r < splitRows.front().size(); r++) { QVector< QVector<SliceChunk> > row; for(int i = 0; i < input.size(); i++) row.push_back( splitRows[i][r] ); matchGridChunk(row, false, input, particles); } } }