10 #ifndef FUNCGRADDISC_H
11 #define FUNCGRADDISC_H
38 double xyz[3] = {x, y,
z};
48 f =
f + std::abs((*
_ls)(v->
x(), v->
y(), v->
z())) * val[i];
50 f =
f - std::abs((*
_ls)(x, y,
z));
74 void gradient(
double x,
double y,
double z,
double &dfdx,
double &dfdy,
81 double xyz[3] = {x, y,
z};
84 double gradsuvw[256][3];
92 const double detJ = e->
getJacobian(uvw[0], uvw[1], uvw[2], jac);
99 if((*
_ls)(x, y,
z) > 0) {
101 dNdx = invjac[0][0] * gradsuvw[i][0] + invjac[0][1] * gradsuvw[i][1] +
102 invjac[0][2] * gradsuvw[i][2];
103 dNdy = invjac[1][0] * gradsuvw[i][0] + invjac[1][1] * gradsuvw[i][1] +
104 invjac[1][2] * gradsuvw[i][2];
105 dNdz = invjac[2][0] * gradsuvw[i][0] + invjac[2][1] * gradsuvw[i][1] +
106 invjac[2][2] * gradsuvw[i][2];
109 dfdx = dfdx + std::abs((*
_ls)(v->
x(), v->
y(), v->
z())) * dNdx;
110 dfdx = dfdx - (*_ls)(v->
x(), v->
y(), v->
z()) * dNdx;
111 dfdy = dfdy + std::abs((*
_ls)(v->
x(), v->
y(), v->
z())) * dNdy;
112 dfdy = dfdy - (*_ls)(v->
x(), v->
y(), v->
z()) * dNdy;
113 dfdz = dfdz + std::abs((*
_ls)(v->
x(), v->
y(), v->
z())) * dNdz;
114 dfdz = dfdz - (*_ls)(v->
x(), v->
y(), v->
z()) * dNdz;
119 dNdx = invjac[0][0] * gradsuvw[i][0] + invjac[0][1] * gradsuvw[i][1] +
120 invjac[0][2] * gradsuvw[i][2];
121 dNdy = invjac[1][0] * gradsuvw[i][0] + invjac[1][1] * gradsuvw[i][1] +
122 invjac[1][2] * gradsuvw[i][2];
123 dNdz = invjac[2][0] * gradsuvw[i][0] + invjac[2][1] * gradsuvw[i][1] +
124 invjac[2][2] * gradsuvw[i][2];
127 dfdx = dfdx + std::abs((*
_ls)(v->
x(), v->
y(), v->
z())) * dNdx;
128 dfdx = dfdx + (*_ls)(v->
x(), v->
y(), v->
z()) * dNdx;
129 dfdy = dfdy + std::abs((*
_ls)(v->
x(), v->
y(), v->
z())) * dNdy;
130 dfdy = dfdy + (*_ls)(v->
x(), v->
y(), v->
z()) * dNdy;
131 dfdz = dfdz + std::abs((*
_ls)(v->
x(), v->
y(), v->
z())) * dNdz;
132 dfdz = dfdz + (*_ls)(v->
x(), v->
y(), v->
z()) * dNdz;