v0.16.0
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
HcurlEdgeBase Struct Reference
Collaboration diagram for HcurlEdgeBase:
[legend]

Public Member Functions

template<int DIM, bool CALCULATE_DIRVATIVES, typename TPhi , typename TDiffPhi >
MoFEMErrorCode calculate (int p, int nb_integration_pts, int n0_idx, int n1_idx, double n[], FTensor::Tensor1< double, 3 > t_grad_n[], TPhi &t_phi, TDiffPhi *t_diff_phi_ptr)
 
template<int DIM, bool CALCULATE_DIRVATIVES, typename TPhi >
MoFEMErrorCode calculate (int p, int nb_integration_pts, int n0_idx, int n1_idx, double n[], FTensor::Tensor1< double, 3 > t_grad_n[], TPhi &t_phi, std::nullptr_t)
 

Public Attributes

FTensor::Index< 'i', 3 > i
 
FTensor::Tensor1< double, 3 > tGradN0pN1
 
FTensor::Tensor1< double, 3 > tPhi0
 
FTensor::Tensor1< double, 3 > tDiffb
 
VectorDouble fI
 
MatrixDouble diffFi
 

Detailed Description

Definition at line 1978 of file Hcurl.cpp.

Member Function Documentation

◆ calculate() [1/2]

template<int DIM, bool CALCULATE_DIRVATIVES, typename TPhi >
MoFEMErrorCode HcurlEdgeBase::calculate ( int  p,
int  nb_integration_pts,
int  n0_idx,
int  n1_idx,
double  n[],
FTensor::Tensor1< double, 3 >  t_grad_n[],
TPhi &  t_phi,
std::nullptr_t   
)
inline

Definition at line 2068 of file Hcurl.cpp.

2070 {
2071 static_assert(!CALCULATE_DIRVATIVES,
2072 "nullptr diff tensor is only valid when derivatives are off");
2073 return calculate<DIM, CALCULATE_DIRVATIVES, TPhi, double>(
2074 p, nb_integration_pts, n0_idx, n1_idx, n, t_grad_n, t_phi,
2075 static_cast<double *>(nullptr));
2076 }
const double n
refractive index of diffusive medium

◆ calculate() [2/2]

template<int DIM, bool CALCULATE_DIRVATIVES, typename TPhi , typename TDiffPhi >
MoFEMErrorCode HcurlEdgeBase::calculate ( int  p,
int  nb_integration_pts,
int  n0_idx,
int  n1_idx,
double  n[],
FTensor::Tensor1< double, 3 >  t_grad_n[],
TPhi &  t_phi,
TDiffPhi *  t_diff_phi_ptr 
)
inline

Definition at line 1992 of file Hcurl.cpp.

1994 {
1995
1996 FTensor::Index<'j', DIM> j;
1997
1999
2000 FTensor::Tensor1<double, 3> &t_grad_n0 = t_grad_n[n0_idx];
2001 FTensor::Tensor1<double, 3> &t_grad_n1 = t_grad_n[n1_idx];
2002 tGradN0pN1(i) = t_grad_n0(i) + t_grad_n1(i);
2003
2004 fI.resize(p + 1);
2005 diffFi.resize(3, p + 1);
2006 diffFi.clear();
2007
2009
2010 for (int gg = 0; gg != nb_integration_pts; ++gg) {
2011
2012 const int shift_n = (DIM + 1) * gg;
2013 const double n0 = n[shift_n + n0_idx];
2014 const double n1 = n[shift_n + n1_idx];
2015
2016 tPhi0(i) = n0 * t_grad_n1(i) - n1 * t_grad_n0(i);
2017 t_phi(i) = tPhi0(i);
2018
2019 ++t_phi;
2020
2021 if constexpr (CALCULATE_DIRVATIVES) {
2022
2023 t_diff_phi0(i, j) =
2024 t_grad_n0(j) * t_grad_n1(i) - t_grad_n1(j) * t_grad_n0(i);
2025 (*t_diff_phi_ptr)(i, j) = t_diff_phi0(i, j);
2026 ++(*t_diff_phi_ptr);
2027 }
2028
2029 if (p > 1) {
2030
2031 if constexpr (CALCULATE_DIRVATIVES)
2032 CHKERR Jacobi_polynomials(p, 0, n1, n0 + n1, &t_grad_n1(0),
2033 &tGradN0pN1(0), &*fI.data().begin(),
2034 &*diffFi.data().begin(), DIM);
2035 else
2036 CHKERR Jacobi_polynomials(p, 0, n1, n0 + n1, nullptr, nullptr,
2037 &*fI.data().begin(), nullptr, DIM);
2038
2040 &diffFi(0, 1), &diffFi(1, 1), &diffFi(2, 1));
2041
2042 for (int oo = 1; oo <= p - 1; ++oo) {
2043
2044 const double b = pow(n0 + n1, oo);
2045 t_phi(i) = b * fI[oo] * tPhi0(i);
2046
2047 if constexpr (CALCULATE_DIRVATIVES) {
2048
2049 tDiffb(i) =
2050 oo * pow(n0 + n1, oo - 1) * (t_grad_n0(i) + t_grad_n1(i));
2051 (*t_diff_phi_ptr)(i, j) = (b * fI[oo]) * t_diff_phi0(i, j) +
2052 (b * t_diff_fi(j)) * tPhi0(i) +
2053 tDiffb(j) * fI[oo] * tPhi0(i);
2054 ++t_diff_fi;
2055 ++(*t_diff_phi_ptr);
2056 }
2057
2058 ++t_phi;
2059 }
2060 }
2061 }
2062
2064 }
PetscErrorCode Jacobi_polynomials(int p, double alpha, double x, double t, double *diff_x, double *diff_t, double *L, double *diffL, const int dim)
Calculate Jacobi approximation basis.
#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.
FTensor::Index< 'j', 3 > j
FTensor::Tensor1< double, 3 > tDiffb
Definition Hcurl.cpp:1984
FTensor::Index< 'i', 3 > i
Definition Hcurl.cpp:1980
MatrixDouble diffFi
Definition Hcurl.cpp:1987
FTensor::Tensor1< double, 3 > tGradN0pN1
Definition Hcurl.cpp:1982
VectorDouble fI
Definition Hcurl.cpp:1986
FTensor::Tensor1< double, 3 > tPhi0
Definition Hcurl.cpp:1983

Member Data Documentation

◆ diffFi

MatrixDouble HcurlEdgeBase::diffFi

Definition at line 1987 of file Hcurl.cpp.

◆ fI

VectorDouble HcurlEdgeBase::fI

Definition at line 1986 of file Hcurl.cpp.

◆ i

FTensor::Index<'i', 3> HcurlEdgeBase::i

Definition at line 1980 of file Hcurl.cpp.

◆ tDiffb

FTensor::Tensor1<double, 3> HcurlEdgeBase::tDiffb

Definition at line 1984 of file Hcurl.cpp.

◆ tGradN0pN1

FTensor::Tensor1<double, 3> HcurlEdgeBase::tGradN0pN1

Definition at line 1982 of file Hcurl.cpp.

◆ tPhi0

FTensor::Tensor1<double, 3> HcurlEdgeBase::tPhi0

Definition at line 1983 of file Hcurl.cpp.


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