label MeshChecker::check
(
			const polyMesh & mesh,
			bool noTopology,
			bool allGeometry,
			bool allTopology
) const{

    label nFailedChecks = 0;

     printMeshStats(mesh, allTopology);

     if (!noTopology)
     {
         nFailedChecks += checkTopology(mesh, allTopology, allGeometry);
     }

     nFailedChecks += checkGeometry(mesh, allGeometry);

     if (nFailedChecks)
     {
         Info<< "\nFailed " << nFailedChecks << " mesh checks.\n"
             << endl;
     }
     else
     {
         Info<< "\nMesh OK.\n" << endl;
     }

    return nFailedChecks;
}
示例#2
0
int MoveBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = View::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: positionChanged((*reinterpret_cast< const Quackle::GamePosition(*)>(_a[1]))); break;
        case 1: movesChanged((*reinterpret_cast< const Quackle::MoveList(*)>(_a[1]))); break;
        case 2: moveActivated((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break;
        case 3: selectionChanged(); break;
        case 4: removeMove(); break;
        case 5: checkGeometry(); break;
        }
        _id -= 6;
    }
    return _id;
}
示例#3
0
文件: movebox.cpp 项目: esaye/quackle
// This is complex as it tries to do as little as possible when
// the move list hasn't changed and is sorted the same way,
// so simulations can go as fast as possible.
// Nevertheless, TODO clean this up
void MoveBox::setMoves(const Quackle::MoveList &moves, const Quackle::Move &selectedMove)
{
	bool resorted = false;
	if (m_previousMoves.size() == moves.size())
	{
		Quackle::MoveList::const_iterator prevIt = m_previousMoves.begin();
		const Quackle::MoveList::const_iterator end = moves.end();
		for (Quackle::MoveList::const_iterator it = moves.begin(); it != end; ++it, ++prevIt)
		{
			if (!(*prevIt == *it))
			{
				resorted = true;
				break;
			}
		}
	}
	else
	{
		resorted = true;
	}

	bool hasNewItems = false;

	Quackle::MoveList::const_iterator end(moves.end());
	for (Quackle::MoveList::const_iterator it = moves.begin(); it != end; ++it)
	{
		QMap<Quackle::Move, QTreeWidgetItem *>::const_iterator mapEnd(m_moveMap.end());
		for (QMap<Quackle::Move, QTreeWidgetItem *>::const_iterator mapIt = m_moveMap.begin(); mapIt != mapEnd; ++mapIt)
		{
			if (mapIt.key() == *it)
			{
				mapIt.value()->setText(WinPercentageColumn, formatWinPercentage((*it).win));
				mapIt.value()->setText(EquityColumn, formatValuation((*it).equity));

				if (resorted)
				{
					m_treeWidget->addTopLevelItem(m_treeWidget->takeTopLevelItem(m_treeWidget->indexOfTopLevelItem(mapIt.value())));
				}

				goto foundFirstPass;
			}
		}

		hasNewItems = true;
		m_moveMap.insert(*it, createItem(*it));

		foundFirstPass:
		continue;
	}

	if (resorted)
	{
		for (QMutableMapIterator<Quackle::Move, QTreeWidgetItem *> mapIt(m_moveMap); mapIt.hasNext(); )
		{
			mapIt.next();

			for (Quackle::MoveList::const_iterator it = moves.begin(); it != end; ++it)
				if (mapIt.key() == *it)
					goto found;

			delete mapIt.value();
			mapIt.remove();

			found:
			continue;
		}
	}

	if (moves.contains(selectedMove) && m_moveMap.contains(selectedMove))
	{
		m_treeWidget->setCurrentItem(m_moveMap.value(selectedMove));
	}

	selectionChanged();

	if (hasNewItems)
		QTimer::singleShot(0, this, SLOT(checkGeometry()));

	m_previousMoves = moves;
	m_previousSelection = selectedMove;
}