[Paraview] Getting scalar values from XDMF file in filters

Tobias Brandvik tbrandvik at gmail.com
Thu Jun 25 09:15:50 EDT 2009


Jerry,

Many thanks for your help. The first approach works just fine and I'll
use that for now and then implement the second approach later to
reduce the memory consumption.

Cheers,
Tobias

On Thu, Jun 25, 2009 at 2:09 PM, Jerry Clarke<clarke at arl.army.mil> wrote:
> Tobias,
>
> You could use a Grid Centered Attribute in the Xdmf file:
> <Grid ...
>  <Topology ...
>  <Geometry ...
>  <Attribute Name="Specific Heat Capacity" Center="Grid" ..
>
> This means that there is one value for the entire Grid. The
> down side is the way this is implemented in the vtkXdmfReader; it
> creates a point value array and duplicates that value in the array.
> To access it you would access like any other point attribute and read
> the first value.
>
> The other way (as you mentioned) is to parse the XML in your filter.
> If you do it this way, you can use an <Information> element in the
> Grid.
>
> <Grid ..
>  <Information Name="Specific Heat Capacity" Value="1.0" />
>
> Then use XdmfDOM to parse the XML, find the <Information>
> element, create an XdmfInformation, and then info->GetValue();
> Since you'll know which element you're looking for, the easiest way
> to find the element is to use the XPath notation :
>
> (Python)
> node = dom.FindElementByPath(
> '/Xdmf/Domain/Grid/Information[@Name = "Specific Heat Capacity"]')
>
>
> Jerry
>
>
>
>
>
>
> Tobias Brandvik wrote:
>>
>> Hi all,
>>
>> I'm currently using the XDMF reader to read HDF5 files and this works
>> fine both in serial and parallel mode. The HDF5 files come from a CFD
>> code and only contain the primary flow variables (as multi-block
>> structured 3D arrays). I have written a filter that calculates
>> secondary flow variables - this also works well. However, the filter
>> currently needs the user to input scalar values such as the specific
>> heat capacity in order to calculate the secondary variables. What I
>> would like to do is to read these in automatically from the XDMF or
>> HDF5 files. So my question is, is there any way of getting the XDMF
>> reader to read in the scalars and store them somewhere in such a way
>> that they are accessible from the filter? If not, I guess I will have
>> to modify the XDMF reader itself or open the XMDF/HDF5 file directly
>> in the filter.
>>
>> Best wishes,
>>
>> Tobias Brandvik
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ParaView Wiki at:
>> http://paraview.org/Wiki/ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>
>


More information about the ParaView mailing list