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
5 changes: 3 additions & 2 deletions src/MeshField_Element.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ struct FieldElement {
return c;
}

using NodeArray = Kokkos::Array<typename FieldAccessor::BaseType,
ShapeType::meshEntDim * ShapeType::numNodes>;
using NodeArray =
Kokkos::Array<typename baseType<typename FieldAccessor::BaseType>::type,
ShapeType::meshEntDim * ShapeType::numNodes>;
KOKKOS_INLINE_FUNCTION NodeArray getNodeValues(int ent) const {
NodeArray c;
for (auto topo : elm2dof.getTopology()) { // element topology
Expand Down
29 changes: 22 additions & 7 deletions test/testCountIntegrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void setVertices(Omega_h::Mesh &mesh, AnalyticFunction func, ShapeField field) {
// - TODO should be encoded in the field?
const auto x = coords[vtx * MeshDim];
const auto y = coords[vtx * MeshDim + 1];
field(0, 0, vtx, MeshField::Vertex) = func(x, y);
field(vtx, 0, 0, MeshField::Vertex) = func(x, y);
};
MeshField::parallel_for(ExecutionSpace(), {0}, {mesh.nverts()},
setFieldAtVertices, "setFieldAtVertices");
Expand All @@ -56,13 +56,10 @@ class CountIntegrator : public MeshField::Integrator {
count = fes.numMeshEnts;
}
};
int main(int argc, char **argv) {
Kokkos::initialize(argc, argv);
auto lib = Omega_h::Library(&argc, &argv);
auto mesh = createMeshTri18(lib);
MeshField::OmegahMeshField<ExecutionSpace, 2, MeshField::KokkosController>
omf(mesh);

template <template <typename...> typename Controller>
void doRun(Omega_h::Mesh &mesh,
MeshField::OmegahMeshField<ExecutionSpace, 2, Controller> &omf) {
const auto ShapeOrder = 1;
auto field = omf.getCoordField();
const auto [shp, map] =
Expand All @@ -72,5 +69,23 @@ int main(int argc, char **argv) {
CountIntegrator countInt(fes);
countInt.process(fes);
assert(mesh.nelems() == countInt.getCount());
}

int main(int argc, char **argv) {
Kokkos::initialize(argc, argv);
auto lib = Omega_h::Library(&argc, &argv);
auto mesh = createMeshTri18(lib);
#ifdef MESHFIELDS_ENABLE_CABANA
{
MeshField::OmegahMeshField<ExecutionSpace, 2, MeshField::CabanaController>
omf(mesh);
doRun<MeshField::CabanaController>(mesh, omf);
}
#endif
{
MeshField::OmegahMeshField<ExecutionSpace, 2, MeshField::KokkosController>
omf(mesh);
doRun<MeshField::KokkosController>(mesh, omf);
}
return 0;
}
Loading