On 7/23/23 06:16, Gordan Šegon wrote:
I am trying to remap dof indices of certain cells before assembly using the
following (sketch code):
...
const unsigned int dofs_per_cell = fe.n_dofs_per_cell();
// Iterate over cells and remap dofs on marked cells
for (auto& cell : dof_handler.active_cell_iterators()) {
std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
if ( /* cell marked for remapping */ ){
fe_values.reinit(cell);
cell->get_dof_indices(local_dof_indices);
for (auto &local_dof_index: local_dof_indices)
local_dof_index = custom_remap_function(local_dof_index);
cell->set_dof_indices(local_dof_index);
}
}
This will not work unless you have a discontinuous FE because you will be
touching DoFs twice.
A better way is to simply set up a permutation vector mapping old to new DoF
indices and calling DoFHandler::renumber_dofs().
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email: bange...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/6f6fbea6-66ae-7716-3208-d34b21d800dc%40colostate.edu.