Skip to content
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

Refactor input file processing flow of control #1537

Merged
merged 4 commits into from Jul 1, 2019

Conversation

@akohlmey
Copy link
Member

commented Jun 24, 2019

Summary

This changes the logic of how (additional) input files are processed, e.g. via include or Input::file( const char *). Lifts some limitations discovered when writing the KIM simulator model interface (PR #1440).

Related Issues

A subset of the change was added to PR #1440

Author(s)

Axel Kohlmeyer (Temple U)

Licensing

By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).

Backward Compatibility

Should be fully compatible. At least that is the plan and so far it has worked.

Implementation Notes

Rather than just opening a file and adding it to the stack of open file pointers and waiting until returning to Input::file() to do all the processing and logic of closing files and unwinding the stack, we just stop in Input::file() at the end of a file and wait for the calling code to close a file and unwind the stack. This means, that now Input::include() needs to call Input::file(), but makes the whole process cleaner and puts the file closing logic where the file is opened. This will also allow to using Input->file(const char*) from inside some code in a similar fashion as the include command.

Post Submission Checklist

  • The feature or features in this pull request is complete
  • Licensing information is complete
  • Corresponding author information is complete
  • The source code follows the LAMMPS formatting guidelines
  • The feature has been verified to work with the conventional build system
  • The feature has been verified to work with the CMake based build system

akohlmey added some commits Jun 24, 2019

add workaround for handline include files
# Conflicts:
#	src/input.h
simplify nested include file handling
# Conflicts:
#	src/input.h
@sjplimp

This comment has been minimized.

Copy link
Contributor

commented Jun 26, 2019

changes look good - makes include work for more use cases

@stanmoore1
Copy link
Contributor

left a comment

Looks OK to me but it touches core LAMMPS and I'd feel better if we ran this through full regression testing.

@stanmoore1

This comment has been minimized.

Copy link
Contributor

commented Jul 1, 2019

And you already did that, so GTG.

@sjplimp

sjplimp approved these changes Jul 1, 2019

@akohlmey akohlmey merged commit b727f0b into lammps:master Jul 1, 2019

6 checks passed

lammps/pull-requests/build-docs-pr head run ended
Details
lammps/pull-requests/cmake/cmake-serial-pr head run ended
Details
lammps/pull-requests/kokkos-omp-pr head run ended
Details
lammps/pull-requests/openmpi-pr head run ended
Details
lammps/pull-requests/serial-pr head run ended
Details
lammps/pull-requests/shlib-pr head run ended
Details

@akohlmey akohlmey deleted the akohlmey:refactor-input-file-handling branch Jul 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.