OGS
MeshLib::IntegrationPointWriter Struct Referencefinal

Detailed Description

Definition at line 21 of file IntegrationPointWriter.h.

#include <IntegrationPointWriter.h>

Public Member Functions

template<typename LocalAssemblerInterface, typename... Args>
 IntegrationPointWriter (std::string const &name, int const n_components, int const integration_order, std::vector< std::unique_ptr< LocalAssemblerInterface > > const &local_assemblers, std::vector< double >(LocalAssemblerInterface::*getIpData)(Args...) const, Args &&... args)
template<typename LocalAssemblerInterface, typename Accessor>
 IntegrationPointWriter (std::string const &name, int const n_components, int const integration_order, std::vector< std::unique_ptr< LocalAssemblerInterface > > const &local_assemblers, Accessor accessor)
int numberOfComponents () const
int integrationOrder () const
std::string name () const
std::vector< std::vector< double > > values () const

Private Attributes

std::string const _name
int const _n_components
int const _integration_order
std::function< std::vector< std::vector< double > >()> _callback

Constructor & Destructor Documentation

◆ IntegrationPointWriter() [1/2]

template<typename LocalAssemblerInterface, typename... Args>
MeshLib::IntegrationPointWriter::IntegrationPointWriter ( std::string const & name,
int const n_components,
int const integration_order,
std::vector< std::unique_ptr< LocalAssemblerInterface > > const & local_assemblers,
std::vector< double >(LocalAssemblerInterface::* getIpData )(Args...) const,
Args &&... args )
inline

Constructor taking a member function of the LocalAssemblerInterface as a callback.

The callback getIpData must return a std::vector<double>.

Definition at line 28 of file IntegrationPointWriter.h.

37 : _name(name),
38 _n_components(n_components),
39 _integration_order(integration_order)
40 {
41 _callback = [&local_assemblers,
42 getIpData,
43 ... f_args = std::forward<Args>(args)]
44 {
45 // Result containing integration point data for each local
46 // assembler.
47 std::vector<std::vector<double>> result;
48 result.reserve(local_assemblers.size());
49
50 std::transform(begin(local_assemblers), end(local_assemblers),
51 std::back_inserter(result),
52 [&](auto const& la)
53 { return (*la.*getIpData)(f_args...); });
54
55 return result;
56 };
57 }
std::function< std::vector< std::vector< double > >()> _callback

References _callback, _integration_order, _n_components, _name, and name().

◆ IntegrationPointWriter() [2/2]

template<typename LocalAssemblerInterface, typename Accessor>
MeshLib::IntegrationPointWriter::IntegrationPointWriter ( std::string const & name,
int const n_components,
int const integration_order,
std::vector< std::unique_ptr< LocalAssemblerInterface > > const & local_assemblers,
Accessor accessor )
inline

Constructor taking an accessor function as a callback.

The accessor function must take a const reference to a LocalAssemblerInterface object as its only argument. The callback accessor must return a std::vector<double>.

Definition at line 65 of file IntegrationPointWriter.h.

72 : _name(name),
73 _n_components(n_components),
74 _integration_order(integration_order)
75 {
76 _callback = [&local_assemblers, accessor]
77 {
78 // Result containing integration point data for each local
79 // assembler.
80 std::vector<std::vector<double>> result;
81 result.reserve(local_assemblers.size());
82
83 std::transform(begin(local_assemblers), end(local_assemblers),
84 std::back_inserter(result),
85 [&accessor](auto const& la)
86 { return accessor(*la); });
87
88 return result;
89 };
90 }

References _callback, _integration_order, _n_components, _name, and name().

Member Function Documentation

◆ integrationOrder()

int MeshLib::IntegrationPointWriter::integrationOrder ( ) const
inline

Definition at line 93 of file IntegrationPointWriter.h.

93{ return _integration_order; }

References _integration_order.

Referenced by addIntegrationPointData().

◆ name()

std::string MeshLib::IntegrationPointWriter::name ( ) const
inline

Definition at line 94 of file IntegrationPointWriter.h.

94{ return _name; }

References _name.

Referenced by IntegrationPointWriter(), IntegrationPointWriter(), and addIntegrationPointData().

◆ numberOfComponents()

int MeshLib::IntegrationPointWriter::numberOfComponents ( ) const
inline

Definition at line 92 of file IntegrationPointWriter.h.

92{ return _n_components; }

References _n_components.

Referenced by addIntegrationPointData().

◆ values()

std::vector< std::vector< double > > MeshLib::IntegrationPointWriter::values ( ) const
inline

Definition at line 95 of file IntegrationPointWriter.h.

95{ return _callback(); }

References _callback.

Referenced by addIntegrationPointData().

Member Data Documentation

◆ _callback

std::function<std::vector<std::vector<double> >()> MeshLib::IntegrationPointWriter::_callback
private

◆ _integration_order

int const MeshLib::IntegrationPointWriter::_integration_order
private

◆ _n_components

int const MeshLib::IntegrationPointWriter::_n_components
private

◆ _name

std::string const MeshLib::IntegrationPointWriter::_name
private

Definition at line 98 of file IntegrationPointWriter.h.

Referenced by IntegrationPointWriter(), IntegrationPointWriter(), and name().


The documentation for this struct was generated from the following file: