@@ -34,6 +34,25 @@ namespace
3434 Attributable const &source,
3535 std::vector<std::string> ignore = {})
3636 {
37+ #if 0 // leave this in for potential future debugging
38+ std::cout << "COPYING ATTRIBUTES FROM '" << [&source]() -> std::string {
39+ auto vec = source.myPath().group;
40+ if (vec.empty())
41+ {
42+ return "[]";
43+ }
44+ std::stringstream sstream;
45+ auto it = vec.begin();
46+ sstream << "[" << *it++;
47+ for (; it != vec.end(); ++it)
48+ {
49+ sstream << ", " << *it;
50+ }
51+ sstream << "]";
52+ return sstream.str();
53+ }() << "'"
54+ << std::endl;
55+ #endif
3756 auto shouldBeIgnored = [&ignore](std::string const &attrName) {
3857 // `ignore` is empty by default and normally has only a handful of
3958 // entries otherwise.
@@ -94,6 +113,25 @@ namespace
94113 static_cast <BaseRecordComponent const &>(fromTemplate));
95114 }
96115
116+ template <typename T>
117+ void initializeFromTemplate (
118+ BaseRecord<T> &initializeMe, BaseRecord<T> const &fromTemplate)
119+ {
120+ if (fromTemplate.scalar ())
121+ {
122+ initializeMe[RecordComponent::SCALAR];
123+ initializeFromTemplate (
124+ static_cast <T &>(initializeMe),
125+ static_cast <T const &>(fromTemplate));
126+ }
127+ else
128+ {
129+ initializeFromTemplate (
130+ static_cast <Container<T> &>(initializeMe),
131+ static_cast <Container<T> const &>(fromTemplate));
132+ }
133+ }
134+
97135 void initializeFromTemplate (
98136 ParticleSpecies &initializeMe, ParticleSpecies const &fromTemplate)
99137 {
0 commit comments