# Help visualize the Q-value

**URL:** https://discourse.paraview.org/t/help-visualize-the-q-value/17397
**Category:** ParaView Support
**Tags:** vtk
**Created:** [January 14, 2026, 7:42am UTC](https://discourse.paraview.org/t/help-visualize-the-q-value/17397 "2026-01-14T07:42:19Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![R\_Mur](https://discourse.paraview.org/user_avatar/discourse.paraview.org/r_mur/32/17400_2.png) [@R\_Mur](https://discourse.paraview.org/u/R_Mur)
#### Post date: [January 14, 2026, 7:42am UTC](https://discourse.paraview.org/t/help-visualize-the-q-value/17397/1 "2026-01-14T07:42:19Z")

</div>

I’m trying to visualize Q-values using C++.  
Currently, I can’t get the intended outline to appear as shown in the file below. Could someone please tell me why?  
As it stands, it’s currently a cube.  
I want to display a rectangular prism outline.

 ![cube](https://discourse.paraview.org/uploads/default/original/3X/0/a/0a4f4447a413f4143bb95048d07e90810e07b918.png)

 ![rectangular](https://discourse.paraview.org/uploads/default/original/3X/a/7/a7371e80c7bee7bfb682919af62d4d8ccd8ffafb.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 14, 2026, 8:16am UTC](https://discourse.paraview.org/t/help-visualize-the-q-value/17397/2 "2026-01-14T08:16:09Z")

</div>

Are you looking for the representation selector ?

 ![a](https://discourse.paraview.org/uploads/default/original/3X/5/b/5b55148bd8fdb43fa32fa87d1e48eb13d19d3451.png)

---

<div class="post-metadata">

### Author: ![R\_Mur](https://discourse.paraview.org/user_avatar/discourse.paraview.org/r_mur/32/17400_2.png) [@R\_Mur](https://discourse.paraview.org/u/R_Mur)
#### Post date: [January 14, 2026, 9:07am UTC](https://discourse.paraview.org/t/help-visualize-the-q-value/17397/3 "2026-01-14T09:07:04Z")

</div>

Touching that icon didn’t seem to have any particular effect.  
As far as comparing the two outlines goes, it doesn’t appear to be an issue with the camera or anything like that.

 ![compare](https://discourse.paraview.org/uploads/default/original/3X/0/1/0146accc27741cc5ce033612c1cdcac8e81a1b02.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 14, 2026, 9:38am UTC](https://discourse.paraview.org/t/help-visualize-the-q-value/17397/4 "2026-01-14T09:38:03Z")

</div>

please share your data

---

<div class="post-metadata">

### Author: ![R\_Mur](https://discourse.paraview.org/user_avatar/discourse.paraview.org/r_mur/32/17400_2.png) [@R\_Mur](https://discourse.paraview.org/u/R_Mur)
#### Post date: [January 15, 2026, 6:00am UTC](https://discourse.paraview.org/t/help-visualize-the-q-value/17397/5 "2026-01-15T06:00:01Z")

</div>

The code is as follows:

IMAX=1700

JMAX=204

KMAX=204

dx=0.002

dy=0.00025

dz=0.002

The grid is cut with x and z at equal intervals and y at non-equal intervals.

The Q value threshold is set to 9.94.

void write\_paraview(

```
double x0\[\],

double y0\[\],

double z0\[\],

double q\[\]\[JMAX + 1\]\[IMAX + 1\],

double uzudo\[\]\[JMAX + 1\]\[IMAX + 1\],

double u0\[\]\[JMAX + 1\]\[IMAX + 1\],

double v0\[\]\[JMAX + 1\]\[IMAX + 1\],

double w0\[\]\[JMAX + 1\]\[IMAX + 1\],

double p0\[\]\[JMAX + 1\]\[IMAX + 1\]) {

ofstream datado;

char str\[32\];

sprintf(str, "paraview.%04d.vtk", n / 250);

//char str2\[20\];

//sprintf(str, "./data2/paraview_output/");

std::string datafile = "./data2/paraview_output/";

//string datafile = str2;

//mkdir(str2, 0777);

datafile.append(str);

datado.open(datafile.c_str(), ios::out | ios::binary);

if (!datado) {

    cout << "Error: cannot open file(" << datafile.c_str() << ")" << endl;

    exit(1);

}

if (n == 0) {

    datado << "# vtk DataFile Version 2.0" << endl;

    datado << "q_uzudo" << endl;

    datado << "ASCII" << endl;

    datado << "DATASET RECTILINEAR_GRID" << endl;

    datado << "DIMENSIONS " << IMAX + 1 << ' ' << JMAX + 1 << ' ' << KMAX + 1 << endl;

    datado << "X_COORDINATES " << IMAX + 1 << " double" << endl;

    for (int i = 0; i < IMAX + 1; i++) {

        datado << x0\[i\] << ' ';

    }

    datado << endl;

    datado << "Y_COORDINATES " << JMAX + 1 << " double" << endl;

    for (int j = 0; j < JMAX + 1; j++) {

        datado << y0\[j\] << ' ';

    }

    datado << endl;

    datado << "Z_COORDINATES " << KMAX + 1 << " double" << endl;

    for (int k = 0; k < KMAX + 1; k++) {

        datado << z0\[k\] << ' ';

    }

    datado << endl;

}

else { //境界内の計算

    int imin = 0, imax = 0, jmin = 0, jmax = 0, kmin = 0, kmax = 0;

    for (int i = 1; i < IMAX; i++) {

        for (int j = 1; j < JMAX; j++) {

            for (int k = 1; k < KMAX; k++) {

                if (q\[k\]\[j\]\[i\] > q_threshold) {

                    imin = i;

                    goto loopend1;

                }

            }

        }

    }

loopend1:

    for (int i = IMAX - 1; i > 0; i--) {

        for (int j = 1; j < JMAX; j++) {

            for (int k = 1; k < KMAX; k++) {

                if (q\[k\]\[j\]\[i\] > q_threshold) {

                    imax = i;

                    goto loopend2;

                }

            }

        }

    }

loopend2:

    for (int j = 1; j < JMAX; j++) {

        for (int i = 1; i < IMAX; i++) {

            for (int k = 1; k < KMAX; k++) {

                if (q\[k\]\[j\]\[i\] > q_threshold) {

                    jmin = j;

                    goto loopend3;

                }

            }

        }

    }

loopend3:

    for (int j = JMAX - 1; j > 0; j--) {

        for (int i = 1; i < IMAX; i++) {

            for (int k = 1; k < KMAX; k++) {

                if (q\[k\]\[j\]\[i\] > q_threshold) {

                    jmax = j;

                    goto loopend4;

                }

            }

        }

    }

loopend4:

    for (int k = 1; k < KMAX; k++) {

        for (int j = 1; j < JMAX; j++) {

            for (int i = 1; i < IMAX; i++) {

                if (q\[k\]\[j\]\[i\] > q_threshold) {

                    kmin = k;

                    goto loopend5;

                }

            }

        }

    }

loopend5:

    for (int k = KMAX - 1; k > 0; k--) {

        for (int j = 1; j < JMAX; j++) {

            for (int i = 1; i < IMAX; i++) {

                if (q\[k\]\[j\]\[i\] > q_threshold) {

                    kmax = k;

                    goto loopend6;

                }

            }

        }

    }

loopend6:

    datado << "# vtk DataFile Version 2.0" << endl;

    datado << "q_uzudo" << endl;

    datado << "ASCII" << endl;

    datado << "DATASET RECTILINEAR_GRID" << endl;

    datado << "DIMENSIONS " << imax - imin + 3 << ' ' << jmax - jmin + 3 << ' ' << kmax - kmin + 3 << endl;

    datado << "X_COORDINATES " << imax - imin + 3 << " double" << endl;

    for (int i = imin - 1; i < imax + 2; i++) {

        datado << x0\[i\] << ' ';

    }

    datado << endl;

    datado << "Y_COORDINATES " << jmax - jmin + 3 << " double" << endl;

    for (int j = jmin - 1; j < jmax + 2; j++) {

        datado << y0\[j\] << ' ';

    }

    datado << endl;

    datado << "Z_COORDINATES " << kmax - kmin + 3 << " double" << endl;

    for (int k = kmin - 1; k < kmax + 2; k++) {

        datado << z0\[k\] << ' ';

    }

    datado << endl;

    datado << "POINT_DATA " << (imax - imin + 3) \* (jmax - jmin + 3) \* (kmax - kmin + 3) << endl;

    datado << "SCALARS q double" << endl;

    datado << "LOOKUP_TABLE default" << endl;

    for (int k = kmin - 1; k < kmax + 2; k++) {

        for (int j = jmin - 1; j < jmax + 2; j++) {

            for (int i = imin - 1; i < imax + 2; i++) {

                datado << q\[k\]\[j\]\[i\] << endl;

            }

        }

    }

    datado << "SCALARS uzudo double" << endl;

    datado << "LOOKUP_TABLE default" << endl;

    for (int k = kmin - 1; k < kmax + 2; k++) {

        for (int j = jmin - 1; j < jmax + 2; j++) {

            for (int i = imin - 1; i < imax + 2; i++) {

                datado << uzudo\[k\]\[j\]\[i\] << endl;

            }

        }

    }

    datado << "VECTORS v double" << endl;

    for (int k = kmin - 1; k < kmax + 2; k++) {

        for (int j = jmin - 1; j < jmax + 2; j++) {

            for (int i = imin - 1; i < imax + 2; i++) {

                datado << u0\[k\]\[j\]\[i\] << ' ' << v0\[k\]\[j\]\[i\] << ' ' << w0\[k\]\[j\]\[i\] << endl;

            }

        }

    }

}

datado.close();

```

}

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 15, 2026, 9:07pm UTC](https://discourse.paraview.org/t/help-visualize-the-q-value/17397/6 "2026-01-15T21:07:17Z")

</div>

please share your **data**

---

<div class="post-metadata">

### Author: ![R\_Mur](https://discourse.paraview.org/user_avatar/discourse.paraview.org/r_mur/32/17400_2.png) [@R\_Mur](https://discourse.paraview.org/u/R_Mur)
#### Post date: [January 16, 2026, 3:56am UTC](https://discourse.paraview.org/t/help-visualize-the-q-value/17397/7 "2026-01-16T03:56:29Z")

</div>

[paraview.0100.vtk](https://discourse.paraview.org/uploads/short-url/Apz786yhuZDzx0HwBMpXQfA0pIY.vtk) (13.4 KB)

[paraview.0101.vtk](https://discourse.paraview.org/uploads/short-url/qvIIHO1DH8fqukvFLsGL0eXuGjU.vtk) (3.2 MB)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 16, 2026, 8:57am UTC](https://discourse.paraview.org/t/help-visualize-the-q-value/17397/8 "2026-01-16T08:57:22Z")

</div>

The file open fine in ParaView:

 ![image](https://discourse.paraview.org/uploads/default/original/3X/e/d/ed69abf47c388f2c36bb453b3679a4750755e518.png)

What is wrong with it ?

---

<div class="post-metadata">

### Author: ![R\_Mur](https://discourse.paraview.org/user_avatar/discourse.paraview.org/r_mur/32/17400_2.png) [@R\_Mur](https://discourse.paraview.org/u/R_Mur)
#### Post date: [January 16, 2026, 1:38pm UTC](https://discourse.paraview.org/t/help-visualize-the-q-value/17397/9 "2026-01-16T13:38:32Z")

</div>

I couldn’t do it !  
Please tell me exactly how to do it.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 16, 2026, 1:42pm UTC](https://discourse.paraview.org/t/help-visualize-the-q-value/17397/11 "2026-01-16T13:42:47Z")

</div>

![a](https://discourse.paraview.org/uploads/default/original/3X/e/a/eaff8a2d960cf92851d795b5dc0df96f2a977411.png)  
 ![b](https://discourse.paraview.org/uploads/default/original/3X/9/8/9864b0e29f58449e75cd1a9ae5c78a7e8b595d73.png)

---

<div class="post-metadata">

### Author: ![R\_Mur](https://discourse.paraview.org/user_avatar/discourse.paraview.org/r_mur/32/17400_2.png) [@R\_Mur](https://discourse.paraview.org/u/R_Mur)
#### Post date: [January 16, 2026, 4:35pm UTC](https://discourse.paraview.org/t/help-visualize-the-q-value/17397/12 "2026-01-16T16:35:00Z")

</div>

Got it!

Thank you for your answer!
