OGS
MeshLib::IntegrationPointWriter Struct Referencefinal

Detailed Description

Definition at line 24 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::*)(Args...) const getIpData,
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 31 of file IntegrationPointWriter.h.

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

References _callback.

◆ 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 68 of file IntegrationPointWriter.h.

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

References _callback.

Member Function Documentation

◆ integrationOrder()

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

Definition at line 96 of file IntegrationPointWriter.h.

96{ return _integration_order; }

References _integration_order.

Referenced by addIntegrationPointData().

◆ name()

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

Definition at line 97 of file IntegrationPointWriter.h.

97{ return _name; }

References _name.

Referenced by addIntegrationPointData().

◆ numberOfComponents()

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

Definition at line 95 of file IntegrationPointWriter.h.

95{ return _n_components; }

References _n_components.

Referenced by addIntegrationPointData().

◆ values()

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

Definition at line 98 of file IntegrationPointWriter.h.

98{ 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

Definition at line 103 of file IntegrationPointWriter.h.

Referenced by integrationOrder().

◆ _n_components

int const MeshLib::IntegrationPointWriter::_n_components
private

Definition at line 102 of file IntegrationPointWriter.h.

Referenced by numberOfComponents().

◆ _name

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

Definition at line 101 of file IntegrationPointWriter.h.

Referenced by name().


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