Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/openfast-registry/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Usage: openfast_registry registryfile [options] -or-
-noextrap do not generate ModName_Input_ExtrapInterp or ModName_Output_ExtrapInterp routines
-D<SYM> define symbol for conditional evaluation inside registry file
-ccode generate additional code for interfacing with C/C++
-inputintallow allow integers in InputType
-keep do not delete temporary files from registry program
-shownodes output a listing of the nodes in registry's AST
=== alternate usage for generating templates ===
Expand Down Expand Up @@ -63,6 +64,10 @@ int main(int argc, char *argv[])
{
reg.gen_c_code = true;
}
else if ((arg.compare("-inputintallow")) == 0 || (arg.compare("/inputintallow")) == 0)
{
reg.input_int_allow = true;
}
else if ((arg.compare("-noextrap")) == 0 || (arg.compare("/noextrap")) == 0)
{
reg.no_extrap_interp = true;
Expand Down
1 change: 1 addition & 0 deletions modules/openfast-registry/src/registry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ struct Registry
bool gen_c_code = false;
bool no_extrap_interp = false;
bool gen_inc_subs = false;
bool input_int_allow = false;

Registry()
{
Expand Down
13 changes: 8 additions & 5 deletions modules/openfast-registry/src/registry_gen_fortran.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,14 @@ void Registry::gen_fortran_module(const Module &mod, const std::string &out_dir)

// If derived data type should only contain reals,
// verify that it does, otherwise exit with error
if ((ddt.interface != nullptr) && ddt.interface->only_reals)
if (!ddt.only_contains_reals())
if (!this->input_int_allow)
{
std::cerr << "Registry warning: Data type '" << dt_name << "' contains non-real values." << std::endl;
exit(EXIT_FAILURE);
if ((ddt.interface != nullptr) && ddt.interface->only_reals)
Copy link
Collaborator

@deslaughter deslaughter Jan 22, 2024

Choose a reason for hiding this comment

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

Instead of adding a new flag, you could disable this check if the -noextrap flag has been set: if ((ddt.interface != nullptr) && ddt.interface->only_reals && !this->no_extrap_interp) and then add that flag to for this module. I didn't see extrap/interp being called for ExternalInflow. However, I also don't think there should be an integer in the InputType.

if (!ddt.only_contains_reals())
{
std::cerr << "Registry warning: Data type '" << dt_name << "' contains non-real values." << std::endl;
exit(EXIT_FAILURE);
}
}

// Write derived type header
Expand Down Expand Up @@ -1636,4 +1639,4 @@ void gen_copy_f2c(std::ostream &w, const Module &mod, const DataType::Derived &d
indent.erase(indent.size() - 3);
w << indent << "END SUBROUTINE";
w << indent;
}
}