Patrick Riesen wrote: > New question #97361 on DOLFIN: > https://answers.launchpad.net/dolfin/+question/97361 > > hi, i want to change some values of a subfunction of a mixed function > with iterating over the dofs this mixed function (_uw). However, the > mixed function has two subspaces which are identical. > > if i want to go over the dofs of _uw[1] as > > for(CellIterator cell(_fluid->mesh()); !cell.end(); ++cell) { > > ufc_cell.update(*cell); > > _uw->restrict(w_coeffs.get(), w_sub->element(), *cell, ufc_cell, -1); > > > _uw->function_space().dofmap().tabulate_dofs(cell_dofs.get(), > ufc_cell, cell->index()); > > _uw->vector().get(w_coeffs.get(), > w_sub->dofmap().local_dimension(ufc_cell), cell_dofs.get()); > > for(dolfin::uint i = 0; i < cell_dims; i++) w_coeffs[i] = w_coeffs[i] > * scV_init; > > _uw->vector().set(w_coeffs.get(), > w_sub->dofmap().local_dimension(ufc_cell), cell_dofs.get()); } > > i thought this will change the values of _uw[1], but it will change > the values of _uw[0], although i specified the second sub-element > w_sub. So it should modify the values in _uw->vector() which > correspond to _uw[1]. Does somebody see what i am doing wrong, or is > this maybe not as supposed to be? >
I can't follow the example code very easily, but it sounds like you're missing the dof map offset (see _ufc_offset inside DofMap). Can you make a simpler example without restrict, and vetors, etc? Just try getting the (sub) dof map and see which entries it points to. Garth > many thanks for the help, patrick > > > _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : dolfin@lists.launchpad.net Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp