getfem-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Getfem-users] VTK export -- bug or feature ?


From: Roman Putanowicz
Subject: Re: [Getfem-users] VTK export -- bug or feature ?
Date: Thu, 15 Jul 2010 02:29:55 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

> Dear All,
> 
> Have you experienced similar problems as the described below?
> 
> It seems that the output of vtk_export for vectorial elements
> depends on the dimension of the mesh (geometric dimension, mesh.dim()
> I meant).
[skip ...]

Well, the dependency of the output on the geometric dimension of a mesh
is feature not a bug, however the question arises if this is the right
feature :).

The culprit is in the function:

template<class IT> void vtk_export::write_vec(IT p) {
 float v[3];
 for (size_type i=0; i < dim_; ++i) {
    v[i] = float(p[i]);
 }
 for (size_type i=dim_; i < 3; ++i) v[i] = 0.0f;
   write_val(v[0]);write_val(v[1]);write_val(v[2]);
}

It gets as an argument the index (iterator) of the starting element
of the vector being written.
It then assumes that the size of the vector is equal to dim_ where
dim_ is the geometric dimension of the underlying mesh.

I think that this is a bit restricting -- we can have 2-dimensional
vector field over 1-dimensional segment mesh and the same field over
3-dimensional segment mesh. On export to VTK point coordinates are
padded with zeros thus the output should be the same and should not
depend on the mesh geometric dimension.

The fix should be easy -- my proposal is to explicitly tell
vtk_export::write_vec what is the dimension of the vector field
When exporting point data this dimension will be deduced from 
mesh_fem. When exporting cell data or sliced point data this dimension
must be specified explicitly or will be set by default to 1.
This way we can export cell data which is a vector field (is this
supported by VTK?).
My proposal changes GetFEM API but in a way that should not break any code.
The changes restrict to the single file getfem_export.h

In the attachment I send the modified getfem_export.h

The question arises if the discussed issue applies to DX output.
I haven't check that yet.

Regards,

Roman
-- 
Roman Putanowicz, PhD  < address@hidden  >
Institute for Computational Civil Engng (L-5)
Dept. of Civil Engng, Cracow Univ. of Technology
www.l5.pk.edu.pl, tel. +48 12 628 2569, fax 2034

Attachment: getfem_export.h
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]