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

Separate SpeciesThermo and ThermoPhase code in C++ #21

Closed
ischoegl opened this issue Jan 9, 2020 · 2 comments
Closed

Separate SpeciesThermo and ThermoPhase code in C++ #21

ischoegl opened this issue Jan 9, 2020 · 2 comments
Labels
feature-request New feature request

Comments

@ischoegl
Copy link
Member

ischoegl commented Jan 9, 2020

Abstract

C++ code implementing SpeciesThermo and (Thermo)Phase classes is currently both contained in the folders include/cantera/thermo / src/thermo, whereas the (historic?) include/cantera/tpx / src/tpx folders hold aspects of PureFluidPhase.

Motivation

It is hard to track 75 (and growing) header files.

  • What problem is it trying to solve: make various implementations more tractable
  • Who is affected by the change: developers and users using the C++ interface
  • Why is this a good solution: it clearly separates what is currently not clearly delineated; this also follows the separation of thermo.pyx and speciesthermo.pyx in the Cython interface.

Possible Solutions

Distribute existing files between two folders (e.g. thermo and species(thermo)?) and update header #include statements. Eliminate tpx folders and potentially clarify name Sub.h. Deprecate location of original files by creating (almost empty) placeholder files that #include moved files while issuing compiler warnings.

References

Issues #6 and #20.

@ischoegl ischoegl added the feature-request New feature request label Jan 9, 2020
@speth
Copy link
Member

speth commented Jan 9, 2020

Rather than looking directly at the directory structure, I find the inheritance diagrams in the Doxygen documentation to be one of the most useful ways of understanding how the classes are organized, e.g.

Perhaps a good "landing page" that brought attention to these important base classes would provide a better starting point for helping new developers explore the codebase. And of course, the more complete documentation envisioned by #6 would help clarify some of this as well.

As far as this specific proposal goes, if we moved all of the tpx files into thermo and the SpeciesThermoInterpType classes out, I think we'd have just as many files in thermo as we do now. Would you also split the PDSS classes into a subdirectory? And what about the files for classes that aren't descendants of ThermoPhase, like Species.h and Elements.h?

Reorganizing these files would introduces dozens of additional files which we'd be stuck with throughout the transition. Having multiple files with the same name would be fairly annoying to deal with at least in my IDE of choice (SublimeText) which provides quick access to files based on partial name matches.

@ischoegl
Copy link
Member Author

ischoegl commented Jan 9, 2020

@speth I have used the doxygen inheritance diagrams for that purpose for quite some time, and they are indeed helpful! (although I do find myself using find . | xargs grep ... a lot). A good landing page would certainly be welcome as well, but it simply is hard to retain an overview of what's in that folder, which motivated this feature request.

Regarding the other points raised: there are only 20 files in both tpx folders opposed to 130+ files in the two thermo folders, so there should be a net benefit (edit: most files are phase specific, so you do have a point). Regarding separation points for Species etc. a topical separation of phase specific and species specific information would make the most sense (i.e. group files from a user interface/YAML perspective; not necessarily what's currently done in Cython, where Element and Species are part of thermo.pyx rather than species(thermo).pyx).

Regarding IDE's I'm on emacs ... but I do understand that a reorganization would be disruptive during a transition (although I hope it would create a clearer structure in the long run).

@ischoegl ischoegl closed this as completed Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature request
Projects
None yet
Development

No branches or pull requests

2 participants