Skip to content

Use C++ to read VTK inflow in AWAE#3074

Merged
andrew-platt merged 13 commits intoOpenFAST:dev-tcfrom
deslaughter:fastfarm_cpp_vtk
Nov 20, 2025
Merged

Use C++ to read VTK inflow in AWAE#3074
andrew-platt merged 13 commits intoOpenFAST:dev-tcfrom
deslaughter:fastfarm_cpp_vtk

Conversation

@deslaughter
Copy link
Copy Markdown
Collaborator

@deslaughter deslaughter commented Nov 18, 2025

This PR is ready to be merged after PR #3066.

Feature or improvement description

This PR adds a new function for reading the VTK based inflow used by the AWAE module. While benchmarking FAST.Farm, it was found that the program spent 60%-80% of it's time in reading these files and parsing the floating point grid data when used in a multi-threaded OpenMP context. Part of this was in waiting to get a lock to find a unique unit number via GetNewUnit and a large part of it was in parsing the floating point values from strings into SiKi numbers.

Using a C++ based function removes the need to get unique unit numbers and using the https://github.com/fastfloat/fast_float library to read the grid values significantly improved the parsing speed. This change can reduce the FAST.Farm run time up to 75% depending on the contents of the VTK files and grid sizes.

The fast_float library is a single header file which has been added to modules/nwtc-library/include/fast_float.h. An accompanying fast_float.md was also added containing a brief description, version information, and use case. This library is licensed under APACHE 2.0 and MIT, both of which are listed within the header file itself.

Impacted areas of the software

NWTC Library and AWAE

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a C++ function for reading VTK inflow files in the AWAE module to improve FAST.Farm performance. The key changes include adding the fast_float library for efficient floating-point parsing, implementing a KdTree data structure for spatial queries, and refactoring AWAE data structures to use more compact array representations.

  • Adds C++ VTK reader using fast_float library for performance
  • Implements KdTree for efficient nearest-neighbor searches
  • Refactors AWAE grid data structures from individual X/Y/Z components to combined XYZ arrays
  • Updates build system to compile C++ code and link new libraries

Reviewed Changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
modules/nwtc-library/include/fast_float.h Adds fast_float v8.1.0 header library for fast floating-point parsing
modules/nwtc-library/include/fast_float.md Documentation for fast_float library usage and licensing
modules/nwtc-library/src/KdTree.f90 New KdTree implementation for spatial searches
modules/nwtc-library/src/Registry_NWTC_Library*.txt Registry definitions for KdTreeType
modules/nwtc-library/src/NWTC_Library_Types.f90 Generated type definitions for KdTree
modules/awae/src/vtk.cpp New C++ function for reading VTK inflow files
modules/awae/src/AWAE_Registry.txt Refactored data structures to use XYZ arrays instead of separate components
modules/awae/CMakeLists.txt Builds new C++ library and links it to awaelib
modules/nwtc-library/CMakeLists.txt Adds KdTree source and include directory
modules/elastodyn/src/ElastoDyn.f90 Updates SmllRotTrans calls to use keyword arguments
glue-codes/fast-farm/src/FAST_Farm_Subs.f90 Updates to use refactored array structures
glue-codes/fast-farm/src/FAST_Farm_IO_Params.f90 Refactors PointInAABB function signature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@andrew-platt andrew-platt merged commit b37b534 into OpenFAST:dev-tc Nov 20, 2025
13 checks passed
@deslaughter deslaughter deleted the fastfarm_cpp_vtk branch November 20, 2025 15:49
This was referenced Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants