On Thu, Nov 20, 2008 at 11:08 AM, John Peterson <jwpeterson@...> wrote:
> On Thu, Nov 20, 2008 at 8:18 AM, jurak <jurak@...> wrote:
>> Hi,
>>
>> ther is a small bug in function
>>
>> VTKIO::solution_to_vtk(const EquationSystems& es, vtkUnstructuredGrid*&
>> grid)
>>
>> in vtk_io.C. On line 320
>>
>> data>SetNumberOfValues(sys.solution>size());
>>
>> sets the number of values too high when there is more than one variable
>> in sys.
>> (Corresponding vtufile is then filled with some garbage values.) It
>> should be replaced by
>>
>> data>SetNumberOfValues(n_nodes);
>
> Hmm... I think that's pretty close, but what we really want is the
> number of degrees of freedom for variable "j" when we are in the
> jloop. For Lagrange FEs there is one DoF per node per variable, but
> this is not the case for other finite element types. Unfortunately, I
> can't remember off the top of my head how to find the total number of
> DoFs for a particular variable.
>
> It looks like DofMap::variable_{first,last}_local_dof () gives the
> first (resp. last) local degree of freedom index for a particular
> variable. This could probably be used to obtain the total number of
> dofs for a given variable, by summing the result across processors.
> This should really be in the library somewhere, so hopefully Ben or
> someone more knowledgeable will comment on the right way to do it.
Aha, you'll probably want to do something like
EquationSystems::build_solution_vector() to get this right.

John
