本文整理汇总了C++中Corner::isType1方法的典型用法代码示例。如果您正苦于以下问题:C++ Corner::isType1方法的具体用法?C++ Corner::isType1怎么用?C++ Corner::isType1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Corner
的用法示例。
在下文中一共展示了Corner::isType1方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CornerHorizontalTilePlane
CornerSequence::CornerSequence(int xStart, int yStart, int xEnd, int yEnd, int numMacros,
//std::set<Macro *, CompareMacroWidth> *initialWidthSortedMacros,
//std::set<Macro *, CompareMacroHeight> *initialHeightSortedMacros) {
SortedMacros *initialWidthSortedMacros, SortedMacros *initialHeightSortedMacros) {
fixedMacros = new std::vector<Macro *>();
macros = new std::vector<Macro *>();
corners = new std::vector<Corner *>();
orientations = new std::vector<int>(numMacros, 0);
macros->reserve(numMacros);
corners->reserve(numMacros);
cornerHorizontalTilePlane = new CornerHorizontalTilePlane(xStart, yStart, xEnd, yEnd);
cornerVerticalTilePlane = new CornerVerticalTilePlane(xStart, yStart, xEnd, yEnd);
cornerHorizontalTilePlane->coupleWithCornerVerticalTilePlane(cornerVerticalTilePlane);
cornerHorizontalTilePlane->calculateCurrentCornersWidthAndHeight();
cornerVerticalTilePlane->calculateCurrentCornersWidthAndHeight();
sizeQuadtree = new Quadtree(0, 0, xEnd - xStart + 1, yEnd - yStart + 1, new CornerSize()); // +1 for containing Corners with the size of floorplan.
positionQuadtree = new Quadtree(xStart, yStart, xEnd + 1, yEnd + 1, new CornerPosition());
// Insert Corners to quadtrees.
std::vector<Corner *> *createdCorners = cornerHorizontalTilePlane->getCurrentlyCreatedCorners();
for (int i = 0; i < createdCorners->size(); ++i) {
Corner *corner = createdCorners->at(i);
corner->updateWidthAndHeightForSorting();
sizeQuadtree->insert(corner);
positionQuadtree->insert(corner);
}
createdCorners = cornerVerticalTilePlane->getCurrentlyCreatedCorners();
for (int i = 0; i < createdCorners->size(); ++i) {
Corner *corner = createdCorners->at(i);
corner->updateWidthAndHeightForSorting();
if (corner->isType1()) {
sizeQuadtree->insert(corner);
positionQuadtree->insert(corner);
}
}
this->initialWidthSortedMacros = initialWidthSortedMacros;
this->initialHeightSortedMacros = initialHeightSortedMacros;
//widthSortedMacros = new std::set<Macro *, CompareMacroWidth>(*initialWidthSortedMacros);
//heightSortedMacros = new std::set<Macro *, CompareMacroHeight>(*initialHeightSortedMacros);
//widthSortedMacros = new SortedMacros(initialWidthSortedMacros);
//heightSortedMacros = new SortedMacros(initialHeightSortedMacros);
widthSortedMacros = new SortedMacros(true);
heightSortedMacros = new SortedMacros(true);
indexPlacedUnsuccessfully = numMacros;
}
示例2: updateQuadtrees
void CornerSequence::updateQuadtrees() {
std::vector<Corner *> *currentlyCreatedCorners = cornerHorizontalTilePlane->getCurrentlyCreatedCorners();
std::vector<Corner *> *currentlyModifiedHorizontalCorners = cornerHorizontalTilePlane->getCurrentlyModifiedHorizontalCorners();
std::vector<Corner *> *currentlyModifiedVerticalCorners = cornerHorizontalTilePlane->getCurrentlyModifiedVerticalCorners();
std::vector<Corner *> *currentlyRemovedCorners = cornerHorizontalTilePlane->getCurrentlyRemovedCorners();
for (int j = 0; j < currentlyCreatedCorners->size(); ++j) {
Corner *createdCorner = currentlyCreatedCorners->at(j);
createdCorner->updateWidthAndHeightForSorting();
sizeQuadtree->insert(createdCorner);
positionQuadtree->insert(createdCorner);
}
for (int j = 0; j < currentlyModifiedHorizontalCorners->size(); ++j) {
Corner *modifiedCorner = currentlyModifiedHorizontalCorners->at(j);
sizeQuadtree->remove(modifiedCorner);
modifiedCorner->updateWidthAndHeightForSorting();
sizeQuadtree->insert(modifiedCorner);
}
for (int j = 0; j < currentlyModifiedVerticalCorners->size(); ++j) {
Corner *modifiedCorner = currentlyModifiedVerticalCorners->at(j);
if (modifiedCorner->isType1()) {
sizeQuadtree->remove(modifiedCorner);
modifiedCorner->updateWidthAndHeightForSorting();
sizeQuadtree->insert(modifiedCorner);
}
}
for (int j = 0; j < currentlyRemovedCorners->size(); ++j) {
Corner *removedCorner = currentlyRemovedCorners->at(j);
sizeQuadtree->remove(removedCorner);
positionQuadtree->remove(removedCorner);
delete removedCorner;
}
currentlyCreatedCorners = cornerVerticalTilePlane->getCurrentlyCreatedCorners();
currentlyModifiedVerticalCorners = cornerVerticalTilePlane->getCurrentlyModifiedVerticalCorners();
currentlyModifiedHorizontalCorners = cornerVerticalTilePlane->getCurrentlyModifiedHorizontalCorners();
std::vector<Corner *> *currentlyChangedToType0Corners = cornerVerticalTilePlane->getCurrentlyChangedToType0Corners();
currentlyRemovedCorners = cornerVerticalTilePlane->getCurrentlyRemovedCorners();
for (int j = 0; j < currentlyCreatedCorners->size(); ++j) {
Corner *createdCorner = currentlyCreatedCorners->at(j);
if (createdCorner->isType1()) {
createdCorner->updateWidthAndHeightForSorting();
sizeQuadtree->insert(createdCorner);
positionQuadtree->insert(createdCorner);
}
}
for (int j = 0; j < currentlyModifiedVerticalCorners->size(); ++j) {
Corner *modifiedCorner = currentlyModifiedVerticalCorners->at(j);
if (modifiedCorner->isType1()) {
sizeQuadtree->remove(modifiedCorner);
modifiedCorner->updateWidthAndHeightForSorting();
sizeQuadtree->insert(modifiedCorner);
}
}
for (int j = 0; j < currentlyModifiedHorizontalCorners->size(); ++j) {
Corner *modifiedCorner = currentlyModifiedHorizontalCorners->at(j);
sizeQuadtree->remove(modifiedCorner);
modifiedCorner->updateWidthAndHeightForSorting();
sizeQuadtree->insert(modifiedCorner);
}
for (int j = 0; j < currentlyChangedToType0Corners->size(); ++j) {
Corner *changedToType0Corner = currentlyChangedToType0Corners->at(j);
sizeQuadtree->remove(changedToType0Corner);
positionQuadtree->remove(changedToType0Corner);
}
for (int j = 0; j < currentlyRemovedCorners->size(); ++j) {
Corner *removedCorner = currentlyRemovedCorners->at(j);
if (removedCorner->isType1()) {
sizeQuadtree->remove(removedCorner);
positionQuadtree->remove(removedCorner);
}
delete removedCorner;
}
}
示例3: placeMacrosWithIncrementalUpdate
bool CornerSequence::placeMacrosWithIncrementalUpdate(int startPosition, int backupPosition) {
bool placedUnsuccessfully = false;
// Store Corners removed from sizeQuadtree during finding valid Corners.
std::vector<Corner *> *temporarilyRemovedCorners = new std::vector<Corner *>();
for (int i = startPosition; i < macros->size(); ++i) {
//std::cout << i << "\n";
Macro *macro = macros->at(i);
macro->setOrientation(orientations->at(i));
int macroWidth = macro->getWidth();
int macroHeight = macro->getHeight();
Corner *corner = corners->at(i);
//std::cout << "begin Macro " << i << "\n";
//std::cout << "smallest width emtpy Tile: ";
//cornerHorizontalTilePlane->getEmptyTileWithSmallestWidth()->print();
//std::cout << "smallest height empty Tile: ";
//cornerVerticalTilePlane->getEmptyTileWithSmallestHeight()->print();
//std::cout << "smallest width Macro: ";
//////(*widthSortedMacros->begin())->print();
//widthSortedMacros->getSmallest()->print();
//std::cout << "smallest height Macro: ";
////(*heightSortedMacros->begin())->print();
//heightSortedMacros->getSmallest()->print();
//fillInWastedRegion();
// Check whether to select another Corner.
bool toSelectAnotherCorner = false;
if (corner == 0) {
toSelectAnotherCorner = true;
} else if (corner->isNotFromTilePlane()) {
Corner *inputCorner = corner;
std::vector<Point *> *foundCorners = positionQuadtree->getPointsAtXY(inputCorner->getX(), inputCorner->getY());
if (foundCorners == 0) {
// No matched Corner is found.
toSelectAnotherCorner = true;
} else {
for (int j = 0; j < foundCorners->size(); ++j) {
Corner *foundCorner = static_cast<Corner *>(foundCorners->at(j));
if (foundCorner->getDirection() == inputCorner->getDirection()) {
// The matched Corner is found.
corner = foundCorner;
break;
}
// No matched Corner is found.
toSelectAnotherCorner = true;
}
delete foundCorners;
}
delete inputCorner;
corners->at(i) = 0;
// If macro ends up being unsuccessfully placed,
// notFromTilePlane Corners after corner will be deleted in ~CornerSeqence().
}
if (toSelectAnotherCorner) {
corner = static_cast<Corner *>(sizeQuadtree->getPointRandomlyByXY(macroWidth, macroHeight, true, true));
if (corner == 0) {
// No Corner is available.
placedUnsuccessfully = true;
indexPlacedUnsuccessfully = i;
break;
}
}
// Check overlap.
int cornerDirection;
int macroXStart;
int macroYStart;
int macroXEnd;
int macroYEnd;
int cornerX;
int cornerY;
while (true) {
// Check corner gap size.
bool cornerGapSizeIsValid = true;
if (corner->isType1()) {
if (corner->isGapOnHorizontalSide()) {
if (corner->getGapSize() >= macroWidth) {
cornerGapSizeIsValid = false;
}
} else {
if (corner->getGapSize() >= macroHeight) {
cornerGapSizeIsValid = false;
}
}
}
if (cornerGapSizeIsValid) {
// Calculate macro position.
cornerX = corner->getX();
cornerY = corner->getY();
cornerDirection = corner->getDirection();
switch (cornerDirection) {
case 0:
// Bl
macroXStart = cornerX;
macroYStart = cornerY;
//.........这里部分代码省略.........