Loading [MathJax]/jax/input/TeX/config.js
OGS
MeshLib::IntegrationPointWriter Struct Referencefinal

Detailed Description

Definition at line 27 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 34 of file IntegrationPointWriter.h.

43 : _name(name),
44 _n_components(n_components),
45 _integration_order(integration_order)
46 {
47 _callback = [&local_assemblers,
48 getIpData,
49 ... f_args = std::forward<Args>(args)]
50 {
51 // Result containing integration point data for each local
52 // assembler.
53 std::vector<std::vector<double>> result;
54 result.reserve(local_assemblers.size());
55
56 std::transform(begin(local_assemblers), end(local_assemblers),
57 std::back_inserter(result),
58 [&](auto const& la)
59 { return (*la.*getIpData)(f_args...); });
60
61 return result;
62 };
63 }
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 71 of file IntegrationPointWriter.h.

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

References _callback.

Member Function Documentation

◆ integrationOrder()

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

Definition at line 99 of file IntegrationPointWriter.h.

99{ return _integration_order; }

References _integration_order.

Referenced by addIntegrationPointData().

◆ name()

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

Definition at line 100 of file IntegrationPointWriter.h.

100{ return _name; }

References _name.

Referenced by addIntegrationPointData().

◆ numberOfComponents()

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

Definition at line 98 of file IntegrationPointWriter.h.

98{ return _n_components; }

References _n_components.

Referenced by addIntegrationPointData().

◆ values()

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

Definition at line 101 of file IntegrationPointWriter.h.

101{ 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 106 of file IntegrationPointWriter.h.

Referenced by integrationOrder().

◆ _n_components

int const MeshLib::IntegrationPointWriter::_n_components
private

Definition at line 105 of file IntegrationPointWriter.h.

Referenced by numberOfComponents().

◆ _name

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

Definition at line 104 of file IntegrationPointWriter.h.

Referenced by name().


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