dggridR consists of several parts connected together with a discomforting amount of duct tape and superglue. These parts are assembled into a directory called src
which is designed to be nuke-able.
These parts are:
submodules/DGGRID
- The upstream engine for manipulating discrete global gridscopy_to_src/dglib.{cpp,h}
- A simplifying layer of C++copy_to_src/Rwrapper.{h,cpp}
- Code that wrapsdglib.{cpp,h}
for use with Rcopy_to_src/cgen_{head,body,funcs}.h
- Full-factorial coordinate conversion code generated withcopy_to_src/func_gen.py
copy_to_src/func_gen.py
- Autogenerates full-factorial coordinate conversion code./update_from_upstream.h
- Copies the appropriate files fromsubmodules/DGGRID
intosrc/
Why do we have to do this copying? Because R's build model is pretty terrible: it assumes all the code lives in the same directory. If you want a reasonable, subdirectory-based organization of your code things become very painful.
Updating the C++ code in dggridR is a multi-step process.
- Pull code from https://github.com/sahrk/DGGRID into https://github.com/r-barnes/DGGRID
- Update submodules/DGGRID from https://github.com/r-barnes/DGGRID
- Run ./update_from_upstream.sh to update dggridR/src from submodules/DGGRID
Making fixes to the C++ code requires running this process in reverse. The following workflow is suggested.
- Make any changes you need to submodules/DGGRID. Use submodules/DGGRID/CMakeLists.txt and the usual CMake workflow to ensure these compile.
- Use ./update_from_upstream.sh to import your changes into dggridR and test that they work.
- Iterate on the above until everything is working.
- If you need changes to CRAN soonish, collect changes to submodules/DGGRID into a branch on r-barnes/DGGRID that submodules/DGGRID can point to.
- Break changes in submodules/DGGRID apart into small branches on r-barnes/DGGRID which can be made into pull requests to https://github.com/sahrk/DGGRID.
- Get Kevin Sahr's to approve and merge the PR's into https://github.com/sahrk/DGGRID.
- Update https://github.com/r-barnes/DGGRID
- Point submodules/DGGRID to master on https://github.com/r-barnes/DGGRID
- Run ./update_from_upstream.sh to update dggridR/src from submodules/DGGRID