OGS
IntegrationPointDataTools.cpp
Go to the documentation of this file.
1
13
15#include "MeshLib/MeshEnums.h"
16#include "MeshLib/Properties.h"
20
21namespace MeshToolsLib
22{
23template <typename ElementType>
25 MeshLib::IntegrationPointMetaData const& ip_meta_data)
26{
27 using IntegrationPolicy =
29 using NonGenericIntegrationMethod =
31 NonGenericIntegrationMethod int_met{
32 (unsigned int)ip_meta_data.integration_order};
33 return int_met.getNumberOfPoints();
34}
35
37 MeshLib::IntegrationPointMetaData const& ip_meta_data,
38 MeshLib::Element const& e)
39{
40 switch (e.getCellType())
41 {
44 ip_meta_data);
47 ip_meta_data);
50 ip_meta_data);
53 ip_meta_data);
56 ip_meta_data);
59 ip_meta_data);
62 ip_meta_data);
65 ip_meta_data);
68 ip_meta_data);
71 ip_meta_data);
74 ip_meta_data);
77 ip_meta_data);
80 ip_meta_data);
83 ip_meta_data);
86 MeshLib::Pyramid13>(ip_meta_data);
89 OGS_FATAL("Mesh element type {:s} is not supported",
92 default:
93 OGS_FATAL("Invalid Element Type");
94 }
95 return 0;
96}
97
99 std::vector<MeshLib::Element*> const& mesh_elements,
101 MeshLib::Properties const& properties)
102{
103 // For special field data such as OGS_VERSION, IntegrationPointMetaData,
104 // etc., which are not "real" integration points:
105 if (pv.getPropertyName().find("_ip") == std::string::npos)
106 {
107 return {};
108 }
109
110 auto const n_components = pv.getNumberOfGlobalComponents();
111
112 std::vector<std::size_t> element_ip_data_offsets(mesh_elements.size() + 1);
113 std::size_t counter = 0;
114 auto const ip_meta_data =
116 for (std::size_t i = 0; i < mesh_elements.size(); i++)
117 {
118 auto const* const element = mesh_elements[i];
119
120 // Assuming that the order of elements in mesh_elements is not touched.
121 element_ip_data_offsets[i] = counter;
122 counter += getNumberOfElementIntegrationPoints(ip_meta_data, *element) *
123 n_components;
124 }
125 element_ip_data_offsets[mesh_elements.size()] = counter;
126
127 return element_ip_data_offsets;
128}
129
130} // namespace MeshToolsLib
#define OGS_FATAL(...)
Definition Error.h:26
Definition of mesh-related Enumerations.
Definition of the class Properties that implements a container of properties.
virtual CellType getCellType() const =0
Property manager on mesh items. Class Properties manages scalar, vector or matrix properties....
Definition Properties.h:36
int getNumberOfGlobalComponents() const
std::string const & getPropertyName() const
IntegrationPointMetaData getIntegrationPointMetaData(MeshLib::Properties const &properties, std::string const &name)
std::string CellType2String(const CellType t)
Given a MeshElemType this returns the appropriate string.
int getNumberOfElementIntegrationPointsGeneral(MeshLib::IntegrationPointMetaData const &ip_meta_data)
std::vector< std::size_t > getIntegrationPointDataOffsetsOfMeshElements(std::vector< MeshLib::Element * > const &mesh_elements, MeshLib::PropertyVectorBase const &pv, MeshLib::Properties const &properties)
int getNumberOfElementIntegrationPoints(MeshLib::IntegrationPointMetaData const &ip_meta_data, MeshLib::Element const &e)
NumLib::IntegrationGaussLegendreRegular< MeshElement::dimension > IntegrationMethod