Read CalculiX FRD result files. The parser is C++ behind a plain C ABI, so the same implementation serves Python, C++, and anything else with a foreign-function interface — and the Python side turns what it produced into a pyvista.UnstructuredGrid.
import pyvista_frd
mesh = pyvista_frd.read("mesh.frd")
mesh.plot(scalars="STRESS_Mises")
Time steps work the way PyVista’s reader does:
reader = pyvista_frd.FRDReader("mesh.frd")
reader.time_values # [0.5, 1.0]
reader.set_active_time_value(1.0)
mesh = reader.read()
Documentation
frd-reader.pyvista.org – a worked gallery, the Python API and the C ABI, and how every claim below is checked.
Installation
pip install pyvista-frd-reader
Wheels are published for Linux (x86_64 and aarch64), macOS (Intel and Apple silicon) and Windows. They contain a compiled library and no CPython extension module, so one wheel per platform serves every supported interpreter.
The Linux wheels are manylinux_2_28, meaning glibc 2.28 or newer – RHEL 8, Debian 10, Ubuntu 20.04 and later. That floor comes from NumPy and VTK, not from this package: the core needs only C++17, but a wheel tagged for an older glibc than its own dependencies can be installed on would promise something that does not work.
Installing from source needs CMake and a C++17 compiler: there is no pure-Python fallback, because a reader that silently falls back is indistinguishable from one that works until someone measures it.
What it reads
Element types HE8, PE6, PE15, TE4, HE20, TE10, TR3, TR6, QU4, QU8, BE2, BE3, PY5 and PY13 — the last two being CalculiX’s experimental pyramids, C3D5 and C3D13. Both the short and long element-record formats are handled, including the case CalculiX produces past 9999 nodes, where the node ids in a record run together with no separator at all.
All four encodings, which is a block header’s last field: the two ASCII widths and the two binary ones, float32 and float64. Binary FRD is what CalculiX writes from *REFINE MESH and from a DOUBLE output card, and PyVista’s reader cannot open it — it parses FRD as text, so a binary file returns an empty mesh or an error. See doc/binary.md.
For any 6-component tensor whose name contains STRESS or STRAIN, the reader appends the derived arrays PyVista’s reader appends:
<NAME>_Mises — equivalent von Mises magnitude
<NAME>_sgMises — signed by the trace
<NAME>_PS1, _PS2, _PS3 — principal values, largest first
Elements with the wrong number of nodes, or a type nothing recognises, raise pyvista.InvalidMeshWarning naming the line they were found on.
The grid’s cell arrays are handed to VTK in 32-bit storage whenever the mesh fits in it, which is any file short of two billion connectivity entries. vtkCellArray keeps the width it is given, so that halves what the mesh costs to hold for as long as it is held. Points stay float64.
What it writes
The same four encodings.
import pyvista_frd
mesh = pyvista_frd.read("result.frd")
pyvista_frd.write("copy.frd", mesh) # ASCII, six digits
pyvista_frd.write("small.frd", mesh, binary=True) # a third of the size, exact
# Or convert without going through a mesh. A binary file that no ASCII-only
# reader can open becomes one any of them can.
pyvista_frd.convert("binary.frd", "ascii.frd", binary=False)
The writer is graded on reproducing CalculiX’s bytes, not on agreeing with this library’s own reader: a document read and emitted again is the input byte for byte, over 1,111 external FRD files. That gate turned up a second dialect of the format shipped with CalculiX GraphiX, and the fact that CalculiX renders its ASCII values through single precision – which this library deliberately does not, so a converted file carries the full double and differs from CalculiX’s own text at a rounding tie. Separately, CalculiX itself reads files this library writes and produces byte-identical results from them. The method and its limits are in doc/writing.md.
Speed
Not why this exists – multi-language reuse is – but the question follows the language, so it is measured rather than asserted. Against PyVista’s reader, reading the same file to the same grid:
file |
pyvista_frd |
pyvista |
ratio |
|---|---|---|---|
mesh.frd (0.14 MB) |
3.12 ms |
8.13 ms |
2.6x |
synthetic (12.8 MB) |
82.4 ms |
534 ms |
6.5x |
Medians of interleaved runs on one workstation. Treat the ratio as indicative and the absolute figures as a property of that machine – benchmarks/read_speed.py reproduces both, and interleaves the two arms rather than running one after the other, because a machine that drifts mid-run otherwise charges the drift to whichever arm was unlucky.
The ratio grows with file size because both readers pay the same fixed cost to build the VTK grid at the end; only the parse differs. On a small file that fixed cost is most of the work.
Two files is a spot check, not a measurement. Over CalculiX’s own regression suite – 839 files, 125 MB, both readers driven to the same end state – the aggregate is 7.42x, the median file is 5.49x, and the spread runs from 0.83x on a tiny file to 37.67x on a small one with many time steps. Those numbers, and the reason the naive comparison flatters this library, are in doc/parity.md.
Parity
This reader is graded against PyVista’s, file by file and array by array. As well as the fixture corpus in tests/, it has been swept over 1,766 FRD files this project did not write – CalculiX’s regression suite, solved, plus every .frd GitHub’s code search will return – with no divergences. One of those files is binary and only this library can read it, which is counted as its own verdict rather than as an agreement. The method, the findings, and an explicit account of what the sweep does not establish are in doc/parity.md. Deliberate differences from PyVista are listed in doc/divergences.md.
Credit
The FRD reader this library reimplements was written by Rafal (@3rav) in pyvista#8255, and every behavioural decision reproduced here is one he made first. His reader is vendored unchanged as the oracle this project is tested against. The format itself is CalculiX’s, by Guido Dhondt and Klaus Wittig. See doc/history.md for the full lineage and licensing.
Relationship to PyVista’s reader
PyVista ships its own .frd reader, written in Python. This package is a reimplementation of it, and agreement with it is the claim being made: the conformance suite compares every array of every file in the corpus against PyVista’s own parser, bit for bit, and the exceptions are listed in doc/divergences.md with the test that pins each one.
This package deliberately does not register itself as PyVista’s .frd handler. Doing so today would make pv.read use this reader while pv.get_reader kept the built-in — two readers for one extension, differing by which call the user made. Overriding it properly is a follow-up.
Using it from C++
The core builds standalone and installs a header and a library:
cmake -S cpp -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
cpp/include/pvfrd/pvfrd.h is the whole public surface. It is plain C with no C++ types crossing the boundary:
#include <pvfrd/pvfrd.h>
pvfrd_file *file = NULL;
if (pvfrd_open("mesh.frd", &file) != PVFRD_OK) { /* handle it */ }
const double *points = pvfrd_points(file);
uint64_t n_points = pvfrd_n_points(file);
int64_t index = pvfrd_find_array(file, /* step */ 0, "STRESS_Mises");
const double *mises = NULL;
pvfrd_array_data(file, 0, index, &mises);
pvfrd_close(file);
Linking against the shared library needs nothing else. Linking against the static one needs the C++ runtime and libm named explicitly – -lstdc++ -lm on GCC and Clang – because a static archive carries no link dependencies of its own. CI compiles and links the example above on every push, so if it is wrong here it is wrong in a way that reddens a build.
Opening a file parses the mesh and indexes the result blocks; a step’s values are parsed when that step is first asked for, so reading one time step of a many-step file does not pay for the rest. pvfrd_open_memory takes bytes you already have, for callers holding the file in an archive or an HTTP response.
Development
cmake -S cpp -B cpp/build -DPVFRD_BUILD_TESTS=ON
cmake --build cpp/build
./cpp/build/pvfrd_tests # the C++ tier
pip install -e .[tests]
pytest # conformance against PyVista
Both tiers read the same fixture corpus under tests/fixtures/.
tools/mutate.py breaks the C++ on purpose — twenty-one plausible mistakes, one at a time — and checks that the suite reddens for each. A green suite has two explanations, and that script is what tells them apart. It is also how the corpus grew: two mutants survived the first sweep, and the files that now catch them were written in response.
Releasing
Tag it. doc/releasing.md covers the one-time PyPI setup and what the pipeline checks before it will publish.
License
MIT. The vendored fast_float header under cpp/third_party/ is Apache-2.0 / MIT / BSL at your option.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyvista_frd_reader-0.2.1.tar.gz.
File metadata
- Download URL: pyvista_frd_reader-0.2.1.tar.gz
- Upload date:
- Size: 500.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e410d6ceac7cad424326bb75d55c3706acbdba97656bb05f2e042df64b965c43
|
|
| MD5 |
1a9ba2f12b5c078311ae31ccd6a7d8ca
|
|
| BLAKE2b-256 |
3338ae20cd309d9983cdcae848ba4eb6ce1594b7dfa915af60f7be17c667d64c
|
Provenance
The following attestation bundles were made for pyvista_frd_reader-0.2.1.tar.gz:
Publisher:
native.yml on pyvista/pyvista-frd-reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyvista_frd_reader-0.2.1.tar.gz -
Subject digest:
e410d6ceac7cad424326bb75d55c3706acbdba97656bb05f2e042df64b965c43 - Sigstore transparency entry: 2642535179
- Sigstore integration time:
-
Permalink:
pyvista/pyvista-frd-reader@f536a97cc98c6f1513debc3fcfede36b5f7839b8 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/pyvista
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
native.yml@f536a97cc98c6f1513debc3fcfede36b5f7839b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyvista_frd_reader-0.2.1-py3-none-win_amd64.whl.
File metadata
- Download URL: pyvista_frd_reader-0.2.1-py3-none-win_amd64.whl
- Upload date:
- Size: 128.9 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70d0f81544d42c0287f376623103dd557df3a42327140bee8f2fa23eed90d61c
|
|
| MD5 |
f48df143952dad6964bd155db6ec58c8
|
|
| BLAKE2b-256 |
caa90b193aeebcc2e892315decc6f99b1c0a7b81409421b32c524a64ac32370e
|
Provenance
The following attestation bundles were made for pyvista_frd_reader-0.2.1-py3-none-win_amd64.whl:
Publisher:
native.yml on pyvista/pyvista-frd-reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyvista_frd_reader-0.2.1-py3-none-win_amd64.whl -
Subject digest:
70d0f81544d42c0287f376623103dd557df3a42327140bee8f2fa23eed90d61c - Sigstore transparency entry: 2642535226
- Sigstore integration time:
-
Permalink:
pyvista/pyvista-frd-reader@f536a97cc98c6f1513debc3fcfede36b5f7839b8 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/pyvista
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
native.yml@f536a97cc98c6f1513debc3fcfede36b5f7839b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyvista_frd_reader-0.2.1-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyvista_frd_reader-0.2.1-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 147.4 kB
- Tags: Python 3, manylinux: glibc 2.24+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb443939493a6c21b92297a81e9643a3859bc5f9f738ac1df36e590f7f09c02a
|
|
| MD5 |
ddda5600a4132fcdfdb0e271d31dd488
|
|
| BLAKE2b-256 |
35316ac2e5a694bfbabc09697c652e5c25494a4dfa2e8196895056489eadb482
|
Provenance
The following attestation bundles were made for pyvista_frd_reader-0.2.1-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
native.yml on pyvista/pyvista-frd-reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyvista_frd_reader-0.2.1-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
cb443939493a6c21b92297a81e9643a3859bc5f9f738ac1df36e590f7f09c02a - Sigstore transparency entry: 2642535311
- Sigstore integration time:
-
Permalink:
pyvista/pyvista-frd-reader@f536a97cc98c6f1513debc3fcfede36b5f7839b8 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/pyvista
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
native.yml@f536a97cc98c6f1513debc3fcfede36b5f7839b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyvista_frd_reader-0.2.1-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: pyvista_frd_reader-0.2.1-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 134.6 kB
- Tags: Python 3, manylinux: glibc 2.24+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bdef0f7f7b4eae8ce0761bd47d736f0d8fb120a5029d90e4028ad0bb80d138c
|
|
| MD5 |
0ad25c8b0d641258b4f2dadd26496a73
|
|
| BLAKE2b-256 |
19edd3dbb20e37a9be1e37b6246f948f4daf450db2e9db691bb874e337043e01
|
Provenance
The following attestation bundles were made for pyvista_frd_reader-0.2.1-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl:
Publisher:
native.yml on pyvista/pyvista-frd-reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyvista_frd_reader-0.2.1-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl -
Subject digest:
4bdef0f7f7b4eae8ce0761bd47d736f0d8fb120a5029d90e4028ad0bb80d138c - Sigstore transparency entry: 2642535272
- Sigstore integration time:
-
Permalink:
pyvista/pyvista-frd-reader@f536a97cc98c6f1513debc3fcfede36b5f7839b8 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/pyvista
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
native.yml@f536a97cc98c6f1513debc3fcfede36b5f7839b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyvista_frd_reader-0.2.1-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyvista_frd_reader-0.2.1-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 116.5 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1afb7bd7d265d26c03ba3cca28439ceb67f0afa6963230992f3c6c7b493670c4
|
|
| MD5 |
e4fa6e45728868a1cf9e94f0474d7a82
|
|
| BLAKE2b-256 |
2ce70d6627776b72bdb41cc7a8780228bbc00b37199db04aee95f36ec6bfe988
|
Provenance
The following attestation bundles were made for pyvista_frd_reader-0.2.1-py3-none-macosx_11_0_arm64.whl:
Publisher:
native.yml on pyvista/pyvista-frd-reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyvista_frd_reader-0.2.1-py3-none-macosx_11_0_arm64.whl -
Subject digest:
1afb7bd7d265d26c03ba3cca28439ceb67f0afa6963230992f3c6c7b493670c4 - Sigstore transparency entry: 2642535351
- Sigstore integration time:
-
Permalink:
pyvista/pyvista-frd-reader@f536a97cc98c6f1513debc3fcfede36b5f7839b8 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/pyvista
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
native.yml@f536a97cc98c6f1513debc3fcfede36b5f7839b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyvista_frd_reader-0.2.1-py3-none-macosx_10_15_x86_64.whl.
File metadata
- Download URL: pyvista_frd_reader-0.2.1-py3-none-macosx_10_15_x86_64.whl
- Upload date:
- Size: 125.2 kB
- Tags: Python 3, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
895587076ae3426cc7ce570953f642ebca8c9ca4d5f495259d87841ca75c683a
|
|
| MD5 |
3e0b47cb971ac185901f51460fe4f479
|
|
| BLAKE2b-256 |
605964ab5a61d8bce60db0c33efaeb778aaef48f27fdd0969f66796d8542d473
|
Provenance
The following attestation bundles were made for pyvista_frd_reader-0.2.1-py3-none-macosx_10_15_x86_64.whl:
Publisher:
native.yml on pyvista/pyvista-frd-reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyvista_frd_reader-0.2.1-py3-none-macosx_10_15_x86_64.whl -
Subject digest:
895587076ae3426cc7ce570953f642ebca8c9ca4d5f495259d87841ca75c683a - Sigstore transparency entry: 2642535298
- Sigstore integration time:
-
Permalink:
pyvista/pyvista-frd-reader@f536a97cc98c6f1513debc3fcfede36b5f7839b8 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/pyvista
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
native.yml@f536a97cc98c6f1513debc3fcfede36b5f7839b8 -
Trigger Event:
push
-
Statement type: