コード例 #1
0
		virtual	void	ProcessIsland(btCollisionObject** bodies,int numBodies,btPersistentManifold**	manifolds,int numManifolds, int islandId)
		{
			if (islandId<0)
			{
				if (numManifolds + m_numConstraints)
				{
					///we don't split islands, so all constraints/contact manifolds/bodies are passed into the solver regardless the island id
					m_solver->solveGroup( bodies,numBodies,manifolds, numManifolds,&m_sortedConstraints[0],m_numConstraints,m_solverInfo,m_debugDrawer,m_stackAlloc,m_dispatcher);
				}
			} else
			{
					//also add all non-contact constraints/joints for this island
				btTypedConstraint** startConstraint = 0;
				int numCurConstraints = 0;
				int i;
				
				//find the first constraint for this island
				for (i=0;i<m_numConstraints;i++)
				{
					if (btGetConstraintIslandId(m_sortedConstraints[i]) == islandId)
					{
						startConstraint = &m_sortedConstraints[i];
						break;
					}
				}
				//count the number of constraints in this island
				for (;i<m_numConstraints;i++)
				{
					if (btGetConstraintIslandId(m_sortedConstraints[i]) == islandId)
					{
						numCurConstraints++;
					}
				}

				if (m_solverInfo.m_minimumSolverBatchSize<=1)
				{
					///only call solveGroup if there is some work: avoid virtual function call, its overhead can be excessive
					if (numManifolds + numCurConstraints)
					{
						m_solver->solveGroup( bodies,numBodies,manifolds, numManifolds,startConstraint,numCurConstraints,m_solverInfo,m_debugDrawer,m_stackAlloc,m_dispatcher);
					}
				} else
				{
					
					for (i=0;i<numBodies;i++)
						m_bodies.push_back(bodies[i]);
					for (i=0;i<numManifolds;i++)
						m_manifolds.push_back(manifolds[i]);
					for (i=0;i<numCurConstraints;i++)
						m_constraints.push_back(startConstraint[i]);
					if ((m_constraints.size()+m_manifolds.size())>m_solverInfo.m_minimumSolverBatchSize)
					{
						processConstraints();
					} else
					{
						//printf("deferred\n");
					}
				}
			}
		}
コード例 #2
0
ファイル: sqlimport.cpp プロジェクト: collinsod/meta
void sqlimport::processConstraints(QString tablename,QString sqlStatement,int startPos)
{
    int posStart;
    int posEnd;
    QString constraintStr;

    posStart = sqlStatement.indexOf("CONSTRAINT ",startPos); //
    if (posStart >= 0)
    {
        posEnd = sqlStatement.indexOf("CONSTRAINT ",posStart+1);
        if (posEnd >= 0)
        {
            constraintStr = sqlStatement.mid(posStart,posEnd-posStart-1);
            //Store the constraint
            storeConstraint(tablename,constraintStr.simplified());
            //Maybe there are more constraints so
            processConstraints(tablename,sqlStatement,posEnd);
        }
        else
        {
            posEnd = sqlStatement.lastIndexOf(")",-1);
            constraintStr = sqlStatement.mid(posStart,posEnd-posStart);
            storeConstraint(tablename,constraintStr.simplified());
        }
    }
}
コード例 #3
0
    void processConstraintsAt(KMat::GenMatrix<T,S,1>& x )
    {
      setX(x);
      processConstraints();
	};
コード例 #4
0
 void setX(KMat::GenMatrix<T,S,1> const& ax)
 {
   f.setX(ax);
   IPenaltyFunction<T,S>::setX(ax);
   processConstraints();
 };
コード例 #5
0
	virtual	void	processIsland(btCollisionObject** bodies,int numBodies,btPersistentManifold**	manifolds,int numManifolds, int islandId)
	{
		if (islandId<0)
		{
			///we don't split islands, so all constraints/contact manifolds/bodies are passed into the solver regardless the island id
			m_solver->solveMultiBodyGroup( bodies,numBodies,manifolds, numManifolds,m_sortedConstraints, m_numConstraints, &m_multiBodySortedConstraints[0],m_numConstraints,*m_solverInfo,m_debugDrawer,m_dispatcher);
		} else
		{
				//also add all non-contact constraints/joints for this island
			btTypedConstraint** startConstraint = 0;
			btMultiBodyConstraint** startMultiBodyConstraint = 0;

			int numCurConstraints = 0;
			int numCurMultiBodyConstraints = 0;

			int i;
			
			//find the first constraint for this island

			for (i=0;i<m_numConstraints;i++)
			{
				if (btGetConstraintIslandId2(m_sortedConstraints[i]) == islandId)
				{
					startConstraint = &m_sortedConstraints[i];
					break;
				}
			}
			//count the number of constraints in this island
			for (;i<m_numConstraints;i++)
			{
				if (btGetConstraintIslandId2(m_sortedConstraints[i]) == islandId)
				{
					numCurConstraints++;
				}
			}

			for (i=0;i<m_numMultiBodyConstraints;i++)
			{
				if (btGetMultiBodyConstraintIslandId(m_multiBodySortedConstraints[i]) == islandId)
				{
					
					startMultiBodyConstraint = &m_multiBodySortedConstraints[i];
					break;
				}
			}
			//count the number of multi body constraints in this island
			for (;i<m_numMultiBodyConstraints;i++)
			{
				if (btGetMultiBodyConstraintIslandId(m_multiBodySortedConstraints[i]) == islandId)
				{
					numCurMultiBodyConstraints++;
				}
			}

			//if (m_solverInfo->m_minimumSolverBatchSize<=1)
			//{
			//	m_solver->solveGroup( bodies,numBodies,manifolds, numManifolds,startConstraint,numCurConstraints,*m_solverInfo,m_debugDrawer,m_dispatcher);
			//} else
			{
				
				for (i=0;i<numBodies;i++)
					m_bodies.push_back(bodies[i]);
				for (i=0;i<numManifolds;i++)
					m_manifolds.push_back(manifolds[i]);
				for (i=0;i<numCurConstraints;i++)
					m_constraints.push_back(startConstraint[i]);
				
				for (i=0;i<numCurMultiBodyConstraints;i++)
					m_multiBodyConstraints.push_back(startMultiBodyConstraint[i]);
				
				if ((m_constraints.size()+m_manifolds.size())>m_solverInfo->m_minimumSolverBatchSize)
				{
					processConstraints();
				} else
				{
					//printf("deferred\n");
				}
			}
		}
	}
コード例 #6
0
ファイル: sqlimport.cpp プロジェクト: collinsod/meta
void sqlimport::processSQL(QStringList sqlLines)
{
    QString sqlStatement;
    int nlines;
    QString tablename;
    int temp,temp2;

    for (nlines = 0; nlines <= sqlLines.count()-1;nlines++)
    {
        sqlStatement = sqlStatement + sqlLines[nlines].simplified() + " ";
    }

    //qDebug() << sqlStatement;

    if ((sqlStatement.toUpper().contains("CREATE TABLE ")) ||
            (sqlStatement.toUpper().contains("CREATE  TABLE ")))
    {
        //qDebug() << "CREATE:" << sqlStatement;
        sqlStatement = cleanSQL(sqlStatement);

        temp = sqlStatement.indexOf(" TABLE ");
        temp2 = sqlStatement.indexOf("(");


        tablename = sqlStatement.mid(temp+7,temp2-temp-8);

        processKeyIndexes(tablename,sqlStatement,0);
        processIndexes(tablename,sqlStatement,0);
        if (translateConstraints)
        {
            processConstraints(tablename,sqlStatement,0);
        }

        if (translateConstraints)
        {
            setNULLToForeignKeys(tablename,sqlStatement);
        }


        sqlStatement = sqlStatement.replace(" unsigned "," ",Qt::CaseInsensitive);

        sqlStatement = removeIndexes(sqlStatement);

        if (translateConstraints)
        {
            sqlStatement = removeConstraints(sqlStatement);
        }

        sqlStatement = sqlStatement + "\n";
        //outfile.write(sqlStatement.toAscii());
        writeToFile(sqlStatement.toAscii());
    }
    else
    {
        if (processInserts == true)
        {
            //qDebug() << "INSERT:" << sqlStatement;
            //processInsert(sqlStatement,0,"");
            processInsert(sqlStatement);
        }
    }
}