|
|
@ -90,7 +90,7 @@ namespace ipc::rigid { |
|
|
|
load(fname); |
|
|
|
} |
|
|
|
#else |
|
|
|
load("/home/cflin/Documents/CppField/source/RigidElasticSim/sim-test/rigid-test/cube/config.json"); |
|
|
|
load(CMAKE_SOURCE_DIR "/sim-test/rigid-test/rocker-arm/config.json"); |
|
|
|
#endif |
|
|
|
} |
|
|
|
if (m_has_scene) { |
|
|
@ -150,14 +150,22 @@ namespace ipc::rigid { |
|
|
|
sp_StaticSim_->simulation(); |
|
|
|
gui_ctrl_.is_modified = true; |
|
|
|
gui_ctrl_.is_solved = true; |
|
|
|
gui_ctrl_.single_color = false; |
|
|
|
} |
|
|
|
if (ImGui::Button(("原始模型"))) { |
|
|
|
gui_ctrl_.single_color = true; |
|
|
|
gui_ctrl_.is_modified = true; |
|
|
|
} |
|
|
|
// ImGui::RadioButton("开始计算##SimPlayer", &player_state, PlayerState::Playing);
|
|
|
|
// ImGui::RadioButton("暂停##SimPlayer", &player_state, PlayerState::Paused);
|
|
|
|
ImGui::Checkbox("网格可视化", &gui_ctrl_.mesh_visible); |
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
if (ImGui::CollapsingHeader( |
|
|
|
"边界条件", ImGuiTreeNodeFlags_DefaultOpen)) { |
|
|
|
ImGui::Checkbox("边界可视化", &gui_ctrl_.is_visible_BC); |
|
|
|
if (ImGui::Checkbox("边界可视化", &gui_ctrl_.is_visible_BC)) { |
|
|
|
gui_ctrl_.is_modified = true; |
|
|
|
} |
|
|
|
if (ImGui::CollapsingHeader( |
|
|
|
"Dirichlet边界", ImGuiTreeNodeFlags_DefaultOpen)) { |
|
|
|
// --------------------------------------------------------------------
|
|
|
@ -170,13 +178,20 @@ namespace ipc::rigid { |
|
|
|
(float) i_DBC.relMinBBox.z()}; |
|
|
|
std::vector<float> v_max_point = {(float) i_DBC.relMaxBBox.x(), (float) i_DBC.relMaxBBox.y(), |
|
|
|
(float) i_DBC.relMaxBBox.z()}; |
|
|
|
ImGui::InputFloat3(("Dirichlet最小值 " + std::to_string(i + 1)).c_str(), v_min_point.data()); |
|
|
|
ImGui::InputFloat3(("Dirichlet最大值 " + std::to_string(i + 1)).c_str(), v_max_point.data()); |
|
|
|
if ( |
|
|
|
ImGui::InputFloat3(("Dirichlet最小值 " + std::to_string(i + 1)).c_str(), |
|
|
|
v_min_point.data()) || |
|
|
|
ImGui::InputFloat3(("Dirichlet最大值 " + std::to_string(i + 1)).c_str(), |
|
|
|
v_max_point.data())) { |
|
|
|
gui_ctrl_.is_modified = true; |
|
|
|
i_DBC.relMinBBox = {v_min_point[0], v_min_point[1], v_min_point[2]}; |
|
|
|
i_DBC.relMaxBBox = {v_max_point[0], v_max_point[1], v_max_point[2]}; |
|
|
|
} |
|
|
|
} |
|
|
|
if (gui_ctrl_.is_modified) |
|
|
|
sp_StaticSim_->updateBC(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ImGui::CollapsingHeader( |
|
|
@ -191,14 +206,20 @@ namespace ipc::rigid { |
|
|
|
(float) i_NBC.relMaxBBox.z()}; |
|
|
|
std::vector<float> v_force = {(float) i_NBC.force.x(), (float) i_NBC.force.y(), |
|
|
|
(float) i_NBC.force.z()}; |
|
|
|
|
|
|
|
ImGui::InputFloat3(("Neumann最小值 " + std::to_string(i + 1)).c_str(), v_min_point.data()); |
|
|
|
ImGui::InputFloat3(("Neumann最大值 " + std::to_string(i + 1)).c_str(), v_max_point.data()); |
|
|
|
ImGui::InputFloat3(("Neumann力 " + std::to_string(i + 1)).c_str(), v_force.data()); |
|
|
|
if ( |
|
|
|
ImGui::InputFloat3(("Neumann最小值 " + std::to_string(i + 1)).c_str(), |
|
|
|
v_min_point.data()) || |
|
|
|
ImGui::InputFloat3(("Neumann最大值 " + std::to_string(i + 1)).c_str(), |
|
|
|
v_max_point.data()) || |
|
|
|
ImGui::InputFloat3(("Neumann力 " + std::to_string(i + 1)).c_str(), v_force.data())) { |
|
|
|
gui_ctrl_.is_modified = true; |
|
|
|
i_NBC.relMinBBox = {v_min_point[0], v_min_point[1], v_min_point[2]}; |
|
|
|
i_NBC.relMaxBBox = {v_max_point[0], v_max_point[1], v_max_point[2]}; |
|
|
|
i_NBC.force={v_force[0],v_force[1],v_force[2]}; |
|
|
|
i_NBC.force = {v_force[0], v_force[1], v_force[2]}; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (gui_ctrl_.is_modified) |
|
|
|
sp_StaticSim_->updateBC(); |
|
|
|
|
|
|
|
} |
|
|
@ -254,7 +275,8 @@ namespace ipc::rigid { |
|
|
|
char *desc = "121.88"; |
|
|
|
// ImGui::Text("柔顺度(compliance)");
|
|
|
|
// sp_StaticSim_->EvaluateTarget(ssim::SimTargetOption::COMPLIANCE)(0,0);
|
|
|
|
ImGui::TextWrapped("柔顺度 (compliance): %.3e", sp_StaticSim_->EvaluateTarget(ssim::SimTargetOption::COMPLIANCE)(0,0)); |
|
|
|
ImGui::TextWrapped("柔顺度 (compliance): %.3e", |
|
|
|
sp_StaticSim_->EvaluateTarget(ssim::SimTargetOption::COMPLIANCE)(0, 0)); |
|
|
|
if (ImGui::IsItemHovered()) { |
|
|
|
// 显示工具的提示
|
|
|
|
ImGui::BeginTooltip(); |
|
|
|