dmorse / pscfpp

Polymer Self-Consistent Field Theory (C++/CUDA version)
https://pscf-home.cems.umn.edu
GNU General Public License v3.0
27 stars 20 forks source link

Improved handling of flexibleParams, changed setup() methods to protected #99

Closed benmagruder closed 1 year ago

benmagruder commented 1 year ago

This pull request primarily improves the handling of flexibleParams. With this update, we no longer store an array of indices of each flexible lattice parameter; instead, we store an array of booleans (one for each lattice parameter) to keep track of which lattice parameters are flexible. With this change, the internal handling of flexibleParams now matches the format that is read from the parameter file (the external interface of flexibleParams).

The flexibleParams array of booleans has also been switched from a DArray<int> to an FSArray<bool, 6>, and it is read from the parameter file using the new FSArrayParam object in the util submodule.

A new unit test, testSolve2D(), was added to FilmIteratorTest in order to test a full calculation with 1 flexible parameter and 1 rigid parameter, to ensure that flexibleParams is implemented properly throughout.

I added a new method to Iterator called nFlexibleParams() that returns an integer value representing the number of lattice parameters that are flexible.

The other significant change in this pull request is in the AmIterator setup() methods. setup() is no longer a public method for any AmIterator. In the pspc Iterator base class, setup() was deleted entirely. In AmIteratorTmpl, setup() is now protected and it is no longer empty (it contains a call to allocateAM() if needed). In child classes of AmIteratorTmpl, setup() has been deleted and these classes will use the setup() function of the template class instead. The setup() function of FilmIterator is now protected, and the unit test for this function has been deleted (it is tested implicitly in other unit tests). No other unit tests required modification since we don't have unit tests for most iterators.

(Note that there is still a public setup() function in fd1d::Iterator and pspg::Iterator. I imagine that these could probably be deleted or made protected as well, though I didn't make the changes myself since I'm not as familiar with the 1D and GPU codes.)

Other small changes are included here to the Doxygen documentation for FilmIterator methods, so they now have a single-line "brief" description in addition to the multiple-line detailed description.

Changes regarding flexibleParams have been documented. New code compiles and all unit tests pass.