void scene::runNPC(float movSpd, float rotSpd) { mesh *pMesh; mesh *wayPoint; for (mMeshList.moveFirst(); !mMeshList.eof(); mMeshList.moveNext()) { pMesh = mMeshList.getData(); if (pMesh->mName != NULL) if (strcmp(pMesh->mName, "npc") == 0) { if (pMesh->mTarget == NULL) { pMesh->mTarget = new float[3]; setMotion((long) pMesh, 1, false); moveMesh( (long) pMesh, MOV_VEL, 0, 0, randEx(movSpd * 0.5, movSpd) ); moveMesh( (long) pMesh, MOV_ANGVEL, randEx(rotSpd * 0.5, rotSpd), randEx(rotSpd * 0.5, rotSpd), randEx(rotSpd * 0.5, rotSpd) ); wayPoint = (mesh *) findWaypoint((long) pMesh); if (wayPoint != NULL) { vectorCopy(pMesh->mTarget, wayPoint->mOrigin); pMesh->mNext = wayPoint; } } else { wayPoint = pMesh->mNext; if ( vectorDist(pMesh->mOrigin, wayPoint->mOrigin) < pMesh->mRadius + wayPoint->mRadius ) { wayPoint = wayPoint->mNext; if (wayPoint != NULL) { vectorCopy(pMesh->mTarget, wayPoint->mOrigin); pMesh->mNext = wayPoint; } } } } } }
void ISOP2P1::movingMesh() { moveMesh(); syncMesh(); fem_space_p.updateDofInterpPoint(); fem_space_v.updateDofInterpPoint(); };
void reactingOneDimRPvol2::updateMesh(const scalarField& mass0) { if (!moveMesh_) { return; } const scalarField newV(mass0/rho_); Info<< "Initial/final volumes = " << gSum(regionMesh().V()) << ", " << gSum(newV) << " [m3]" << endl; // move the mesh const labelList moveMap = moveMesh(regionMesh().V() - newV, minimumDelta_); // flag any cells that have not moved as non-reacting forAll(moveMap, i) { if (moveMap[i] == 0) { solidChemistry_->setCellReacting(i, false); } } }