Ejemplo n.º 1
0
/**
  \brief Set chunks for the group

  This will reparent all the chunks to this object
  */
void cwTrip::setChucks(QList<cwSurveyChunk*> chunks) {
    //Remove old chunks
    removeChunks(0, numberOfChunks() - 1);

    Chunks = chunks;

    foreach(cwSurveyChunk* chunk, Chunks) {
        chunk->setParentTrip(this);
    }
void AbstractGeneratorConfig::computeLinearScalePartitioning(const string& key)
{
    I64u cardinality = static_cast<I64u>(scalingFactor() * getInt("partitioning." + key + ".base-cardinality"));
    double chunkSize = cardinality / static_cast<double> (numberOfChunks());

    I64u genIDBegin = static_cast<ID> ((chunkSize * nodeID()) + 0.5);
    I64u genIDEnd = static_cast<ID> ((chunkSize * (nodeID() + 1) + 0.5));

    setString("generator." + key + ".sequence.base_cardinality", getString("partitioning." + key + ".base-cardinality"));
    setString("generator." + key + ".sequence.cardinality", toString(cardinality));
    setString("generator." + key + ".partition.begin", toString(genIDBegin));
    setString("generator." + key + ".partition.end", toString(genIDEnd));
}
Ejemplo n.º 3
0
/**
  \brief Remove the chunks
  */
void cwTrip::removeChunks(int begin, int end) {
    if(end < begin) { return; }

    //Clamp the end and the beginning
    begin = qMax(0, begin);
    end = qMin(end, numberOfChunks());

    for(int i = end; i >= begin; i--) {
        Chunks.at(i)->deleteLater();
        Chunks.removeAt(i);
    }

    emit chunksRemoved(begin, end);
    emit numberOfChunksChanged();
}
Ejemplo n.º 4
0
/**
  \brief Adds the chunk to the trip
  */
 void cwTrip::addChunk(cwSurveyChunk* chunk) {
     insertChunk(numberOfChunks(), chunk);
 }
Ejemplo n.º 5
0
/**
  \brief Set chunks for the group

  This will reparent all the chunks to this object
  */
void cwTrip::setChucks(QList<cwSurveyChunk*> chunks) {
    //Remove old chunks
    removeChunks(0, numberOfChunks() - 1);

    Chunks = chunks;

    foreach(cwSurveyChunk* chunk, Chunks) {
        chunk->setParentTrip(this);
    }

    emit chunksInserted(0, numberOfChunks() - 1);
}

/**
  \brief Get's the chunk at i

  If i is out of bounds, this returns a null chunk
  */
cwSurveyChunk* cwTrip::chunk(int i) const {
    if(i < 0 || i > numberOfChunks()) {
        return NULL;
    }
    return Chunks[i];
}

/**