-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for pointers in OpenFAST Registry generated Pack and Unpack subroutines #1625
Add support for pointers in OpenFAST Registry generated Pack and Unpack subroutines #1625
Conversation
This commit significantly modifies the OpenFAST Registry code which generated the Pack and Unpack routines so that it can support packing and unpacking pointers without loosing their associations. This was accomplished by creating a PackBuffer derived type which stores a buffer of bytes and a pointer index. The byte buffer replaces the DbKiBuf, IntKiBuf, and ReKiBuf and packs all data as bytes (int8) using the `transfer` intrinsic. As each pointer is encountered in any structure, `c_loc` is used to get the address and the pointer index in PackBuffer is searched. If the pointer is found (already encountered in another field), then the exisitng index is saved into the buffer; otherwise, the pointer is added to the index and the new index is saved into the buffer. If the pointer wasn't in the index, then the associated data is saved to the buffer. Unpacking is the reverse of this process.
I'm suspicious we haven't been generating the |
@andrew-platt, NWTC Library Types files were not originally going to be auto-generated because of the mesh data types, but then we started modifying it and eventually decided the other data types stored in the library needed some of the routines the registry could generate.... anyway, it looks like @deslaughter has fixed the reasons for @deslaughter , With this change to the NWTC Library source files, all of the |
Thanks @bjonkman for the info on the history! |
@bjonkman, thanks for the background, it's very helpful to know why things are the way they are. I'll update the |
Also reduce number of simultaneous tests in rtest-OF
e503c98
to
75d1e9d
Compare
2d7a2f2
to
0838e5f
Compare
I've added |
Could you regenerate Morison_Types.f90? A conflict got introduced with #1623 |
This may be a good idea to initialize fields to default values where possible.
@andrew-platt , the latest commit has the regenerated types files |
This commit changes the extrap/interp routines used by the Registry and Mesh to use Lagrange polynomials. This formulation allows for scalar coefficients to be calculated and then multiplied by the values/arrays to be interpolation. This should significantly reduce the number of operations used by these routines.
This code was unintentionally left in from developing the new pack/unpack functionality for the registry.
Adding a note from a discussion with @deslaughter so that I remember this later:
|
9f68217
into
OpenFAST:dev-unstable-pointers
This pull request is ready to merge.
Feature or improvement description
This commit significantly modifies the OpenFAST Registry code which generated the Pack and Unpack routines so that it can support packing and unpacking pointers without loosing their associations. This was accomplished by creating a PackBuffer derived type which stores a buffer of bytes and a pointer index. The byte buffer replaces the DbKiBuf, IntKiBuf, and ReKiBuf and packs all data as bytes (int8) using the
transfer
intrinsic. As each pointer is encountered in any structure,c_loc
is used to get the address and the pointer index in PackBuffer is searched. If the pointer is found (already encountered in another field), then the exisitng index is saved into the buffer; otherwise, the pointer is added to the index and the new index is saved into the buffer. If the pointer wasn't in the index, then the associated data is saved to the buffer. Unpacking is the reverse of this process.Impacted areas of the software
OpenFAST Registry, all _Types.f90 files, NWTC Library, OpenFAST Library, Visual Studio projects
Additional supporting information
A new file
ModReg.f90
was added to NWTC Library and contains generic routines for packing and unpacking data.ModReg.f90
is generated from a Python script,GenModReg.py
in the parent directory. This script takes function prototypes and expands them for a variety of intrinsic types and array ranks. Generation ofNWTC_Library_Types.f90
was added to the CMakeLists.txt and theSetErrStat
function was moved intoNWTC_Base.f90
. This removes some of the manual copying when these files need to be updated. The MeshPack, MeshUnpack, DLLPack, and DLLUnpack routines were also updated.Test results, if applicable
An OpenFAST regression test was added to verify the restart capability, and ensure that all data was being packed and upacked correctly. The test is
5MW_OC3Mnpl_DLL_WTurb_WavesIrr_Restart
which is the same as5MW_OC3Mnpl_DLL_WTurb_WavesIrr
except modified to generate a checkpoint file. The test is run twice, which required modifications toexecuteOpenfastRegressionCase.py
and then the final output is checked against the reference.