Skip to content

Commit

Permalink
Adapt this to changed SCALAR API
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Jan 4, 2024
1 parent 8cae9c8 commit c497fef
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/auxiliary/TemplateFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@ namespace
Attributable const &source,
std::vector<std::string> 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.
Expand Down Expand Up @@ -94,6 +113,25 @@ namespace
static_cast<BaseRecordComponent const &>(fromTemplate));
}

template <typename T>
void initializeFromTemplate(
BaseRecord<T> &initializeMe, BaseRecord<T> const &fromTemplate)
{
if (fromTemplate.scalar())
{
initializeMe[RecordComponent::SCALAR];
initializeFromTemplate(
static_cast<T &>(initializeMe),
static_cast<T const &>(fromTemplate));
}
else
{
initializeFromTemplate(
static_cast<Container<T> &>(initializeMe),
static_cast<Container<T> const &>(fromTemplate));
}
}

void initializeFromTemplate(
ParticleSpecies &initializeMe, ParticleSpecies const &fromTemplate)
{
Expand Down

0 comments on commit c497fef

Please sign in to comment.