void QVX_TensileTest::BeginTensileTest(QVX_Environment* pEnvIn, int NumStepIn, double ConvThreshIn, double MixRadiusIn, MatBlendModel ModelIn, double PolyExpIn) { //set up local copy of the environment and object... // if (MixRadius != 0) RenderMixedObject(pEnvIn->pObj, &LocObj, MixRadius); //if there's any mixing, we need to make it... //else LocObj = *(pEnvIn->pObj); //otherwise just simulate the original object. LocEnv = *pEnvIn; //set local environment params to those of the input LocEnv.pObj = &LocObj; //make sure local environment points to local object //set up blending if desired BlendingEnabled = false; if (MixRadiusIn != 0){ //if some blending... //check for 2 or fewer materials! if (LocObj.GetNumLeafMatInUse() > 2){ QMessageBox::warning(NULL, "Warning", "Currently blending only supported with 2 or fewer materials. Aborting."); return; } BlendingEnabled = true; MixRadius = MixRadiusIn; BlendModel = ModelIn; PolyExp = PolyExpIn; } NumStep = NumStepIn; ConvThresh = ConvThreshIn; CurTick = 0; TotalTick = NumStep; CancelFlag = false; std::string Message = ""; pEnvIn->EnableFloor(false); pEnvIn->EnableGravity(false); pEnvIn->EnableTemp(false); Import(&LocEnv, NULL, &Message); EnableSelfCollision(false); EnableEquilibriumMode(true); SetStopConditionType(SC_MIN_MAXMOVE); SetStopConditionValue(ConvThreshIn); // SetBondDampZ(1.0); // SetSlowDampZ(0.03); EnablePlasticity(false); EnableFailure(false); if (!DoBCChecks()) return; CurViewMode = RVM_VOXELS; CurViewCol = RVC_STRAIN_EN; CurViewVox = RVV_DEFORMED; //QString DispMesg; OutFilePath = QFileDialog::getSaveFileName(NULL, "Save Tensile Test Results", "", "TXT Files (*.txt)"); emit StartExternalGLUpdate(33); TestRunning = true; if (OutFilePath != "") TensileThread.Execute(false); // RunTensileTest(&DispMesg); if (ProgressMessage != "") QMessageBox::warning(NULL, "warning", QString::fromStdString(ProgressMessage)); }
void QVX_TensileTest::BeginTensileTest(QVX_Sim* pSim, int NumStepIn, double ConvThreshIn, Vec3D<double> MixRadIn, MatBlendModel ModelIn, double PolyExpIn) //void QVX_TensileTest::BeginTensileTest(QVX_Environment* pEnvIn, int NumStepIn, double ConvThreshIn, double MixRadiusIn, MatBlendModel ModelIn, double PolyExpIn) { //set up local copy of the environment and object... //QVX_Environment* pEnvIn = (QVX_Environment*) pSim->pEnv; LocObj = *(pSim->pEnv->pObj); //otherwise just simulate the original object. LocEnv = *pSim->pEnv; //set local environment params to those of the input LocEnv.pObj = &LocObj; //make sure local environment points to local object //set up blending if desired bool EnableBlending = false; if (MixRadIn.x != 0 || MixRadIn.y != 0 || MixRadIn.z != 0){ //if some blending... //check for 2 or fewer materials! if (LocObj.GetNumLeafMatInUse() > 2){ QMessageBox::warning(NULL, "Warning", "Currently blending only supported with 2 or fewer materials. Aborting."); return; } EnableBlending = true; MixRadius = MixRadIn; BlendModel = ModelIn; PolyExp = PolyExpIn; if (MixRadius.x==0)MixRadius.x = LocObj.GetLatticeDim()/10000; //set to tiny fraction to avoid blowup of exponential function if (MixRadius.y==0)MixRadius.y = LocObj.GetLatticeDim()/10000; //set to tiny fraction to avoid blowup of exponential function if (MixRadius.z==0)MixRadius.z = LocObj.GetLatticeDim()/10000; //set to tiny fraction to avoid blowup of exponential function RenderMixedObject(pSim->pEnv->pObj, &LocObj, MixRadius); //if there's any mixing, we need to make it... } EnableFeature(VXSFEAT_BLENDING, EnableBlending); NumStep = NumStepIn; ConvThresh = ConvThreshIn; CurTick = 0; TotalTick = NumStep; CancelFlag = false; std::string Message = ""; LocEnv.EnableFloor(false); LocEnv.EnableGravity(false); LocEnv.EnableTemp(false); Import(&LocEnv, NULL, &Message); EnableFeature(VXSFEAT_COLLISIONS, false); EnableFeature(VXSFEAT_EQUILIBRIUM_MODE, true); EnableFeature(VXSFEAT_PLASTICITY, false); EnableFeature(VXSFEAT_FAILURE, false); EnableFeature(VXSFEAT_VOLUME_EFFECTS, pSim->IsFeatureEnabled(VXSFEAT_VOLUME_EFFECTS)); //enables volume effects according to last set physics sandbox value SetStopConditionType(SC_MIN_MAXMOVE); SetStopConditionValue(ConvThreshIn); if (!DoBCChecks()) return; OutFilePath = QFileDialog::getSaveFileName(NULL, "Save Tensile Test Results", GetLastDir(), "TXT Files (*.txt)"); pTensileView->VoxMesh.LinkSimVoxels(this, pTensileView); pTensileView->VoxMesh.DefMesh.DrawSmooth=false; //match view to current selection of the physics sandbox pTensileView->SetCurViewCol(pSim->pSimView->GetCurViewCol()); pTensileView->SetCurViewMode(pSim->pSimView->GetCurViewMode()); pTensileView->SetCurViewVox(pSim->pSimView->GetCurViewVox()); pTensileView->SetViewAngles(pSim->pSimView->GetViewAngles()); pTensileView->SetViewForce(pSim->pSimView->GetViewForce()); emit StartExternalGLUpdate(33); TestRunning = true; if (OutFilePath != "") TensileThread.Execute(false); // RunTensileTest(&DispMesg); if (ProgressMessage != "") QMessageBox::warning(NULL, "warning", QString::fromStdString(ProgressMessage)); }