OGS
ProcessLib::Reflection::detail::GetFlattenedIPDataFromLocAsm< Dim, Accessor_IPDataVecInLocAsm, Accessor_CurrentLevelFromIPDataVecElement > Struct Template Reference

Detailed Description

template<int Dim, typename Accessor_IPDataVecInLocAsm, typename Accessor_CurrentLevelFromIPDataVecElement>
struct ProcessLib::Reflection::detail::GetFlattenedIPDataFromLocAsm< Dim, Accessor_IPDataVecInLocAsm, Accessor_CurrentLevelFromIPDataVecElement >

A function object taking a local assembler as its argument and returning a std::vector<double> of some specific "flattened" integration point (IP) data.

Template Parameters
Dimthe space dimension
Accessor_IPDataVecInLocAsmsee below
Accessor_CurrentLevelFromIPDataVecElementsee below

In OGS IP data is usually stored in the local assembler in the following way:

struct LocAsm
{
std::vector<IPData1> ip_data1;
std::vector<IPData2> ip_data2;
};

The types IPData1 and IPData2 might directly contain the IP data or might have struct members who contain the IP data, e.g.:

struct IPData1
{
double scalar1; // IPData1 directly holds IP data
Eigen::Vector<double, 3> vector1;
};
struct IPData_Level2
{
double scalar2;
Eigen::Vector<double, 6> kelvin2;
};
struct IPData2
{
IPData_Level2 level2; // IPData2 does not directly hold IP data
};

Accessor_IPDataVecInLocAsm is a function object with signature LocAsm const& -> std::vector<IPData> const&.

Accessor_CurrentLevelFromIPDataVecElement is a function object with signature IPData const& -> double (or Eigen::Vector), where IPData is the "top level" struct contained in the std::vector<IPData>.

I.e. the first accessor takes us from the local assembler to the IP data vector and the second accessor takes us from an IP data vector element to the final IP data of type double or Eigen::Vector.

Note
This function object transforms Kelvin vector typed IP data to a ParaView compatible symmetric tensor representation.

Definition at line 186 of file ReflectionIPData.h.

#include <ReflectionIPData.h>

Public Member Functions

template<typename LocAsm >
std::vector< double > operator() (LocAsm const &loc_asm) const
 

Public Attributes

Accessor_IPDataVecInLocAsm accessor_ip_data_vec_in_loc_asm
 
Accessor_CurrentLevelFromIPDataVecElement accessor_current_level_from_ip_data_vec_element
 

Member Function Documentation

◆ operator()()

template<int Dim, typename Accessor_IPDataVecInLocAsm , typename Accessor_CurrentLevelFromIPDataVecElement >
template<typename LocAsm >
std::vector< double > ProcessLib::Reflection::detail::GetFlattenedIPDataFromLocAsm< Dim, Accessor_IPDataVecInLocAsm, Accessor_CurrentLevelFromIPDataVecElement >::operator() ( LocAsm const & loc_asm) const
inline

Definition at line 197 of file ReflectionIPData.h.

198 {
199 using IPDataVector = std::remove_cvref_t<
200 std::invoke_result_t<Accessor_IPDataVecInLocAsm, LocAsm const&>>;
201 using IPDataVectorElement = typename IPDataVector::value_type;
202
203 // the concrete IP data, e.g. double or Eigen::Vector
204 using ConcreteIPData = std::remove_cvref_t<
205 std::invoke_result_t<Accessor_CurrentLevelFromIPDataVecElement,
206 IPDataVectorElement const&>>;
207 static_assert(is_raw_data<ConcreteIPData>::value,
208 "This method only deals with raw data. The given "
209 "ConcreteIPData is not raw data.");
210
211 constexpr unsigned num_rows = NumberOfRows<ConcreteIPData>::value;
212 constexpr unsigned num_cols = NumberOfColumns<ConcreteIPData>::value;
213 constexpr unsigned num_comp = num_rows * num_cols;
214 auto const& ip_data_vector = accessor_ip_data_vec_in_loc_asm(loc_asm);
215 auto const num_ips = ip_data_vector.size();
216
217 std::vector<double> result(num_comp * num_ips);
218
219 for (std::size_t ip = 0; ip < num_ips; ++ip)
220 {
221 auto const& ip_data_vector_element = ip_data_vector[ip];
222 auto const& ip_data =
224 ip_data_vector_element);
225
226 if constexpr (num_comp == 1)
227 {
228 // scalar
229 result[ip] = ip_data;
230 }
231 else if constexpr (num_rows == MathLib::KelvinVector::
233 num_cols == 1)
234 {
235 // Kelvin vector
236 auto const converted =
238 ip_data);
239
240 for (unsigned comp = 0; comp < num_comp; ++comp)
241 {
242 result[ip * num_comp + comp] = converted[comp];
243 }
244 }
245 else if constexpr (num_cols == MathLib::KelvinVector::
247 num_rows == 1)
248 {
249 static_assert(
250 num_rows != 1 /* always false in this branch */,
251 "We support Kelvin column-vectors, but not Kelvin "
252 "row-vectors. The latter are unusual and confusion with "
253 "generic vectors might be possible.");
254 }
255 else if constexpr (num_rows == 1 || num_cols == 1)
256 {
257 // row or column vector
258 for (unsigned comp = 0; comp < num_comp; ++comp)
259 {
260 result[ip * num_comp + comp] = ip_data[comp];
261 }
262 }
263 else
264 {
265 // matrix
266 // row-major traversal
267 for (unsigned row = 0; row < num_rows; ++row)
268 {
269 for (unsigned col = 0; col < num_cols; ++col)
270 {
271 result[ip * num_comp + row * num_cols + col] =
272 ip_data(row, col);
273 }
274 }
275 }
276 }
277 return result;
278 }
Eigen::Matrix< double, 4, 1 > kelvinVectorToSymmetricTensor(Eigen::Matrix< double, 4, 1, Eigen::ColMajor, 4, 1 > const &v)
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.
Accessor_CurrentLevelFromIPDataVecElement accessor_current_level_from_ip_data_vec_element

References ProcessLib::Reflection::detail::GetFlattenedIPDataFromLocAsm< Dim, Accessor_IPDataVecInLocAsm, Accessor_CurrentLevelFromIPDataVecElement >::accessor_current_level_from_ip_data_vec_element, ProcessLib::Reflection::detail::GetFlattenedIPDataFromLocAsm< Dim, Accessor_IPDataVecInLocAsm, Accessor_CurrentLevelFromIPDataVecElement >::accessor_ip_data_vec_in_loc_asm, MathLib::KelvinVector::kelvin_vector_dimensions(), and MathLib::KelvinVector::kelvinVectorToSymmetricTensor().

Member Data Documentation

◆ accessor_current_level_from_ip_data_vec_element

template<int Dim, typename Accessor_IPDataVecInLocAsm , typename Accessor_CurrentLevelFromIPDataVecElement >
Accessor_CurrentLevelFromIPDataVecElement ProcessLib::Reflection::detail::GetFlattenedIPDataFromLocAsm< Dim, Accessor_IPDataVecInLocAsm, Accessor_CurrentLevelFromIPDataVecElement >::accessor_current_level_from_ip_data_vec_element

◆ accessor_ip_data_vec_in_loc_asm

template<int Dim, typename Accessor_IPDataVecInLocAsm , typename Accessor_CurrentLevelFromIPDataVecElement >
Accessor_IPDataVecInLocAsm ProcessLib::Reflection::detail::GetFlattenedIPDataFromLocAsm< Dim, Accessor_IPDataVecInLocAsm, Accessor_CurrentLevelFromIPDataVecElement >::accessor_ip_data_vec_in_loc_asm

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