-----------------------------------------------------------------------------
| 95 | } |
| 96 | //----------------------------------------------------------------------------- |
| 97 | std::vector<int> |
| 98 | ElementDofLayout::sub_view(std::span<const int> component) const |
| 99 | { |
| 100 | // Fill up a list of parent dofs, from which subdofmap will select |
| 101 | std::vector<int> dof_list(_num_dofs * _block_size); |
| 102 | std::iota(dof_list.begin(), dof_list.end(), 0); |
| 103 | |
| 104 | const ElementDofLayout* element_dofmap_current = this; |
| 105 | for (int i : component) |
| 106 | { |
| 107 | // Switch to sub-dofmap |
| 108 | assert(element_dofmap_current); |
| 109 | if (i >= (int)element_dofmap_current->_sub_dofmaps.size()) |
| 110 | throw std::runtime_error("Invalid component"); |
| 111 | element_dofmap_current = &_sub_dofmaps.at(i); |
| 112 | |
| 113 | std::vector<int> dof_list_new(element_dofmap_current->_num_dofs |
| 114 | * element_dofmap_current->_block_size); |
| 115 | for (std::size_t j = 0; j < dof_list_new.size(); ++j) |
| 116 | dof_list_new[j] = dof_list[element_dofmap_current->_parent_map[j]]; |
| 117 | dof_list = dof_list_new; |
| 118 | } |
| 119 | |
| 120 | return dof_list; |
| 121 | } |
| 122 | //----------------------------------------------------------------------------- |
| 123 | int ElementDofLayout::block_size() const { return _block_size; } |
| 124 | //----------------------------------------------------------------------------- |
no test coverage detected