From 0770d852fcdbf7dfcc4dd8f4ef6453000972a8b4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 27 Jun 2026 14:52:32 +0000 Subject: [PATCH 1/4] v2: harden interface, add field integral, parallel time-series, tests/CI Interface & robustness: - Implement the long-form flags that were documented but silently ignored (--res, --data, --batch, --out, --view, --threads). - Reject unknown options and malformed/zero view vectors instead of swallowing them; wrap main in try/catch so bad input gives a clean "Error: ..." and exit 1 rather than an abort/std::terminate crash. - Report data-file size mismatches with mesh vertex/face counts. Generic analysis: - Add the area integral of the field (sum value*pixel_area) alongside average/min/max. This is domain-agnostic: a radiance field yields radiant intensity, pressure yields force, etc. Exposed in text and JSON output; JSON now also carries resolution, width/height, min/max, image, and emits null for non-finite numbers so pipelines don't break. Performance / time-series: - Separate the scalar field from the read-only mesh and process batch timesteps across a standard-library thread pool (one renderer per worker, output kept in view order). A fixed -d field loads once and is shared; per-timestep field files stream on demand, so peak memory is O(threads) not O(timesteps). Field parsing switched to strtod. - ~1000 changing-view/changing-field timesteps on the 70k-triangle bunny now run in ~1.5s. - Resolve relative batch data-file paths against the batch file's directory so a case folder is portable across working directories. Build (dependency-free / airgapped): - Add a one-line Makefile and document a single-compiler-invocation build; link Threads in CMake (required by std::thread). Examples, tests, CI: - Rewrite generate_field.py to be standard-library only (no numpy/pyvista) and emit a portable time-series case; drop the stale cases.txt that referenced missing data. - Commit a small ready-to-run timeseries_demo and add a dependency-free test suite (bash+awk) covering geometry, the integral, and interface errors, plus a GitHub Actions workflow building with GCC/Clang and CMake. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Tp1jQ6ZJCz1QXTASbyVhE7 --- .github/workflows/ci.yml | 45 ++ .gitignore | 9 + Makefile | 26 + README.md | 235 ++++---- examples/with_fields/cases.txt | 9 - examples/with_fields/generate_field.py | 90 ++- .../timeseries_demo/field_0000.txt | 162 +++++ .../timeseries_demo/field_0001.txt | 162 +++++ .../timeseries_demo/field_0002.txt | 162 +++++ .../timeseries_demo/field_0003.txt | 162 +++++ .../timeseries_demo/field_0004.txt | 162 +++++ .../timeseries_demo/field_0005.txt | 162 +++++ .../timeseries_demo/field_0006.txt | 162 +++++ .../timeseries_demo/field_0007.txt | 162 +++++ .../timeseries_demo/field_0008.txt | 162 +++++ .../timeseries_demo/field_0009.txt | 162 +++++ .../timeseries_demo/field_0010.txt | 162 +++++ .../timeseries_demo/field_0011.txt | 162 +++++ .../timeseries_demo/field_0012.txt | 162 +++++ .../timeseries_demo/field_0013.txt | 162 +++++ .../timeseries_demo/field_0014.txt | 162 +++++ .../timeseries_demo/field_0015.txt | 162 +++++ .../timeseries_demo/field_0016.txt | 162 +++++ .../timeseries_demo/field_0017.txt | 162 +++++ .../timeseries_demo/field_0018.txt | 162 +++++ .../timeseries_demo/field_0019.txt | 162 +++++ .../timeseries_demo/field_0020.txt | 162 +++++ .../timeseries_demo/field_0021.txt | 162 +++++ .../timeseries_demo/field_0022.txt | 162 +++++ .../timeseries_demo/field_0023.txt | 162 +++++ .../timeseries_demo/timeseries.txt | 25 + src/CMakeLists.txt | 22 +- src/main.cpp | 552 +++++++++++------- tests/run_tests.sh | 89 +++ 34 files changed, 4639 insertions(+), 351 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 Makefile delete mode 100644 examples/with_fields/cases.txt create mode 100644 examples/with_fields/timeseries_demo/field_0000.txt create mode 100644 examples/with_fields/timeseries_demo/field_0001.txt create mode 100644 examples/with_fields/timeseries_demo/field_0002.txt create mode 100644 examples/with_fields/timeseries_demo/field_0003.txt create mode 100644 examples/with_fields/timeseries_demo/field_0004.txt create mode 100644 examples/with_fields/timeseries_demo/field_0005.txt create mode 100644 examples/with_fields/timeseries_demo/field_0006.txt create mode 100644 examples/with_fields/timeseries_demo/field_0007.txt create mode 100644 examples/with_fields/timeseries_demo/field_0008.txt create mode 100644 examples/with_fields/timeseries_demo/field_0009.txt create mode 100644 examples/with_fields/timeseries_demo/field_0010.txt create mode 100644 examples/with_fields/timeseries_demo/field_0011.txt create mode 100644 examples/with_fields/timeseries_demo/field_0012.txt create mode 100644 examples/with_fields/timeseries_demo/field_0013.txt create mode 100644 examples/with_fields/timeseries_demo/field_0014.txt create mode 100644 examples/with_fields/timeseries_demo/field_0015.txt create mode 100644 examples/with_fields/timeseries_demo/field_0016.txt create mode 100644 examples/with_fields/timeseries_demo/field_0017.txt create mode 100644 examples/with_fields/timeseries_demo/field_0018.txt create mode 100644 examples/with_fields/timeseries_demo/field_0019.txt create mode 100644 examples/with_fields/timeseries_demo/field_0020.txt create mode 100644 examples/with_fields/timeseries_demo/field_0021.txt create mode 100644 examples/with_fields/timeseries_demo/field_0022.txt create mode 100644 examples/with_fields/timeseries_demo/field_0023.txt create mode 100644 examples/with_fields/timeseries_demo/timeseries.txt create mode 100755 tests/run_tests.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4f22c9a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: CI + +on: + push: + branches: ["**"] + pull_request: + +jobs: + build-and-test: + name: Build & test (${{ matrix.os }} / ${{ matrix.cxx }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + cxx: [g++, clang++] + exclude: + # macOS g++ is an alias for clang; one clang job there is enough. + - os: macos-latest + cxx: g++ + steps: + - uses: actions/checkout@v4 + + - name: Build (dependency-free, single recipe) + run: make CXX=${{ matrix.cxx }} + + - name: Run test suite + run: ./tests/run_tests.sh ./flatland + + - name: Smoke-test the committed time-series example + run: | + ./flatland examples/sphere_areas/sphere_coarse.obj \ + -b examples/with_fields/timeseries_demo/timeseries.txt -j > /dev/null + + cmake-build: + name: CMake build (Ubuntu) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Configure & build with CMake + run: | + cmake -S src -B build -DCMAKE_BUILD_TYPE=Release + cmake --build build --config Release + - name: Run test suite against CMake binary + run: ./tests/run_tests.sh ./build/flatland diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bf70044 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# Build artifacts +/build/ +src/build/ +/flatland +*.o +*.ppm + +# OS cruft +.DS_Store diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9741c7a --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +# FlatLand — dependency-free build. +# +# No CMake, no third-party libraries: just a C++17 compiler. Ideal for airgapped +# or minimal systems. +# +# make # build ./flatland +# make test # build, then run the test suite +# make clean # remove build artifacts +# +# Override the compiler if needed: make CXX=clang++ + +CXX ?= c++ +CXXFLAGS ?= -std=c++17 -O2 -Wall +LDFLAGS ?= -pthread +SRC = src/main.cpp +BIN = flatland + +$(BIN): $(SRC) + $(CXX) $(CXXFLAGS) $(SRC) -o $(BIN) $(LDFLAGS) + +.PHONY: test clean +test: $(BIN) + ./tests/run_tests.sh ./$(BIN) + +clean: + rm -f $(BIN) diff --git a/README.md b/README.md index 3a57856..d04df80 100644 --- a/README.md +++ b/README.md @@ -1,156 +1,161 @@ # FlatLand -FlatLand is a modular C++ utility designed for the geometric analysis and visualization of 3D models via orthographic projection and rasterization. -While primarily focused on computing the projected silhouette and visible surface area of 3D meshes (OBJ format), the latest version introduces scalar field mapping. This allows users to project arbitrary data (e.g., temperature, stress, pressure) defined on nodes or faces onto the 2D viewing plane, generating average value statistics and heatmap visualizations. +FlatLand is a small, dependency-free C++ utility for the geometric analysis of 3D +meshes (OBJ) via orthographic projection and software rasterization. -The tool features a custom Z-buffer implementation for depth testing and edge-function rasterization for high-fidelity coverage calculations. It is optimized for batch processing, supporting runtime precision switching (Float vs Double) and per-view resolution settings. +Its core job is computing the **projected (visible) surface area** of a mesh from +arbitrary viewing angles. On top of that it can map a **scalar field** (defined per +node or per face — temperature, pressure, radiance, stress, …) onto the visible +projection and report per-view statistics: average, min, max, and the **area +integral** `∫ f dA`. The integral is deliberately generic: supply a radiance field +and it is radiant intensity; supply pressure and it is a force; FlatLand itself +stays domain-agnostic. -## Key Features - - **Projected Area Analysis**: Accurate calculation of visible surface area from arbitrary viewing angles. - - **Scalar Data Mapping**: Load external data files (node-based or face-based) to compute visible average values and generate heatmap images. - - **Flexible Batch Mode**: Process thousands of views with a single load of the mesh geometry. Supports overriding resolution and data files per-view. - - **Runtime Precision**: Switch between float (speed) and double (accuracy) arithmetic via CLI flags. - - **Visual Output**: export .ppm heatmaps of the projected mesh. - - **JSON Integration**: Structured output for easy parsing in automated pipelines. +It is built for **time-dependent batches** — sweep thousands of timesteps with a +changing view direction *and* a changing field over a fixed mesh, in seconds. -## Build Instructions -The tool relies on standard C++17 and CMake (3.14+). No third-party dependencies are required. +## Design goals +- **Reliable** — clean error handling (no crashes on bad input), a test suite, and CI. +- **Fast** — multi-threaded batch processing; ~1000 changing-field/changing-view + timesteps on a 70k-triangle mesh in a couple of seconds. +- **Dependency-free** — standard C++17 and nothing else. Builds with a single + compiler invocation, which matters on minimal or airgapped systems. + +## Build + +FlatLand is a single `.cpp` file. No third-party libraries. + +**Simplest recipe (airgapped-friendly):** ```shell -# Clone the repository -git clone https://github.com/Interfluo/flatland.git -cd flatland +make # produces ./flatland +``` -# Build using the provided helper script -./run_build.sh +**Or a single compiler call, no build system at all:** +```shell +c++ -std=c++17 -O2 -pthread src/main.cpp -o flatland ``` -Alternatively, you can build manually via CMake: + +**Or via CMake (3.14+):** ```shell -mkdir build && cd build -cmake .. -DCMAKE_BUILD_TYPE=Release -cmake --build . --config Release +cmake -S src -B build -DCMAKE_BUILD_TYPE=Release +cmake --build build ``` -To verify the build: +Verify: ```shell -./build/flatland --help +./flatland --help +make test # build + run the test suite ``` +> The only system requirement is a C++17 compiler with threads (`-pthread`), +> available out of the box with stock GCC or Clang. + ## Usage ```shell ./flatland [options] ``` -### Core options -| Flag | Arguments | Description | -| :--- | :-------- | :---------- | -| -v | x y z | Add a single view direction. Can be repeated multiple times. | -| -b | file | Load views from a batch file (see format below). | -| -o | prefix | "Save heatmap images with this filename prefix (e.g., out_0000.ppm)." | -| -j | none | Output results as structured JSON to stdout. | -| -h | none | Show help message. | -### Simulation Parameters +### Options | Flag | Arguments | Description | | :--- | :-------- | :---------- | -| -r | val | Set default pixel resolution (default: 0.001). Used if a batch entry doesn't specify one.| -| -d | file | "Path to a default scalar data file (text file, one value per line)."| -| -p | mode | "Set math precision: float (default, faster) or double (higher accuracy)."| -| --no-cull |none | Disable backface culling (renders all matching faces).| +| `-v, --view` | x y z | Add a single view direction. Repeatable. | +| `-b, --batch` | file | Load views/timesteps from a file (see format below). Additive with `-v`. | +| `-r, --res` | val | Default pixel resolution (default `0.001`). | +| `-d, --data` | file | Default scalar field file (one value per line; length = vertex or face count). | +| `-p, --precision` | mode | `float` (default, faster) or `double` (more accurate). | +| `-t, --threads` | n | Worker threads for batch views (default: auto / all cores). | +| `--no-cull` | — | Disable backface culling (render all faces). | +| `-o, --out` | prefix | Save PPM heatmaps as `_.ppm`. | +| `-j, --json` | — | Emit structured JSON to stdout. | +| `-h, --help` | — | Show help. | + +### Per-view outputs +| Field | Meaning | +| :--- | :--- | +| `area` | Visible projected area = `covered_pixels × resolution²`. | +| `average` | Mean field value over visible pixels (requires a data file). | +| `integral` | Area integral of the field: `Σ value × pixel_area` (= radiant intensity, force, …). | +| `min` / `max` | Field extremes over visible pixels. | + +> **Accuracy note:** coverage is computed by point-sampling pixel centers with edge +> functions and a Z-buffer. Area therefore converges as resolution increases; choose +> a resolution fine enough to resolve thin features (use `-o` to inspect). + +## Time-dependent / batch workflow + +The batch file is the time-series interface: **one line per timestep**, each with its +own view direction and (optionally) its own resolution and field file. -### Batch File Format -The batch file (-b) allows for defining mixed-resolution or mixed-data jobs. Each line represents a view. ```text - [resolution] [data_file_path] + [resolution] [data_file] ``` - - resolution and data_file_path are optional. - - If omitted, the global defaults (set via -r and -d) are used. +- `resolution` and `data_file` are optional; omitted values fall back to `-r` / `-d`. +- Relative `data_file` paths are resolved against the **batch file's directory**, so a + case folder is portable and runs from any working directory. +- Lines starting with `#` are comments. -**Example** views.txt: -```text -# Standard view using global defaults -1.0 0.0 0.0 +A fixed field (one `-d` file) is loaded once and shared across all timesteps; per-line +field files are streamed on demand, so memory stays bounded by the thread count rather +than the number of timesteps. -# High-resolution view (0.005 pixel size) -0.0 1.0 0.0 0.005 +**Example** `timeseries.txt`: +```text +# nx ny nz resolution field_file +1.0 0.0 0.3 0.002 field_0000.txt +0.0 1.0 0.3 0.002 field_0001.txt +-1.0 0.0 0.3 0.002 field_0002.txt +``` +```shell +./flatland part.obj -b timeseries.txt -j > results.json +``` -# View with specific scalar data file overlay -0.0 0.0 1.0 0.002 ./pressure_load_case_2.txt +### Generating a time series +`examples/with_fields/generate_field.py` builds a rotating-view / evolving-field case +using **only the Python standard library** (no numpy/pyvista): +```shell +python3 examples/with_fields/generate_field.py bunny.obj data 1000 0.002 +./flatland bunny.obj -b data/timeseries.txt -j > results.json +``` +A small ready-to-run demo is committed at `examples/with_fields/timeseries_demo/`: +```shell +./flatland examples/sphere_areas/sphere_coarse.obj \ + -b examples/with_fields/timeseries_demo/timeseries.txt ``` -### Examples -**1. Basic Area Calculation**: Calculate the projected area of bunny.obj from the X-axis using default settings. +## Examples +**1. Basic area** — projected area of the bunny down the X axis: ```shell ./flatland bunny.obj -v 1 0 0 ``` -**2. Heatmap Generation with Double Precision**: Map values from temps.txt onto the mesh, render a heatmap to heat_0000.ppm, using high-precision math. +**2. Field heatmap, double precision** — map `temps.txt`, render to `heat_0000.ppm`: ```shell ./flatland engine.obj -v 0 1 1 -d temps.txt -p double -o heat ``` -**3. JSON Pipeline**: Run a batch of views defined in views.txt, outputting strict JSON for a Python script to ingest. +**3. JSON pipeline** — batch of views to JSON: ```shell ./flatland part.obj -b views.txt -j > results.json ``` -## Benchmarks - -### Benchmark 1: Bunny -In this benchmark, we test the impact of varying resolution (pixel area) against computed projected area and note execution times. We use the [Stanford Bunny](https://docs.pyvista.org/api/examples/_autosummary/pyvista.examples.downloads.download_bunny.html#pyvista.examples.downloads.download_bunny) geometry. - -
- -

Pixel size vs image quality

-
- -The projected area calculation converges as expected, and execution times remain fast even for the highest resolution cases. - - - - - - - - -
- -

Projected Area error for Bunnyn

-
- -

Execution time for Bunny

-
- -*Note, that the lowest resolution image is 4x4 pixels while highest resolution image is 12070x15402 pixels.* - -### Benchmark 2: Sphere -This benchmark exercises the tool on an [Icosphere](https://docs.pyvista.org/api/utilities/_autosummary/pyvista.icosphere -) of varying subdivision levels. This is a vital validation case since the area of a unit sphere is known to be $\pi$ from any view angle. - -
- -

Varying Icosphere subdivision levels

-
+## Validation -The results demonstrate exponential convergence towards the correct analytical answer as mesh and pixel resolution increase. - - - - - - - - -
- -

Projected Area error for Icosphere

-
- -

Execution time for Icosphere

-
- - -## Notes / Tips - -1. **Batch Processing**: For large datasets, always use the batch file (-b) option. Repeatedly calling the tool from the CLI incurs overhead from re-loading and parsing the OBJ file every time. - -2. **Resolution**: Use the image output (-o) to perform a sweep of pixel sizes when setting up a new case. Ensure you are not under-resolving thin geometry features. - -3. **Culling**: Running without back-face culling (--no-cull) is supported but rarely necessary unless you are dealing with non-manifold or open surface meshes where "inside" faces contribute to the silhouette. +Two analytical checks (also enforced by the test suite): +- **Cube** — the projected area of a unit cube along an axis is exactly `1`. +- **Sphere** — the projected area of a unit sphere is `π` from any direction; FlatLand + converges to `π` as mesh and pixel resolution increase. +Run the suite (dependency-free, bash + awk): +```shell +make test # or: ./tests/run_tests.sh +``` +CI builds with GCC and Clang (Linux + macOS) and via CMake on every push — see +`.github/workflows/ci.yml`. + +## Tips +1. **Batch over repeated CLI calls** — one `-b` run loads and parses the mesh once; + repeatedly invoking the binary re-parses the OBJ every time. +2. **Pick resolution deliberately** — sweep `-r` with `-o` image output when setting up + a new case so thin geometry isn't under-resolved. +3. **Threads** — batch views run in parallel automatically; cap with `-t` if you need + to leave cores free. +4. **Culling** — `--no-cull` is for non-manifold or open surfaces where "inside" faces + should still contribute to the silhouette. diff --git a/examples/with_fields/cases.txt b/examples/with_fields/cases.txt deleted file mode 100644 index a4c2d8f..0000000 --- a/examples/with_fields/cases.txt +++ /dev/null @@ -1,9 +0,0 @@ -# nx ny nz r file -1 0 0 0.0001 data/face_field_0.txt -1 0 0 0.0001 data/node_field_0.txt -0 1 0 0.0001 data/node_field_0.txt -0 0 1 0.0001 data/node_field_0.txt -0 1 0 0.0001 data/node_field_5.txt -0 1 0 0.0001 data/node_field_20.txt -0 1 0 0.0010 data/node_field_20.txt -0 1 0 0.0100 data/node_field_20.txt \ No newline at end of file diff --git a/examples/with_fields/generate_field.py b/examples/with_fields/generate_field.py index 38c017d..afd3eb0 100644 --- a/examples/with_fields/generate_field.py +++ b/examples/with_fields/generate_field.py @@ -1,21 +1,79 @@ -import numpy as np -import pyvista as pv +#!/usr/bin/env python3 +"""Generate a time-dependent FlatLand case: rotating view + evolving scalar field. +Dependency-free: parses the OBJ itself and uses only the Python standard library +(no numpy / pyvista). This makes the example reproducible with a stock Python 3. -def save_field(filename, values): - lines = [f"{i}\n" for i in values] - - with open(filename, "w") as f: - f.writelines(lines) - return None +For each timestep it writes one node-field file (one value per vertex) and appends +a line to a batch file of the form expected by `flatland -b`: + + + +Usage: + python3 generate_field.py [num_steps] [resolution] + +Example: + python3 generate_field.py bunny.obj data 200 0.001 + ../../src/build/flatland bunny.obj -b data/timeseries.txt -j > results.json +""" +import math +import os +import sys + + +def load_vertices(path): + verts = [] + with open(path) as f: + for line in f: + if line.startswith("v "): + _, x, y, z = line.split()[:4] + verts.append((float(x), float(y), float(z))) + if not verts: + raise SystemExit(f"no vertices found in {path}") + return verts + + +def main(): + if len(sys.argv) < 3: + raise SystemExit(__doc__) + mesh = sys.argv[1] + out_dir = sys.argv[2] + steps = int(sys.argv[3]) if len(sys.argv) > 3 else 200 + res = float(sys.argv[4]) if len(sys.argv) > 4 else 0.001 + + verts = load_vertices(mesh) + os.makedirs(out_dir, exist_ok=True) + + # Normalize x into [0, 1] so the traveling wave is mesh-independent. + xs = [v[0] for v in verts] + x0, x1 = min(xs), max(xs) + span = (x1 - x0) or 1.0 + + batch_path = os.path.join(out_dir, "timeseries.txt") + with open(batch_path, "w") as batch: + batch.write("# nx ny nz resolution field_file (one timestep per line)\n") + for t in range(steps): + # Field: a wave that sweeps along x as time advances. + phase = 2.0 * math.pi * t / steps + freq = 4.0 + # Field file lives beside the batch file; FlatLand resolves the batch's + # relative data paths against the batch file's directory, so the batch + # only needs the bare filename and the case stays portable. + field_name = f"field_{t:04d}.txt" + with open(os.path.join(out_dir, field_name), "w") as ff: + ff.write("\n".join( + f"{math.sin(freq * math.pi * ((v[0] - x0) / span) - phase):.6f}" + for v in verts + )) + ff.write("\n") + + # View: orbit the mesh about the z-axis with a slight tilt. + ang = 2.0 * math.pi * t / steps + nx, ny, nz = math.cos(ang), math.sin(ang), 0.3 + batch.write(f"{nx:.6f} {ny:.6f} {nz:.6f} {res} {field_name}\n") + + print(f"Wrote {steps} timesteps to {batch_path}") if __name__ == "__main__": - mesh = pv.read("bunny.obj") - - for i, v in enumerate(np.linspace(4, 20, 21)): - node_field = np.sin(np.pi*v*mesh.points[:, 0]) - face_field = np.sin(np.pi*v*mesh.cell_centers().points[:, 0]) - - save_field(f"data/node_field_{i}.txt", node_field) - save_field(f"data/face_field_{i}.txt", face_field) + main() diff --git a/examples/with_fields/timeseries_demo/field_0000.txt b/examples/with_fields/timeseries_demo/field_0000.txt new file mode 100644 index 0000000..47aa60b --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0000.txt @@ -0,0 +1,162 @@ +-0.000000 +-0.000000 +-0.000000 +0.160970 +0.160970 +-0.160970 +-0.160970 +-0.000000 +-0.806606 +0.806606 +0.806606 +-0.806606 +0.932032 +-0.932032 +-0.000000 +-0.932032 +0.932032 +-0.000000 +0.000000 +0.000000 +0.000000 +0.000000 +-0.000000 +0.000000 +0.000000 +0.000000 +0.000000 +0.932032 +-0.932032 +-0.000000 +-0.932032 +0.932032 +0.932032 +0.932032 +0.000000 +0.932032 +0.932032 +-0.932032 +-0.932032 +-0.000000 +-0.932032 +-0.932032 +0.800141 +-0.800141 +-0.000000 +-0.852508 +-0.351342 +-0.959869 +0.852508 +0.959869 +0.351342 +-0.800141 +0.800141 +-0.000000 +0.852508 +0.351342 +-0.852508 +-0.351342 +-0.000000 +-0.997549 +-0.996734 +0.160970 +0.978017 +0.978017 +-0.996734 +-0.997549 +-0.000000 +0.997549 +0.996734 +0.996734 +0.997549 +-0.160970 +-0.978017 +-0.978017 +-0.000000 +0.997549 +0.996734 +-0.160970 +-0.978017 +-0.978017 +0.996734 +0.997549 +-0.000000 +-0.997549 +-0.996734 +-0.996734 +-0.997549 +0.160970 +0.978017 +0.978017 +0.800141 +-0.800141 +-0.000000 +-0.852508 +-0.351342 +-0.959869 +0.852508 +0.959869 +0.351342 +-0.800141 +0.800141 +-0.000000 +0.852508 +0.351342 +-0.852508 +-0.351342 +0.909371 +0.909371 +0.806607 +0.302696 +0.753476 +0.276440 +0.302696 +0.276440 +0.753476 +0.909371 +0.909371 +0.806607 +0.302696 +0.753476 +0.302696 +0.753476 +-0.909371 +-0.909371 +-0.806607 +-0.302696 +-0.753476 +-0.276440 +-0.302696 +-0.276440 +-0.753476 +-0.909371 +-0.909371 +-0.806607 +-0.302696 +-0.753476 +-0.302696 +-0.753476 +-0.452168 +0.524026 +0.925532 +0.452168 +-0.925532 +-0.524026 +-0.452168 +0.925532 +0.524026 +0.452168 +-0.524026 +-0.925532 +-0.452168 +0.524026 +0.925532 +0.452168 +-0.925532 +-0.524026 +-0.452168 +0.925532 +0.524026 +0.452168 +-0.524026 +-0.925532 diff --git a/examples/with_fields/timeseries_demo/field_0001.txt b/examples/with_fields/timeseries_demo/field_0001.txt new file mode 100644 index 0000000..c579146 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0001.txt @@ -0,0 +1,162 @@ +-0.258819 +-0.258819 +-0.258819 +0.410929 +0.410929 +0.099958 +0.099958 +-0.258819 +-0.932107 +0.626137 +0.626137 +-0.932107 +0.994064 +-0.806485 +-0.258819 +-0.806485 +0.994064 +-0.258819 +0.258819 +0.258819 +0.258819 +0.258819 +-0.258819 +0.258819 +0.258819 +0.258819 +0.258819 +0.994064 +-0.806485 +-0.258819 +-0.806485 +0.994064 +0.806485 +0.806485 +-0.258819 +0.806485 +0.806485 +-0.994064 +-0.994064 +-0.258819 +-0.994064 +-0.994064 +0.617634 +-0.928119 +-0.258819 +-0.958748 +-0.097052 +-0.854576 +0.688172 +0.999748 +0.581689 +-0.928119 +0.617634 +-0.258819 +0.688172 +0.581689 +-0.958748 +-0.097052 +-0.258819 +-0.981667 +-0.941872 +0.410929 +0.998662 +0.998662 +-0.941872 +-0.981667 +-0.258819 +0.945451 +0.983671 +0.983671 +0.945451 +0.099959 +-0.890722 +-0.890722 +-0.258819 +0.945451 +0.983671 +0.099959 +-0.890722 +-0.890722 +0.983671 +0.945451 +-0.258819 +-0.981667 +-0.941872 +-0.941872 +-0.981667 +0.410929 +0.998662 +0.998662 +0.617634 +-0.928119 +-0.258819 +-0.958748 +-0.097052 +-0.854576 +0.688172 +0.999748 +0.581689 +-0.928119 +0.617634 +-0.258819 +0.688172 +0.581689 +-0.958748 +-0.097052 +0.986050 +0.986050 +0.626137 +0.045705 +0.557635 +0.018288 +0.045705 +0.018288 +0.557635 +0.986050 +0.986050 +0.626137 +0.045705 +0.557635 +0.045705 +0.557635 +-0.770720 +-0.770720 +-0.932107 +-0.539059 +-0.897969 +-0.515754 +-0.539059 +-0.515754 +-0.897969 +-0.770720 +-0.770720 +-0.932107 +-0.539059 +-0.897969 +-0.539059 +-0.897969 +-0.205911 +0.726607 +0.992002 +0.667610 +-0.795989 +-0.285734 +-0.205911 +0.992002 +0.726607 +0.667610 +-0.285734 +-0.795989 +-0.205911 +0.726607 +0.992002 +0.667610 +-0.795989 +-0.285734 +-0.205911 +0.992002 +0.726607 +0.667610 +-0.285734 +-0.795989 diff --git a/examples/with_fields/timeseries_demo/field_0002.txt b/examples/with_fields/timeseries_demo/field_0002.txt new file mode 100644 index 0000000..86b939f --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0002.txt @@ -0,0 +1,162 @@ +-0.500000 +-0.500000 +-0.500000 +0.632884 +0.632884 +0.354075 +0.354075 +-0.500000 +-0.994086 +0.402997 +0.402997 +-0.994086 +0.988351 +-0.625976 +-0.500000 +-0.625976 +0.988351 +-0.500000 +0.500000 +0.500000 +0.500000 +0.500000 +-0.500000 +0.500000 +0.500000 +0.500000 +0.500000 +0.988351 +-0.625976 +-0.500000 +-0.625976 +0.988351 +0.625976 +0.625976 +-0.500000 +0.625976 +0.625976 +-0.988351 +-0.988351 +-0.500000 +-0.988351 +-0.988351 +0.393036 +-0.992848 +-0.500000 +-0.999651 +0.163852 +-0.691046 +0.476937 +0.971496 +0.772395 +-0.992848 +0.393036 +-0.500000 +0.476937 +0.772395 +-0.999651 +0.163852 +-0.500000 +-0.898886 +-0.822823 +0.632884 +0.951250 +0.951250 +-0.822823 +-0.898886 +-0.500000 +0.828921 +0.903572 +0.903572 +0.828921 +0.354076 +-0.742725 +-0.742725 +-0.500000 +0.828921 +0.903572 +0.354076 +-0.742725 +-0.742725 +0.903572 +0.828921 +-0.500000 +-0.898886 +-0.822823 +-0.822823 +-0.898886 +0.632884 +0.951250 +0.951250 +0.393036 +-0.992848 +-0.500000 +-0.999651 +0.163852 +-0.691046 +0.476937 +0.971496 +0.772395 +-0.992848 +0.393036 +-0.500000 +0.476937 +0.772395 +-0.999651 +0.163852 +0.995531 +0.995531 +0.402997 +-0.214401 +0.323792 +-0.241111 +-0.214401 +-0.241111 +0.323792 +0.995531 +0.995531 +0.402997 +-0.214401 +0.323792 +-0.214401 +0.323792 +-0.579546 +-0.579546 +-0.994086 +-0.738686 +-0.981267 +-0.719920 +-0.738686 +-0.719920 +-0.981267 +-0.579546 +-0.579546 +-0.994086 +-0.738686 +-0.981267 +-0.738686 +-0.981267 +0.054378 +0.879671 +0.990869 +0.837555 +-0.612200 +-0.027969 +0.054378 +0.990869 +0.879671 +0.837555 +-0.027969 +-0.612200 +0.054378 +0.879671 +0.990869 +0.837555 +-0.612200 +-0.027969 +0.054378 +0.990869 +0.879671 +0.837555 +-0.027969 +-0.612200 diff --git a/examples/with_fields/timeseries_demo/field_0003.txt b/examples/with_fields/timeseries_demo/field_0003.txt new file mode 100644 index 0000000..b22af4b --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0003.txt @@ -0,0 +1,162 @@ +-0.707107 +-0.707107 +-0.707107 +0.811709 +0.811709 +0.584062 +0.584062 +-0.707107 +-0.988320 +0.152393 +0.152393 +-0.988320 +0.915284 +-0.402809 +-0.707107 +-0.402809 +0.915284 +-0.707107 +0.707107 +0.707107 +0.707107 +0.707107 +-0.707107 +0.707107 +0.707107 +0.707107 +0.707107 +0.915284 +-0.402809 +-0.707107 +-0.402809 +0.915284 +0.402809 +0.402809 +-0.707107 +0.402809 +0.402809 +-0.915284 +-0.915284 +-0.707107 +-0.915284 +-0.915284 +0.141653 +-0.989916 +-0.707107 +-0.972429 +0.413590 +-0.480422 +0.233200 +0.877038 +0.910463 +-0.989916 +0.141653 +-0.707107 +0.233200 +0.910463 +-0.972429 +0.413590 +-0.707107 +-0.754847 +-0.647700 +0.811709 +0.839012 +0.839012 +-0.647700 +-0.754847 +-0.707107 +0.655901 +0.761896 +0.761896 +0.655901 +0.584063 +-0.544113 +-0.544113 +-0.707107 +0.655901 +0.761896 +0.584063 +-0.544113 +-0.544113 +0.761896 +0.655901 +-0.707107 +-0.754847 +-0.647700 +-0.647700 +-0.754847 +0.811709 +0.839012 +0.839012 +0.141653 +-0.989916 +-0.707107 +-0.972429 +0.413590 +-0.480422 +0.233200 +0.877038 +0.910463 +-0.989916 +0.141653 +-0.707107 +0.233200 +0.910463 +-0.972429 +0.413590 +0.937169 +0.937169 +0.152394 +-0.459896 +0.067883 +-0.484079 +-0.459896 +-0.484079 +0.067883 +0.937169 +0.937169 +0.152394 +-0.459896 +0.067883 +-0.459896 +0.067883 +-0.348876 +-0.348876 +-0.988320 +-0.887973 +-0.997693 +-0.875024 +-0.887973 +-0.875024 +-0.997693 +-0.348876 +-0.348876 +-0.988320 +-0.887973 +-0.997693 +-0.887973 +-0.997693 +0.310961 +0.972787 +0.922209 +0.950423 +-0.386691 +0.231702 +0.310961 +0.922209 +0.972787 +0.950423 +0.231702 +-0.386691 +0.310961 +0.972787 +0.922209 +0.950423 +-0.386691 +0.231702 +0.310961 +0.922209 +0.972787 +0.950423 +0.231702 +-0.386691 diff --git a/examples/with_fields/timeseries_demo/field_0004.txt b/examples/with_fields/timeseries_demo/field_0004.txt new file mode 100644 index 0000000..82c65b6 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0004.txt @@ -0,0 +1,162 @@ +-0.866025 +-0.866025 +-0.866025 +0.935217 +0.935217 +0.774247 +0.774247 +-0.866025 +-0.915201 +-0.108595 +-0.108595 +-0.915201 +0.779842 +-0.152190 +-0.866025 +-0.152190 +0.779842 +-0.866025 +0.866025 +0.866025 +0.866025 +0.866025 +-0.866025 +0.866025 +0.866025 +0.866025 +0.866025 +0.779842 +-0.152190 +-0.866025 +-0.152190 +0.779842 +0.152190 +0.152190 +-0.866025 +0.152190 +0.152190 +-0.779842 +-0.779842 +-0.866025 +-0.779842 +-0.779842 +-0.119383 +-0.919523 +-0.866025 +-0.878937 +0.635143 +-0.237058 +-0.026429 +0.722811 +0.986485 +-0.919523 +-0.119383 +-0.866025 +-0.026429 +0.986485 +-0.878937 +0.635143 +-0.866025 +-0.559366 +-0.428437 +0.935217 +0.669596 +0.669596 +-0.428437 +-0.559366 +-0.866025 +0.438183 +0.568298 +0.568298 +0.438183 +0.774247 +-0.308421 +-0.308421 +-0.866025 +0.438183 +0.568298 +0.774247 +-0.308421 +-0.308421 +0.568298 +0.438183 +-0.866025 +-0.559366 +-0.428437 +-0.428437 +-0.559366 +0.935217 +0.669596 +0.669596 +-0.119383 +-0.919523 +-0.866025 +-0.878937 +0.635143 +-0.237058 +-0.026429 +0.722811 +0.986485 +-0.919523 +-0.119383 +-0.866025 +-0.026429 +0.986485 +-0.878937 +0.635143 +0.814940 +0.814940 +-0.108595 +-0.674049 +-0.192652 +-0.694057 +-0.674049 +-0.694057 +-0.192652 +0.814940 +0.814940 +-0.108595 +-0.674049 +-0.192652 +-0.674049 +-0.192652 +-0.094431 +-0.094431 +-0.915201 +-0.976746 +-0.946128 +-0.970498 +-0.976746 +-0.970498 +-0.946128 +-0.094431 +-0.094431 +-0.915201 +-0.976746 +-0.946128 +-0.976746 +-0.946128 +0.546353 +0.999609 +0.790703 +0.998520 +-0.134829 +0.475583 +0.546353 +0.790703 +0.999609 +0.998520 +0.475583 +-0.134829 +0.546353 +0.999609 +0.790703 +0.998520 +-0.134829 +0.475583 +0.546353 +0.790703 +0.999609 +0.998520 +0.475583 +-0.134829 diff --git a/examples/with_fields/timeseries_demo/field_0005.txt b/examples/with_fields/timeseries_demo/field_0005.txt new file mode 100644 index 0000000..7291e65 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0005.txt @@ -0,0 +1,162 @@ +-0.965926 +-0.965926 +-0.965926 +0.994992 +0.994992 +0.911667 +0.911667 +-0.965926 +-0.779713 +-0.362183 +-0.362183 +-0.779713 +0.591255 +0.108800 +-0.965926 +0.108800 +0.591255 +-0.965926 +0.965926 +0.965926 +0.965926 +0.965926 +-0.965926 +0.965926 +0.965926 +0.965926 +0.965926 +0.591255 +0.108800 +-0.965926 +0.108800 +0.591255 +-0.108800 +-0.108800 +-0.965926 +-0.108800 +-0.108800 +-0.591255 +-0.591255 +-0.965926 +-0.591255 +-0.591255 +-0.372283 +-0.786466 +-0.965926 +-0.725548 +0.813411 +0.022461 +-0.284257 +0.519326 +0.995279 +-0.786466 +-0.372283 +-0.965926 +-0.284257 +0.995279 +-0.725548 +0.813411 +-0.965926 +-0.325766 +-0.179977 +0.994992 +0.454549 +0.454549 +-0.179977 +-0.325766 +-0.965926 +0.190604 +0.335971 +0.335971 +0.190604 +0.911667 +-0.051710 +-0.051710 +-0.965926 +0.190604 +0.335971 +0.911667 +-0.051710 +-0.051710 +0.335971 +0.190604 +-0.965926 +-0.325766 +-0.179977 +-0.179977 +-0.325766 +0.994992 +0.454549 +0.454549 +-0.372283 +-0.786466 +-0.965926 +-0.725548 +0.813411 +0.022461 +-0.284257 +0.519326 +0.995279 +-0.786466 +-0.372283 +-0.965926 +-0.284257 +0.995279 +-0.725548 +0.813411 +0.637174 +0.637174 +-0.362183 +-0.842268 +-0.440059 +-0.856737 +-0.842268 +-0.856737 +-0.440059 +0.637174 +0.637174 +-0.362183 +-0.842268 +-0.440059 +-0.842268 +-0.440059 +0.166449 +0.166449 +-0.779713 +-0.998955 +-0.830086 +-0.999833 +-0.998955 +-0.999833 +-0.830086 +0.166449 +0.166449 +-0.779713 +-0.998955 +-0.830086 +-0.998955 +-0.830086 +0.744511 +0.958309 +0.605311 +0.978571 +0.126221 +0.687053 +0.744511 +0.605311 +0.958309 +0.978571 +0.687053 +0.126221 +0.744511 +0.958309 +0.605311 +0.978571 +0.126221 +0.687053 +0.744511 +0.605311 +0.958309 +0.978571 +0.687053 +0.126221 diff --git a/examples/with_fields/timeseries_demo/field_0006.txt b/examples/with_fields/timeseries_demo/field_0006.txt new file mode 100644 index 0000000..1d51ddd --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0006.txt @@ -0,0 +1,162 @@ +-1.000000 +-1.000000 +-1.000000 +0.986959 +0.986959 +0.986959 +0.986959 +-1.000000 +-0.591089 +-0.591089 +-0.591089 +-0.591089 +0.362375 +0.362375 +-1.000000 +0.362375 +0.362375 +-1.000000 +1.000000 +1.000000 +1.000000 +1.000000 +-1.000000 +1.000000 +1.000000 +1.000000 +1.000000 +0.362375 +0.362375 +-1.000000 +0.362375 +0.362375 +-0.362375 +-0.362375 +-1.000000 +-0.362375 +-0.362375 +-0.362375 +-0.362375 +-1.000000 +-0.362375 +-0.362375 +-0.599813 +-0.599813 +-1.000000 +-0.522714 +0.936247 +0.280450 +-0.522714 +0.280450 +0.936247 +-0.599813 +-0.599813 +-1.000000 +-0.522714 +0.936247 +-0.522714 +0.936247 +-1.000000 +-0.069965 +0.080749 +0.986959 +0.208525 +0.208525 +0.080749 +-0.069965 +-1.000000 +-0.069965 +0.080749 +0.080749 +-0.069965 +0.986959 +0.208525 +0.208525 +-1.000000 +-0.069965 +0.080749 +0.986959 +0.208525 +0.208525 +0.080749 +-0.069965 +-1.000000 +-0.069965 +0.080749 +0.080749 +-0.069965 +0.986959 +0.208525 +0.208525 +-0.599813 +-0.599813 +-1.000000 +-0.522714 +0.936247 +0.280450 +-0.522714 +0.280450 +0.936247 +-0.599813 +-0.599813 +-1.000000 +-0.522714 +0.936247 +-0.522714 +0.936247 +0.415986 +0.415986 +-0.591089 +-0.953087 +-0.657475 +-0.961031 +-0.953087 +-0.961031 +-0.657475 +0.415986 +0.415986 +-0.591089 +-0.953087 +-0.657475 +-0.953087 +-0.657475 +0.415986 +0.415986 +-0.591089 +-0.953087 +-0.657475 +-0.961031 +-0.953087 +-0.961031 +-0.657475 +0.415986 +0.415986 +-0.591089 +-0.953087 +-0.657475 +-0.953087 +-0.657475 +0.891933 +0.851702 +0.378669 +0.891933 +0.378669 +0.851702 +0.891933 +0.378669 +0.851702 +0.891933 +0.851702 +0.378669 +0.891933 +0.851702 +0.378669 +0.891933 +0.378669 +0.851702 +0.891933 +0.378669 +0.851702 +0.891933 +0.851702 +0.378669 diff --git a/examples/with_fields/timeseries_demo/field_0007.txt b/examples/with_fields/timeseries_demo/field_0007.txt new file mode 100644 index 0000000..166f7b4 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0007.txt @@ -0,0 +1,162 @@ +-0.965926 +-0.965926 +-0.965926 +0.911667 +0.911667 +0.994992 +0.994992 +-0.965926 +-0.362183 +-0.779713 +-0.779713 +-0.362183 +0.108800 +0.591255 +-0.965926 +0.591255 +0.108800 +-0.965926 +0.965926 +0.965926 +0.965926 +0.965926 +-0.965926 +0.965926 +0.965926 +0.965926 +0.965926 +0.108800 +0.591255 +-0.965926 +0.591255 +0.108800 +-0.591255 +-0.591255 +-0.965926 +-0.591255 +-0.591255 +-0.108800 +-0.108800 +-0.965926 +-0.108800 +-0.108800 +-0.786466 +-0.372283 +-0.965926 +-0.284257 +0.995279 +0.519326 +-0.725548 +0.022461 +0.813411 +-0.372283 +-0.786466 +-0.965926 +-0.725548 +0.813411 +-0.284257 +0.995279 +-0.965926 +0.190604 +0.335971 +0.911667 +-0.051710 +-0.051710 +0.335971 +0.190604 +-0.965926 +-0.325766 +-0.179977 +-0.179977 +-0.325766 +0.994992 +0.454549 +0.454549 +-0.965926 +-0.325766 +-0.179977 +0.994992 +0.454549 +0.454549 +-0.179977 +-0.325766 +-0.965926 +0.190604 +0.335971 +0.335971 +0.190604 +0.911667 +-0.051710 +-0.051710 +-0.786466 +-0.372283 +-0.965926 +-0.284257 +0.995279 +0.519326 +-0.725548 +0.022461 +0.813411 +-0.372283 +-0.786466 +-0.965926 +-0.725548 +0.813411 +-0.284257 +0.995279 +0.166449 +0.166449 +-0.779713 +-0.998955 +-0.830086 +-0.999833 +-0.998955 +-0.999833 +-0.830086 +0.166449 +0.166449 +-0.779713 +-0.998955 +-0.830086 +-0.998955 +-0.830086 +0.637174 +0.637174 +-0.362183 +-0.842268 +-0.440059 +-0.856737 +-0.842268 +-0.856737 +-0.440059 +0.637174 +0.637174 +-0.362183 +-0.842268 +-0.440059 +-0.842268 +-0.440059 +0.978571 +0.687053 +0.126221 +0.744511 +0.605311 +0.958309 +0.978571 +0.126221 +0.687053 +0.744511 +0.958309 +0.605311 +0.978571 +0.687053 +0.126221 +0.744511 +0.605311 +0.958309 +0.978571 +0.126221 +0.687053 +0.744511 +0.958309 +0.605311 diff --git a/examples/with_fields/timeseries_demo/field_0008.txt b/examples/with_fields/timeseries_demo/field_0008.txt new file mode 100644 index 0000000..f803779 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0008.txt @@ -0,0 +1,162 @@ +-0.866025 +-0.866025 +-0.866025 +0.774247 +0.774247 +0.935217 +0.935217 +-0.866025 +-0.108595 +-0.915201 +-0.915201 +-0.108595 +-0.152190 +0.779842 +-0.866025 +0.779842 +-0.152190 +-0.866025 +0.866025 +0.866025 +0.866025 +0.866025 +-0.866025 +0.866025 +0.866025 +0.866025 +0.866025 +-0.152190 +0.779842 +-0.866025 +0.779842 +-0.152190 +-0.779842 +-0.779842 +-0.866025 +-0.779842 +-0.779842 +0.152190 +0.152190 +-0.866025 +0.152190 +0.152190 +-0.919523 +-0.119383 +-0.866025 +-0.026429 +0.986485 +0.722811 +-0.878937 +-0.237058 +0.635143 +-0.119383 +-0.919523 +-0.866025 +-0.878937 +0.635143 +-0.026429 +0.986485 +-0.866025 +0.438183 +0.568298 +0.774247 +-0.308421 +-0.308421 +0.568298 +0.438183 +-0.866025 +-0.559366 +-0.428437 +-0.428437 +-0.559366 +0.935217 +0.669596 +0.669596 +-0.866025 +-0.559366 +-0.428437 +0.935217 +0.669596 +0.669596 +-0.428437 +-0.559366 +-0.866025 +0.438183 +0.568298 +0.568298 +0.438183 +0.774247 +-0.308421 +-0.308421 +-0.919523 +-0.119383 +-0.866025 +-0.026429 +0.986485 +0.722811 +-0.878937 +-0.237058 +0.635143 +-0.119383 +-0.919523 +-0.866025 +-0.878937 +0.635143 +-0.026429 +0.986485 +-0.094431 +-0.094431 +-0.915201 +-0.976746 +-0.946128 +-0.970498 +-0.976746 +-0.970498 +-0.946128 +-0.094431 +-0.094431 +-0.915201 +-0.976746 +-0.946128 +-0.976746 +-0.946128 +0.814940 +0.814940 +-0.108595 +-0.674049 +-0.192652 +-0.694057 +-0.674049 +-0.694057 +-0.192652 +0.814940 +0.814940 +-0.108595 +-0.674049 +-0.192652 +-0.674049 +-0.192652 +0.998520 +0.475583 +-0.134829 +0.546353 +0.790703 +0.999609 +0.998520 +-0.134829 +0.475583 +0.546353 +0.999609 +0.790703 +0.998520 +0.475583 +-0.134829 +0.546353 +0.790703 +0.999609 +0.998520 +-0.134829 +0.475583 +0.546353 +0.999609 +0.790703 diff --git a/examples/with_fields/timeseries_demo/field_0009.txt b/examples/with_fields/timeseries_demo/field_0009.txt new file mode 100644 index 0000000..7a42f31 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0009.txt @@ -0,0 +1,162 @@ +-0.707107 +-0.707107 +-0.707107 +0.584062 +0.584062 +0.811709 +0.811709 +-0.707107 +0.152393 +-0.988320 +-0.988320 +0.152393 +-0.402809 +0.915284 +-0.707107 +0.915284 +-0.402809 +-0.707107 +0.707107 +0.707107 +0.707107 +0.707107 +-0.707107 +0.707107 +0.707107 +0.707107 +0.707107 +-0.402809 +0.915284 +-0.707107 +0.915284 +-0.402809 +-0.915284 +-0.915284 +-0.707107 +-0.915284 +-0.915284 +0.402809 +0.402809 +-0.707107 +0.402809 +0.402809 +-0.989916 +0.141653 +-0.707107 +0.233200 +0.910463 +0.877038 +-0.972429 +-0.480422 +0.413590 +0.141653 +-0.989916 +-0.707107 +-0.972429 +0.413590 +0.233200 +0.910463 +-0.707107 +0.655901 +0.761896 +0.584063 +-0.544113 +-0.544113 +0.761896 +0.655901 +-0.707107 +-0.754847 +-0.647700 +-0.647700 +-0.754847 +0.811709 +0.839012 +0.839012 +-0.707107 +-0.754847 +-0.647700 +0.811709 +0.839012 +0.839012 +-0.647700 +-0.754847 +-0.707107 +0.655901 +0.761896 +0.761896 +0.655901 +0.584063 +-0.544113 +-0.544113 +-0.989916 +0.141653 +-0.707107 +0.233200 +0.910463 +0.877038 +-0.972429 +-0.480422 +0.413590 +0.141653 +-0.989916 +-0.707107 +-0.972429 +0.413590 +0.233200 +0.910463 +-0.348876 +-0.348876 +-0.988320 +-0.887973 +-0.997693 +-0.875024 +-0.887973 +-0.875024 +-0.997693 +-0.348876 +-0.348876 +-0.988320 +-0.887973 +-0.997693 +-0.887973 +-0.997693 +0.937169 +0.937169 +0.152394 +-0.459896 +0.067883 +-0.484079 +-0.459896 +-0.484079 +0.067883 +0.937169 +0.937169 +0.152394 +-0.459896 +0.067883 +-0.459896 +0.067883 +0.950423 +0.231702 +-0.386691 +0.310961 +0.922209 +0.972787 +0.950423 +-0.386691 +0.231702 +0.310961 +0.972787 +0.922209 +0.950423 +0.231702 +-0.386691 +0.310961 +0.922209 +0.972787 +0.950423 +-0.386691 +0.231702 +0.310961 +0.972787 +0.922209 diff --git a/examples/with_fields/timeseries_demo/field_0010.txt b/examples/with_fields/timeseries_demo/field_0010.txt new file mode 100644 index 0000000..24bee1b --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0010.txt @@ -0,0 +1,162 @@ +-0.500000 +-0.500000 +-0.500000 +0.354075 +0.354075 +0.632884 +0.632884 +-0.500000 +0.402997 +-0.994086 +-0.994086 +0.402997 +-0.625976 +0.988351 +-0.500000 +0.988351 +-0.625976 +-0.500000 +0.500000 +0.500000 +0.500000 +0.500000 +-0.500000 +0.500000 +0.500000 +0.500000 +0.500000 +-0.625976 +0.988351 +-0.500000 +0.988351 +-0.625976 +-0.988351 +-0.988351 +-0.500000 +-0.988351 +-0.988351 +0.625976 +0.625976 +-0.500000 +0.625976 +0.625976 +-0.992848 +0.393036 +-0.500000 +0.476937 +0.772395 +0.971496 +-0.999651 +-0.691046 +0.163852 +0.393036 +-0.992848 +-0.500000 +-0.999651 +0.163852 +0.476937 +0.772395 +-0.500000 +0.828921 +0.903572 +0.354076 +-0.742725 +-0.742725 +0.903572 +0.828921 +-0.500000 +-0.898886 +-0.822823 +-0.822823 +-0.898886 +0.632884 +0.951250 +0.951250 +-0.500000 +-0.898886 +-0.822823 +0.632884 +0.951250 +0.951250 +-0.822823 +-0.898886 +-0.500000 +0.828921 +0.903572 +0.903572 +0.828921 +0.354076 +-0.742725 +-0.742725 +-0.992848 +0.393036 +-0.500000 +0.476937 +0.772395 +0.971496 +-0.999651 +-0.691046 +0.163852 +0.393036 +-0.992848 +-0.500000 +-0.999651 +0.163852 +0.476937 +0.772395 +-0.579546 +-0.579546 +-0.994086 +-0.738686 +-0.981267 +-0.719920 +-0.738686 +-0.719920 +-0.981267 +-0.579546 +-0.579546 +-0.994086 +-0.738686 +-0.981267 +-0.738686 +-0.981267 +0.995531 +0.995531 +0.402997 +-0.214401 +0.323792 +-0.241111 +-0.214401 +-0.241111 +0.323792 +0.995531 +0.995531 +0.402997 +-0.214401 +0.323792 +-0.214401 +0.323792 +0.837555 +-0.027969 +-0.612200 +0.054378 +0.990869 +0.879671 +0.837555 +-0.612200 +-0.027969 +0.054378 +0.879671 +0.990869 +0.837555 +-0.027969 +-0.612200 +0.054378 +0.990869 +0.879671 +0.837555 +-0.612200 +-0.027969 +0.054378 +0.879671 +0.990869 diff --git a/examples/with_fields/timeseries_demo/field_0011.txt b/examples/with_fields/timeseries_demo/field_0011.txt new file mode 100644 index 0000000..535bd08 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0011.txt @@ -0,0 +1,162 @@ +-0.258819 +-0.258819 +-0.258819 +0.099958 +0.099958 +0.410929 +0.410929 +-0.258819 +0.626137 +-0.932107 +-0.932107 +0.626137 +-0.806485 +0.994064 +-0.258819 +0.994064 +-0.806485 +-0.258819 +0.258819 +0.258819 +0.258819 +0.258819 +-0.258819 +0.258819 +0.258819 +0.258819 +0.258819 +-0.806485 +0.994064 +-0.258819 +0.994064 +-0.806485 +-0.994064 +-0.994064 +-0.258819 +-0.994064 +-0.994064 +0.806485 +0.806485 +-0.258819 +0.806485 +0.806485 +-0.928119 +0.617634 +-0.258819 +0.688172 +0.581689 +0.999748 +-0.958748 +-0.854576 +-0.097052 +0.617634 +-0.928119 +-0.258819 +-0.958748 +-0.097052 +0.688172 +0.581689 +-0.258819 +0.945451 +0.983671 +0.099959 +-0.890722 +-0.890722 +0.983671 +0.945451 +-0.258819 +-0.981667 +-0.941872 +-0.941872 +-0.981667 +0.410929 +0.998662 +0.998662 +-0.258819 +-0.981667 +-0.941872 +0.410929 +0.998662 +0.998662 +-0.941872 +-0.981667 +-0.258819 +0.945451 +0.983671 +0.983671 +0.945451 +0.099959 +-0.890722 +-0.890722 +-0.928119 +0.617634 +-0.258819 +0.688172 +0.581689 +0.999748 +-0.958748 +-0.854576 +-0.097052 +0.617634 +-0.928119 +-0.258819 +-0.958748 +-0.097052 +0.688172 +0.581689 +-0.770720 +-0.770720 +-0.932107 +-0.539059 +-0.897969 +-0.515754 +-0.539059 +-0.515754 +-0.897969 +-0.770720 +-0.770720 +-0.932107 +-0.539059 +-0.897969 +-0.539059 +-0.897969 +0.986050 +0.986050 +0.626137 +0.045705 +0.557635 +0.018288 +0.045705 +0.018288 +0.557635 +0.986050 +0.986050 +0.626137 +0.045705 +0.557635 +0.045705 +0.557635 +0.667610 +-0.285734 +-0.795989 +-0.205911 +0.992002 +0.726607 +0.667610 +-0.795989 +-0.285734 +-0.205911 +0.726607 +0.992002 +0.667610 +-0.285734 +-0.795989 +-0.205911 +0.992002 +0.726607 +0.667610 +-0.795989 +-0.285734 +-0.205911 +0.726607 +0.992002 diff --git a/examples/with_fields/timeseries_demo/field_0012.txt b/examples/with_fields/timeseries_demo/field_0012.txt new file mode 100644 index 0000000..76c7bf4 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0012.txt @@ -0,0 +1,162 @@ +0.000000 +0.000000 +0.000000 +-0.160970 +-0.160970 +0.160970 +0.160970 +0.000000 +0.806606 +-0.806606 +-0.806606 +0.806606 +-0.932032 +0.932032 +0.000000 +0.932032 +-0.932032 +0.000000 +0.000000 +0.000000 +-0.000000 +-0.000000 +0.000000 +-0.000000 +-0.000000 +0.000000 +0.000000 +-0.932032 +0.932032 +0.000000 +0.932032 +-0.932032 +-0.932032 +-0.932032 +-0.000000 +-0.932032 +-0.932032 +0.932032 +0.932032 +0.000000 +0.932032 +0.932032 +-0.800141 +0.800141 +0.000000 +0.852508 +0.351342 +0.959869 +-0.852508 +-0.959869 +-0.351342 +0.800141 +-0.800141 +0.000000 +-0.852508 +-0.351342 +0.852508 +0.351342 +0.000000 +0.997549 +0.996734 +-0.160970 +-0.978017 +-0.978017 +0.996734 +0.997549 +0.000000 +-0.997549 +-0.996734 +-0.996734 +-0.997549 +0.160970 +0.978017 +0.978017 +0.000000 +-0.997549 +-0.996734 +0.160970 +0.978017 +0.978017 +-0.996734 +-0.997549 +0.000000 +0.997549 +0.996734 +0.996734 +0.997549 +-0.160970 +-0.978017 +-0.978017 +-0.800141 +0.800141 +0.000000 +0.852508 +0.351342 +0.959869 +-0.852508 +-0.959869 +-0.351342 +0.800141 +-0.800141 +0.000000 +-0.852508 +-0.351342 +0.852508 +0.351342 +-0.909371 +-0.909371 +-0.806607 +-0.302696 +-0.753476 +-0.276440 +-0.302696 +-0.276440 +-0.753476 +-0.909371 +-0.909371 +-0.806607 +-0.302696 +-0.753476 +-0.302696 +-0.753476 +0.909371 +0.909371 +0.806607 +0.302696 +0.753476 +0.276440 +0.302696 +0.276440 +0.753476 +0.909371 +0.909371 +0.806607 +0.302696 +0.753476 +0.302696 +0.753476 +0.452168 +-0.524026 +-0.925532 +-0.452168 +0.925532 +0.524026 +0.452168 +-0.925532 +-0.524026 +-0.452168 +0.524026 +0.925532 +0.452168 +-0.524026 +-0.925532 +-0.452168 +0.925532 +0.524026 +0.452168 +-0.925532 +-0.524026 +-0.452168 +0.524026 +0.925532 diff --git a/examples/with_fields/timeseries_demo/field_0013.txt b/examples/with_fields/timeseries_demo/field_0013.txt new file mode 100644 index 0000000..82c78d1 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0013.txt @@ -0,0 +1,162 @@ +0.258819 +0.258819 +0.258819 +-0.410929 +-0.410929 +-0.099958 +-0.099958 +0.258819 +0.932107 +-0.626137 +-0.626137 +0.932107 +-0.994064 +0.806485 +0.258819 +0.806485 +-0.994064 +0.258819 +-0.258819 +-0.258819 +-0.258819 +-0.258819 +0.258819 +-0.258819 +-0.258819 +-0.258819 +-0.258819 +-0.994064 +0.806485 +0.258819 +0.806485 +-0.994064 +-0.806485 +-0.806485 +0.258819 +-0.806485 +-0.806485 +0.994064 +0.994064 +0.258819 +0.994064 +0.994064 +-0.617634 +0.928119 +0.258819 +0.958748 +0.097052 +0.854576 +-0.688172 +-0.999748 +-0.581689 +0.928119 +-0.617634 +0.258819 +-0.688172 +-0.581689 +0.958748 +0.097052 +0.258819 +0.981667 +0.941872 +-0.410929 +-0.998662 +-0.998662 +0.941872 +0.981667 +0.258819 +-0.945451 +-0.983671 +-0.983671 +-0.945451 +-0.099959 +0.890722 +0.890722 +0.258819 +-0.945451 +-0.983671 +-0.099959 +0.890722 +0.890722 +-0.983671 +-0.945451 +0.258819 +0.981667 +0.941872 +0.941872 +0.981667 +-0.410929 +-0.998662 +-0.998662 +-0.617634 +0.928119 +0.258819 +0.958748 +0.097052 +0.854576 +-0.688172 +-0.999748 +-0.581689 +0.928119 +-0.617634 +0.258819 +-0.688172 +-0.581689 +0.958748 +0.097052 +-0.986050 +-0.986050 +-0.626137 +-0.045705 +-0.557635 +-0.018288 +-0.045705 +-0.018288 +-0.557635 +-0.986050 +-0.986050 +-0.626137 +-0.045705 +-0.557635 +-0.045705 +-0.557635 +0.770720 +0.770720 +0.932107 +0.539059 +0.897969 +0.515754 +0.539059 +0.515754 +0.897969 +0.770720 +0.770720 +0.932107 +0.539059 +0.897969 +0.539059 +0.897969 +0.205911 +-0.726607 +-0.992002 +-0.667610 +0.795989 +0.285734 +0.205911 +-0.992002 +-0.726607 +-0.667610 +0.285734 +0.795989 +0.205911 +-0.726607 +-0.992002 +-0.667610 +0.795989 +0.285734 +0.205911 +-0.992002 +-0.726607 +-0.667610 +0.285734 +0.795989 diff --git a/examples/with_fields/timeseries_demo/field_0014.txt b/examples/with_fields/timeseries_demo/field_0014.txt new file mode 100644 index 0000000..47e01d9 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0014.txt @@ -0,0 +1,162 @@ +0.500000 +0.500000 +0.500000 +-0.632884 +-0.632884 +-0.354075 +-0.354075 +0.500000 +0.994086 +-0.402997 +-0.402997 +0.994086 +-0.988351 +0.625976 +0.500000 +0.625976 +-0.988351 +0.500000 +-0.500000 +-0.500000 +-0.500000 +-0.500000 +0.500000 +-0.500000 +-0.500000 +-0.500000 +-0.500000 +-0.988351 +0.625976 +0.500000 +0.625976 +-0.988351 +-0.625976 +-0.625976 +0.500000 +-0.625976 +-0.625976 +0.988351 +0.988351 +0.500000 +0.988351 +0.988351 +-0.393036 +0.992848 +0.500000 +0.999651 +-0.163852 +0.691046 +-0.476937 +-0.971496 +-0.772395 +0.992848 +-0.393036 +0.500000 +-0.476937 +-0.772395 +0.999651 +-0.163852 +0.500000 +0.898886 +0.822823 +-0.632884 +-0.951250 +-0.951250 +0.822823 +0.898886 +0.500000 +-0.828921 +-0.903572 +-0.903572 +-0.828921 +-0.354076 +0.742725 +0.742725 +0.500000 +-0.828921 +-0.903572 +-0.354076 +0.742725 +0.742725 +-0.903572 +-0.828921 +0.500000 +0.898886 +0.822823 +0.822823 +0.898886 +-0.632884 +-0.951250 +-0.951250 +-0.393036 +0.992848 +0.500000 +0.999651 +-0.163852 +0.691046 +-0.476937 +-0.971496 +-0.772395 +0.992848 +-0.393036 +0.500000 +-0.476937 +-0.772395 +0.999651 +-0.163852 +-0.995531 +-0.995531 +-0.402997 +0.214401 +-0.323792 +0.241111 +0.214401 +0.241111 +-0.323792 +-0.995531 +-0.995531 +-0.402997 +0.214401 +-0.323792 +0.214401 +-0.323792 +0.579546 +0.579546 +0.994086 +0.738686 +0.981267 +0.719920 +0.738686 +0.719920 +0.981267 +0.579546 +0.579546 +0.994086 +0.738686 +0.981267 +0.738686 +0.981267 +-0.054378 +-0.879671 +-0.990869 +-0.837555 +0.612200 +0.027969 +-0.054378 +-0.990869 +-0.879671 +-0.837555 +0.027969 +0.612200 +-0.054378 +-0.879671 +-0.990869 +-0.837555 +0.612200 +0.027969 +-0.054378 +-0.990869 +-0.879671 +-0.837555 +0.027969 +0.612200 diff --git a/examples/with_fields/timeseries_demo/field_0015.txt b/examples/with_fields/timeseries_demo/field_0015.txt new file mode 100644 index 0000000..d830434 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0015.txt @@ -0,0 +1,162 @@ +0.707107 +0.707107 +0.707107 +-0.811709 +-0.811709 +-0.584062 +-0.584062 +0.707107 +0.988320 +-0.152393 +-0.152393 +0.988320 +-0.915284 +0.402809 +0.707107 +0.402809 +-0.915284 +0.707107 +-0.707107 +-0.707107 +-0.707107 +-0.707107 +0.707107 +-0.707107 +-0.707107 +-0.707107 +-0.707107 +-0.915284 +0.402809 +0.707107 +0.402809 +-0.915284 +-0.402809 +-0.402809 +0.707107 +-0.402809 +-0.402809 +0.915284 +0.915284 +0.707107 +0.915284 +0.915284 +-0.141653 +0.989916 +0.707107 +0.972429 +-0.413590 +0.480422 +-0.233200 +-0.877038 +-0.910463 +0.989916 +-0.141653 +0.707107 +-0.233200 +-0.910463 +0.972429 +-0.413590 +0.707107 +0.754847 +0.647700 +-0.811709 +-0.839012 +-0.839012 +0.647700 +0.754847 +0.707107 +-0.655901 +-0.761896 +-0.761896 +-0.655901 +-0.584063 +0.544113 +0.544113 +0.707107 +-0.655901 +-0.761896 +-0.584063 +0.544113 +0.544113 +-0.761896 +-0.655901 +0.707107 +0.754847 +0.647700 +0.647700 +0.754847 +-0.811709 +-0.839012 +-0.839012 +-0.141653 +0.989916 +0.707107 +0.972429 +-0.413590 +0.480422 +-0.233200 +-0.877038 +-0.910463 +0.989916 +-0.141653 +0.707107 +-0.233200 +-0.910463 +0.972429 +-0.413590 +-0.937169 +-0.937169 +-0.152394 +0.459896 +-0.067883 +0.484079 +0.459896 +0.484079 +-0.067883 +-0.937169 +-0.937169 +-0.152394 +0.459896 +-0.067883 +0.459896 +-0.067883 +0.348876 +0.348876 +0.988320 +0.887973 +0.997693 +0.875024 +0.887973 +0.875024 +0.997693 +0.348876 +0.348876 +0.988320 +0.887973 +0.997693 +0.887973 +0.997693 +-0.310961 +-0.972787 +-0.922209 +-0.950423 +0.386691 +-0.231702 +-0.310961 +-0.922209 +-0.972787 +-0.950423 +-0.231702 +0.386691 +-0.310961 +-0.972787 +-0.922209 +-0.950423 +0.386691 +-0.231702 +-0.310961 +-0.922209 +-0.972787 +-0.950423 +-0.231702 +0.386691 diff --git a/examples/with_fields/timeseries_demo/field_0016.txt b/examples/with_fields/timeseries_demo/field_0016.txt new file mode 100644 index 0000000..d324ac5 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0016.txt @@ -0,0 +1,162 @@ +0.866025 +0.866025 +0.866025 +-0.935217 +-0.935217 +-0.774247 +-0.774247 +0.866025 +0.915201 +0.108595 +0.108595 +0.915201 +-0.779842 +0.152190 +0.866025 +0.152190 +-0.779842 +0.866025 +-0.866025 +-0.866025 +-0.866025 +-0.866025 +0.866025 +-0.866025 +-0.866025 +-0.866025 +-0.866025 +-0.779842 +0.152190 +0.866025 +0.152190 +-0.779842 +-0.152190 +-0.152190 +0.866025 +-0.152190 +-0.152190 +0.779842 +0.779842 +0.866025 +0.779842 +0.779842 +0.119383 +0.919523 +0.866025 +0.878937 +-0.635143 +0.237058 +0.026429 +-0.722811 +-0.986485 +0.919523 +0.119383 +0.866025 +0.026429 +-0.986485 +0.878937 +-0.635143 +0.866025 +0.559366 +0.428437 +-0.935217 +-0.669596 +-0.669596 +0.428437 +0.559366 +0.866025 +-0.438183 +-0.568298 +-0.568298 +-0.438183 +-0.774247 +0.308421 +0.308421 +0.866025 +-0.438183 +-0.568298 +-0.774247 +0.308421 +0.308421 +-0.568298 +-0.438183 +0.866025 +0.559366 +0.428437 +0.428437 +0.559366 +-0.935217 +-0.669596 +-0.669596 +0.119383 +0.919523 +0.866025 +0.878937 +-0.635143 +0.237058 +0.026429 +-0.722811 +-0.986485 +0.919523 +0.119383 +0.866025 +0.026429 +-0.986485 +0.878937 +-0.635143 +-0.814940 +-0.814940 +0.108595 +0.674049 +0.192652 +0.694057 +0.674049 +0.694057 +0.192652 +-0.814940 +-0.814940 +0.108595 +0.674049 +0.192652 +0.674049 +0.192652 +0.094431 +0.094431 +0.915201 +0.976746 +0.946128 +0.970498 +0.976746 +0.970498 +0.946128 +0.094431 +0.094431 +0.915201 +0.976746 +0.946128 +0.976746 +0.946128 +-0.546353 +-0.999609 +-0.790703 +-0.998520 +0.134829 +-0.475583 +-0.546353 +-0.790703 +-0.999609 +-0.998520 +-0.475583 +0.134829 +-0.546353 +-0.999609 +-0.790703 +-0.998520 +0.134829 +-0.475583 +-0.546353 +-0.790703 +-0.999609 +-0.998520 +-0.475583 +0.134829 diff --git a/examples/with_fields/timeseries_demo/field_0017.txt b/examples/with_fields/timeseries_demo/field_0017.txt new file mode 100644 index 0000000..5804a1b --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0017.txt @@ -0,0 +1,162 @@ +0.965926 +0.965926 +0.965926 +-0.994992 +-0.994992 +-0.911667 +-0.911667 +0.965926 +0.779713 +0.362183 +0.362183 +0.779713 +-0.591255 +-0.108800 +0.965926 +-0.108800 +-0.591255 +0.965926 +-0.965926 +-0.965926 +-0.965926 +-0.965926 +0.965926 +-0.965926 +-0.965926 +-0.965926 +-0.965926 +-0.591255 +-0.108800 +0.965926 +-0.108800 +-0.591255 +0.108800 +0.108800 +0.965926 +0.108800 +0.108800 +0.591255 +0.591255 +0.965926 +0.591255 +0.591255 +0.372283 +0.786466 +0.965926 +0.725548 +-0.813411 +-0.022461 +0.284257 +-0.519326 +-0.995279 +0.786466 +0.372283 +0.965926 +0.284257 +-0.995279 +0.725548 +-0.813411 +0.965926 +0.325766 +0.179977 +-0.994992 +-0.454549 +-0.454549 +0.179977 +0.325766 +0.965926 +-0.190604 +-0.335971 +-0.335971 +-0.190604 +-0.911667 +0.051710 +0.051710 +0.965926 +-0.190604 +-0.335971 +-0.911667 +0.051710 +0.051710 +-0.335971 +-0.190604 +0.965926 +0.325766 +0.179977 +0.179977 +0.325766 +-0.994992 +-0.454549 +-0.454549 +0.372283 +0.786466 +0.965926 +0.725548 +-0.813411 +-0.022461 +0.284257 +-0.519326 +-0.995279 +0.786466 +0.372283 +0.965926 +0.284257 +-0.995279 +0.725548 +-0.813411 +-0.637174 +-0.637174 +0.362183 +0.842268 +0.440059 +0.856737 +0.842268 +0.856737 +0.440059 +-0.637174 +-0.637174 +0.362183 +0.842268 +0.440059 +0.842268 +0.440059 +-0.166449 +-0.166449 +0.779713 +0.998955 +0.830086 +0.999833 +0.998955 +0.999833 +0.830086 +-0.166449 +-0.166449 +0.779713 +0.998955 +0.830086 +0.998955 +0.830086 +-0.744511 +-0.958309 +-0.605311 +-0.978571 +-0.126221 +-0.687053 +-0.744511 +-0.605311 +-0.958309 +-0.978571 +-0.687053 +-0.126221 +-0.744511 +-0.958309 +-0.605311 +-0.978571 +-0.126221 +-0.687053 +-0.744511 +-0.605311 +-0.958309 +-0.978571 +-0.687053 +-0.126221 diff --git a/examples/with_fields/timeseries_demo/field_0018.txt b/examples/with_fields/timeseries_demo/field_0018.txt new file mode 100644 index 0000000..e2ac1f2 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0018.txt @@ -0,0 +1,162 @@ +1.000000 +1.000000 +1.000000 +-0.986959 +-0.986959 +-0.986959 +-0.986959 +1.000000 +0.591089 +0.591089 +0.591089 +0.591089 +-0.362375 +-0.362375 +1.000000 +-0.362375 +-0.362375 +1.000000 +-1.000000 +-1.000000 +-1.000000 +-1.000000 +1.000000 +-1.000000 +-1.000000 +-1.000000 +-1.000000 +-0.362375 +-0.362375 +1.000000 +-0.362375 +-0.362375 +0.362375 +0.362375 +1.000000 +0.362375 +0.362375 +0.362375 +0.362375 +1.000000 +0.362375 +0.362375 +0.599813 +0.599813 +1.000000 +0.522714 +-0.936247 +-0.280450 +0.522714 +-0.280450 +-0.936247 +0.599813 +0.599813 +1.000000 +0.522714 +-0.936247 +0.522714 +-0.936247 +1.000000 +0.069965 +-0.080749 +-0.986959 +-0.208525 +-0.208525 +-0.080749 +0.069965 +1.000000 +0.069965 +-0.080749 +-0.080749 +0.069965 +-0.986959 +-0.208525 +-0.208525 +1.000000 +0.069965 +-0.080749 +-0.986959 +-0.208525 +-0.208525 +-0.080749 +0.069965 +1.000000 +0.069965 +-0.080749 +-0.080749 +0.069965 +-0.986959 +-0.208525 +-0.208525 +0.599813 +0.599813 +1.000000 +0.522714 +-0.936247 +-0.280450 +0.522714 +-0.280450 +-0.936247 +0.599813 +0.599813 +1.000000 +0.522714 +-0.936247 +0.522714 +-0.936247 +-0.415986 +-0.415986 +0.591089 +0.953087 +0.657475 +0.961031 +0.953087 +0.961031 +0.657475 +-0.415986 +-0.415986 +0.591089 +0.953087 +0.657475 +0.953087 +0.657475 +-0.415986 +-0.415986 +0.591089 +0.953087 +0.657475 +0.961031 +0.953087 +0.961031 +0.657475 +-0.415986 +-0.415986 +0.591089 +0.953087 +0.657475 +0.953087 +0.657475 +-0.891933 +-0.851702 +-0.378669 +-0.891933 +-0.378669 +-0.851702 +-0.891933 +-0.378669 +-0.851702 +-0.891933 +-0.851702 +-0.378669 +-0.891933 +-0.851702 +-0.378669 +-0.891933 +-0.378669 +-0.851702 +-0.891933 +-0.378669 +-0.851702 +-0.891933 +-0.851702 +-0.378669 diff --git a/examples/with_fields/timeseries_demo/field_0019.txt b/examples/with_fields/timeseries_demo/field_0019.txt new file mode 100644 index 0000000..6716e7c --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0019.txt @@ -0,0 +1,162 @@ +0.965926 +0.965926 +0.965926 +-0.911667 +-0.911667 +-0.994992 +-0.994992 +0.965926 +0.362183 +0.779713 +0.779713 +0.362183 +-0.108800 +-0.591255 +0.965926 +-0.591255 +-0.108800 +0.965926 +-0.965926 +-0.965926 +-0.965926 +-0.965926 +0.965926 +-0.965926 +-0.965926 +-0.965926 +-0.965926 +-0.108800 +-0.591255 +0.965926 +-0.591255 +-0.108800 +0.591255 +0.591255 +0.965926 +0.591255 +0.591255 +0.108800 +0.108800 +0.965926 +0.108800 +0.108800 +0.786466 +0.372283 +0.965926 +0.284257 +-0.995279 +-0.519326 +0.725548 +-0.022461 +-0.813411 +0.372283 +0.786466 +0.965926 +0.725548 +-0.813411 +0.284257 +-0.995279 +0.965926 +-0.190604 +-0.335971 +-0.911667 +0.051710 +0.051710 +-0.335971 +-0.190604 +0.965926 +0.325766 +0.179977 +0.179977 +0.325766 +-0.994992 +-0.454549 +-0.454549 +0.965926 +0.325766 +0.179977 +-0.994992 +-0.454549 +-0.454549 +0.179977 +0.325766 +0.965926 +-0.190604 +-0.335971 +-0.335971 +-0.190604 +-0.911667 +0.051710 +0.051710 +0.786466 +0.372283 +0.965926 +0.284257 +-0.995279 +-0.519326 +0.725548 +-0.022461 +-0.813411 +0.372283 +0.786466 +0.965926 +0.725548 +-0.813411 +0.284257 +-0.995279 +-0.166449 +-0.166449 +0.779713 +0.998955 +0.830086 +0.999833 +0.998955 +0.999833 +0.830086 +-0.166449 +-0.166449 +0.779713 +0.998955 +0.830086 +0.998955 +0.830086 +-0.637174 +-0.637174 +0.362183 +0.842268 +0.440059 +0.856737 +0.842268 +0.856737 +0.440059 +-0.637174 +-0.637174 +0.362183 +0.842268 +0.440059 +0.842268 +0.440059 +-0.978571 +-0.687053 +-0.126221 +-0.744511 +-0.605311 +-0.958309 +-0.978571 +-0.126221 +-0.687053 +-0.744511 +-0.958309 +-0.605311 +-0.978571 +-0.687053 +-0.126221 +-0.744511 +-0.605311 +-0.958309 +-0.978571 +-0.126221 +-0.687053 +-0.744511 +-0.958309 +-0.605311 diff --git a/examples/with_fields/timeseries_demo/field_0020.txt b/examples/with_fields/timeseries_demo/field_0020.txt new file mode 100644 index 0000000..aef381f --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0020.txt @@ -0,0 +1,162 @@ +0.866025 +0.866025 +0.866025 +-0.774247 +-0.774247 +-0.935217 +-0.935217 +0.866025 +0.108595 +0.915201 +0.915201 +0.108595 +0.152190 +-0.779842 +0.866025 +-0.779842 +0.152190 +0.866025 +-0.866025 +-0.866025 +-0.866025 +-0.866025 +0.866025 +-0.866025 +-0.866025 +-0.866025 +-0.866025 +0.152190 +-0.779842 +0.866025 +-0.779842 +0.152190 +0.779842 +0.779842 +0.866025 +0.779842 +0.779842 +-0.152190 +-0.152190 +0.866025 +-0.152190 +-0.152190 +0.919523 +0.119383 +0.866025 +0.026429 +-0.986485 +-0.722811 +0.878937 +0.237058 +-0.635143 +0.119383 +0.919523 +0.866025 +0.878937 +-0.635143 +0.026429 +-0.986485 +0.866025 +-0.438183 +-0.568298 +-0.774247 +0.308421 +0.308421 +-0.568298 +-0.438183 +0.866025 +0.559366 +0.428437 +0.428437 +0.559366 +-0.935217 +-0.669596 +-0.669596 +0.866025 +0.559366 +0.428437 +-0.935217 +-0.669596 +-0.669596 +0.428437 +0.559366 +0.866025 +-0.438183 +-0.568298 +-0.568298 +-0.438183 +-0.774247 +0.308421 +0.308421 +0.919523 +0.119383 +0.866025 +0.026429 +-0.986485 +-0.722811 +0.878937 +0.237058 +-0.635143 +0.119383 +0.919523 +0.866025 +0.878937 +-0.635143 +0.026429 +-0.986485 +0.094431 +0.094431 +0.915201 +0.976746 +0.946128 +0.970498 +0.976746 +0.970498 +0.946128 +0.094431 +0.094431 +0.915201 +0.976746 +0.946128 +0.976746 +0.946128 +-0.814940 +-0.814940 +0.108595 +0.674049 +0.192652 +0.694057 +0.674049 +0.694057 +0.192652 +-0.814940 +-0.814940 +0.108595 +0.674049 +0.192652 +0.674049 +0.192652 +-0.998520 +-0.475583 +0.134829 +-0.546353 +-0.790703 +-0.999609 +-0.998520 +0.134829 +-0.475583 +-0.546353 +-0.999609 +-0.790703 +-0.998520 +-0.475583 +0.134829 +-0.546353 +-0.790703 +-0.999609 +-0.998520 +0.134829 +-0.475583 +-0.546353 +-0.999609 +-0.790703 diff --git a/examples/with_fields/timeseries_demo/field_0021.txt b/examples/with_fields/timeseries_demo/field_0021.txt new file mode 100644 index 0000000..cacec72 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0021.txt @@ -0,0 +1,162 @@ +0.707107 +0.707107 +0.707107 +-0.584062 +-0.584062 +-0.811709 +-0.811709 +0.707107 +-0.152393 +0.988320 +0.988320 +-0.152393 +0.402809 +-0.915284 +0.707107 +-0.915284 +0.402809 +0.707107 +-0.707107 +-0.707107 +-0.707107 +-0.707107 +0.707107 +-0.707107 +-0.707107 +-0.707107 +-0.707107 +0.402809 +-0.915284 +0.707107 +-0.915284 +0.402809 +0.915284 +0.915284 +0.707107 +0.915284 +0.915284 +-0.402809 +-0.402809 +0.707107 +-0.402809 +-0.402809 +0.989916 +-0.141653 +0.707107 +-0.233200 +-0.910463 +-0.877038 +0.972429 +0.480422 +-0.413590 +-0.141653 +0.989916 +0.707107 +0.972429 +-0.413590 +-0.233200 +-0.910463 +0.707107 +-0.655901 +-0.761896 +-0.584063 +0.544113 +0.544113 +-0.761896 +-0.655901 +0.707107 +0.754847 +0.647700 +0.647700 +0.754847 +-0.811709 +-0.839012 +-0.839012 +0.707107 +0.754847 +0.647700 +-0.811709 +-0.839012 +-0.839012 +0.647700 +0.754847 +0.707107 +-0.655901 +-0.761896 +-0.761896 +-0.655901 +-0.584063 +0.544113 +0.544113 +0.989916 +-0.141653 +0.707107 +-0.233200 +-0.910463 +-0.877038 +0.972429 +0.480422 +-0.413590 +-0.141653 +0.989916 +0.707107 +0.972429 +-0.413590 +-0.233200 +-0.910463 +0.348876 +0.348876 +0.988320 +0.887973 +0.997693 +0.875024 +0.887973 +0.875024 +0.997693 +0.348876 +0.348876 +0.988320 +0.887973 +0.997693 +0.887973 +0.997693 +-0.937169 +-0.937169 +-0.152394 +0.459896 +-0.067883 +0.484079 +0.459896 +0.484079 +-0.067883 +-0.937169 +-0.937169 +-0.152394 +0.459896 +-0.067883 +0.459896 +-0.067883 +-0.950423 +-0.231702 +0.386691 +-0.310961 +-0.922209 +-0.972787 +-0.950423 +0.386691 +-0.231702 +-0.310961 +-0.972787 +-0.922209 +-0.950423 +-0.231702 +0.386691 +-0.310961 +-0.922209 +-0.972787 +-0.950423 +0.386691 +-0.231702 +-0.310961 +-0.972787 +-0.922209 diff --git a/examples/with_fields/timeseries_demo/field_0022.txt b/examples/with_fields/timeseries_demo/field_0022.txt new file mode 100644 index 0000000..f240218 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0022.txt @@ -0,0 +1,162 @@ +0.500000 +0.500000 +0.500000 +-0.354075 +-0.354075 +-0.632884 +-0.632884 +0.500000 +-0.402997 +0.994086 +0.994086 +-0.402997 +0.625976 +-0.988351 +0.500000 +-0.988351 +0.625976 +0.500000 +-0.500000 +-0.500000 +-0.500000 +-0.500000 +0.500000 +-0.500000 +-0.500000 +-0.500000 +-0.500000 +0.625976 +-0.988351 +0.500000 +-0.988351 +0.625976 +0.988351 +0.988351 +0.500000 +0.988351 +0.988351 +-0.625976 +-0.625976 +0.500000 +-0.625976 +-0.625976 +0.992848 +-0.393036 +0.500000 +-0.476937 +-0.772395 +-0.971496 +0.999651 +0.691046 +-0.163852 +-0.393036 +0.992848 +0.500000 +0.999651 +-0.163852 +-0.476937 +-0.772395 +0.500000 +-0.828921 +-0.903572 +-0.354076 +0.742725 +0.742725 +-0.903572 +-0.828921 +0.500000 +0.898886 +0.822823 +0.822823 +0.898886 +-0.632884 +-0.951250 +-0.951250 +0.500000 +0.898886 +0.822823 +-0.632884 +-0.951250 +-0.951250 +0.822823 +0.898886 +0.500000 +-0.828921 +-0.903572 +-0.903572 +-0.828921 +-0.354076 +0.742725 +0.742725 +0.992848 +-0.393036 +0.500000 +-0.476937 +-0.772395 +-0.971496 +0.999651 +0.691046 +-0.163852 +-0.393036 +0.992848 +0.500000 +0.999651 +-0.163852 +-0.476937 +-0.772395 +0.579546 +0.579546 +0.994086 +0.738686 +0.981267 +0.719920 +0.738686 +0.719920 +0.981267 +0.579546 +0.579546 +0.994086 +0.738686 +0.981267 +0.738686 +0.981267 +-0.995531 +-0.995531 +-0.402997 +0.214401 +-0.323792 +0.241111 +0.214401 +0.241111 +-0.323792 +-0.995531 +-0.995531 +-0.402997 +0.214401 +-0.323792 +0.214401 +-0.323792 +-0.837555 +0.027969 +0.612200 +-0.054378 +-0.990869 +-0.879671 +-0.837555 +0.612200 +0.027969 +-0.054378 +-0.879671 +-0.990869 +-0.837555 +0.027969 +0.612200 +-0.054378 +-0.990869 +-0.879671 +-0.837555 +0.612200 +0.027969 +-0.054378 +-0.879671 +-0.990869 diff --git a/examples/with_fields/timeseries_demo/field_0023.txt b/examples/with_fields/timeseries_demo/field_0023.txt new file mode 100644 index 0000000..31e73b7 --- /dev/null +++ b/examples/with_fields/timeseries_demo/field_0023.txt @@ -0,0 +1,162 @@ +0.258819 +0.258819 +0.258819 +-0.099958 +-0.099958 +-0.410929 +-0.410929 +0.258819 +-0.626137 +0.932107 +0.932107 +-0.626137 +0.806485 +-0.994064 +0.258819 +-0.994064 +0.806485 +0.258819 +-0.258819 +-0.258819 +-0.258819 +-0.258819 +0.258819 +-0.258819 +-0.258819 +-0.258819 +-0.258819 +0.806485 +-0.994064 +0.258819 +-0.994064 +0.806485 +0.994064 +0.994064 +0.258819 +0.994064 +0.994064 +-0.806485 +-0.806485 +0.258819 +-0.806485 +-0.806485 +0.928119 +-0.617634 +0.258819 +-0.688172 +-0.581689 +-0.999748 +0.958748 +0.854576 +0.097052 +-0.617634 +0.928119 +0.258819 +0.958748 +0.097052 +-0.688172 +-0.581689 +0.258819 +-0.945451 +-0.983671 +-0.099959 +0.890722 +0.890722 +-0.983671 +-0.945451 +0.258819 +0.981667 +0.941872 +0.941872 +0.981667 +-0.410929 +-0.998662 +-0.998662 +0.258819 +0.981667 +0.941872 +-0.410929 +-0.998662 +-0.998662 +0.941872 +0.981667 +0.258819 +-0.945451 +-0.983671 +-0.983671 +-0.945451 +-0.099959 +0.890722 +0.890722 +0.928119 +-0.617634 +0.258819 +-0.688172 +-0.581689 +-0.999748 +0.958748 +0.854576 +0.097052 +-0.617634 +0.928119 +0.258819 +0.958748 +0.097052 +-0.688172 +-0.581689 +0.770720 +0.770720 +0.932107 +0.539059 +0.897969 +0.515754 +0.539059 +0.515754 +0.897969 +0.770720 +0.770720 +0.932107 +0.539059 +0.897969 +0.539059 +0.897969 +-0.986050 +-0.986050 +-0.626137 +-0.045705 +-0.557635 +-0.018288 +-0.045705 +-0.018288 +-0.557635 +-0.986050 +-0.986050 +-0.626137 +-0.045705 +-0.557635 +-0.045705 +-0.557635 +-0.667610 +0.285734 +0.795989 +0.205911 +-0.992002 +-0.726607 +-0.667610 +0.795989 +0.285734 +0.205911 +-0.726607 +-0.992002 +-0.667610 +0.285734 +0.795989 +0.205911 +-0.992002 +-0.726607 +-0.667610 +0.795989 +0.285734 +0.205911 +-0.726607 +-0.992002 diff --git a/examples/with_fields/timeseries_demo/timeseries.txt b/examples/with_fields/timeseries_demo/timeseries.txt new file mode 100644 index 0000000..f625f96 --- /dev/null +++ b/examples/with_fields/timeseries_demo/timeseries.txt @@ -0,0 +1,25 @@ +# nx ny nz resolution field_file (one timestep per line) +1.000000 0.000000 0.300000 0.02 field_0000.txt +0.965926 0.258819 0.300000 0.02 field_0001.txt +0.866025 0.500000 0.300000 0.02 field_0002.txt +0.707107 0.707107 0.300000 0.02 field_0003.txt +0.500000 0.866025 0.300000 0.02 field_0004.txt +0.258819 0.965926 0.300000 0.02 field_0005.txt +0.000000 1.000000 0.300000 0.02 field_0006.txt +-0.258819 0.965926 0.300000 0.02 field_0007.txt +-0.500000 0.866025 0.300000 0.02 field_0008.txt +-0.707107 0.707107 0.300000 0.02 field_0009.txt +-0.866025 0.500000 0.300000 0.02 field_0010.txt +-0.965926 0.258819 0.300000 0.02 field_0011.txt +-1.000000 0.000000 0.300000 0.02 field_0012.txt +-0.965926 -0.258819 0.300000 0.02 field_0013.txt +-0.866025 -0.500000 0.300000 0.02 field_0014.txt +-0.707107 -0.707107 0.300000 0.02 field_0015.txt +-0.500000 -0.866025 0.300000 0.02 field_0016.txt +-0.258819 -0.965926 0.300000 0.02 field_0017.txt +-0.000000 -1.000000 0.300000 0.02 field_0018.txt +0.258819 -0.965926 0.300000 0.02 field_0019.txt +0.500000 -0.866025 0.300000 0.02 field_0020.txt +0.707107 -0.707107 0.300000 0.02 field_0021.txt +0.866025 -0.500000 0.300000 0.02 field_0022.txt +0.965926 -0.258819 0.300000 0.02 field_0023.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 887ba53..c640215 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,22 +1,22 @@ -cmake_minimum_required(VERSION 3.14) # A reasonably modern version; works everywhere +cmake_minimum_required(VERSION 3.14) project(FlatLand - VERSION 0.1 - DESCRIPTION "Projected Areas of arbitrary meshesl" + VERSION 2.0 + DESCRIPTION "Projected-area and field analysis of arbitrary meshes" LANGUAGES CXX) -# Set the C++ standard you need (adjust if you're using features from newer standards) -set(CMAKE_CXX_STANDARD 17) # Or 11, 14, 20, 23 depending on your code +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) # Use strict ISO C++ (good for portability) +set(CMAKE_CXX_EXTENSIONS OFF) # strict ISO C++ for portability -# Create the executable -add_executable(flatland main.cpp) # "mytool" is the output binary name; change if you want - -# Optional: Enable optimizations for release builds (default is fine otherwise) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() -# Optional: Install target (copies binary to a standard location when you run `cmake --install`) +add_executable(flatland main.cpp) + +# std::thread needs the platform threading library (e.g. -pthread on glibc). +find_package(Threads REQUIRED) +target_link_libraries(flatland PRIVATE Threads::Threads) + install(TARGETS flatland DESTINATION bin) diff --git a/src/main.cpp b/src/main.cpp index 90d070b..2d65e65 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,11 +2,20 @@ // main.cpp // FlatLand // -// Features: -// - Runtime precision switching (Float vs Double) -// - Flexible Batch Mode (Per-view resolution & data files) -// - Edge Function Rasterization -// - JSON Metadata +// Orthographic projection + rasterization for geometric analysis of 3D meshes. +// +// Core capabilities: +// - Projected (silhouette / visible) surface area from arbitrary view directions +// - Generic per-view field statistics over the visible projection: +// average, min, max, and the AREA INTEGRAL ∫ f dA = Σ value · pixel_area. +// The integral is the building block for quantities such as radiant +// intensity (supply a radiance field) — FlatLand stays domain-agnostic. +// - Runtime precision switching (float / double) +// - Batch mode with per-view resolution and data files +// - Parallel batch processing (standard library threads only) +// - PPM heatmap export and structured JSON output +// +// No third-party dependencies. C++17. // #include @@ -19,8 +28,12 @@ #include #include #include -#include #include +#include +#include +#include +#include +#include /* ---------------------- Math & Structs (Templated) @@ -37,26 +50,34 @@ struct TriProjected { }; struct Triangle3D { - int v0_idx, v1_idx, v2_idx; // Indices into vertex array - // We store indices to allow re-fetching vertices if precision changes (though here we load once) + int v0_idx, v1_idx, v2_idx; // Indices into the vertex array }; enum ValueMode { MODE_NONE, MODE_NODE, MODE_FACE }; +// Read-only geometry, loaded once and shared across all views/threads. template struct Mesh { std::vector> vertices; std::vector faces; +}; + +// A scalar field defined on the mesh. Kept separate from Mesh so different +// views can use different fields without mutating shared state (thread-safe). +template +struct Field { std::vector values; - ValueMode val_mode = MODE_NONE; + ValueMode mode = MODE_NONE; }; template struct ViewResult { + bool has_field = false; T area = 0; T average_value = 0; - T min_val = std::numeric_limits::max(); - T max_val = -std::numeric_limits::max(); + T integral = 0; // Σ value · pixel_area (the area integral of the field) + T min_val = 0; + T max_val = 0; double time_seconds = 0.0; long covered_pixels = 0; int image_width = 0; @@ -79,7 +100,7 @@ template inline Vec3 operator-(const Vec3& a, const Vec3& template inline Vec3 normalize(const Vec3& v) { T n = std::sqrt(dot(v,v)); return n>0 ? Vec3{v.x/n, v.y/n, v.z/n} : Vec3{0,0,0}; } /* ---------------------- - Renderer + Renderer (one per worker thread) ---------------------- */ template class Renderer { @@ -91,12 +112,12 @@ class Renderer { void resize(int w, int h, bool use_vals) { size_t needed = (size_t)w * h; - if (needed == 0) return; + if (needed == 0) { Nx = Ny = 0; return; } Nx = w; Ny = h; if (zbuffer.size() < needed) zbuffer.resize(needed); if (mask.size() < needed) mask.resize(needed); if (use_vals && val_buffer.size() < needed) val_buffer.resize(needed); - + std::fill(zbuffer.begin(), zbuffer.begin() + needed, std::numeric_limits::max()); std::fill(mask.begin(), mask.begin() + needed, 0); if (use_vals) std::fill(val_buffer.begin(), val_buffer.begin() + needed, 0); @@ -112,7 +133,7 @@ inline T edge_eval(const Vec2& a, const Vec2& b, const Vec2& p) { } template -void rasterize(const TriProjected& tri, Renderer& r, T xmin, T ymin, T pix_sz) { +void rasterize(const TriProjected& tri, Renderer& r, T xmin, T ymin, T pix_sz, bool use_vals) { T min_x = std::min({tri.v0.x, tri.v1.x, tri.v2.x}); T max_x = std::max({tri.v0.x, tri.v1.x, tri.v2.x}); T min_y = std::min({tri.v0.y, tri.v1.y, tri.v2.y}); @@ -123,14 +144,14 @@ void rasterize(const TriProjected& tri, Renderer& r, T xmin, T ymin, T pix int iy_min = std::max(0, static_cast((min_y - ymin)/pix_sz)); int iy_max = std::min(r.Ny - 1, static_cast((max_y - ymin)/pix_sz)); - Vec2 p_start = { xmin + (ix_min + 0.5f)*pix_sz, ymin + (iy_min + 0.5f)*pix_sz }; - - // Edge Functions Setup + Vec2 p_start = { xmin + (ix_min + (T)0.5)*pix_sz, ymin + (iy_min + (T)0.5)*pix_sz }; + + // Edge function values at the first sampled pixel center T w0_row = edge_eval(tri.v1, tri.v2, p_start); T w1_row = edge_eval(tri.v2, tri.v0, p_start); T w2_row = edge_eval(tri.v0, tri.v1, p_start); - - // Increments + + // Per-pixel increments T A0 = (tri.v2.y - tri.v1.y)*pix_sz, B0 = (tri.v1.x - tri.v2.x)*pix_sz; T A1 = (tri.v0.y - tri.v2.y)*pix_sz, B1 = (tri.v2.x - tri.v0.x)*pix_sz; T A2 = (tri.v1.y - tri.v0.y)*pix_sz, B2 = (tri.v0.x - tri.v1.x)*pix_sz; @@ -144,7 +165,7 @@ void rasterize(const TriProjected& tri, Renderer& r, T xmin, T ymin, T pix if (z < r.zbuffer[idx]) { r.zbuffer[idx] = z; r.mask[idx] = 1; - if (!r.val_buffer.empty()) + if (use_vals) r.val_buffer[idx] = (w0*tri.val0 + w1*tri.val1 + w2*tri.val2)*tri.inv_area; } } @@ -157,13 +178,13 @@ void rasterize(const TriProjected& tri, Renderer& r, T xmin, T ymin, T pix /* ---------------------- IO & Loaders ---------------------- */ -// Templated OBJ loader to support Float/Double +// Templated OBJ loader to support float/double geometry. template Mesh load_obj(const std::string& filename) { Mesh mesh; std::ifstream file(filename); - if (!file.is_open()) throw std::runtime_error("Cannot open " + filename); - + if (!file.is_open()) throw std::runtime_error("cannot open mesh file '" + filename + "'"); + std::string line; while (std::getline(file, line)) { if (line.empty() || line[0] == '#') continue; @@ -185,53 +206,69 @@ Mesh load_obj(const std::string& filename) { mesh.faces.push_back({idxs[0], idxs[k-1], idxs[k]}); } } + if (mesh.vertices.empty()) throw std::runtime_error("mesh '" + filename + "' contains no vertices"); + if (mesh.faces.empty()) throw std::runtime_error("mesh '" + filename + "' contains no faces"); return mesh; } +// Fast field loader: slurp the whole file and parse with strtod (far faster than +// iostream extraction for the time-series case of thousands of field files). +// Reuses `field.values` storage so per-timestep reloads don't churn allocations. template -void load_values(const std::string& filename, Mesh& mesh) { - if (filename.empty()) return; - mesh.values.clear(); - std::ifstream file(filename); - if (!file.is_open()) throw std::runtime_error("Cannot open data file " + filename); - double v; - while (file >> v) mesh.values.push_back((T)v); - - if (mesh.values.size() == mesh.vertices.size()) mesh.val_mode = MODE_NODE; - else if (mesh.values.size() == mesh.faces.size()) mesh.val_mode = MODE_FACE; - else throw std::runtime_error("Data size mismatch: " + std::to_string(mesh.values.size())); +void load_field_into(const std::string& filename, const Mesh& mesh, Field& field) { + std::ifstream file(filename, std::ios::binary); + if (!file.is_open()) throw std::runtime_error("cannot open data file '" + filename + "'"); + std::string buf((std::istreambuf_iterator(file)), std::istreambuf_iterator()); + + field.values.clear(); + const char* p = buf.c_str(); + char* end; + double d = std::strtod(p, &end); + while (end != p) { // strtod skips leading whitespace itself + field.values.push_back((T)d); + p = end; + d = std::strtod(p, &end); + } + + if (field.values.size() == mesh.vertices.size()) field.mode = MODE_NODE; + else if (field.values.size() == mesh.faces.size()) field.mode = MODE_FACE; + else throw std::runtime_error("data file '" + filename + "' has " + + std::to_string(field.values.size()) + " values, but mesh has " + + std::to_string(mesh.vertices.size()) + " vertices / " + + std::to_string(mesh.faces.size()) + " faces"); } /* ---------------------- Image Output ---------------------- */ template -void save_ppm(const Renderer& r, const std::string& fname, T min_v, T max_v) { +void save_ppm(const Renderer& r, const std::string& fname, T min_v, T max_v, bool use_vals) { std::ofstream f(fname, std::ios::binary); - if (!f.is_open()) return; + if (!f.is_open()) throw std::runtime_error("cannot write image '" + fname + "'"); f << "P6\n" << r.Nx << " " << r.Ny << "\n255\n"; double range = (double)(max_v - min_v); if (std::abs(range) < 1e-9) range = 1.0; const uint8_t bg[3] = {30,30,35}; - - // Simple heatmap colors + + // Simple 5-stop heatmap (blue -> cyan -> yellow -> orange -> red) const double stops[5][3] = {{0,0,1}, {0,1,1}, {1,1,0}, {1,.5,0}, {1,0,0}}; - + for (int iy=r.Ny-1; iy>=0; --iy) { for (int ix=0; ix= 4) idx = 3; double fr = t - idx; - uint8_t rgb[3]; for(int c=0;c<3;++c) rgb[c] = (uint8_t)(((1.0-fr)*stops[idx][c] + fr*stops[idx+1][c])*255); - if (r.val_buffer.empty()) { rgb[0]=rgb[1]=rgb[2]=255; } - f.write((char*)rgb, 3); } + f.write((const char*)rgb, 3); } } } @@ -240,17 +277,20 @@ void save_ppm(const Renderer& r, const std::string& fname, T min_v, T max_v) Processing Pipeline ---------------------- */ template -ViewResult process_view(const Vec3& view_dir, const Mesh& mesh, T pix_sz, bool cull, Renderer& renderer) { +ViewResult process_view(const Vec3& view_dir, const Mesh& mesh, const Field* field, + T pix_sz, bool cull, Renderer& renderer) { auto t0 = std::chrono::high_resolution_clock::now(); ViewResult res; - - // Basis + const bool use_vals = (field && field->mode != MODE_NONE); + res.has_field = use_vals; + + // Orthonormal view basis (n = view normal, u/v = screen axes) Vec3 n = normalize(view_dir); Vec3 h = (std::abs(n.x) < 0.9) ? Vec3{1,0,0} : Vec3{0,1,0}; Vec3 u = normalize(cross(h, n)); Vec3 v = cross(n, u); - // Project + // Project triangles to the view plane std::vector> tris; tris.reserve(mesh.faces.size()); T b_min_x=1e20, b_max_x=-1e20, b_min_y=1e20, b_max_y=-1e20; @@ -262,47 +302,40 @@ ViewResult process_view(const Vec3& view_dir, const Mesh& mesh, T pix_s const Vec3& v2 = mesh.vertices[f.v2_idx]; Vec3 tri_n = cross(v1-v0, v2-v0); - // if (cull && dot(tri_n, n) >= 0) continue; - if (cull && dot(tri_n, n) <= 0) continue; - + if (cull && dot(tri_n, n) <= 0) continue; // keep faces pointing toward the viewer + Vec2 p0 = {dot(v0,u), dot(v0,v)}; Vec2 p1 = {dot(v1,u), dot(v1,v)}; Vec2 p2 = {dot(v2,u), dot(v2,v)}; - // 1. COMPUTE VALUES FIRST to avoid "undeclared identifier" T val0=0, val1=0, val2=0; - if (mesh.val_mode == MODE_NODE) { - val0=mesh.values[f.v0_idx]; val1=mesh.values[f.v1_idx]; val2=mesh.values[f.v2_idx]; - } else if (mesh.val_mode == MODE_FACE) { - val0=val1=val2=mesh.values[i]; + if (use_vals) { + if (field->mode == MODE_NODE) { + val0=field->values[f.v0_idx]; val1=field->values[f.v1_idx]; val2=field->values[f.v2_idx]; + } else { // MODE_FACE + val0=val1=val2=field->values[i]; + } } - T area2 = edge_eval(p0, p1, p2); + T area2 = edge_eval(p0, p1, p2); // twice signed screen-space area; >0 = CCW if (std::abs(area2) < 1e-12) continue; - - // area2 is twice the signed area in screen space; positive = CCW + b_min_x = std::min({b_min_x, p0.x, p1.x, p2.x}); b_max_x = std::max({b_max_x, p0.x, p1.x, p2.x}); b_min_y = std::min({b_min_y, p0.y, p1.y, p2.y}); b_max_y = std::max({b_max_y, p0.y, p1.y, p2.y}); - // 2. WINDING FIX: Check for Negative Area (Clockwise) - // If CW, we swap vertices 1 and 2 to make it CCW. + // Normalize winding to CCW so edge functions are positive inside. if (area2 < 0) { - tris.push_back({ - p0, p2, p1, // Swap 2D Vertices - - dot(v0,n), dot(v2,n), dot(v1,n), // Swap Depths (CRITICAL for Z-buffer) - val0, val2, val1, // Swap Values (CRITICAL for Shading) - (T)(1.0/(-area2)) // Use Positive Area - }); + tris.push_back({ p0, p2, p1, + dot(v0,n), dot(v2,n), dot(v1,n), + val0, val2, val1, + (T)(1.0/(-area2)) }); } else { - tris.push_back({ - p0, p1, p2, - dot(v0,n), dot(v1,n), dot(v2,n), - val0, val1, val2, - (T)(1.0/area2) - }); + tris.push_back({ p0, p1, p2, + dot(v0,n), dot(v1,n), dot(v2,n), + val0, val1, val2, + (T)(1.0/area2) }); } } @@ -311,95 +344,174 @@ ViewResult process_view(const Vec3& view_dir, const Mesh& mesh, T pix_s b_min_y -= pix_sz; b_max_y += pix_sz; int w = (int)std::ceil((b_max_x - b_min_x)/pix_sz); int h = (int)std::ceil((b_max_y - b_min_y)/pix_sz); - - renderer.resize(w, h, mesh.val_mode != MODE_NONE); + + renderer.resize(w, h, use_vals); res.image_width=w; res.image_height=h; - for (const auto& t : tris) rasterize(t, renderer, b_min_x, b_min_y, pix_sz); + for (const auto& t : tris) rasterize(t, renderer, b_min_x, b_min_y, pix_sz, use_vals); - // Stats + // Aggregate statistics over visible pixels size_t npix = (size_t)w * h; double sum = 0; + T mn = std::numeric_limits::max(); + T mx = -std::numeric_limits::max(); for (size_t k=0; k res.max_val) res.max_val = val; - } + if (!renderer.mask[k]) continue; + res.covered_pixels++; + if (use_vals) { + T val = renderer.val_buffer[k]; + sum += val; + if (val < mn) mn = val; + if (val > mx) mx = val; } } - res.area = res.covered_pixels * pix_sz * pix_sz; - if (res.covered_pixels) res.average_value = (T)(sum / res.covered_pixels); - else { res.min_val = res.max_val = 0; } + T pix_area = pix_sz * pix_sz; + res.area = res.covered_pixels * pix_area; + if (use_vals && res.covered_pixels) { + res.average_value = (T)(sum / res.covered_pixels); + res.integral = (T)(sum * pix_area); // ∫ f dA over the visible projection + res.min_val = mn; + res.max_val = mx; + } } - + res.time_seconds = std::chrono::duration(std::chrono::high_resolution_clock::now() - t0).count(); return res; } /* ---------------------- - Application Runners + Output Helpers ---------------------- */ -// Escaping for JSON std::string esc(const std::string& s) { std::string out; for(char c:s) (c=='\\'||c=='"') ? out+="\\" + std::string(1,c) : out+=c; return out; } +// Emit a JSON-safe number: non-finite values become null so pipelines don't choke. +template +std::string jnum(T v) { + if (!std::isfinite((double)v)) return "null"; + std::ostringstream o; o << std::setprecision(10) << (double)v; return o.str(); +} + +/* ---------------------- + Application Runner + ---------------------- */ template void run_app(const std::string& obj, const std::string& default_data, const std::string& out_pre, - const std::vector& batch, double default_res, bool cull, bool json) { - + const std::vector& batch, double default_res, bool cull, bool json, + unsigned threads) { + Mesh mesh = load_obj(obj); - if (!default_data.empty()) load_values(default_data, mesh); // Preload default data - Renderer renderer; + // A fixed field (-d) is loaded ONCE and shared read-only across all timesteps/threads. + std::shared_ptr> default_field; + if (!default_data.empty()) { + default_field = std::make_shared>(); + load_field_into(default_data, mesh, *default_field); + } + + std::vector view_res(batch.size()); + for (size_t k=0; k 0) ? (T)batch[k].resolution : (T)default_res; + + std::vector> results(batch.size()); + std::atomic next{0}; + std::mutex err_mtx; + std::string err_msg; + + // Worker: pull timestep indices off a shared counter. Each owns a renderer and a + // reusable field buffer, so per-timestep field files load on demand -> peak memory + // is O(threads), not O(timesteps). The shared fixed field is never reloaded. + auto worker = [&]() { + Renderer renderer; + Field local; // scratch for per-view data files + std::string local_path; // last file loaded into `local` + size_t k; + while ((k = next.fetch_add(1)) < batch.size()) { + try { + const auto& b = batch[k]; + const std::string& path = b.data_file.empty() ? default_data : b.data_file; + + const Field* fp = nullptr; + if (path.empty()) { + fp = nullptr; + } else if (path == default_data) { + fp = default_field.get(); // shared, already loaded + } else { + if (path != local_path) { load_field_into(path, mesh, local); local_path = path; } + fp = &local; + } + + ViewResult r = process_view({(T)b.nx, (T)b.ny, (T)b.nz}, mesh, fp, + view_res[k], cull, renderer); + if (!out_pre.empty()) { + std::ostringstream oss; oss << out_pre << "_" << std::setw(4) << std::setfill('0') << k << ".ppm"; + r.output_image = oss.str(); + save_ppm(renderer, r.output_image, r.min_val, r.max_val, r.has_field); + } + results[k] = std::move(r); + } catch (const std::exception& e) { + std::lock_guard lk(err_mtx); + if (err_msg.empty()) err_msg = "timestep " + std::to_string(k) + ": " + e.what(); + next.store(batch.size()); // signal other workers to stop + return; + } + } + }; + unsigned n_workers = std::max(1u, std::min(threads, (unsigned)batch.size())); + if (n_workers <= 1) { + worker(); + } else { + std::vector pool; + for (unsigned t=0; t 0) ? (T)b.resolution : (T)default_res; - ViewResult r = process_view({(T)b.nx, (T)b.ny, (T)b.nz}, mesh, res, cull, renderer); - - // Output Image? - if (!out_pre.empty()) { - std::ostringstream oss; oss << out_pre << "_" << std::setw(4) << std::setfill('0') << k << ".ppm"; - save_ppm(renderer, oss.str(), r.min_val, r.max_val); - } - + const auto& r = results[k]; if (json) { std::cout << " {\n" << " \"idx\": " << k << ",\n" - << " \"normal\": [" << b.nx << "," << b.ny << "," << b.nz << "],\n" - << " \"area\": " << r.area << ",\n" - << " \"avg\": " << r.average_value << ",\n" + << " \"normal\": [" << jnum(b.nx) << "," << jnum(b.ny) << "," << jnum(b.nz) << "],\n" + << " \"resolution\": " << jnum(view_res[k]) << ",\n" + << " \"area\": " << jnum(r.area) << ",\n" << " \"pixels\": " << r.covered_pixels << ",\n" - << " \"time\": " << r.time_seconds << "\n" + << " \"width\": " << r.image_width << ",\n" + << " \"height\": " << r.image_height << ",\n"; + if (r.has_field) { + std::cout << " \"average\": " << jnum(r.average_value) << ",\n" + << " \"integral\": " << jnum(r.integral) << ",\n" + << " \"min\": " << jnum(r.min_val) << ",\n" + << " \"max\": " << jnum(r.max_val) << ",\n"; + } else { + std::cout << " \"average\": null,\n" + << " \"integral\": null,\n" + << " \"min\": null,\n" + << " \"max\": null,\n"; + } + std::cout << " \"image\": " << (r.output_image.empty() ? "null" : "\"" + esc(r.output_image) + "\"") << ",\n" + << " \"time\": " << jnum(r.time_seconds) << "\n" << " }" << (k==batch.size()-1?"":",") << "\n"; } else { - std::cout << "View " << k << " | Area: " << r.area << " | Avg: " << r.average_value + std::cout << "View " << k << " | Area: " << r.area; + if (r.has_field) + std::cout << " | Avg: " << r.average_value << " | Integral: " << r.integral; + std::cout << " | Pixels: " << r.covered_pixels << " | Time: " << r.time_seconds << "s\n"; } - - // Restore default data if we switched it temporarily? - // For efficiency, we assume subsequent views use what is loaded unless changed. - // If batch mixed global/local indiscriminately, we'd need to track state carefully. } if (json) std::cout << " ]\n}\n"; } @@ -409,34 +521,49 @@ void run_app(const std::string& obj, const std::string& default_data, const std: ---------------------- */ void print_help(const char* prog) { std::cout << "FlatLand: Mesh Projection & Rasterization Tool\n" - << "Usage: " << prog << " [mesh.obj] [options]\n\n" + << "Usage: " << prog << " [options]\n\n" << "Core Options:\n" - << " -v Add a single view direction. Can be repeated multiple times.\n" - << " -b, --batch Load views from a file. See 'Batch Format' below.\n" - << " (Note: Views from -v and -b are additive)\n\n" - << "Simulation Parameters:\n" - << " -r, --res Set default pixel resolution (default: 0.001).\n" - << " Used if a batch entry does not specify its own resolution.\n" - << " -d, --data Path to default scalar data file (node or face values).\n" - << " Used if a batch entry does not specify its own data file.\n" - << " --no-cull Disable backface culling (renders all matching faces).\n" - << " -p, --precision Set math precision: 'float' (default, faster) or 'double' (more accurate).\n\n" + << " -v, --view Add a single view direction. Repeatable.\n" + << " -b, --batch Load views from a file (see 'Batch Format').\n" + << " Views from -v and -b are additive.\n\n" + << "Analysis Parameters:\n" + << " -r, --res Default pixel resolution (default: 0.001).\n" + << " Used when a batch entry omits its own resolution.\n" + << " -d, --data Default scalar field file (one value per line;\n" + << " length must equal the vertex or face count).\n" + << " -p, --precision Math precision: 'float' (default) or 'double'.\n" + << " --no-cull Disable backface culling (render all faces).\n" + << " -t, --threads Worker threads for batch views (default: auto).\n\n" << "Output Control:\n" - << " -o, --out Save heatmap images with this filename prefix.\n" - << " Files named: _.ppm\n" - << " -j, --json Output results in structured JSON format to stdout.\n" - << " -h, --help Show this help message.\n\n" + << " -o, --out Save PPM heatmaps as _.ppm.\n" + << " -j, --json Emit structured JSON to stdout.\n" + << " -h, --help Show this help message.\n\n" + << "Per-View Outputs:\n" + << " area visible projected area (covered_pixels * resolution^2)\n" + << " average mean field value over visible pixels (with -d / batch data)\n" + << " integral area integral of the field: sum(value * pixel_area).\n" + << " Supply a radiance field to get radiant intensity, etc.\n" + << " min/max field extremes over visible pixels\n\n" << "Batch File Format:\n" - << " Each line represents a view. Lines starting with # are comments.\n" + << " One view per line; '#' starts a comment.\n" << " Columns: [resolution] [data_file_path]\n" - << " Examples:\n" - << " 1.0 0.0 0.0 (Uses default resolution & default data)\n" - << " 0.0 1.0 0.0 0.005 (Overrides resolution, uses default data)\n" - << " 0.0 0.0 1.0 0.002 data.txt (Overrides both)\n\n" - << "Precedence Rules:\n" - << " 1. Batch file specific settings (resolution/data) take highest precedence.\n" - << " 2. Command line flags (-r, -d) set the defaults for any view missing those details.\n" - << " 3. Single views (-v) always use the command-line default resolution and data.\n"; + << " 1.0 0.0 0.0 (default resolution & data)\n" + << " 0.0 1.0 0.0 0.005 (override resolution)\n" + << " 0.0 0.0 1.0 0.002 data.txt (override both)\n"; +} + +// Parse the value following a flag; errors if it is missing. +static std::string need_value(int& i, int argc, char* argv[], const std::string& flag) { + if (i+1 >= argc) throw std::runtime_error("option '" + flag + "' requires an argument"); + return argv[++i]; +} + +static double parse_double(const std::string& s, const std::string& ctx) { + try { + size_t pos; double d = std::stod(s, &pos); + if (pos != s.size()) throw std::invalid_argument(""); + return d; + } catch (...) { throw std::runtime_error("invalid number '" + s + "' for " + ctx); } } int main(int argc, char* argv[]) { @@ -445,66 +572,91 @@ int main(int argc, char* argv[]) { std::string obj_file, data_file, batch_file, out_pre, prec="float"; double res = 0.001; bool json=false, cull=true; + unsigned threads = 0; // 0 => auto std::vector batch; - int i = 1; - if (argv[1][0] != '-') { obj_file = argv[1]; i++; } - - for (; i= argc) throw std::runtime_error("option '" + a + "' requires three numbers: x y z"); + double x = parse_double(argv[i+1], "-v x"); + double y = parse_double(argv[i+2], "-v y"); + double z = parse_double(argv[i+3], "-v z"); + if (x==0 && y==0 && z==0) throw std::runtime_error("view direction cannot be the zero vector"); + batch.push_back({x, y, z, -1.0, ""}); + i += 3; } + else if (!a.empty() && a[0] == '-') { + throw std::runtime_error("unknown option '" + a + "' (try --help)"); + } + else if (obj_file.empty()) { obj_file = a; } + else throw std::runtime_error("unexpected argument '" + a + "' (mesh already set to '" + obj_file + "')"); } - else if (obj_file.empty() && arg[0]!='-') { obj_file = arg; } - } - if (obj_file.empty()) { std::cerr << "Error: No OBJ file.\n"; return 1; } - - // Parse Batch File if present - if (!batch_file.empty()) { - std::ifstream f(batch_file); - if (!f.is_open()) { std::cerr << "Error: Cannot open batch file.\n"; return 1; } - std::string line; - while (std::getline(f, line)) { - size_t c = line.find('#'); - if (c != std::string::npos) line = line.substr(0, c); - std::stringstream ss(line); - double nx, ny, nz; - if (ss >> nx >> ny >> nz) { - BatchEntry be = {nx, ny, nz, -1.0, ""}; - // Optional columns - double r_temp; - if (ss >> r_temp) { - be.resolution = r_temp; - std::string d_temp; - if (ss >> d_temp) be.data_file = d_temp; + if (obj_file.empty()) throw std::runtime_error("no mesh (.obj) file specified"); + if (prec != "float" && prec != "double") throw std::runtime_error("precision must be 'float' or 'double', got '" + prec + "'"); + if (res <= 0) throw std::runtime_error("resolution must be positive"); + + // Parse batch file (additive with any -v views) + if (!batch_file.empty()) { + std::ifstream f(batch_file); + if (!f.is_open()) throw std::runtime_error("cannot open batch file '" + batch_file + "'"); + // Relative data-file paths in a batch are resolved against the batch file's + // directory, so a committed time-series case works from any CWD. + std::string batch_dir; + size_t slash = batch_file.find_last_of('/'); + if (slash != std::string::npos) batch_dir = batch_file.substr(0, slash + 1); + std::string line; + int lineno = 0; + while (std::getline(f, line)) { + ++lineno; + size_t c = line.find('#'); + if (c != std::string::npos) line = line.substr(0, c); + std::stringstream ss(line); + double nx, ny, nz; + if (ss >> nx >> ny >> nz) { + if (nx==0 && ny==0 && nz==0) + throw std::runtime_error("batch line " + std::to_string(lineno) + ": zero view vector"); + BatchEntry be = {nx, ny, nz, -1.0, ""}; + double r_temp; + if (ss >> r_temp) { + if (r_temp <= 0) throw std::runtime_error("batch line " + std::to_string(lineno) + ": resolution must be positive"); + be.resolution = r_temp; + std::string d_temp; + if (ss >> d_temp) + be.data_file = (d_temp[0] == '/') ? d_temp : batch_dir + d_temp; + } + batch.push_back(be); + } else if (!line.empty() && line.find_first_not_of(" \t\r\n") != std::string::npos) { + throw std::runtime_error("batch line " + std::to_string(lineno) + ": expected ' ...'"); } - batch.push_back(be); } } - } - - if (batch.empty()) { std::cerr << "Error: No views specified.\n"; return 1; } - - // Dispatch - if (!json) std::cerr << "Running with " << prec << " precision...\n"; - - if (prec == "float") { - run_app(obj_file, data_file, out_pre, batch, res, cull, json); - } else { - run_app(obj_file, data_file, out_pre, batch, res, cull, json); - } + if (batch.empty()) throw std::runtime_error("no views specified (use -v or -b)"); + + unsigned hw = std::thread::hardware_concurrency(); + if (threads == 0) threads = hw ? hw : 1; + + if (!json) std::cerr << "Running " << batch.size() << " view(s) with " << prec + << " precision on " << threads << " thread(s)...\n"; + + if (prec == "float") run_app(obj_file, data_file, out_pre, batch, res, cull, json, threads); + else run_app(obj_file, data_file, out_pre, batch, res, cull, json, threads); + + } catch (const std::exception& e) { + std::cerr << "Error: " << e.what() << "\n"; + return 1; + } return 0; } diff --git a/tests/run_tests.sh b/tests/run_tests.sh new file mode 100755 index 0000000..d28b0e7 --- /dev/null +++ b/tests/run_tests.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +# +# FlatLand test suite — dependency-free (bash + awk only). +# +# Usage: tests/run_tests.sh [path-to-flatland-binary] +# If no binary is given, builds one from src/main.cpp with the system compiler. +# +set -u + +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +BIN="${1:-}" +TMP="$(mktemp -d)" +trap 'rm -rf "$TMP"' EXIT + +pass=0; fail=0 + +ok() { printf " \033[32mPASS\033[0m %s\n" "$1"; pass=$((pass+1)); } +bad() { printf " \033[31mFAIL\033[0m %s\n" "$1"; fail=$((fail+1)); } + +# near