177 {
180 if (!nb_dofs)
182 int nb_integration_pts = data.
getN().size1();
183 auto *fe_ptr =
const_cast<FEMethod *
>(this->getFEMethod());
185
186 auto get_tag = [&]() {
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 }
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) {
206 "Missing common data for ADOL-C evaluation");
207 }
208 if (mat_grad_ptr->size2() != DIM * DIM) {
210 "Inconsistent size of gradient matrix for ADOL-C evaluation");
211 }
212 if (mat_grad_ptr->size1() != nb_integration_pts) {
214 "Inconsistent size of gradient matrix data for ADOL-C evaluation");
215 }
216#endif
217
219 auto get_grad_at_pts =
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 =
227 *mat_k_dF_ptr, nb_integration_pts);
228
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());
251 t_k_at_pts(0) =
252 (*
physicalPtr->matOpsDataPtr->getDependentDataPtr(
"k"))(0, 0);
253 next();
254 }
255 }
256
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());
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)
#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
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'J', DIM1 > J
FTensor::Index< 'k', 3 > k
DataLayoutTraits< DataLayout::GaussByCoeffs > DL
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.