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 226 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 237 of file ReflectionIPData.h.

238 {
242
243 // the concrete IP data, e.g. double or Eigen::Vector
246 IPDataVectorElement const&>>;
248 "This method only deals with raw data. The given "
249 "ConcreteIPData is not raw data.");
250
253 constexpr unsigned num_comp = num_rows * num_cols;
255 auto const num_ips = ip_data_vector.size();
256
258
259 for (std::size_t ip = 0; ip < num_ips; ++ip)
260 {
262 auto const& ip_data =
265
266 if constexpr (num_comp == 1)
267 {
268 // scalar
269 result[ip] = ip_data;
270 }
271 else if constexpr (num_rows == MathLib::KelvinVector::
273 num_cols == 1)
274 {
275 // Kelvin vector
276 auto const converted =
278 ip_data);
279
280 for (unsigned comp = 0; comp < num_comp; ++comp)
281 {
283 }
284 }
285 else if constexpr (num_cols == MathLib::KelvinVector::
287 num_rows == 1)
288 {
289 static_assert(
290 num_rows != 1 /* always false in this branch */,
291 "We support Kelvin column-vectors, but not Kelvin "
292 "row-vectors. The latter are unusual and confusion with "
293 "generic vectors might be possible.");
294 }
295 else if constexpr (num_rows == 1 || num_cols == 1)
296 {
297 // row or column vector
298 for (unsigned comp = 0; comp < num_comp; ++comp)
299 {
301 }
302 }
303 else
304 {
305 // matrix
306 // row-major traversal
307 for (unsigned row = 0; row < num_rows; ++row)
308 {
309 for (unsigned col = 0; col < num_cols; ++col)
310 {
311 result[ip * num_comp + row * num_cols + col] =
312 ip_data(row, col);
313 }
314 }
315 }
316 }
317 return result;
318 }
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 accessor_current_level_from_ip_data_vec_element, 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

Definition at line 234 of file ReflectionIPData.h.

Referenced by operator()().

◆ 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

Definition at line 232 of file ReflectionIPData.h.

Referenced by operator()().


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