Revision 99bcb1a63c60aff851469c7ff47d2e33c213b5c2 authored by Dmitry Yu. Naumov on 02 February 2023, 10:06:47 UTC, committed by Dmitry Yu. Naumov on 02 February 2023, 10:06:47 UTC
Small fixes See merge request ogs/ogs!4466
IntegrationMethodProvider.h
/**
* \file
* \copyright
* Copyright (c) 2012-2023, 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 "IntegrationMethodRegistry.h"
#include "MeshLib/Elements/Quad.h"
namespace NumLib
{
/// An \c IntegrationMethodProvider provides <tt>GenericIntegrationMethod</tt>s
/// for <tt>MeshLib::Element</tt>s.
template <typename T>
concept IntegrationMethodProvider = requires(T t)
{
{
// using Quad as a representative mesh element type
t.template getIntegrationMethod<MeshLib::Quad>(
std::declval<MeshLib::Element>())
} -> std::same_as<GenericIntegrationMethod const&>;
};
/// Provides OGS's default Gauss-Legendre integration method of a given order
/// for any mesh element.
class DefaultIntegrationMethodProvider
{
public:
explicit DefaultIntegrationMethodProvider(
IntegrationOrder const integration_order)
: integration_order_{integration_order}
{
}
template <typename MeshElement>
GenericIntegrationMethod const& getIntegrationMethod(
MeshLib::Element const& /*e*/) const
{
return IntegrationMethodRegistry::template getIntegrationMethod<
MeshElement>(integration_order_);
}
private:
IntegrationOrder integration_order_;
};
/// Used in template functions to get the \c DefaultIntegrationMethodProvider
/// for the given \c integration_order.
inline DefaultIntegrationMethodProvider getIntegrationMethodProvider(
NumLib::IntegrationOrder const integration_order)
{
return DefaultIntegrationMethodProvider{integration_order};
}
/// Overload for <tt>IntegrationMethodProvider</tt>s returning the provider
/// itself.
template <IntegrationMethodProvider IntegrationMethodProvider_>
IntegrationMethodProvider_ const& getIntegrationMethodProvider(
IntegrationMethodProvider_ const& integration_method_provider)
{
return integration_method_provider;
}
} // namespace NumLib
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...