Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions src/MeshField.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,15 @@ class OmegahMeshField {

template <typename DataType, size_t order, size_t numComp>
// Ordering of field indexing changed to 'entity, node, component'
auto CreateLagrangeField() {
auto CreateLagrangeField() const {
return MeshField::CreateLagrangeField<ExecutionSpace, Controller, DataType,
order, dim, numComp>(meshInfo);
}

auto getCoordField() { return coordField; }

// FIXME support 2d and 3d and fields with order>1
template <typename Field> void writeVtk(Field &field) {
template <typename Field> void writeVtk(Field &field) const {
using FieldDataType = typename decltype(field.vtxField)::BaseType;
// HACK assumes there is a vertex field.. in the Field Mixin object
auto field_view = field.vtxField.serialize();
Expand All @@ -318,7 +318,7 @@ class OmegahMeshField {
}

template <typename ViewType = Kokkos::View<MeshField::LO *>>
ViewType createOffsets(size_t numTri, size_t numPtsPerElem) {
ViewType createOffsets(size_t numTri, size_t numPtsPerElem) const {
ViewType offsets("offsets", numTri + 1);
Kokkos::parallel_for(
"setOffsets", numTri,
Expand All @@ -330,8 +330,8 @@ class OmegahMeshField {

// evaluate a field at the specified local coordinate for each triangle
template <typename ViewType, typename ShapeField>
auto triangleLocalPointEval(ViewType localCoords, size_t NumPtsPerElem,
ShapeField field) {
auto triangleLocalPointEval(const ViewType &localCoords, size_t NumPtsPerElem,
const ShapeField &field) const {
auto offsets = createOffsets(meshInfo.numTri, NumPtsPerElem);
auto eval = triangleLocalPointEval<ViewType, ShapeField>(localCoords,
offsets, field);
Expand All @@ -340,8 +340,9 @@ class OmegahMeshField {

// evaluate a field at the specified local coordinates for each triangle
template <typename ViewType, typename ShapeField>
auto triangleLocalPointEval(ViewType localCoords, Kokkos::View<LO *> offsets,
ShapeField field) {
auto triangleLocalPointEval(const ViewType &localCoords,
Kokkos::View<LO *> offsets,
const ShapeField &field) const {
const auto MeshDim = 2;
if (mesh.dim() != MeshDim) {
MeshField::fail("input mesh must be 2d\n");
Expand All @@ -360,16 +361,18 @@ class OmegahMeshField {
}

template <typename ViewType, typename ShapeField>
auto tetrahedronLocalPointEval(ViewType localCoords, size_t NumPtsPerElem,
ShapeField field) {
auto tetrahedronLocalPointEval(const ViewType &localCoords,
size_t NumPtsPerElem,
const ShapeField &field) const {
auto offsets = createOffsets(meshInfo.numTet, NumPtsPerElem);
auto eval = tetrahedronLocalPointEval(localCoords, offsets, field);
return eval;
}

template <typename ViewType, typename ShapeField>
auto tetrahedronLocalPointEval(ViewType localCoords,
Kokkos::View<LO *> offsets, ShapeField field) {
auto tetrahedronLocalPointEval(const ViewType &localCoords,
Kokkos::View<LO *> offsets,
const ShapeField &field) const {
const auto MeshDim = 3;
if (mesh.dim() != MeshDim) {
MeshField::fail("input mesh must be 3d\n");
Expand Down
4 changes: 2 additions & 2 deletions src/MeshField_Element.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ struct FieldElement {
* heavily based on SCOREC/core @ 7cd76473 apf/apfVectorElement.cc
*/
template <typename Matrices>
Kokkos::View<Real *> getJacobianDeterminants(Matrices const &J) {
Kokkos::View<Real *> getJacobianDeterminants(Matrices const &J) const {
static_assert(has_static_rank<Matrices>::value,
"Matrices must have a static rank() method.");
static_assert(has_extent_method<Matrices>::value,
Expand Down Expand Up @@ -321,7 +321,7 @@ struct FieldElement {
* @return Kokkos::View containing the jacobian for all the mesh elements
*/
Kokkos::View<Real ***> getJacobians(Kokkos::View<Real **> localCoords,
Kokkos::View<LO *> offsets) {
Kokkos::View<LO *> offsets) const {
if (Debug) {
// check input parametric coords are positive and sum to one
LO numErrors = 0;
Expand Down
Loading