Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6913705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:15:07+00:00 2026-05-27T09:15:07+00:00

I’m trying to visualize some data I have stored on a regular grid using

  • 0

I’m trying to visualize some data I have stored on a regular grid using VTK (drawing a colored isosurface). I wrote some code to dump the data in the vtk legacy format which works for low resolution versions of the data. I can extract and view the expected isosurface with ParaView or the VTK library. When I increase the resolution by a factor of 10 in each dimension (nx goes from about 100 to 1000, same with ny, nz), paraview and a viewer I wrote using the VTK library are incorrect. They look like a set of slightly off-axis sheets instead of a single “blob”. I know from other tests that the data itself is correct.

Is there something wrong with my legacy vtk format dumping code below? I don’t understand what the lookup table does, but it seems to work fine for the low resolution case.

std::ofstream out(filename);

out << "# vtk DataFile Version 3.0" << std::endl;
out << "Signed distance/biharmonic visualizer" << std::endl;
out << "ASCII" << std::endl;
out << "DATASET STRUCTURED_POINTS" << std::endl;
out << "DIMENSIONS " << nx << " " << ny << " " << nz << std::endl;
out << "ORIGIN 0 0 0" << std::endl;
out << "SPACING " << h << " " << h << " " << h << std::endl;
out << "POINT_DATA " << nx*ny*nz << std::endl;
out << "SCALARS signedDistance double" << std::endl;
out << "LOOKUP_TABLE default" << std::endl;
for(size_t i = 0; i < nx; ++i)
  for(size_t j = 0; j < ny; ++j)
    for(size_t k = 0; k < nz; ++k)
      out << tempPhi(i,j,k) << std::endl;
out << "SCALARS biharmonic double" << std::endl;
out << "LOOKUP_TABLE default" << std::endl;
for(size_t i = 0; i < nx; ++i)
  for(size_t j = 0; j < ny; ++j)
    for(size_t k = 0; k < nz; ++k)
      out << biharmonic(i,j,k) << std::endl;
out.close();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:15:08+00:00Added an answer on May 27, 2026 at 9:15 am

    In the VTK file you provide there are a number of occurrences of 1.79769e+308. To actually ‘see’ your data I had to replace these with zeros. Having done this and looked at your data file in VisIt I would guess that your method of writing the point data is incorrect (your three nested for loops – which flatten the data from 3D to a 1D list).

    I would suggest that you you write some small test data sets with your VTK writer and also with this simple C code, which is supplied with VisIt to write legacy VTK files. Make sure that the data sets written with both methods agree exactly (note that VisItWriterLib.c writes version 2 VTK file formats, whereas you use version 3 – this shouldn’t cause a problem however).

    Edit: As discussed in the comments, the problem was the ordering of the nested for loops which were used to output the point data and flatten it from 3D to a 1D list. The code

    for(size_t i = 0; i < nx; ++i)
      for(size_t j = 0; j < ny; ++j)
        for(size_t k = 0; k < nz; ++k)
          out << tempPhi(i,j,k) << std::endl;
    

    should in fact read

    for(size_t k = 0; k < nz; ++k)
      for(size_t j = 0; j < ny; ++j)
        for(size_t i = 0; i < nx; ++i)
          out << tempPhi(i,j,k) << std::endl;
    

    i.e. the data should be written in column major order, not row major. This is a point in which the VTK file formats document is lacking.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.