PolyDiM
C++ library for POLYtopal DIscretization Methods
Loading...
Searching...
No Matches
FEM_PCC_1D_LocalSpace.hpp
Go to the documentation of this file.
1// _LICENSE_HEADER_
2//
3// Copyright (C) 2019 - 2025.
4// Terms register on the GPL-3.0 license.
5//
6// This file can be redistributed and/or modified under the license terms.
7//
8// See top level LICENSE file for more details.
9//
10// This file can be used citing references in CITATION.cff file.
11
12#ifndef __FEM_PCC_1D_LocalSpace_HPP
13#define __FEM_PCC_1D_LocalSpace_HPP
14
16
17namespace Polydim
18{
19namespace FEM
20{
21namespace PCC
22{
24{
26
27 Eigen::Vector3d Origin;
28 Eigen::Vector3d Tangent;
29 double Length;
30};
31
33{
35 {
36 Eigen::Vector3d Origin;
37 Eigen::Vector3d Tangent;
38 double Length;
40 };
41
43 unsigned int Order;
45 Eigen::MatrixXd Dofs;
46 std::vector<unsigned int> DofsMeshOrder;
47 std::array<unsigned int, 3> Dof0DsIndex;
48 std::array<unsigned int, 2> Dof1DsIndex;
50};
51
53{
54 private:
55 Eigen::MatrixXd F(const Polydim::FEM::PCC::FEM_PCC_1D_LocalSpace_Data::SegmentMapData &mapData, const Eigen::MatrixXd &x) const
56 {
57 Eigen::MatrixXd points(3, x.cols());
58
59 for (unsigned int p = 0; p < x.cols(); ++p)
60 points.col(p) << mapData.Origin + mapData.Tangent * x(0, p);
61
62 return points;
63 }
64
65 Eigen::MatrixXd FInv(const Polydim::FEM::PCC::FEM_PCC_1D_LocalSpace_Data::SegmentMapData &mapData, const Eigen::MatrixXd &x) const
66 {
67 Eigen::MatrixXd points(3, x.cols());
68
69 for (unsigned int p = 0; p < x.cols(); ++p)
70 points(0, p) = (x.col(p) - mapData.Origin).dot(mapData.Tangent) / mapData.SquaredLength;
71
72 return points;
73 }
74
75 inline Eigen::VectorXd DetJ(const Polydim::FEM::PCC::FEM_PCC_1D_LocalSpace_Data::SegmentMapData &mapData,
76 const Eigen::MatrixXd &x) const
77 {
78 return Eigen::VectorXd::Constant(x.cols(), mapData.Length);
79 }
80
81 Eigen::MatrixXd MapValues(const Polydim::FEM::PCC::FEM_PCC_1D_LocalSpace_Data &local_space,
82 const Eigen::MatrixXd &referenceValues) const;
83
84 std::vector<Eigen::MatrixXd> MapDerivativeValues(const Polydim::FEM::PCC::FEM_PCC_1D_LocalSpace_Data &local_space,
85 const std::vector<Eigen::MatrixXd> &referenceDerivateValues) const;
86
87 Gedim::Quadrature::QuadratureData InternalQuadrature(const Gedim::Quadrature::QuadratureData &reference_quadrature,
89
90 public:
93
94 inline Eigen::MatrixXd ComputeBasisFunctionsValues(const Polydim::FEM::PCC::FEM_PCC_1D_ReferenceElement_Data &reference_element_data,
95 const Polydim::FEM::PCC::FEM_PCC_1D_LocalSpace_Data &local_space) const
96 {
97 return MapValues(local_space, reference_element_data.ReferenceBasisFunctionValues);
98 }
99
100 inline std::vector<Eigen::MatrixXd> ComputeBasisFunctionsDerivativeValues(
101 const Polydim::FEM::PCC::FEM_PCC_1D_ReferenceElement_Data &reference_element_data,
102 const Polydim::FEM::PCC::FEM_PCC_1D_LocalSpace_Data &local_space) const
103 {
104 return MapDerivativeValues(local_space, reference_element_data.ReferenceBasisFunctionDerivativeValues);
105 }
106
107 inline Eigen::MatrixXd ComputeBasisFunctionsValues(const Polydim::FEM::PCC::FEM_PCC_1D_ReferenceElement_Data &reference_element_data,
109 const Eigen::MatrixXd &points) const
110 {
111 const Eigen::MatrixXd referencePoints = FInv(local_space.MapData, points);
112
114
115 return MapValues(local_space, reference_element.EvaluateBasisFunctions(referencePoints, reference_element_data));
116 }
117
118 inline std::vector<Eigen::MatrixXd> ComputeBasisFunctionsDerivativeValues(
119 const Polydim::FEM::PCC::FEM_PCC_1D_ReferenceElement_Data &reference_element_data,
121 const Eigen::MatrixXd &points) const
122 {
123 const Eigen::MatrixXd referencePoints = FInv(local_space.MapData, points);
124
126
127 return MapDerivativeValues(local_space, reference_element.EvaluateBasisFunctionDerivatives(referencePoints, reference_element_data));
128 }
129
130 inline Eigen::MatrixXd InternalDOFsCoordinates(const Polydim::FEM::PCC::FEM_PCC_1D_ReferenceElement_Data &reference_element_data,
131 const Polydim::FEM::PCC::FEM_PCC_1D_LocalSpace_Data &local_space) const
132 {
133 const auto &dof_coordinates = local_space.Dofs;
134
135 const unsigned int starting_index = local_space.Dof1DsIndex.at(0);
136 const unsigned int num_internal_dofs = reference_element_data.NumDofs1D;
137
138 if (num_internal_dofs == 0)
139 return Eigen::MatrixXd(0, 0);
140
141 const Eigen::MatrixXd edge_dofs_coordinates = dof_coordinates.block(0, starting_index, 3, num_internal_dofs);
142
143 return edge_dofs_coordinates;
144 }
145};
146} // namespace PCC
147} // namespace FEM
148} // namespace Polydim
149
150#endif
Definition FEM_PCC_1D_LocalSpace.hpp:53
Polydim::FEM::PCC::FEM_PCC_1D_LocalSpace_Data CreateLocalSpace(const Polydim::FEM::PCC::FEM_PCC_1D_ReferenceElement_Data &reference_element_data, const Polydim::FEM::PCC::FEM_PCC_1D_Segment_Geometry &segment) const
Definition FEM_PCC_1D_LocalSpace.cpp:23
std::vector< Eigen::MatrixXd > ComputeBasisFunctionsDerivativeValues(const Polydim::FEM::PCC::FEM_PCC_1D_ReferenceElement_Data &reference_element_data, const Polydim::FEM::PCC::FEM_PCC_1D_LocalSpace_Data &local_space) const
Definition FEM_PCC_1D_LocalSpace.hpp:100
std::vector< Eigen::MatrixXd > ComputeBasisFunctionsDerivativeValues(const Polydim::FEM::PCC::FEM_PCC_1D_ReferenceElement_Data &reference_element_data, const Polydim::FEM::PCC::FEM_PCC_1D_LocalSpace_Data &local_space, const Eigen::MatrixXd &points) const
Definition FEM_PCC_1D_LocalSpace.hpp:118
Eigen::MatrixXd ComputeBasisFunctionsValues(const Polydim::FEM::PCC::FEM_PCC_1D_ReferenceElement_Data &reference_element_data, const Polydim::FEM::PCC::FEM_PCC_1D_LocalSpace_Data &local_space) const
Definition FEM_PCC_1D_LocalSpace.hpp:94
Eigen::MatrixXd ComputeBasisFunctionsValues(const Polydim::FEM::PCC::FEM_PCC_1D_ReferenceElement_Data &reference_element_data, const Polydim::FEM::PCC::FEM_PCC_1D_LocalSpace_Data &local_space, const Eigen::MatrixXd &points) const
Definition FEM_PCC_1D_LocalSpace.hpp:107
Eigen::MatrixXd InternalDOFsCoordinates(const Polydim::FEM::PCC::FEM_PCC_1D_ReferenceElement_Data &reference_element_data, const Polydim::FEM::PCC::FEM_PCC_1D_LocalSpace_Data &local_space) const
Definition FEM_PCC_1D_LocalSpace.hpp:130
Factory that builds the reference element data for a 1D PCC finite element.
Definition FEM_PCC_1D_ReferenceElement.hpp:67
Eigen::MatrixXd EvaluateBasisFunctions(const Eigen::MatrixXd &points, const Polydim::FEM::PCC::FEM_PCC_1D_ReferenceElement_Data &reference_element_data) const
Definition FEM_PCC_1D_ReferenceElement.hpp:199
std::vector< Eigen::MatrixXd > EvaluateBasisFunctionDerivatives(const Eigen::MatrixXd &points, const Polydim::FEM::PCC::FEM_PCC_1D_ReferenceElement_Data &reference_element_data) const
Definition FEM_PCC_1D_ReferenceElement.hpp:207
Definition FEM_MCC_2D_LocalSpace.cpp:17
Definition QuadratureData.hpp:22
Eigen::Vector3d Origin
Definition FEM_PCC_1D_LocalSpace.hpp:36
double SquaredLength
Definition FEM_PCC_1D_LocalSpace.hpp:39
Eigen::Vector3d Tangent
Definition FEM_PCC_1D_LocalSpace.hpp:37
double Length
Definition FEM_PCC_1D_LocalSpace.hpp:38
Definition FEM_PCC_1D_LocalSpace.hpp:33
std::array< unsigned int, 2 > Dof1DsIndex
Definition FEM_PCC_1D_LocalSpace.hpp:48
std::array< unsigned int, 3 > Dof0DsIndex
Definition FEM_PCC_1D_LocalSpace.hpp:47
std::vector< unsigned int > DofsMeshOrder
Definition FEM_PCC_1D_LocalSpace.hpp:46
unsigned int Order
Definition FEM_PCC_1D_LocalSpace.hpp:43
Eigen::MatrixXd Dofs
Definition FEM_PCC_1D_LocalSpace.hpp:45
Polydim::FEM::PCC::FEM_PCC_1D_LocalSpace_Data::SegmentMapData MapData
Definition FEM_PCC_1D_LocalSpace.hpp:42
unsigned int NumberOfBasisFunctions
Definition FEM_PCC_1D_LocalSpace.hpp:44
Gedim::Quadrature::QuadratureData InternalQuadrature
Definition FEM_PCC_1D_LocalSpace.hpp:49
Reference element data for a 1D PCC finite element.
Definition FEM_PCC_1D_ReferenceElement.hpp:46
unsigned int NumDofs1D
Definition FEM_PCC_1D_ReferenceElement.hpp:50
Eigen::MatrixXd ReferenceBasisFunctionValues
Definition FEM_PCC_1D_ReferenceElement.hpp:58
std::vector< Eigen::MatrixXd > ReferenceBasisFunctionDerivativeValues
Definition FEM_PCC_1D_ReferenceElement.hpp:59
Definition FEM_PCC_1D_LocalSpace.hpp:24
double Tolerance1D
Definition FEM_PCC_1D_LocalSpace.hpp:25
Eigen::Vector3d Origin
Definition FEM_PCC_1D_LocalSpace.hpp:27
Eigen::Vector3d Tangent
Definition FEM_PCC_1D_LocalSpace.hpp:28
double Length
Definition FEM_PCC_1D_LocalSpace.hpp:29