| 55 | }; |
| 56 | |
| 57 | TEST_F(PeriodicExplorationTest, brick5_periodic_timing) { |
| 58 | #if WITH_TETGEN |
| 59 | PeriodicExploration explorer( |
| 60 | m_data_dir + "brick5.wire", 5, 0.25); |
| 61 | explorer.with_parameters( |
| 62 | m_data_dir + "brick5.orbit", |
| 63 | m_data_dir + "brick5.modifier"); |
| 64 | explorer.with_refinement("loop", 2); |
| 65 | |
| 66 | std::cout << "This might take a few minutes "; |
| 67 | std::cout.flush(); |
| 68 | VectorF dofs = explorer.get_dofs(); |
| 69 | const size_t num_dofs = explorer.get_num_dofs(); |
| 70 | for (size_t i=0; i<5; i++) { |
| 71 | Float factor = 1.0 - i * 0.1; |
| 72 | VectorF modified_dofs(dofs); |
| 73 | for (size_t j=0; j<num_dofs; j++) { |
| 74 | if (explorer.is_thickness_dof(j)) { |
| 75 | modified_dofs[j] *= factor; |
| 76 | } else { |
| 77 | if (dofs[j] < 0) { |
| 78 | modified_dofs[j] += i * 0.05; |
| 79 | } else { |
| 80 | modified_dofs[j] -= i * 0.05; |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | explorer.set_dofs(modified_dofs); |
| 85 | explorer.periodic_inflate(false); |
| 86 | write_mesh("test.msh", explorer.get_mesh()); |
| 87 | bool tetgen_success = explorer.run_tetgen(); |
| 88 | ASSERT_TRUE(tetgen_success); |
| 89 | |
| 90 | Mesh::Ptr mesh = explorer.get_mesh(); |
| 91 | std::vector<MatrixFr> velocities = explorer.get_shape_velocities(); |
| 92 | ASSERT_EQ(explorer.get_num_dofs(), velocities.size()); |
| 93 | |
| 94 | std::vector<std::string> attr_names; |
| 95 | for (size_t j=0; j<num_dofs; j++) { |
| 96 | std::stringstream attr_name_stream; |
| 97 | attr_name_stream << "velocity_" << j; |
| 98 | std::string attr_name = attr_name_stream.str(); |
| 99 | |
| 100 | VectorF flattened_attr = flatten(velocities[j]); |
| 101 | |
| 102 | mesh->add_attribute(attr_name); |
| 103 | mesh->set_attribute(attr_name, flattened_attr); |
| 104 | attr_names.push_back(attr_name); |
| 105 | } |
| 106 | |
| 107 | //std::stringstream sin; |
| 108 | //sin << "exploration_brick5_itr_" << i << ".msh"; |
| 109 | //save_mesh(sin.str(), mesh, attr_names); |
| 110 | |
| 111 | std::cout << "."; |
| 112 | std::cout.flush(); |
| 113 | } |
| 114 | std::cout << " done!" << std::endl;; |
nothing calls this directly
no test coverage detected