Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formats for AMR dataset? #77

Open
henry2004y opened this issue Dec 21, 2020 · 1 comment
Open

Formats for AMR dataset? #77

henry2004y opened this issue Dec 21, 2020 · 1 comment

Comments

@henry2004y
Copy link

Hello,

Do you know if it is possible to generate any AMR-based VTK file formats? The data I have is organized in a block-based AMR format, but I have little knowledge of how VTK handles AMR datasets. It would be great if there exists a proper format already and I can convert to that.

@henry2004y
Copy link
Author

henry2004y commented May 13, 2021

As a reference, this is an example in C++ for writing a 2D AMR dataset.

I have found some interesting stuff. In ParaView 5.9, there is a AMR GaussianPulse Source which allows you to generate a sample AMR data. Here I create a 2D pulse. This can then be stored in this *.vthb file, which looks like

<VTKFile type="vtkOverlappingAMR" version="1.1" byte_order="LittleEndian" header_type="UInt64">
  <vtkOverlappingAMR origin="-2 -2 0" grid_description="XY">
    <Block level="0" spacing="0.5 0.5 0.5">
      <DataSet index="0" amr_box="0 4 0 4 0 -1" file="test/test_0.vti"/>
    </Block>
    <Block level="1" spacing="0.25 0.25 0.5">
      <DataSet index="0" amr_box="0 3 0 5 0 -1" file="test/test_1.vti"/>
      <DataSet index="1" amr_box="6 9 4 9 0 -1" file="test/test_2.vti"/>
    </Block>
  </vtkOverlappingAMR>
</VTKFile>

Each linked .vti file is just a standard image file like (test/test_0.vti)

<VTKFile type="ImageData" version="2.2" byte_order="LittleEndian" header_type="UInt64">
  <ImageData WholeExtent="0 5 0 5 0 0" Origin="-2 -2 0" Spacing="0.5 0.5 0.5" Direction="1 0 0 0 1 0 0 0 1">
  <Piece Extent="0 5 0 5 0 0">
    <PointData>
    </PointData>
    <CellData>
      <DataArray type="Float64" Name="Centroid" NumberOfComponents="3" format="ascii" RangeMin="0.3535533905932738" RangeMax="2.4748737341529163">
        -1.75 -1.75 0 -1.25 -1.75 0
        -0.75 -1.75 0 -0.25 -1.75 0
        0.25 -1.75 0 -1.75 -1.25 0
        -1.25 -1.25 0 -0.75 -1.25 0
        -0.25 -1.25 0 0.25 -1.25 0
        -1.75 -0.75 0 -1.25 -0.75 0
        -0.75 -0.75 0 -0.25 -0.75 0
        0.25 -0.75 0 -1.75 -0.25 0
        -1.25 -0.25 0 -0.75 -0.25 0
        -0.25 -0.25 0 0.25 -0.25 0
        -1.75 0.25 0 -1.25 0.25 0
        -0.75 0.25 0 -0.25 0.25 0
        0.25 0.25 0
        <InformationKey name="L2_NORM_FINITE_RANGE" location="vtkDataArray" length="2">
          <Value index="0">
            0.35355339059
          </Value>
          <Value index="1">
            2.4748737342
          </Value>
        </InformationKey>
        <InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
          <Value index="0">
            0.35355339059
          </Value>
          <Value index="1">
            2.4748737342
          </Value>
        </InformationKey>
      </DataArray>
      <DataArray type="Float64" Name="Gaussian-Pulse" format="ascii" RangeMin="1.1448674228227765e-11" RangeMax="0.3032653298563167">
        1.1448674228227765e-11 4.618724830985297e-9 2.52173831283944e-7 0.0000018633265860393355 0.0000018633265860393355 4.618724830985297e-9
        0.0000018633265860393355 0.00010173418450532208 0.0007517195964887862 0.0007517195964887862 2.52173831283944e-7 0.00010173418450532208
        0.005554498269121153 0.0410424993119494 0.0410424993119494 0.0000018633265860393355 0.0007517195964887862 0.0410424993119494
        0.3032653298563167 0.3032653298563167 0.0000018633265860393355 0.0007517195964887862 0.0410424993119494 0.3032653298563167
        0.3032653298563167
      </DataArray>
      <DataArray type="UInt8" Name="vtkGhostType" format="ascii" RangeMin="0" RangeMax="8">
        8 8 0 0 0 8
        8 0 0 0 8 8
        0 8 8 0 0 0
        8 8 0 0 0 8
        8
      </DataArray>
    </CellData>
  </Piece>
  </ImageData>
</VTKFile>

This indicates that in principle we can generate AMR dataset once we understand how those amr_box are organized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant