v0.16.3
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp > Struct Template Reference
Inheritance diagram for MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >:
[legend]
Collaboration diagram for MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >:
[legend]

Public Member Functions

 OpEvalMatHuHuImpl (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 

Protected Attributes

boost::shared_ptr< PhysicalEquationsphysicalPtr
 
const bool evalStress
 
const bool evalTangent
 

Detailed Description

template<int DIM, typename DomainEleOp>
struct MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >

Definition at line 159 of file MatHuHu.cpp.

Constructor & Destructor Documentation

◆ OpEvalMatHuHuImpl()

template<int DIM, typename DomainEleOp >
MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >::OpEvalMatHuHuImpl ( boost::shared_ptr< PhysicalEquations physical_ptr,
bool  eval_stress,
bool  eval_tangent 
)
inline

Definition at line 161 of file MatHuHu.cpp.

163 : DomainEleOp("U", DomainEleOp::OPROW), physicalPtr(physical_ptr),
164 evalStress(eval_stress), evalTangent(eval_tangent) {}
boost::shared_ptr< PhysicalEquations > physicalPtr
Definition MatHuHu.cpp:169

Member Function Documentation

◆ doWork()

template<int DIM, typename DomainEleOp >
MoFEMErrorCode MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >::doWork ( int  side,
EntityType  type,
EntData data 
)

Definition at line 175 of file MatHuHu.cpp.

177 {
179 int nb_dofs = data.getIndices().size();
180 if (!nb_dofs)
182 int nb_integration_pts = data.getN().size1();
183 auto *fe_ptr = const_cast<FEMethod *>(this->getFEMethod());
184 const auto ent = fe_ptr->getFEEntityHandle();
185
186 auto get_tag = [&]() {
187 if (physicalPtr->tagVsRangePtr) {
188 for (const auto &tag_range_pair : *physicalPtr->tagVsRangePtr) {
189 if (tag_range_pair.second.find(ent) != tag_range_pair.second.end()) {
190 return tag_range_pair.first;
191 }
192 }
193 }
194 return physicalPtr->tAg; // Default tag if no range matches
195 };
196
197 const int current_tag = get_tag();
198
199 auto mat_grad_ptr = physicalPtr->matOpsDataPtr->getCommonDataPtr("grad");
200 auto mat_k_ptr = physicalPtr->matOpsDataPtr->getCommonDataPtr("k");
201 auto mat_k_dF_ptr = physicalPtr->matOpsDataPtr->getCommonDataPtr("k_dF");
202
203#ifndef NDEBUG
204 if (!mat_grad_ptr || !mat_k_ptr || !mat_k_dF_ptr) {
205 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
206 "Missing common data for ADOL-C evaluation");
207 }
208 if (mat_grad_ptr->size2() != DIM * DIM) {
209 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
210 "Inconsistent size of gradient matrix for ADOL-C evaluation");
211 }
212 if (mat_grad_ptr->size1() != nb_integration_pts) {
213 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
214 "Inconsistent size of gradient matrix data for ADOL-C evaluation");
215 }
216#endif
217
219 auto get_grad_at_pts =
220 MatrixSizeHelper<GetFTensor2FromMatType<DIM, DIM, -1, DL>, DL>::get(
221 *mat_grad_ptr, nb_integration_pts);
222 auto get_k_at_pts =
224 *mat_k_ptr, nb_integration_pts);
225 auto get_k_dF_at_pts =
226 MatrixSizeHelper<GetFTensor2FromMatType<DIM, DIM, -1, DL>, DL>::size(
227 *mat_k_dF_ptr, nb_integration_pts);
228
229 if (evalStress) {
230 FTENSOR_INDEX(DIM, i);
231 FTENSOR_INDEX(DIM, J);
232 FTENSOR_INDEX(DIM, K);
233 FTENSOR_INDEX(DIM, L);
234
235 auto t_grad_at_pts = get_grad_at_pts();
236 auto t_k_at_pts = get_k_at_pts();
237
238 auto next = [&]() {
239 ++t_grad_at_pts;
240 ++t_k_at_pts;
241 };
242
244
245 for (auto gg = 0; gg != nb_integration_pts; ++gg) {
246 auto t_F = getFTensor2FromPtr<DIM, DIM>(
247 physicalPtr->matOpsDataPtr->getActiveDataPtr("F")->data().data());
248 t_F(i, J) = t_grad_at_pts(i, J) + t_kd(i, J);
249 CHKERR physicalPtr->setParams(fe_ptr, gg);
250 CHKERR physicalPtr->evaluateVariable(current_tag, ent, gg);
251 t_k_at_pts(0) =
252 (*physicalPtr->matOpsDataPtr->getDependentDataPtr("k"))(0, 0);
253 next();
254 }
255 }
256
257 if (evalTangent) {
258 FTENSOR_INDEX(DIM, i);
259 FTENSOR_INDEX(DIM, J);
260 FTENSOR_INDEX(DIM, k);
261 FTENSOR_INDEX(DIM, L);
262
263 auto t_grad_at_pts = get_grad_at_pts();
264 auto t_k_dF_at_pts = get_k_dF_at_pts();
266
267 auto next = [&]() {
268 ++t_grad_at_pts;
269 ++t_k_dF_at_pts;
270 };
271
272 for (auto gg = 0; gg != nb_integration_pts; ++gg) {
273 auto t_F = getFTensor2FromPtr<DIM, DIM>(
274 physicalPtr->matOpsDataPtr->getActiveDataPtr("F")->data().data());
275 t_F(i, J) = t_grad_at_pts(i, J) + t_kd(i, J);
276 CHKERR physicalPtr->setParams(fe_ptr, gg);
277 CHKERR physicalPtr->evaluateDerivatives(current_tag, ent, gg);
278 auto t_k_dF = getFTensor2FromPtr<DIM, DIM>(
279 physicalPtr->matOpsDataPtr->getDependentDerivativesDataPtr("k_dF")
280 ->data()
281 .data());
282 t_k_dF_at_pts(i, J) = t_k_dF(i, J);
283 next();
284 }
285 }
286
288}
#define FTENSOR_INDEX(DIM, I)
Kronecker Delta class.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition definitions.h:34
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
constexpr auto t_kd
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'J', DIM1 > J
Definition level_set.cpp:30
FTensor::Index< 'k', 3 > k
DataLayoutTraits< DataLayout::GaussByCoeffs > DL
Definition MatHuHu.hpp:33
decltype(GetFTensor1FromMatImpl< Tensor_Dim, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor1FromMatType
decltype(GetFTensor2FromMatImpl< Tensor_Dim0, Tensor_Dim1, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor2FromMatType
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.
Structure for user loop methods on finite elements.
EntityHandle getFEEntityHandle() const
Get the entity handle of the current finite element.

Member Data Documentation

◆ evalStress

template<int DIM, typename DomainEleOp >
const bool MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >::evalStress
protected

Definition at line 170 of file MatHuHu.cpp.

◆ evalTangent

template<int DIM, typename DomainEleOp >
const bool MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >::evalTangent
protected

Definition at line 171 of file MatHuHu.cpp.

◆ physicalPtr

template<int DIM, typename DomainEleOp >
boost::shared_ptr<PhysicalEquations> MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >::physicalPtr
protected

Definition at line 169 of file MatHuHu.cpp.


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