MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / initialize_3D_grid

Method initialize_3D_grid

tools/Assembler/Materials/ElementWiseMaterial.cpp:77–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77void ElementWiseMaterial::initialize_3D_grid() {
78 const size_t dim = m_material_mesh->get_dim();
79 const size_t num_elem = m_material_mesh->get_num_voxels();
80 const Float cell_size = compute_cell_size();
81
82 m_grid = HashGrid::create(cell_size, 3);
83
84 if (!m_material_mesh->has_attribute("voxel_centroid")) {
85 m_material_mesh->add_attribute("voxel_centroid");
86 }
87 const VectorF& keys = m_material_mesh->get_attribute("voxel_centroid");
88
89 for (size_t i=0; i<num_elem; i++) {
90 m_grid->insert(i, keys.segment(i*dim, dim));
91 }
92}

Callers

nothing calls this directly

Calls 6

get_dimMethod · 0.45
get_num_voxelsMethod · 0.45
has_attributeMethod · 0.45
add_attributeMethod · 0.45
get_attributeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected