1 #ifndef MESHFIELD_ELEMENT_H
2 #define MESHFIELD_ELEMENT_H
4 #include <Kokkos_Core.hpp>
5 #include <MeshField_Defines.hpp>
6 #include <MeshField_Fail.hpp>
7 #include <MeshField_For.hpp>
9 #include <MeshField_Utility.hpp>
11 #include <type_traits>
14 Kokkos::View<MeshField::LO *> getOffsets(MeshField::LO numItems,
15 MeshField::LO numEntriesPerItem) {
16 Kokkos::View<MeshField::LO *> offsets(
"offsets", numItems + 1);
17 auto first = Kokkos::subview(offsets, 0);
18 Kokkos::deep_copy(first, 0);
20 numItems, KOKKOS_LAMBDA(
const int i) {
21 offsets(i + 1) = (i + 1) * numEntriesPerItem;
29 template <
typename T>
class has_size_method {
32 static auto test(
int) -> decltype(std::declval<U>().size(), std::true_type());
33 template <
typename>
static std::false_type test(...);
36 static constexpr
bool value = decltype(test<T>(0))::value;
39 template <
typename T>
class has_static_rank {
42 static auto test(
int) -> decltype(U::rank(), std::true_type());
43 template <
typename>
static std::false_type test(...);
46 static constexpr
bool value = decltype(test<T>(0))::value;
49 template <
typename T>
class has_extent_method {
53 test(
int) -> decltype(std::declval<U>().extent(std::declval<std::size_t>()),
55 template <
typename>
static std::false_type test(...);
58 static constexpr
bool value = decltype(test<T>(0))::value;
63 template <
typename VecA,
typename VecB,
typename Matrix>
64 KOKKOS_INLINE_FUNCTION
auto addTensorProduct(VecA
const &a, VecB
const &b,
66 static_assert(has_size_method<VecA>::value,
67 "VecA must have a size() method.");
68 static_assert(has_size_method<VecB>::value,
69 "VecB must have a size() method.");
70 static_assert(has_static_rank<VecA>::value,
71 "VecA must have a static rank() method.");
72 static_assert(has_static_rank<VecB>::value,
73 "VecB must have a static rank() method.");
75 std::is_same_v<typename VecA::value_type, typename VecB::value_type>);
76 static_assert(VecA::rank() == 1);
77 static_assert(VecB::rank() == 1);
78 static_assert(has_extent_method<Matrix>::value,
79 "Matrix must have an extent(size_t) method.");
80 const auto M = a.size();
81 const auto N = b.size();
82 for (std::size_t i = 0; i < M; ++i) {
83 for (std::size_t j = 0; j < N; ++j) {
84 A(i, j) += b[j] * a[i];
147 template <
typename FieldAccessor,
typename ShapeType,
148 typename ElementDofHolderAccessor>
150 const size_t numMeshEnts;
151 const FieldAccessor field;
153 ElementDofHolderAccessor elm2dof;
155 static const size_t MeshEntDim = ShapeType::meshEntDim;
156 FieldElement(
size_t numMeshEntsIn,
const FieldAccessor &fieldIn,
157 const ShapeType shapeFnIn,
158 const ElementDofHolderAccessor elm2dofIn)
159 : numMeshEnts(numMeshEntsIn), field(fieldIn), shapeFn(shapeFnIn),
160 elm2dof(elm2dofIn) {}
164 return ElementDofHolderAccessor::getTopology();
169 template <
typename T>
struct baseType {
175 template <
typename T,
size_t N>
struct baseType<T[N]> {
176 using type =
typename baseType<T>::type;
179 Kokkos::Array<typename baseType<typename FieldAccessor::BaseType>::type,
180 FieldAccessor::numComp>;
181 static const size_t NumComponents = FieldAccessor::numComp;
185 Kokkos::Array<typename baseType<typename FieldAccessor::BaseType>::type,
186 ShapeType::numNodes * NumComponents>;
191 Kokkos::Array<typename baseType<typename FieldAccessor::BaseType>::type,
192 MeshEntDim * NumComponents>;
204 assert(
static_cast<size_t>(ent) < numMeshEnts);
206 for (
auto topo : elm2dof.getTopology()) {
207 for (
size_t ni = 0; ni < ShapeType::numNodes; ++ni) {
208 for (
size_t ci = 0; ci < NumComponents; ++ci) {
209 const auto map = elm2dof(ni, ci, ent, topo);
210 dofs[ni * NumComponents + ci] =
211 field(map.entity, map.node, map.component, map.topo);
248 template <
typename Coefficients>
250 Coefficients
const &c, Kokkos::Array<Real, MeshEntDim> localCoord)
const {
251 const auto shapeValues = shapeFn.getValues(localCoord);
253 for (
size_t ci = 0; ci < NumComponents; ++ci)
255 for (
size_t ni = 0; ni < ShapeType::numNodes; ++ni)
256 for (
size_t ci = 0; ci < NumComponents; ++ci)
257 v[ci] += c[ni * NumComponents + ci] * shapeValues[ni];
275 template <
typename Coefficients>
277 Coefficients
const &c, Kokkos::Array<Real, MeshEntDim> localCoord)
const {
279 c, shapeFn.getLocalGradients(localCoord));
291 template <
typename Coefficients,
typename ShapeGradients>
293 Coefficients
const &c, ShapeGradients
const &shapeGrads)
const {
295 for (
size_t i = 0; i < MeshEntDim * NumComponents; ++i)
297 for (
size_t ni = 0; ni < ShapeType::numNodes; ++ni)
298 for (
size_t d = 0; d < MeshEntDim; ++d)
299 for (
size_t ci = 0; ci < NumComponents; ++ci)
300 g[d * NumComponents + ci] +=
301 c[ni * NumComponents + ci] * shapeGrads[ni * MeshEntDim + d];
318 KOKKOS_INLINE_FUNCTION ValArray
319 getValue(
int ent, Kokkos::Array<Real, MeshEntDim> localCoord)
const {
324 Kokkos::Array<typename baseType<typename FieldAccessor::BaseType>::type,
325 ShapeType::meshEntDim * ShapeType::numNodes>;
326 KOKKOS_INLINE_FUNCTION NodeArray getNodeValues(
int ent)
const {
328 for (
auto topo : elm2dof.getTopology()) {
329 for (
size_t ni = 0; ni < ShapeType::numNodes; ++ni) {
330 for (
size_t d = 0; d < ShapeType::meshEntDim; ++d) {
331 auto map = elm2dof(ni, d, ent, topo);
333 field(map.entity, map.node, map.component, map.topo);
334 c[ni * ShapeType::meshEntDim + d] = fval;
359 NodeArray
const &x, Kokkos::Array<Real, MeshEntDim> localCoord)
const {
372 template <
typename ShapeGradients>
374 NodeArray
const &x, ShapeGradients
const &grads)
const {
376 for (
size_t i = 0; i < MeshEntDim * MeshEntDim; ++i)
378 for (
size_t n = 0; n < ShapeType::numNodes; ++n)
379 for (
size_t i = 0; i < MeshEntDim; ++i)
380 for (
size_t j = 0; j < MeshEntDim; ++j)
381 J[i * MeshEntDim + j] +=
382 grads[n * MeshEntDim + i] * x[n * MeshEntDim + j];
400 assert(
static_cast<size_t>(ent) < numMeshEnts);
402 const auto nodalGradients = shapeFn.getLocalGradients(ignored);
403 const auto nodeValues = getNodeValues(ent);
404 auto g = nodalGradients[0] * nodeValues[0];
405 for (
size_t i = 1; i < shapeFn.numNodes; ++i) {
406 g = g + nodalGradients[i] * nodeValues[i];
415 template <
typename Matrices>
417 static_assert(has_static_rank<Matrices>::value,
418 "Matrices must have a static rank() method.");
419 static_assert(has_extent_method<Matrices>::value,
420 "Matrices must have an extent(size_t) method.");
421 static_assert(Matrices::rank() == 3);
422 if (J.extent(1) != J.extent(2)) {
423 fail(
"getJacobianDeterminant only supports square matrices. "
424 "The given matrices have dimension %lu x %lu \n",
425 J.extent(1), J.extent(2));
427 const auto dimension = J.extent(1);
428 if (dimension > 3 || dimension < 1) {
429 fail(
"getJacobianDeterminant: invalid dimension of input matrix. "
430 "The given matrices have dimension %lu x %lu \n",
431 J.extent(0), J.extent(1));
433 if (dimension == 3) {
438 Kokkos::View<Real *> determinants(
"3dJacobianDeterminants", J.extent(0));
439 Kokkos::parallel_for(
440 J.extent(0), KOKKOS_LAMBDA(
const int i) {
441 const auto Ji = Kokkos::subview(J, i, Kokkos::ALL(), Kokkos::ALL());
442 const auto cofactorSum =
443 Ji(0, 0) * (Ji(1, 1) * Ji(2, 2) - Ji(1, 2) * Ji(2, 1)) -
444 Ji(0, 1) * (Ji(1, 0) * Ji(2, 2) - Ji(1, 2) * Ji(2, 0)) +
445 Ji(0, 2) * (Ji(1, 0) * Ji(2, 1) - Ji(1, 1) * Ji(2, 0));
446 determinants(i) = cofactorSum;
450 if (dimension == 2) {
451 if (J.extent(1) != 2) {
452 fail(
"getJacobianDeterminant only supports 2x2 matrices in 2d. "
453 "The given matrices have dimension %lu x %lu \n",
454 J.extent(1), J.extent(2));
460 Kokkos::View<Real *> determinants(
"2dJacobianDeterminants", J.extent(0));
462 Kokkos::parallel_for(
463 J.extent(0), KOKKOS_LAMBDA(
const int i) {
465 auto Ji = Kokkos::subview(J, i, Kokkos::ALL(), Kokkos::ALL());
466 const auto cross = Ji(0, 0) * Ji(1, 1) - Ji(1, 0) * Ji(0, 1);
467 determinants(i) = cross;
471 if (dimension == 1) {
472 fail(
"getJacobianDeterminant doesn't yet support 1d. "
473 "The given matrices have dimension %lu x %lu \n",
474 J.extent(0), J.extent(1));
481 return Kokkos::View<Real *>(
"foo", J.extent(0));
484 Kokkos::View<Real ***>
485 getJacobiansStaticLength(Kokkos::View<Real **> localCoords)
const {
488 Kokkos::parallel_reduce(
489 "checkCoords", localCoords.extent(0),
490 KOKKOS_LAMBDA(
const int &ent, LO &lerrors) {
493 for (
size_t i = 0; i < localCoords.extent(1); i++) {
494 if (localCoords(ent, i) < 0)
496 sum += localCoords(ent, i);
504 fail(
"One or more of the parametric coordinates passed "
505 "to evaluate(...) were invalid\n");
508 if (MeshEntDim != 1 && MeshEntDim != 2 && MeshEntDim != 3) {
509 fail(
"getJacobians only currently supports 1d, 2d, and 3d meshes. Input "
511 "has %zu dimensions.\n",
515 if constexpr (MeshEntDim == 1) {
516 const auto numPts = localCoords.extent(0);
517 Kokkos::View<Real ***> res(
"result", numPts * numMeshEnts, 1, 1);
518 auto jacobianFunc = KOKKOS_CLASS_LAMBDA(
const int ent,
const int pt) {
522 MeshField::parallel_for<typename FieldAccessor::Ctrlr, true>({0, 0},
523 {numMeshEnts, numPts}, jacobianFunc,
"1dJacobian");
525 }
else if constexpr (MeshEntDim == 2 || MeshEntDim == 3) {
526 const auto numPts = localCoords.extent(0);
527 Kokkos::View<Real ***> res(
"result", numPts * numMeshEnts, MeshEntDim,
529 Kokkos::deep_copy(res, 0.0);
530 auto jacobianFunc = KOKKOS_CLASS_LAMBDA(
const int ent,
const int pt) {
531 const auto vals = getNodeValues(ent);
532 Kokkos::Array<Real, MeshEntDim> xi;
533 for (
size_t d = 0; d < MeshEntDim; d++)
534 xi[d] = localCoords(pt, d);
535 const auto grad = shapeFn.getLocalGradients(xi);
536 auto A = Kokkos::subview(res, ent * numPts + pt, Kokkos::ALL(),
538 Real localA[MeshEntDim][MeshEntDim] = {};
539 for (
size_t node = 0; node < ShapeType::numNodes; node++) {
540 for (
size_t i = 0; i < MeshEntDim; ++i) {
541 for (
size_t j = 0; j < MeshEntDim; ++j) {
542 localA[j][i] += vals[node * MeshEntDim + i] *
543 grad[node * MeshEntDim + j];
547 for (
size_t i = 0; i < MeshEntDim; ++i) {
548 for (
size_t j = 0; j < MeshEntDim; ++j) {
549 A(i, j) = localA[i][j];
553 MeshField::parallel_for<typename FieldAccessor::Ctrlr, true>({0, 0},
554 {numMeshEnts, numPts}, jacobianFunc,
"2d3dJacobian");
575 Kokkos::View<LO *> offsets)
const {
580 Kokkos::parallel_reduce(
581 "checkCoords", numMeshEnts,
582 KOKKOS_LAMBDA(
const int &ent, LO &lerrors) {
585 for (
size_t i = 0; i < localCoords.extent(1); i++) {
586 if (localCoords(ent, i) < 0)
588 sum += localCoords(ent, i);
596 fail(
"One or more of the parametric coordinates passed "
597 "to evaluate(...) were invalid\n");
600 if (localCoords.extent(0) < numMeshEnts) {
601 fail(
"The size of dimension 0 of the local coordinates input array "
602 "must be at least %zu.\n",
605 if (localCoords.extent(1) != MeshEntDim) {
606 fail(
"Dimension 1 of the input array of local coordinates "
607 "must have size = %zu.\n",
610 if (offsets.size() != numMeshEnts + 1) {
611 fail(
"The input array of offsets must have size = %zu\n",
614 if (MeshEntDim != 1 && MeshEntDim != 2 && MeshEntDim != 3) {
615 fail(
"getJacobians only currently supports 1d, 2d, and 3d meshes. Input "
617 "has %zu dimensions.\n",
620 if constexpr (MeshEntDim == 1) {
621 const auto numPts = MeshFieldUtil::getLastValue(offsets);
622 Kokkos::View<Real ***> res(
"result", numPts, 1, 1);
623 Kokkos::parallel_for(
624 numMeshEnts, KOKKOS_CLASS_LAMBDA(
const int ent) {
626 for (
auto pt = offsets(ent); pt < offsets(ent + 1); pt++) {
632 }
else if constexpr (MeshEntDim == 2 || MeshEntDim == 3) {
633 const auto numPts = MeshFieldUtil::getLastValue(offsets);
635 Kokkos::View<Real ***> res(
"result", numPts, MeshEntDim, MeshEntDim);
636 Kokkos::deep_copy(res, 0.0);
637 Kokkos::parallel_for(
638 numMeshEnts, KOKKOS_CLASS_LAMBDA(
const int ent) {
639 const auto vals = getNodeValues(ent);
640 assert(vals.size() == MeshEntDim * ShapeType::numNodes);
641 for (
auto pt = offsets(ent); pt < offsets(ent + 1); pt++) {
642 auto A = Kokkos::subview(res, pt, Kokkos::ALL(), Kokkos::ALL());
643 Real localA[MeshEntDim][MeshEntDim] = {};
644 Kokkos::Array<Real, MeshEntDim> xi;
645 for (
size_t d = 0; d < MeshEntDim; d++)
646 xi[d] = localCoords(pt, d);
647 const auto grad = shapeFn.getLocalGradients(xi);
648 for (
size_t node = 0; node < ShapeType::numNodes; node++) {
649 for (
size_t i = 0; i < MeshEntDim; ++i) {
650 for (
size_t j = 0; j < MeshEntDim; ++j) {
651 localA[j][i] += vals[node * MeshEntDim + i] *
652 grad[node * MeshEntDim + j];
656 for (
size_t i = 0; i < MeshEntDim; ++i) {
657 for (
size_t j = 0; j < MeshEntDim; ++j) {
658 A(i, j) = localA[i][j];
669 template <
typename FieldElement>
670 Kokkos::View<Real *[FieldElement::NumComponents]>
671 evaluateStaticLength(FieldElement &fes, Kokkos::View<Real **> localCoords) {
674 Kokkos::parallel_reduce(
675 "checkCoords", localCoords.extent(0),
676 KOKKOS_LAMBDA(
const int &ent, LO &lerrors) {
679 for (
size_t i = 0; i < localCoords.extent(1); i++) {
680 if (localCoords(ent, i) < 0)
682 sum += localCoords(ent, i);
690 fail(
"One or more of the parametric coordinates passed "
691 "to evaluate(...) were invalid\n");
694 constexpr
const auto numComponents = FieldElement::ValArray::size();
695 const auto numPts = localCoords.extent(0);
696 Kokkos::View<Real *[numComponents]> res(
"result", numPts * fes.numMeshEnts);
697 auto evaluateFunc = KOKKOS_LAMBDA(
const int ent,
const int pt) {
698 Kokkos::Array<Real, FieldElement::MeshEntDim> lc;
699 for (
size_t i = 0; i < localCoords.extent(1); ++i)
700 lc[i] = localCoords(pt, i);
701 const auto val = fes.getValue(ent, lc);
702 for (
size_t i = 0; i < numComponents; ++i) {
703 res(ent * numPts + pt, i) = val[i];
706 MeshField::parallel_for<
typename decltype(fes.field)::Ctrlr, true>({0, 0}, {fes.numMeshEnts, numPts}, evaluateFunc,
729 template <
typename FieldElement>
730 Kokkos::View<Real *[FieldElement::NumComponents]> evaluate(
731 FieldElement &fes, Kokkos::View<Real **> localCoords,
732 Kokkos::View<LO *> offsets) {
736 Kokkos::parallel_reduce(
737 "checkCoords", fes.numMeshEnts,
738 KOKKOS_LAMBDA(
const int &ent, LO &lerrors) {
741 for (
size_t i = 0; i < localCoords.extent(1); i++) {
742 if (localCoords(ent, i) < 0)
744 sum += localCoords(ent, i);
752 fail(
"One or more of the parametric coordinates passed "
753 "to evaluate(...) were invalid\n");
757 if (localCoords.extent(1) != fes.MeshEntDim) {
758 fail(
"Dimension 1 of the input array of local coordinates "
759 "must have size = %zu.\n",
762 if (offsets.size() != fes.numMeshEnts + 1) {
763 fail(
"The input array of offsets must have size = %zu\n",
764 fes.numMeshEnts + 1);
767 Kokkos::deep_copy(numLocalCoords,
768 Kokkos::subview(offsets, offsets.size() - 1));
769 if (localCoords.extent(0) !=
static_cast<size_t>(numLocalCoords)) {
770 fail(
"The size of dimension 0 of the local coordinates input array (%zu) "
771 "does not match the last entry of the offsets array (%d).\n",
772 localCoords.extent(0), numLocalCoords);
775 const auto numPts = MeshFieldUtil::getLastValue(offsets);
776 Kokkos::View<Real *[FieldElement::NumComponents]> res(
"result", numPts);
777 Kokkos::parallel_for(
778 fes.numMeshEnts, KOKKOS_LAMBDA(
const int ent) {
779 Kokkos::Array<Real, FieldElement::MeshEntDim> lc;
780 const auto c = fes.coefficients(ent);
782 for (
auto pt = offsets(ent); pt < offsets(ent + 1); pt++) {
783 for (
size_t i = 0; i < localCoords.extent(1); i++)
784 lc[i] = localCoords(pt, i);
785 const auto val = fes.valueFromCoefficients(c, lc);
786 for (
size_t i = 0; i < FieldElement::NumComponents; i++)
801 template <
typename FieldElement>
802 Kokkos::View<Real *[FieldElement::NumComponents]> evaluate(
803 FieldElement &fes, Kokkos::View<Real **> localCoords) {
804 const auto numPtsPerElement = 1;
805 return evaluate(fes, localCoords, numPtsPerElement);
819 template <
typename FieldElement>
820 Kokkos::View<Real *[FieldElement::NumComponents]> evaluate(
821 FieldElement &fes, Kokkos::View<Real **> localCoords,
822 size_t numPtsPerElement) {
823 const auto offsets = getOffsets(fes.numMeshEnts, numPtsPerElement);
824 return evaluate(fes, localCoords, offsets);
841 template <
typename FieldElement>
842 Kokkos::View<Real ***> getJacobians(FieldElement &fes,
843 Kokkos::View<Real **> localCoords,
844 size_t numPtsPerElement) {
845 const auto offsets = getOffsets(fes.numMeshEnts, numPtsPerElement);
846 return fes.getJacobians(localCoords, offsets);
859 template <
typename FieldElement,
typename Matrices>
860 Kokkos::View<Real *> getJacobianDeterminants(FieldElement &fes, Matrices J) {
861 return fes.getJacobianDeterminants(J);
870 static constexpr
size_t NumTopologies = Pyramid + 1;
871 Kokkos::Array<LO, NumTopologies + 1> offset;
872 Kokkos::View<LO *> owner;
875 KOKKOS_INLINE_FUNCTION LO
operator()(Mesh_Topology topo, LO entity)
const {
876 return owner(offset[topo] + entity);
885 template <
typename FieldElement>
886 DofHolderOwningEntities getDofHolderOwningEntities(FieldElement
const &fes) {
887 constexpr
size_t numNodes = decltype(fes.shapeFn)::numNodes;
888 constexpr
size_t numTopologies = DofHolderOwningEntities::NumTopologies;
889 const auto &meshInfo = fes.field.meshInfo;
890 const LO numElements = fes.numMeshEnts;
891 DofHolderOwningEntities owners;
892 owners.offset[0] = 0;
893 for (
size_t t = 0; t < numTopologies; ++t)
894 owners.offset[t + 1] =
895 owners.offset[t] + meshInfo.numEntities(
static_cast<Mesh_Topology
>(t));
896 owners.owner = Kokkos::View<LO *>(
897 Kokkos::view_alloc(Kokkos::WithoutInitializing,
"dofHolderOwner"),
898 owners.offset[numTopologies]);
899 Kokkos::deep_copy(owners.owner, numElements);
900 const auto offset = owners.offset;
901 const auto owner = owners.owner;
902 Kokkos::parallel_for(
903 "getDofHolderOwningEntities", numElements, KOKKOS_LAMBDA(
const int ent) {
904 for (
auto topo : fes.elm2dof.getTopology()) {
905 for (size_t n = 0; n < numNodes; ++n) {
906 const auto map = fes.elm2dof(n, 0, ent, topo);
907 Kokkos::atomic_min(&owner(offset[map.topo] + map.entity), ent);
922 template <
typename FieldElement,
typename Source>
923 void setDofByInterpolation(FieldElement &target, Source
const &source) {
924 constexpr
size_t numNodes = decltype(target.shapeFn)::numNodes;
925 constexpr
size_t meshEntDim = FieldElement::MeshEntDim;
926 constexpr
size_t numComp = FieldElement::NumComponents;
929 const auto owners = getDofHolderOwningEntities(target);
930 Kokkos::parallel_for(
931 "interpolate", target.numMeshEnts, KOKKOS_LAMBDA(
const int ent) {
932 const auto nodeCoords = target.shapeFn.getNodeParametricCoords();
933 for (
auto topo : target.elm2dof.getTopology()) {
934 for (size_t n = 0; n < numNodes; ++n) {
935 const auto holder = target.elm2dof(n, 0, ent, topo);
936 if (owners(holder.topo, holder.entity) != ent)
938 Kokkos::Array<Real, meshEntDim> xi;
939 for (size_t d = 0; d < meshEntDim; ++d)
940 xi[d] = nodeCoords[n * meshEntDim + d];
941 const auto val = source(ent, xi);
942 for (size_t c = 0; c < numComp; ++c) {
943 const auto map = target.elm2dof(n, c, ent, topo);
944 target.field(map.entity, map.node, map.component, map.topo) =
Shape function definitions for finite element analysis.
Kokkos::Array< Real, 1 > Vector1
1D parametric coordinate vector
For each dof holder of a field, the element that owns it; see getDofHolderOwningEntities.
KOKKOS_INLINE_FUNCTION LO operator()(Mesh_Topology topo, LO entity) const
the index of the element that owns the given dof holder
Supports mapping between mesh (i.e., Omega_h) ordering and MeshFields ordering.
Supports the evaluation of a field, and other per-element operations, given the definition of the ele...
KOKKOS_INLINE_FUNCTION LocalGradArray localGradientFromShapeGradients(Coefficients const &c, ShapeGradients const &shapeGrads) const
localGradientFromCoefficients with the shape function gradients already evaluated,...
KOKKOS_INLINE_FUNCTION ValArray valueFromCoefficients(Coefficients const &c, Kokkos::Array< Real, MeshEntDim > localCoord) const
compute dot product between the basis functions and the coefficients I.e., $$\sum_{A=1}^{N} c_A N_A$$
KOKKOS_INLINE_FUNCTION LocalGradArray localGradientFromCoefficients(Coefficients const &c, Kokkos::Array< Real, MeshEntDim > localCoord) const
compute dot product between the basis function gradients and the coefficients I.e....
KOKKOS_INLINE_FUNCTION JacobianArray jacobianFromNodeValues(NodeArray const &x, Kokkos::Array< Real, MeshEntDim > localCoord) const
compute the Jacobian at a parametric coordinate from the node coordinates
Kokkos::View< Real * > getJacobianDeterminants(Matrices const &J) const
Kokkos::Array< typename baseType< typename FieldAccessor::BaseType >::type, ShapeType::numNodes *NumComponents > DofArray
every dof of one element, indexed [node * NumComponents + comp]
Kokkos::View< Real *** > getJacobians(Kokkos::View< Real ** > localCoords, Kokkos::View< LO * > offsets) const
Given an array of parametric coordinates 'localCoords', one per mesh element, compute the jacobian wi...
KOKKOS_INLINE_FUNCTION DofArray coefficients(int ent) const
the coefficients of one element on its reference basis
KOKKOS_INLINE_FUNCTION DofArray gatherDofs(int ent) const
gather element's dofs into an array
static constexpr KOKKOS_FUNCTION auto getTopology()
the topology of the element's reference element
KOKKOS_INLINE_FUNCTION Real getJacobian1d(int ent) const
compute the Jacobian of an edge
KOKKOS_INLINE_FUNCTION ValArray getValue(int ent, Kokkos::Array< Real, MeshEntDim > localCoord) const
evaluate the field in the specified element at the specified parametric/local/area coordinate
Kokkos::Array< typename baseType< typename FieldAccessor::BaseType >::type, MeshEntDim *NumComponents > LocalGradArray
parametric gradients of every component at one point, indexed [direction * NumComponents + comp]
KOKKOS_INLINE_FUNCTION JacobianArray jacobianFromShapeGradients(NodeArray const &x, ShapeGradients const &grads) const
jacobianFromNodeValues with the shape function gradients already evaluated, so they can be shared wit...
Kokkos::Array< Real, MeshEntDim *MeshEntDim > JacobianArray
the Jacobian at one point, row-major with J[i][j] = dx_j/dxi_i