v0.15.0
Loading...
Searching...
No Matches
HenckyOps::OpCalculateEigenValsImpl< DIM, GAUSS, DomainEleOp > Struct Template Reference

#include "tutorials/vec-2/src/HenckyOps.hpp"

Inheritance diagram for HenckyOps::OpCalculateEigenValsImpl< DIM, GAUSS, DomainEleOp >:
[legend]
Collaboration diagram for HenckyOps::OpCalculateEigenValsImpl< DIM, GAUSS, DomainEleOp >:
[legend]

Public Member Functions

 OpCalculateEigenValsImpl (const std::string field_name, boost::shared_ptr< CommonData > common_data)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 

Private Attributes

boost::shared_ptr< CommonDatacommonDataPtr
 

Detailed Description

template<int DIM, typename DomainEleOp>
struct HenckyOps::OpCalculateEigenValsImpl< DIM, GAUSS, DomainEleOp >

Definition at line 144 of file HenckyOps.hpp.

Constructor & Destructor Documentation

◆ OpCalculateEigenValsImpl()

template<int DIM, typename DomainEleOp >
HenckyOps::OpCalculateEigenValsImpl< DIM, GAUSS, DomainEleOp >::OpCalculateEigenValsImpl ( const std::string field_name,
boost::shared_ptr< CommonData > common_data )
inline

Definition at line 146 of file HenckyOps.hpp.

148 : DomainEleOp(field_name, DomainEleOp::OPROW),
149 commonDataPtr(common_data) {
150 std::fill(&DomainEleOp::doEntities[MBEDGE],
151 &DomainEleOp::doEntities[MBMAXTYPE], false);
152 }
DomainEle::UserDataOperator DomainEleOp
Finire element operator type.
constexpr auto field_name

Member Function Documentation

◆ doWork()

template<int DIM, typename DomainEleOp >
MoFEMErrorCode HenckyOps::OpCalculateEigenValsImpl< DIM, GAUSS, DomainEleOp >::doWork ( int side,
EntityType type,
EntData & data )
inline

Definition at line 154 of file HenckyOps.hpp.

154 {
156
157 FTensor::Index<'i', DIM> i;
158 FTensor::Index<'j', DIM> j;
159 FTensor::Index<'k', DIM> k;
160
161 constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
162 // const size_t nb_gauss_pts = matGradPtr->size2();
163 const size_t nb_gauss_pts = DomainEleOp::getGaussPts().size2();
164
165 auto t_grad = getFTensor2FromMat<DIM, DIM>(*(commonDataPtr->matGradPtr));
166
167 commonDataPtr->matEigVal.resize(DIM, nb_gauss_pts, false);
168 commonDataPtr->matEigVec.resize(DIM * DIM, nb_gauss_pts, false);
169 auto t_eig_val = getFTensor1FromMat<DIM>(commonDataPtr->matEigVal);
170 auto t_eig_vec = getFTensor2FromMat<DIM, DIM>(commonDataPtr->matEigVec);
171
172 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
173
178
179 F(i, j) = t_grad(i, j) + t_kd(i, j);
180 C(i, j) = F(k, i) ^ F(k, j);
181
182 for (int ii = 0; ii != DIM; ii++)
183 for (int jj = 0; jj != DIM; jj++)
184 eigen_vec(ii, jj) = C(ii, jj);
185
186 CHKERR computeEigenValuesSymmetric(eigen_vec, eig);
187 for (auto ii = 0; ii != DIM; ++ii)
188 eig(ii) = std::max(std::numeric_limits<double>::epsilon(), eig(ii));
189
190 // rare case when two eigen values are equal
191 auto nb_uniq = get_uniq_nb<DIM>(&eig(0));
192 if constexpr (DIM == 3) {
193 if (nb_uniq == 2) {
194 sort_eigen_vals<DIM>(eig, eigen_vec);
195 }
196 }
197
198 t_eig_val(i) = eig(i);
199 t_eig_vec(i, j) = eigen_vec(i, j);
200
201 ++t_grad;
202 ++t_eig_val;
203 ++t_eig_vec;
204 }
205
207 }
Kronecker Delta class.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
@ F
constexpr auto t_kd
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
auto get_uniq_nb(double *ptr)
Definition HenckyOps.hpp:32
auto sort_eigen_vals(FTensor::Tensor1< double, DIM > &eig, FTensor::Tensor2< double, DIM, DIM > &eigen_vec)
Definition HenckyOps.hpp:41
MoFEMErrorCode computeEigenValuesSymmetric(const MatrixDouble &mat, VectorDouble &eig, MatrixDouble &eigen_vec)
compute eigenvalues of a symmetric matrix using lapack dsyev

Member Data Documentation

◆ commonDataPtr

template<int DIM, typename DomainEleOp >
boost::shared_ptr<CommonData> HenckyOps::OpCalculateEigenValsImpl< DIM, GAUSS, DomainEleOp >::commonDataPtr
private

Definition at line 210 of file HenckyOps.hpp.


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