OGS
AverageGradShapeFunction.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <Eigen/Core>
7#include <vector>
8
12
13namespace NumLib
14{
28template <int DisplacementDim,
29 typename ShapeFunction,
30 typename ShapeMatricesType,
31 typename IpData>
33 int const local_node_id,
34 MeshLib::Element const& element,
35 NumLib::GenericIntegrationMethod const& integration_method,
36 std::vector<IpData, Eigen::aligned_allocator<IpData>> const& ip_data,
37 const bool is_axially_symmetric)
38{
39 Eigen::Vector3d bar_gradN = Eigen::Vector3d::Zero();
40 unsigned const n_integration_points =
41 integration_method.getNumberOfPoints();
42 assert(n_integration_points == ip_data.size());
43 for (unsigned ip = 0; ip < n_integration_points; ip++)
44 {
45 auto const& N = ip_data[ip].N_u;
46 auto const& dNdx = ip_data[ip].dNdx_u;
47
48 auto const dNidx = dNdx.col(local_node_id);
49
50 auto const& w = ip_data[ip].integration_weight;
51 bar_gradN.template segment<DisplacementDim>(0) += dNidx * w;
52
53 if (is_axially_symmetric)
54 {
55 auto const x_coord =
57 ShapeMatricesType>(element, N);
58 bar_gradN[2] += w * N(local_node_id) / x_coord;
59 }
60 }
61 return bar_gradN;
62}
63} // namespace NumLib
double interpolateXCoordinate(MeshLib::Element const &e, typename ShapeMatricesType::ShapeMatrices::ShapeType const &N)
Eigen::Vector3d averageGradShapeFunction(int const local_node_id, MeshLib::Element const &element, NumLib::GenericIntegrationMethod const &integration_method, std::vector< IpData, Eigen::aligned_allocator< IpData > > const &ip_data, const bool is_axially_symmetric)