22using Args = kernels::InvariantsEvaluator2D::Buffers;
24static MFEM_HOST_DEVICE
inline
27 kernels::InvariantsEvaluator2D ie(
Args().J(Jpt));
31static MFEM_HOST_DEVICE
inline
34 kernels::InvariantsEvaluator2D ie(
Args().J(Jpt));
35 return 0.5 * ie.Get_I1b() - 1.0;
38static MFEM_HOST_DEVICE
inline
41 kernels::InvariantsEvaluator2D ie(
Args().J(Jpt));
42 return ie.Get_I1() * (1.0 + 1.0/ie.Get_I2()) - 4.0;
46static MFEM_HOST_DEVICE
inline
49 kernels::InvariantsEvaluator2D ie(
Args().J(Jpt));
50 const real_t I2b = ie.Get_I2b();
51 return 0.5*(I2b + 1.0/I2b) - 1.0;
54static MFEM_HOST_DEVICE
inline
57 kernels::InvariantsEvaluator2D ie(
Args().J(Jpt));
58 const real_t I2b = ie.Get_I2b();
59 return 0.5*(I2b*I2b + 1./(I2b*I2b) - 2.);
62static MFEM_HOST_DEVICE
inline
65 return w[0] * EvalW_002(Jpt) + w[1] * EvalW_077(Jpt);
68static MFEM_HOST_DEVICE
inline
71 return w[0] * EvalW_002(Jpt) + w[1] * EvalW_056(Jpt);
75 const real_t metric_normal,
90 MFEM_VERIFY(mid == 1 || mid == 2 || mid == 7 || mid == 77
91 || mid == 80 || mid == 94,
92 "2D metric not yet implemented!");
94 const bool const_m0 = mc_.
Size() == 1;
96 constexpr int DIM = 2;
97 constexpr int NBZ = 1;
99 const int D1D = T_D1D ? T_D1D : d1d;
100 const int Q1D = T_Q1D ? T_Q1D : q1d;
102 const auto MC = const_m0 ?
113 const real_t *metric_data = metric_param.
Read();
117 constexpr int NBZ = 1;
118 constexpr int MQ1 = T_Q1D ? T_Q1D : T_MAX;
119 constexpr int MD1 = T_D1D ? T_D1D : T_MAX;
120 const int D1D = T_D1D ? T_D1D : d1d;
121 const int Q1D = T_Q1D ? T_Q1D : q1d;
123 MFEM_SHARED
real_t BG[2][MQ1*MD1];
124 MFEM_SHARED
real_t XY[2][NBZ][MD1*MD1];
125 MFEM_SHARED
real_t DQ[4][NBZ][MD1*MQ1];
126 MFEM_SHARED
real_t QQ[4][NBZ][MQ1*MQ1];
128 kernels::internal::LoadX<MD1,NBZ>(e,D1D,X,XY);
129 kernels::internal::LoadBG<MD1,MQ1>(D1D,Q1D,
b,g,BG);
131 kernels::internal::GradX<MD1,MQ1,NBZ>(D1D,Q1D,BG,XY,DQ);
132 kernels::internal::GradY<MD1,MQ1,NBZ>(D1D,Q1D,BG,DQ,QQ);
134 MFEM_FOREACH_THREAD(qy,y,Q1D)
136 MFEM_FOREACH_THREAD(qx,x,Q1D)
138 const real_t *Jtr = &J(0,0,qx,qy,e);
140 const real_t m_coef = const_m0 ? MC(0,0,0) : MC(qx,qy,e);
141 const real_t weight = metric_normal * m_coef * W(qx,qy) * detJtr;
149 kernels::internal::PullGrad<MQ1,NBZ>(Q1D,qx,qy,QQ,Jpr);
157 mid == 1 ? EvalW_001(Jpt) :
158 mid == 2 ? EvalW_002(Jpt) :
159 mid == 7 ? EvalW_007(Jpt) :
160 mid == 77 ? EvalW_077(Jpt) :
161 mid == 80 ? EvalW_080(Jpt, metric_data) :
162 mid == 94 ? EvalW_094(Jpt, metric_data) : 0.0;
164 E(qx,qy,e) = weight * EvalW;
168 return energy * ones;
175 const int D1D =
PA.maps->ndof;
176 const int Q1D =
PA.maps->nqpt;
177 const int id = (D1D << 4 ) | Q1D;
193 MFEM_LAUNCH_TMOP_KERNEL(EnergyPA_2D,
id,mn,
MC,mp,M,N,J,W,B,G,X,
O,
E);
const T * Read(bool on_dev=true) const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), on_dev).
Rank 3 tensor (array of matrices)
const real_t * Read(bool on_dev=true) const
Shortcut for mfem::Read( GetMemory(), TotalSize(), on_dev).
TMOP_QualityMetric * metric
real_t GetLocalStateEnergyPA_2D(const Vector &) const
struct mfem::TMOP_Integrator::@23 PA
virtual int Id() const
Return the metric ID.
virtual const real_t * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
int Size() const
Returns the size of the vector.
virtual real_t * Write(bool on_dev=true)
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), on_dev).
MFEM_HOST_DEVICE void CalcInverse(const T *data, T *inv_data)
Return the inverse of a matrix with given size and data into the matrix with data inv_data.
MFEM_HOST_DEVICE void Mult(const int height, const int width, const TA *data, const TX *x, TY *y)
Matrix vector multiplication: y = A x, where the matrix A is of size height x width with given data,...
MFEM_HOST_DEVICE T Det(const T *data)
Compute the determinant of a square matrix of size dim with given data.
MFEM_REGISTER_TMOP_KERNELS(void, DatcSize, const int NE, const int ncomp, const int sizeidx, const real_t input_min_size, const DenseMatrix &w_, const Array< real_t > &b_, const Vector &x_, const Vector &nc_reduce, DenseTensor &j_, const int d1d, const int q1d)
MFEM_HOST_DEVICE DeviceTensor< sizeof...(Dims), T > Reshape(T *ptr, Dims... dims)
Wrap a pointer as a DeviceTensor with automatically deduced template parameters.
void forall_2D_batch(int N, int X, int Y, int BZ, lambda &&body)
kernels::InvariantsEvaluator2D::Buffers Args