← Back to team overview

dolfin team mailing list archive

Re: [Question #92245]: Gradients and SubFunctions

 

Question #92245 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/92245

Patrick Riesen proposed the following answer:
Niclas Jansson wrote:
> Question #92245 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/92245
> 
> Niclas Jansson proposed the following answer:
> Patrick Riesen <question92245@xxxxxxxxxxxxxxxxxxxxx> writes:
> 
>> Question #92245 on DOLFIN changed:
>> https://answers.launchpad.net/dolfin/+question/92245
>>
>> Patrick Riesen proposed the following answer:
>> Murtazo Nazarov wrote:
>>> Question #92245 on DOLFIN changed:
>>> https://answers.launchpad.net/dolfin/+question/92245
>>>
>>> Murtazo Nazarov posted a new comment:
>>>
>>> I guess 
>>>
>>> *snip*
>>>     // extract velocity solution and scale it
>>>      dolfin::uint m_e = _e->vector().size();
>>>      dolfin::uint m = _v->vector().size();
>>>      double* _block = new double[m];
>>>
>>>      dolfin::uint* _rows = new dolfin::uint[m];
>>>      for(dolfin::uint i = 0; i < m; i++)
>>>        _rows[i] = m_e + i;
>>>
>>>      _evp->vector().get(_block, m, _rows);
>>> *snap*
>>>
>>> won't work in parallel or? Otherwise there are many similar ways to deal
>>> with the problem.
>>>
>>> m
>>>
>> no, but there's also get_local (), set_local () which are the parallel 
>> equivalents.
>>
> 
> Working with indices, and get_local is dangerous. For example if the
> velocity components should be scaled differently it won't work if the
> dofmap is renumbered. The safest way is to extract function components
> from a given dofmap. 
> 
> Niclas
> 

i don't know about this because never used DofMap, how would that work ?

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.



References