| 12 | }; |
| 13 | |
| 14 | TEST_F(PhantomMeshGeneratorTest, creation) { |
| 15 | const Vector3F half_size(2.5, 2.5, 2.5); |
| 16 | WireNetwork::Ptr network = load_wire_shared("brick5.wire"); |
| 17 | network->scale_fit(-half_size, half_size); |
| 18 | |
| 19 | WireProfile::Ptr profile = WireProfile::create("square"); |
| 20 | |
| 21 | ParameterManager::Ptr manager = ParameterManager::create(network); |
| 22 | |
| 23 | PhantomMeshGenerator generator(network, manager, profile); |
| 24 | generator.with_shape_velocities(); |
| 25 | generator.generate(); |
| 26 | |
| 27 | Mesh::Ptr mesh = form_mesh( |
| 28 | generator.get_vertices(), generator.get_faces()); |
| 29 | |
| 30 | const size_t num_vertices = mesh->get_num_vertices(); |
| 31 | const size_t dim = mesh->get_dim(); |
| 32 | size_t count=0; |
| 33 | std::vector<std::string> attr_names; |
| 34 | const auto& shape_velocities = generator.get_shape_velocities(); |
| 35 | for (const auto& shape_velocity : shape_velocities) { |
| 36 | VectorF velocity(num_vertices * dim); |
| 37 | std::copy(shape_velocity.data(), |
| 38 | shape_velocity.data() + num_vertices * dim, |
| 39 | velocity.data()); |
| 40 | std::stringstream attr_name; |
| 41 | attr_name << "velocity_" << count; |
| 42 | mesh->add_attribute(attr_name.str()); |
| 43 | mesh->set_attribute(attr_name.str(), velocity); |
| 44 | attr_names.push_back(attr_name.str()); |
| 45 | count++; |
| 46 | } |
| 47 | |
| 48 | save_mesh("phantom_brick5.msh", mesh, attr_names); |
| 49 | } |
nothing calls this directly
no test coverage detected