249 double diffX_xi[3], diffX_eta[3];
250 bzero(diffX_xi, 3 *
sizeof(
double));
251 bzero(diffX_eta, 3 *
sizeof(
double));
252 double i_diffX_xi[3], i_diffX_eta[3];
253 bzero(i_diffX_xi, 3 *
sizeof(
double));
254 bzero(i_diffX_eta, 3 *
sizeof(
double));
255 Range adj_side_elems;
265 bit, &
face, 1, 3, adj_side_elems);
266 adj_side_elems = intersect(
problemTets, adj_side_elems);
268 if (adj_side_elems.size() == 0) {
269 Range adj_tets_on_surface;
273 bit_tet_on_surface, &
face, 1, 3, adj_tets_on_surface,
274 moab::Interface::INTERSECT, 0);
276 adj_side_elems.insert(*adj_tets_on_surface.begin());
278 if (adj_side_elems.size() != 1) {
279 adj_side_elems.clear();
281 bit, &
face, 1, 3, adj_side_elems, moab::Interface::INTERSECT, 5);
283 Range::iterator it = adj_side_elems.begin();
284 for (; it != adj_side_elems.end(); it++) {
287 PetscPrintf(PETSC_COMM_WORLD,
"%lu %lu %lu %lu\n", nodes[0], nodes[1],
290 ParallelComm *pcomm =
292 if (pcomm->rank() == 0) {
302 "expect 1 tet but is %u", adj_side_elems.size());
305 int order[] = {0, 1, 2};
306 if (side_elem != 0) {
307 int side_number, sense, offset;
308 CHKERR moab.side_number(side_elem,
face, side_number, sense, offset);
316 for (
int nn = 0; nn < 3; nn++) {
326 i_diffX_xi[0] += dofs_iX[3 *
order[nn] + 0] *
diffNTRI[2 * nn + 0];
327 i_diffX_xi[1] += dofs_iX[3 *
order[nn] + 1] *
diffNTRI[2 * nn + 0];
328 i_diffX_xi[2] += dofs_iX[3 *
order[nn] + 2] *
diffNTRI[2 * nn + 0];
329 i_diffX_eta[0] += dofs_iX[3 *
order[nn] + 0] *
diffNTRI[2 * nn + 1];
330 i_diffX_eta[1] += dofs_iX[3 *
order[nn] + 1] *
diffNTRI[2 * nn + 1];
331 i_diffX_eta[2] += dofs_iX[3 *
order[nn] + 2] *
diffNTRI[2 * nn + 1];
334 double SpinX_xi[9], SpinX_eta[9];
337 double iSpinX_xi[9], iSpinX_eta[9];
348 x_diffX_eta[0].
r = diffX_eta[0];
349 x_diffX_eta[0].
i = i_diffX_eta[0];
350 x_diffX_eta[1].
r = diffX_eta[1];
351 x_diffX_eta[1].
i = i_diffX_eta[1];
352 x_diffX_eta[2].
r = diffX_eta[2];
353 x_diffX_eta[2].
i = i_diffX_eta[2];
354 cblas_zgemv(CblasRowMajor, CblasNoTrans, 3, 3, &x_one, xSpinX_xi, 3,
355 x_diffX_eta, 1, &x_zero, x_normal, 1);
385 complex<double> x_nrm2;
386 x_nrm2 = sqrt(pow(complex<double>(x_normal[0].
r, x_normal[0].
i), 2) +
387 pow(complex<double>(x_normal[1].
r, x_normal[1].
i), 2) +
388 pow(complex<double>(x_normal[2].
r, x_normal[2].
i), 2));
397 cblas_zgemv(CblasRowMajor, CblasNoTrans, 3, 3, &x_scalar, xSpinX_xi, 3,
398 x_normal, 1, &x_zero, xNSpinX_xi,
400 cblas_zgemv(CblasRowMajor, CblasNoTrans, 3, 3, &x_scalar, xSpinX_eta, 3,
401 x_normal, 1, &x_zero, xNSpinX_eta,
404 bzero(
C, 9 *
sizeof(
double));
406 bzero(iC, 9 *
sizeof(
double));
408 bzero(T, 9 *
sizeof(
double));
410 bzero(iT, 9 *
sizeof(
double));
411 for (
int nn = 0; nn < 3; nn++) {
426 C[3 * nn + 0] =
A[0];
427 C[3 * nn + 1] =
A[1];
428 C[3 * nn + 2] =
A[2];
431 iC[3 * nn + 0] = iA[0];
432 iC[3 * nn + 1] = iA[1];
433 iC[3 * nn + 2] = iA[2];
435 if ((T != NULL) || (iT != NULL)) {
444 cblas_zgemv(CblasRowMajor, CblasNoTrans, 3, 3, &x_scalar, xSpinA, 3,
445 x_normal, 1, &x_zero, xT, 1);
447 T[3 * nn + 0] = xT[0].
r;
448 T[3 * nn + 1] = xT[1].
r;
449 T[3 * nn + 2] = xT[2].
r;
452 iT[3 * nn + 0] = xT[0].
i;
453 iT[3 * nn + 1] = xT[1].
i;
454 iT[3 * nn + 2] = xT[2].
i;
459 cblas_dscal(9, 0.25,
C, 1);
461 cblas_dscal(9, 0.25, iC, 1);
463 cblas_dscal(9, 0.25, T, 1);
465 cblas_dscal(9, 0.25, iT, 1);