From c497fefd5b0e8b214593726cba91f3f9abd28660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Fri, 22 Dec 2023 19:17:51 +0100 Subject: [PATCH] Adapt this to changed SCALAR API --- src/auxiliary/TemplateFile.cpp | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/auxiliary/TemplateFile.cpp b/src/auxiliary/TemplateFile.cpp index 8eab0727dc..59d71ec613 100644 --- a/src/auxiliary/TemplateFile.cpp +++ b/src/auxiliary/TemplateFile.cpp @@ -34,6 +34,25 @@ namespace Attributable const &source, std::vector ignore = {}) { +#if 0 // leave this in for potential future debugging + std::cout << "COPYING ATTRIBUTES FROM '" << [&source]() -> std::string { + auto vec = source.myPath().group; + if (vec.empty()) + { + return "[]"; + } + std::stringstream sstream; + auto it = vec.begin(); + sstream << "[" << *it++; + for (; it != vec.end(); ++it) + { + sstream << ", " << *it; + } + sstream << "]"; + return sstream.str(); + }() << "'" + << std::endl; +#endif auto shouldBeIgnored = [&ignore](std::string const &attrName) { // `ignore` is empty by default and normally has only a handful of // entries otherwise. @@ -94,6 +113,25 @@ namespace static_cast(fromTemplate)); } + template + void initializeFromTemplate( + BaseRecord &initializeMe, BaseRecord const &fromTemplate) + { + if (fromTemplate.scalar()) + { + initializeMe[RecordComponent::SCALAR]; + initializeFromTemplate( + static_cast(initializeMe), + static_cast(fromTemplate)); + } + else + { + initializeFromTemplate( + static_cast &>(initializeMe), + static_cast const &>(fromTemplate)); + } + } + void initializeFromTemplate( ParticleSpecies &initializeMe, ParticleSpecies const &fromTemplate) {