659 ublas::vector<double, ublas::bounded_array<double, 9>> tangent_constrains(
663 &*tangent_constrains.data().begin(), NULL);
665 Tag th_interface_side;
666 CHKERR moab.tag_get_handle(
"INTERFACE_SIDE", th_interface_side);
670 tangent_constrains *= -1;
673 ublas::vector<double, ublas::bounded_array<double, 9>>
674 f_front_mesh_smoothing(9);
675 ublas::noalias(f_front_mesh_smoothing) = ublas::zero_vector<double>(9);
676 double *f_front_mesh_array;
678 for (
int nn = 0; nn < 3; nn++) {
679 for (
int dd = 0;
dd < 3;
dd++) {
682 f_front_mesh_smoothing[3 * nn +
dd] =
688 if (snes_ctx == CTX_SNESSETJACOBIAN) {
692 &
coords.data()[6], center, NULL, NULL);
693 cblas_daxpy(3, -1, &
coords.data()[0], 1, center, 1);
694 double r = cblas_dnrm2(3, center, 1);
695 for (
int nn = 0; nn < 3; nn++) {
696 for (
int dd = 0;
dd < 3;
dd++) {
698 ublas::vector<double, ublas::bounded_array<double, 9>> idofs_X(9, 0);
699 idofs_X[nn * 3 +
dd] =
r *
eps;
700 ublas::vector<double, ublas::bounded_array<double, 9>>
701 direvative_of_constrains(9);
705 &*idofs_X.data().begin(), NULL, NULL, NULL,
706 &*direvative_of_constrains.data().begin());
708 direvative_of_constrains /= -
r *
eps;
710 direvative_of_constrains /= +
r *
eps;
713 double g[3] = {0, 0, 0};
714 for (
int nnn = 0; nnn < 3; nnn++) {
717 for (
int ddd = 0; ddd < 3; ddd++) {
718 g[nnn] += direvative_of_constrains[nnn * 3 + ddd] *
719 f_front_mesh_smoothing[3 * nnn + ddd];
722 for (
int nnn = 0; nnn < 3; nnn++) {
730 for (
int nnn = 0; nnn < 3; nnn++) {
731 for (
int ddd = 0; ddd < 3; ddd++) {
732 direvative_of_constrains[nnn * 3 + ddd] *=
lambda[nnn];
735 for (
int nnn = 0; nnn < 3; nnn++) {
740 &direvative_of_constrains[3 * nnn], ADD_VALUES);
747 case CTX_SNESSETFUNCTION: {
748 ublas::vector<double, ublas::bounded_array<double, 3>>
g(3);
749 for (
int nn = 0; nn < 3; nn++) {
750 g[nn] = cblas_ddot(3, &tangent_constrains[3 * nn], 1,
751 &f_front_mesh_smoothing[3 * nn], 1);
755 &*
g.data().begin(), ADD_VALUES);
757 &*tangent_constrains.data().begin(), ADD_VALUES);
758 ublas::vector<double, ublas::bounded_array<double, 9>>
f(9);
759 for (
int nn = 0; nn < 3; nn++) {
760 for (
int dd = 0;
dd < 3;
dd++) {
761 f[nn * 3 +
dd] =
lambda[nn] * tangent_constrains[3 * nn +
dd];
776 case CTX_SNESSETJACOBIAN: {
777 for (
int nn = 0; nn < 3; nn++) {
780 &lambda_dof_idx, &tangent_constrains[3 * nn],