2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ParaViewはVTK ASCIIではなくBinaryでないとNaNを読み込めない

Last updated at Posted at 2018-07-13

NaNを含むデータをParaViewで表示するには

VTKライブラリを使ってVTK ASCII形式でファイルに出力すると「nan」と表示されます。このファイルをParaViewで開くと

Unsupported cell attribute type: nan for file:(後略)

というエラーメッセージが表示されます。
どうすればNaNを取り扱えるのかと色々検索をかけてやっと解答が見つかりましたので、備忘録として残しておきます。

The reader for the VTK ASCII format does not handle non-finites like NaN. (It has to do with the standard C++ streams not supporting it, but I don't want to go into details.) However, if you write out something in VTK binary format, that should work.

Binary形式にすればちゃんと表示できるだけのことでした。

追記:vtkMathクラスにおいて、正・負の無限大およびNaNを返したり判定する関数

-Inf()

  • NegInf()
  • Nan()
  • IsInf()
  • IsNegInf()
  • IsNan()
  • IsFinite()

が提供されています。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?