From 69026cc7c1385613e5a992c03f6e7506f22a30eb Mon Sep 17 00:00:00 2001 From: Christoph Lehmann <christoph.lehmann@ufz.de> Date: Mon, 17 Oct 2022 07:27:16 +0200 Subject: [PATCH] [PL] Reflection support for IP writers --- .../Reflection/ReflectionForIPWriters.h | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 ProcessLib/Reflection/ReflectionForIPWriters.h diff --git a/ProcessLib/Reflection/ReflectionForIPWriters.h b/ProcessLib/Reflection/ReflectionForIPWriters.h new file mode 100644 index 00000000000..dc7a202b2a0 --- /dev/null +++ b/ProcessLib/Reflection/ReflectionForIPWriters.h @@ -0,0 +1,42 @@ +/** + * \file + * \copyright + * Copyright (c) 2012-2022, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#pragma once + +#include "MeshLib/Utils/IntegrationPointWriter.h" +#include "ReflectionIPData.h" + +namespace ProcessLib::Reflection +{ +/// Adds IP data writers for all IP data obtained recursively from the given +/// \c reflection_data to the given IP writer vector. +template <int Dim, typename LocAsmIF, typename ReflData> +void addReflectedIntegrationPointWriters( + ReflData const& reflection_data, + std::vector<std::unique_ptr<MeshLib::IntegrationPointWriter>>& + integration_point_writers, + unsigned const integration_order, + std::vector<std::unique_ptr<LocAsmIF>> const& local_assemblers) +{ + forEachReflectedFlattenedIPDataAccessor<Dim, LocAsmIF>( + reflection_data, + [&integration_point_writers, integration_order, &local_assemblers]( + std::string const& name, + unsigned const num_comp, + auto&& flattened_ip_data_accessor) + { + // TODO check if writer with such a name already exists. + integration_point_writers.emplace_back( + std::make_unique<MeshLib::IntegrationPointWriter>( + name + "_ip", num_comp, integration_order, local_assemblers, + flattened_ip_data_accessor)); + }); +} +} // namespace ProcessLib::Reflection -- GitLab