24 #ifndef __MINIMAL_SURFACE_ELEMENT_HPP__
25 #define __MINIMAL_SURFACE_ELEMENT_HPP__
103 return sin(2 * M_PI * (x + y));
112 int nb_dofs = data.getFieldData().size();
116 nF.resize(nb_dofs,
false);
118 int nb_gauss_pts = data.getN().size1();
119 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
120 double val = getLength() * getGaussPts()(1, gg);
121 double x = getCoordsAtGaussPts()(gg, 0);
122 double y = getCoordsAtGaussPts()(gg, 1);
126 &*data.getIndices().data().begin(), &
nF[0],
147 PetscErrorCode
doWork(
int row_side,
int col_side, EntityType row_type,
153 int row_nb_dofs = row_data.getIndices().size();
154 if (row_nb_dofs == 0) {
157 int col_nb_dofs = col_data.getIndices().size();
158 if (col_nb_dofs == 0) {
161 K.resize(row_nb_dofs, col_nb_dofs,
false);
163 int nb_gauss_pts = row_data.getN().size1();
164 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
165 double val = getLength() * getGaussPts()(1, gg);
168 noalias(
K) += val * outer_prod(row_n, col_n);
171 &*row_data.getIndices().data().begin(), col_nb_dofs,
172 &*col_data.getIndices().data().begin(),
173 &*
K.data().begin(), ADD_VALUES);
175 if (row_type != col_type || row_side != col_side) {
176 transK.resize(col_nb_dofs, row_nb_dofs,
false);
179 &*col_data.getIndices().data().begin(), row_nb_dofs,
180 &*row_data.getIndices().data().begin(),
181 &*
transK.data().begin(), ADD_VALUES);
202 int nb_dofs = data.getFieldData().size();
206 int nb_gauss_pts = data.getN().size1();
209 if (
type == MBVERTEX) {
215 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
217 ublas::matrix_row<MatrixDouble> grad_at_gauss_pt(
commonData.
gradU, gg);
218 noalias(grad_at_gauss_pt) +=
219 prod(trans(grad_shape_fun), data.getFieldData());
234 bool rhs_and_not_lhs)
244 if (
type == MBVERTEX) {
245 int nb_gauss_pts = data.getN().size1();
247 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
251 inner_prod(grad_at_gauss_pt, grad_at_gauss_pt);
254 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
260 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
263 for (
int rr = 0; rr != 2; rr++) {
271 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
274 for (
int rr = 0; rr != 2; rr++) {
307 int nb_dofs = data.getIndices().size();
313 int nb_gauss_pts = data.getN().size1();
314 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
315 double val = getGaussPts()(2, gg) * getArea();
317 noalias(
rEsidual) += val * prod(data.getDiffN(gg), an_by_grad_u);
320 &*data.getIndices().data().begin(), &
rEsidual[0],
340 PetscErrorCode
doWork(
int row_side,
int col_side, EntityType row_type,
346 int row_nb_dofs = row_data.getIndices().size();
347 if (row_nb_dofs == 0) {
350 int col_nb_dofs = col_data.getIndices().size();
351 if (col_nb_dofs == 0) {
354 kTangent.resize(row_nb_dofs, col_nb_dofs,
false);
356 auxVec.resize(col_nb_dofs,
false);
357 auxMat.resize(col_nb_dofs, 2,
false);
358 int nb_gauss_pts = row_data.getN().size1();
359 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
361 double val = getGaussPts()(2, gg) * getArea();
366 ublas::matrix_row<MatrixDouble> an_pow3_by_grad_u(
370 noalias(
auxVec) = prod(col_diff_n, an_pow3_by_grad_u);
378 val * prod(row_diff_n, trans(an * col_diff_n -
auxMat));
382 &*row_data.getIndices().data().begin(), col_nb_dofs,
383 &*col_data.getIndices().data().begin(),
384 &*
kTangent.data().begin(), ADD_VALUES);
391 #endif // __MINIMAL_SURFACE_ELEMENT_HPP__