11 using namespace MoFEM;
14 #include <adolc/adolc.h>
21 auto create_vec = [&]() {
22 constexpr
int ghosts[] = {0};
34 return 2 * (
order - 1) + addToRule;
40 CHKERR VolumeElementForcesAndSourcesCore::preProcess();
42 if (
A != PETSC_NULL) {
46 if (
F != PETSC_NULL) {
68 CHKERR VecAssemblyBegin(V);
76 CHKERR VolumeElementForcesAndSourcesCore::postProcess();
88 std::vector<VectorDouble> &values_at_gauss_pts,
89 std::vector<MatrixDouble> &gardient_at_gauss_pts)
92 valuesAtGaussPts(values_at_gauss_pts),
93 gradientAtGaussPts(gardient_at_gauss_pts), zeroAtType(MBVERTEX) {}
100 const int nb_base_functions = data.
getN().size2();
104 const int nb_gauss_pts = data.
getN().size1();
105 const int rank = data.
getFieldDofs()[0]->getNbOfCoeffs();
108 if (
type == zeroAtType) {
109 valuesAtGaussPts.resize(nb_gauss_pts);
110 gradientAtGaussPts.resize(nb_gauss_pts);
111 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
112 valuesAtGaussPts[gg].resize(rank,
false);
113 gradientAtGaussPts[gg].resize(rank, 3,
false);
115 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
116 valuesAtGaussPts[gg].clear();
117 gradientAtGaussPts[gg].clear();
128 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
130 double &val = valuesAtGaussPts[gg][0];
132 &gradientAtGaussPts[gg](0, 1),
133 &gradientAtGaussPts[gg](0, 2));
135 for (; bb != nb_dofs; bb++) {
136 val += base_function * field_data;
137 grad(
i) += diff_base_functions(
i) * field_data;
138 ++diff_base_functions;
142 for (; bb != nb_base_functions; bb++) {
143 ++diff_base_functions;
148 }
else if (rank == 3) {
150 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
153 &valuesAtGaussPts[gg][1],
154 &valuesAtGaussPts[gg][2]);
156 &gradientAtGaussPts[gg](0, 0), &gradientAtGaussPts[gg](0, 1),
157 &gradientAtGaussPts[gg](0, 2), &gradientAtGaussPts[gg](1, 0),
158 &gradientAtGaussPts[gg](1, 1), &gradientAtGaussPts[gg](1, 2),
159 &gradientAtGaussPts[gg](2, 0), &gradientAtGaussPts[gg](2, 1),
160 &gradientAtGaussPts[gg](2, 2));
162 for (; bb != nb_dofs / 3; bb++) {
163 values(
i) += base_function * field_data(
i);
164 gradient(
i,
j) += field_data(
i) * diff_base_functions(
j);
165 ++diff_base_functions;
169 for (; bb != nb_base_functions; bb++) {
170 ++diff_base_functions;
178 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
181 for (
int dd = 0;
dd < nb_dofs / rank;
dd++) {
182 for (
int rr1 = 0; rr1 < rank; rr1++) {
183 valuesAtGaussPts[gg][rr1] +=
N[
dd] * values[rank *
dd + rr1];
184 for (
int rr2 = 0; rr2 < 3; rr2++) {
185 gradientAtGaussPts[gg](rr1, rr2) +=
186 diffN(
dd, rr2) * values[rank *
dd + rr1];
204 int tag,
bool jacobian,
bool ale,
208 dAta(data),
commonData(common_data),
tAg(tag), adlocReturnValue(0),
209 jAcobian(jacobian), fUnction(!jacobian), aLe(ale), fieldDisp(field_disp) {
218 CHKERR dAta.materialAdoublePtr->calculateP_PiolaKirchhoffI(
219 dAta, getNumeredEntFiniteElementPtr());
222 auto &t_P = dAta.materialAdoublePtr->t_P;
223 auto &t_invH = dAta.materialAdoublePtr->t_invH;
224 t_P(
i,
j) = t_P(
i,
k) * t_invH(
j,
k);
225 t_P(
i,
j) *= dAta.materialAdoublePtr->detH;
229 for (
int dd1 = 0; dd1 < 3; dd1++) {
230 for (
int dd2 = 0; dd2 < 3; dd2++) {
231 dAta.materialAdoublePtr->P(dd1, dd2) >>=
246 dAta.materialAdoublePtr->F.resize(3, 3,
false);
250 nbActiveVariables = 0;
251 for (
int dd1 = 0; dd1 < 3; dd1++) {
252 for (
int dd2 = 0; dd2 < 3; dd2++) {
253 dAta.materialAdoublePtr->F(dd1, dd2) <<= (*ptrh)[gg](dd1, dd2);
256 dAta.materialAdoublePtr->F(dd1, dd2) += 1;
265 nbActiveVariables = 0;
267 dAta.materialAdoublePtr->h.resize(3, 3,
false);
268 for (
int dd1 = 0; dd1 < 3; dd1++) {
269 for (
int dd2 = 0; dd2 < 3; dd2++) {
270 dAta.materialAdoublePtr->h(dd1, dd2) <<= (*ptrh)[gg](dd1, dd2);
275 dAta.materialAdoublePtr->H.resize(3, 3,
false);
276 for (
int dd1 = 0; dd1 < 3; dd1++) {
277 for (
int dd2 = 0; dd2 < 3; dd2++) {
278 dAta.materialAdoublePtr->H(dd1, dd2) <<= (*ptrH)[gg](dd1, dd2);
284 dAta.materialAdoublePtr->invH.resize(3, 3,
false);
286 dAta.materialAdoublePtr->detH,
287 dAta.materialAdoublePtr->invH);
289 auto &t_F = dAta.materialAdoublePtr->t_F;
290 auto &t_h = dAta.materialAdoublePtr->t_h;
291 auto &t_invH = dAta.materialAdoublePtr->t_invH;
293 t_F(
i,
j) = t_h(
i,
k) * t_invH(
k,
j);
297 CHKERR dAta.materialAdoublePtr->setUserActiveVariables(nbActiveVariables);
298 CHKERR calculateStress(gg);
314 r = ::function(
tAg, 9, nbActiveVariables, &activeVariables[0],
316 if (
r < adlocReturnValue) {
318 "ADOL-C function evaluation with error r = %d",
r);
324 double *jac_ptr[] = {
331 r = jacobian(
tAg, 9, nbActiveVariables, &activeVariables[0], jac_ptr);
332 if (
r < adlocReturnValue) {
334 "ADOL-C function evaluation with error");
342 int row_side, EntityType row_type,
347 if (row_type != MBVERTEX)
350 if (dAta.tEts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
358 dAta.materialAdoublePtr->commonDataPtr = &
commonData;
359 dAta.materialAdoublePtr->opPtr =
this;
361 int nb_gauss_pts = row_data.
getN().size1();
370 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
372 dAta.materialAdoublePtr->gG = gg;
375 if (recordTagForIntegrationPoint(gg)) {
380 if (jAcobian || (!recordTagForIntegrationPoint(gg))) {
381 activeVariables.resize(nbActiveVariables,
false);
383 for (
int dd1 = 0; dd1 < 3; dd1++) {
384 for (
int dd2 = 0; dd2 < 3; dd2++) {
385 activeVariables(dd1 * 3 + dd2) = (*ptrh)[gg](dd1, dd2);
389 for (
int dd1 = 0; dd1 < 3; dd1++) {
390 for (
int dd2 = 0; dd2 < 3; dd2++) {
391 activeVariables(dd1 * 3 + dd2) = (*ptrh)[gg](dd1, dd2);
394 for (
int dd1 = 0; dd1 < 3; dd1++) {
395 for (
int dd2 = 0; dd2 < 3; dd2++) {
396 activeVariables(9 + dd1 * 3 + dd2) = (*ptrH)[gg](dd1, dd2);
400 CHKERR dAta.materialAdoublePtr->setUserActiveVariables(activeVariables);
403 if (jAcobian || (!recordTagForIntegrationPoint(gg))) {
416 bool hessian,
bool ale,
bool field_disp)
419 dAta(data),
commonData(common_data),
tAg(tag), gRadient(gradient),
420 hEssian(hessian), aLe(ale), fieldDisp(field_disp) {}
425 CHKERR dAta.materialAdoublePtr->calculateElasticEnergy(
426 dAta, getNumeredEntFiniteElementPtr());
439 nbActiveVariables = 0;
440 for (
int dd1 = 0; dd1 < 3; dd1++) {
441 for (
int dd2 = 0; dd2 < 3; dd2++) {
442 dAta.materialAdoublePtr->F(dd1, dd2) <<= (*ptrh)[gg](dd1, dd2);
445 dAta.materialAdoublePtr->F(dd1, dd2) += 1;
454 nbActiveVariables = 0;
456 dAta.materialAdoublePtr->h.resize(3, 3,
false);
457 for (
int dd1 = 0; dd1 < 3; dd1++) {
458 for (
int dd2 = 0; dd2 < 3; dd2++) {
459 dAta.materialAdoublePtr->h(dd1, dd2) <<= (*ptrh)[gg](dd1, dd2);
464 dAta.materialAdoublePtr->H.resize(3, 3,
false);
465 for (
int dd1 = 0; dd1 < 3; dd1++) {
466 for (
int dd2 = 0; dd2 < 3; dd2++) {
467 dAta.materialAdoublePtr->H(dd1, dd2) <<= (*ptrH)[gg](dd1, dd2);
473 dAta.materialAdoublePtr->invH.resize(3, 3,
false);
475 dAta.materialAdoublePtr->detH,
476 dAta.materialAdoublePtr->invH);
478 auto &t_F = dAta.materialAdoublePtr->t_F;
479 auto &t_h = dAta.materialAdoublePtr->t_h;
480 auto &t_invH = dAta.materialAdoublePtr->t_invH;
482 t_F(
i,
j) = t_h(
i,
k) * t_invH(
k,
j);
486 CHKERR dAta.materialAdoublePtr->setUserActiveVariables(nbActiveVariables);
500 int r = ::gradient(
tAg, nbActiveVariables, &activeVariables[0],
506 "ADOL-C function evaluation with error");
513 double *
H[nbActiveVariables];
514 for (
int n = 0;
n != nbActiveVariables;
n++) {
517 int r = ::hessian(
tAg, nbActiveVariables, &*activeVariables.begin(),
H);
522 "ADOL-C function evaluation with error");
530 int row_side, EntityType row_type,
535 if (row_type != MBVERTEX)
538 if (dAta.tEts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
546 dAta.materialAdoublePtr->commonDataPtr = &
commonData;
547 dAta.materialAdoublePtr->opPtr =
this;
549 int nb_gauss_pts = row_data.
getN().size1();
558 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
560 dAta.materialAdoublePtr->gG = gg;
563 if (recordTagForIntegrationPoint(gg)) {
567 activeVariables.resize(nbActiveVariables,
false);
569 for (
int dd1 = 0; dd1 < 3; dd1++) {
570 for (
int dd2 = 0; dd2 < 3; dd2++) {
571 activeVariables(dd1 * 3 + dd2) = (*ptrh)[gg](dd1, dd2);
575 for (
int dd1 = 0; dd1 < 3; dd1++) {
576 for (
int dd2 = 0; dd2 < 3; dd2++) {
577 activeVariables(dd1 * 3 + dd2) = (*ptrh)[gg](dd1, dd2);
580 for (
int dd1 = 0; dd1 < 3; dd1++) {
581 for (
int dd2 = 0; dd2 < 3; dd2++) {
582 activeVariables(9 + dd1 * 3 + dd2) = (*ptrH)[gg](dd1, dd2);
586 CHKERR dAta.materialAdoublePtr->setUserActiveVariables(activeVariables);
599 dAta(data),
commonData(common_data), aLe(false) {}
602 int row_side, EntityType row_type,
608 if (!dAta.forcesOnlyOnEntitiesRow.empty()) {
609 iNdices.resize(nb_dofs,
false);
611 indices_ptr = &iNdices[0];
613 VectorDofs::iterator dit = dofs.begin();
614 for (
int ii = 0; dit != dofs.end(); dit++, ii++) {
615 if (dAta.forcesOnlyOnEntitiesRow.find((*dit)->getEnt()) ==
616 dAta.forcesOnlyOnEntitiesRow.end()) {
627 int row_side, EntityType row_type,
631 if (dAta.tEts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
636 const int nb_dofs = row_data.
getIndices().size();
639 if ((
unsigned int)nb_dofs > 3 * row_data.
getN().size2()) {
640 SETERRQ(PETSC_COMM_SELF, 1,
"data inconsistency");
642 const int nb_base_functions = row_data.
getN().size2();
643 const int nb_gauss_pts = row_data.
getN().size1();
645 nf.resize(nb_dofs,
false);
652 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
653 double val = getVolume() * getGaussPts()(3, gg);
656 &stress(0, 0), &stress(0, 1), &stress(0, 2), &stress(1, 0),
657 &stress(1, 1), &stress(1, 2), &stress(2, 0), &stress(2, 1),
661 for (; bb != nb_dofs / 3; bb++) {
662 rhs(
i) += val * t3(
i,
j) * diff_base_functions(
j);
664 ++diff_base_functions;
666 for (; bb != nb_base_functions; bb++) {
667 ++diff_base_functions;
671 CHKERR aSemble(row_side, row_type, row_data);
683 dAta(data),
commonData(common_data), ghostVec(ghost_vec, true),
684 fieldDisp(field_disp) {}
687 int row_side, EntityType row_type,
691 if (row_type != MBVERTEX)
693 if (dAta.tEts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
698 std::vector<MatrixDouble> &
F =
700 dAta.materialDoublePtr->F.resize(3, 3,
false);
704 for (
unsigned int gg = 0; gg != row_data.
getN().size1(); ++gg) {
705 double val = getVolume() * getGaussPts()(3, gg);
706 noalias(dAta.materialDoublePtr->F) =
F[gg];
708 for (
int dd = 0;
dd < 3;
dd++) {
709 dAta.materialDoublePtr->F(
dd,
dd) += 1;
712 int nb_active_variables = 0;
713 CHKERR dAta.materialDoublePtr->setUserActiveVariables(nb_active_variables);
714 CHKERR dAta.materialDoublePtr->calculateElasticEnergy(
715 dAta, getNumeredEntFiniteElementPtr());
716 energy += val * dAta.materialDoublePtr->eNergy;
719 CHKERR VecSetValue(ghostVec, 0, energy, ADD_VALUES);
728 dAta(data),
commonData(common_data), aLe(false) {}
740 const_cast<double *
>(&(col_data.
getDiffN(gg, nb_col / 3)(0, 0)));
744 &jac_stress(3 * 0 + 0, S + 0), &jac_stress(3 * 0 + 0, S + 1),
745 &jac_stress(3 * 0 + 0, S + 2), &jac_stress(3 * 0 + 1, S + 0),
746 &jac_stress(3 * 0 + 1, S + 1), &jac_stress(3 * 0 + 1, S + 2),
747 &jac_stress(3 * 0 + 2, S + 0), &jac_stress(3 * 0 + 2, S + 1),
748 &jac_stress(3 * 0 + 2, S + 2), &jac_stress(3 * 1 + 0, S + 0),
749 &jac_stress(3 * 1 + 0, S + 1), &jac_stress(3 * 1 + 0, S + 2),
750 &jac_stress(3 * 1 + 1, S + 0), &jac_stress(3 * 1 + 1, S + 1),
751 &jac_stress(3 * 1 + 1, S + 2), &jac_stress(3 * 1 + 2, S + 0),
752 &jac_stress(3 * 1 + 2, S + 1), &jac_stress(3 * 1 + 2, S + 2),
753 &jac_stress(3 * 2 + 0, S + 0), &jac_stress(3 * 2 + 0, S + 1),
754 &jac_stress(3 * 2 + 0, S + 2), &jac_stress(3 * 2 + 1, S + 0),
755 &jac_stress(3 * 2 + 1, S + 1), &jac_stress(3 * 2 + 1, S + 2),
756 &jac_stress(3 * 2 + 2, S + 0), &jac_stress(3 * 2 + 2, S + 1),
757 &jac_stress(3 * 2 + 2, S + 2));
759 &jac_stress(3 * 0 + 0, S + 3), &jac_stress(3 * 0 + 0, S + 4),
760 &jac_stress(3 * 0 + 0, S + 5), &jac_stress(3 * 0 + 1, S + 3),
761 &jac_stress(3 * 0 + 1, S + 4), &jac_stress(3 * 0 + 1, S + 5),
762 &jac_stress(3 * 0 + 2, S + 3), &jac_stress(3 * 0 + 2, S + 4),
763 &jac_stress(3 * 0 + 2, S + 5), &jac_stress(3 * 1 + 0, S + 3),
764 &jac_stress(3 * 1 + 0, S + 4), &jac_stress(3 * 1 + 0, S + 5),
765 &jac_stress(3 * 1 + 1, S + 3), &jac_stress(3 * 1 + 1, S + 4),
766 &jac_stress(3 * 1 + 1, S + 5), &jac_stress(3 * 1 + 2, S + 3),
767 &jac_stress(3 * 1 + 2, S + 4), &jac_stress(3 * 1 + 2, S + 5),
768 &jac_stress(3 * 2 + 0, S + 3), &jac_stress(3 * 2 + 0, S + 4),
769 &jac_stress(3 * 2 + 0, S + 5), &jac_stress(3 * 2 + 1, S + 3),
770 &jac_stress(3 * 2 + 1, S + 4), &jac_stress(3 * 2 + 1, S + 5),
771 &jac_stress(3 * 2 + 2, S + 3), &jac_stress(3 * 2 + 2, S + 4),
772 &jac_stress(3 * 2 + 2, S + 5));
774 &jac_stress(3 * 0 + 0, S + 6), &jac_stress(3 * 0 + 0, S + 7),
775 &jac_stress(3 * 0 + 0, S + 8), &jac_stress(3 * 0 + 1, S + 6),
776 &jac_stress(3 * 0 + 1, S + 7), &jac_stress(3 * 0 + 1, S + 8),
777 &jac_stress(3 * 0 + 2, S + 6), &jac_stress(3 * 0 + 2, S + 7),
778 &jac_stress(3 * 0 + 2, S + 8), &jac_stress(3 * 1 + 0, S + 6),
779 &jac_stress(3 * 1 + 0, S + 7), &jac_stress(3 * 1 + 0, S + 8),
780 &jac_stress(3 * 1 + 1, S + 6), &jac_stress(3 * 1 + 1, S + 7),
781 &jac_stress(3 * 1 + 1, S + 8), &jac_stress(3 * 1 + 2, S + 6),
782 &jac_stress(3 * 1 + 2, S + 7), &jac_stress(3 * 1 + 2, S + 8),
783 &jac_stress(3 * 2 + 0, S + 6), &jac_stress(3 * 2 + 0, S + 7),
784 &jac_stress(3 * 2 + 0, S + 8), &jac_stress(3 * 2 + 1, S + 6),
785 &jac_stress(3 * 2 + 1, S + 7), &jac_stress(3 * 2 + 1, S + 8),
786 &jac_stress(3 * 2 + 2, S + 6), &jac_stress(3 * 2 + 2, S + 7),
787 &jac_stress(3 * 2 + 2, S + 8));
791 &jac(0, 0), &jac(1, 0), &jac(2, 0), &jac(3, 0), &jac(4, 0), &jac(5, 0),
792 &jac(6, 0), &jac(7, 0), &jac(8, 0));
794 &jac(0, 1), &jac(1, 1), &jac(2, 1), &jac(3, 1), &jac(4, 1), &jac(5, 1),
795 &jac(6, 1), &jac(7, 1), &jac(8, 1));
797 &jac(0, 2), &jac(1, 2), &jac(2, 2), &jac(3, 2), &jac(4, 2), &jac(5, 2),
798 &jac(6, 2), &jac(7, 2), &jac(8, 2));
800 diff_ptr, &diff_ptr[1], &diff_ptr[2]);
801 for (
int dd = 0;
dd != nb_col / 3; ++
dd) {
802 t2_1_0(
i,
j) += t3_1_0(
i,
j,
k) * diff(
k);
803 t2_1_1(
i,
j) += t3_1_1(
i,
j,
k) * diff(
k);
804 t2_1_2(
i,
j) += t3_1_2(
i,
j,
k) * diff(
k);
819 int row_side,
int col_side, EntityType row_type, EntityType col_type,
827 int *row_indices_ptr = &row_data.
getIndices()[0];
828 int *col_indices_ptr = &col_data.
getIndices()[0];
830 if (!dAta.forcesOnlyOnEntitiesRow.empty()) {
831 rowIndices.resize(nb_row,
false);
833 row_indices_ptr = &rowIndices[0];
835 VectorDofs::iterator dit = dofs.begin();
836 for (
int ii = 0; dit != dofs.end(); dit++, ii++) {
837 if (dAta.forcesOnlyOnEntitiesRow.find((*dit)->getEnt()) ==
838 dAta.forcesOnlyOnEntitiesRow.end()) {
844 if (!dAta.forcesOnlyOnEntitiesCol.empty()) {
845 colIndices.resize(nb_col,
false);
847 col_indices_ptr = &colIndices[0];
849 VectorDofs::iterator dit = dofs.begin();
850 for (
int ii = 0; dit != dofs.end(); dit++, ii++) {
851 if (dAta.forcesOnlyOnEntitiesCol.find((*dit)->getEnt()) ==
852 dAta.forcesOnlyOnEntitiesCol.end()) {
859 col_indices_ptr, &
k(0, 0), ADD_VALUES);
862 if (row_side != col_side || row_type != col_type) {
867 if (!dAta.forcesOnlyOnEntitiesCol.empty()) {
868 rowIndices.resize(nb_row,
false);
870 row_indices_ptr = &rowIndices[0];
872 VectorDofs::iterator dit = dofs.begin();
873 for (
int ii = 0; dit != dofs.end(); dit++, ii++) {
874 if (dAta.forcesOnlyOnEntitiesCol.find((*dit)->getEnt()) ==
875 dAta.forcesOnlyOnEntitiesCol.end()) {
881 if (!dAta.forcesOnlyOnEntitiesRow.empty()) {
882 colIndices.resize(nb_col,
false);
884 col_indices_ptr = &colIndices[0];
886 VectorDofs::iterator dit = dofs.begin();
887 for (
int ii = 0; dit != dofs.end(); dit++, ii++) {
888 if (dAta.forcesOnlyOnEntitiesRow.find((*dit)->getEnt()) ==
889 dAta.forcesOnlyOnEntitiesRow.end()) {
895 trans_k.resize(nb_col, nb_row,
false);
896 noalias(trans_k) = trans(
k);
898 row_indices_ptr, &trans_k(0, 0), ADD_VALUES);
905 int row_side,
int col_side, EntityType row_type, EntityType col_type,
917 if (dAta.tEts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
923 const int nb_gauss_pts = row_data.
getN().size1();
929 k.resize(nb_row, nb_col,
false);
931 jac.resize(9, nb_col,
false);
933 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
934 CHKERR getJac(col_data, gg);
935 double val = getVolume() * getGaussPts()(3, gg);
937 &jac(3 * 0 + 0, 0), &jac(3 * 0 + 0, 1), &jac(3 * 0 + 0, 2),
938 &jac(3 * 0 + 1, 0), &jac(3 * 0 + 1, 1), &jac(3 * 0 + 1, 2),
939 &jac(3 * 0 + 2, 0), &jac(3 * 0 + 2, 1), &jac(3 * 0 + 2, 2),
940 &jac(3 * 1 + 0, 0), &jac(3 * 1 + 0, 1), &jac(3 * 1 + 0, 2),
941 &jac(3 * 1 + 1, 0), &jac(3 * 1 + 1, 1), &jac(3 * 1 + 1, 2),
942 &jac(3 * 1 + 2, 0), &jac(3 * 1 + 2, 1), &jac(3 * 1 + 2, 2),
943 &jac(3 * 2 + 0, 0), &jac(3 * 2 + 0, 1), &jac(3 * 2 + 0, 2),
944 &jac(3 * 2 + 1, 0), &jac(3 * 2 + 1, 1), &jac(3 * 2 + 1, 2),
945 &jac(3 * 2 + 2, 0), &jac(3 * 2 + 2, 1), &jac(3 * 2 + 2, 2));
946 for (
int cc = 0; cc != nb_col / 3; cc++) {
949 &
k(0, 3 * cc + 0), &
k(0, 3 * cc + 1), &
k(0, 3 * cc + 2),
950 &
k(1, 3 * cc + 0), &
k(1, 3 * cc + 1), &
k(1, 3 * cc + 2),
951 &
k(2, 3 * cc + 0), &
k(2, 3 * cc + 1), &
k(2, 3 * cc + 2), 3 * nb_col);
952 for (
int rr = 0; rr != nb_row / 3; rr++) {
953 lhs(
i,
j) += val * t3_1(
i,
m,
j) * diff_base_functions(
m);
954 ++diff_base_functions;
961 CHKERR aSemble(row_side, col_side, row_type, col_type, row_data, col_data);
979 int row_side,
int col_side, EntityType row_type, EntityType col_type,
987 int *row_indices_ptr = &row_data.
getIndices()[0];
988 if (!dAta.forcesOnlyOnEntitiesRow.empty()) {
989 rowIndices.resize(nb_row,
false);
991 row_indices_ptr = &rowIndices[0];
993 VectorDofs::iterator dit = dofs.begin();
994 for (
int ii = 0; dit != dofs.end(); dit++, ii++) {
995 if (dAta.forcesOnlyOnEntitiesRow.find((*dit)->getEnt()) ==
996 dAta.forcesOnlyOnEntitiesRow.end()) {
1002 int *col_indices_ptr = &col_data.
getIndices()[0];
1003 if (!dAta.forcesOnlyOnEntitiesCol.empty()) {
1004 colIndices.resize(nb_col,
false);
1006 col_indices_ptr = &colIndices[0];
1008 VectorDofs::iterator dit = dofs.begin();
1009 for (
int ii = 0; dit != dofs.end(); dit++, ii++) {
1010 if (dAta.forcesOnlyOnEntitiesCol.find((*dit)->getEnt()) ==
1011 dAta.forcesOnlyOnEntitiesCol.end()) {
1012 colIndices[ii] = -1;
1026 col_indices_ptr, &
k(0, 0), ADD_VALUES);
1033 int tag,
bool jacobian,
bool ale)
1035 jacobian, ale, false) {}
1042 CHKERR dAta.materialAdoublePtr->calculatesIGma_EshelbyStress(
1043 dAta, getNumeredEntFiniteElementPtr());
1045 auto &t_sIGma = dAta.materialAdoublePtr->t_sIGma;
1046 auto &t_invH = dAta.materialAdoublePtr->t_invH;
1047 t_sIGma(
i,
j) = t_sIGma(
i,
k) * t_invH(
j,
k);
1048 t_sIGma(
i,
j) *= dAta.materialAdoublePtr->detH;
1052 for (
int dd1 = 0; dd1 < 3; dd1++) {
1053 for (
int dd2 = 0; dd2 < 3; dd2++) {
1054 dAta.materialAdoublePtr->sIGma(dd1, dd2) >>=
1090 materialAdoublePtr) {
1093 if (!materialDoublePtr) {
1095 "Pointer for materialDoublePtr not allocated");
1097 if (!materialAdoublePtr) {
1099 "Pointer for materialAdoublePtr not allocated");
1105 CHKERR it->getAttributeDataStructure(mydata);
1106 int id = it->getMeshsetId();
1113 setOfBlocks[id].materialDoublePtr = materialDoublePtr;
1114 setOfBlocks[id].materialAdoublePtr = materialAdoublePtr;
1121 const std::string element_name,
1122 const std::string spatial_position_field_name,
1123 const std::string material_position_field_name,
const bool ale) {
1128 element_name, spatial_position_field_name);
1130 element_name, spatial_position_field_name);
1132 element_name, spatial_position_field_name);
1136 element_name, material_position_field_name);
1138 element_name, material_position_field_name);
1141 element_name, material_position_field_name);
1144 std::map<int, BlockData>::iterator sit =
setOfBlocks.begin();
1154 const std::string spatial_position_field_name,
1155 const std::string material_position_field_name,
const bool ale,
1156 const bool field_disp) {
1169 std::map<int, BlockData>::iterator sit =
setOfBlocks.begin();
1172 spatial_position_field_name, sit->second,
commonData,
tAg,
false, ale,
1175 spatial_position_field_name, sit->second,
commonData));
1202 spatial_position_field_name, sit->second,
commonData,
tAg,
true, ale,
1205 spatial_position_field_name, spatial_position_field_name, sit->second,