MeteoSwiss-APN/dawn

Explore header vs implementation separation options for CXXNaiveIco

Stagno opened this issue · 0 comments

Central problem is that the stencil class is templated wrt LibTag, thus making it very hard to separate declaration and definition.

A possibility is generating an implementation (.cpp) such as

#include "interface/atlas_interface.hpp" // Necessary for instantiation of template

namespace dawn_generated {
namespace cxxnaiveico {
template<typename LibTag>
class ICON_laplacian_diamond {
	// Makes use of functions/classes that require the tag, e.g. getCells(LibTag, ...)
	...
}

void run_ICON_laplacian_diamond_with_atlas(...) {
	// This would select a specific instance
	ICON_laplacian_diamond<atlasInterface::atlasTag> s(...).run(); 
}
}
}

and exporting only run_ICON_laplacian_diamond_with_atlas(...) in the header file.
However this solution requires including the (atlas) implementation of the unstructured interface in the generated code, breaking the strict separation policy followed so far.

Another viable way is to get rid of the need for interfaces (and templates) by committing to only one library for the naive backend.