Skip to content

Commit 8254cc7

Browse files
committed
WIP support integration with cabana
1 parent aa7bd0f commit 8254cc7

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

test/testCountIntegrator.cpp

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void setVertices(Omega_h::Mesh &mesh, AnalyticFunction func, ShapeField field) {
3131
// - TODO should be encoded in the field?
3232
const auto x = coords[vtx * MeshDim];
3333
const auto y = coords[vtx * MeshDim + 1];
34-
field(0, 0, vtx, MeshField::Vertex) = func(x, y);
34+
field(vtx, 0, 0, MeshField::Vertex) = func(x, y);
3535
};
3636
MeshField::parallel_for(ExecutionSpace(), {0}, {mesh.nverts()},
3737
setFieldAtVertices, "setFieldAtVertices");
@@ -56,13 +56,10 @@ class CountIntegrator : public MeshField::Integrator {
5656
count = fes.numMeshEnts;
5757
}
5858
};
59-
int main(int argc, char **argv) {
60-
Kokkos::initialize(argc, argv);
61-
auto lib = Omega_h::Library(&argc, &argv);
62-
auto mesh = createMeshTri18(lib);
63-
MeshField::OmegahMeshField<ExecutionSpace, MeshField::KokkosController> omf(
64-
mesh);
6559

60+
template <template <typename...> typename Controller>
61+
void doRun(Omega_h::Mesh &mesh,
62+
MeshField::OmegahMeshField<ExecutionSpace, Controller> &omf) {
6663
const auto ShapeOrder = 1;
6764
auto field = omf.getCoordField();
6865
const auto [shp, map] =
@@ -72,5 +69,23 @@ int main(int argc, char **argv) {
7269
CountIntegrator countInt(fes);
7370
countInt.process(fes);
7471
assert(mesh.nelems() == countInt.getCount());
72+
}
73+
74+
int main(int argc, char **argv) {
75+
Kokkos::initialize(argc, argv);
76+
auto lib = Omega_h::Library(&argc, &argv);
77+
auto mesh = createMeshTri18(lib);
78+
#ifdef MESHFIELDS_ENABLE_CABANA
79+
{
80+
MeshField::OmegahMeshField<ExecutionSpace, MeshField::CabanaController> omf(
81+
mesh);
82+
doRun<MeshField::CabanaController>(mesh, omf);
83+
}
84+
#endif
85+
{
86+
MeshField::OmegahMeshField<ExecutionSpace, MeshField::KokkosController> omf(
87+
mesh);
88+
doRun<MeshField::KokkosController>(mesh, omf);
89+
}
7590
return 0;
7691
}

0 commit comments

Comments
 (0)