FmUpdateUnconstrained
是基于 FEMFX 仿真流程中的第一个重要环节,位于 FEMFX/amd_femfx/src/Simulation/FEMFXSimulate.cpp
中,在位于 AMD_FEMFC.h
的函数声明中,是这样解释该函数的内容的:
// Rebuild meshes after fracture, solve end velocity without regard for constraints, and rebuild hierarchies.
// If FM_ASYNC_THREADING and followTaskFunc non-NULL, this call will execute asynchronously, and may return before tasks are complete.
// These tasks will execute followTaskFunc with followTaskData (and index 0) when complete.
void FmUpdateUnconstrained(FmScene* scene, float timestep, FmTaskFuncCallback followTaskFunc, void* followTaskData);
翻译一下,大致包含了这么几部分内容:在产生碎片后重新建立网格对象(需要 new 一些新的 tetMesh 对象);在不考虑约束的情况下求解模型的(位置)、速度等;重新建立模型的等级信息;
在函数 FmUpdateUnconstrained
中,主要实现的内容具体为:
1、一些参数的计算和设置
2、FmWakeIslandsChangedBetweenSteps(scene);
解释:Complete waking of any islands marked between steps
3、FmFindMeshConnectedComponents(scene);
解释:// Recompute mesh connected components after any fracture in the last step.
// This will create new tet mesh objects, and must be done before contact determination so that contact report tet and object ids are valid
4、FmCollectTetMeshIds(scene);
和 FmCollectRigidBodyIds(scene);
解释:Make arrays of active and sleeping object ids
5、写入了一些参数
6、FmTaskFuncStepVelocityRebuildBvh
该函数是通过如下形式执行的:
FmTaskDataStepVelocityRebuildBvh taskData(scene, numTetMeshes, numRigidBodies);
scene->taskSystemCallbacks.ParallelFor("ImplicitSolveBvhBuild", FmTaskFuncStepVelocityRebuildBvh, &taskData, numTasks);
后面会补充一些详细的说明。