Skip to content

Commit cb7fc5e

Browse files
authored
Merge pull request #56 from SCOREC/cws/cabIntegrate
Cws/cab integrate
2 parents 9d52a80 + 794f0b4 commit cb7fc5e

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

src/MeshField_Element.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,9 @@ struct FieldElement {
188188
return c;
189189
}
190190

191-
using NodeArray = Kokkos::Array<typename FieldAccessor::BaseType,
192-
ShapeType::meshEntDim * ShapeType::numNodes>;
191+
using NodeArray =
192+
Kokkos::Array<typename baseType<typename FieldAccessor::BaseType>::type,
193+
ShapeType::meshEntDim * ShapeType::numNodes>;
193194
KOKKOS_INLINE_FUNCTION NodeArray getNodeValues(int ent) const {
194195
NodeArray c;
195196
for (auto topo : elm2dof.getTopology()) { // element topology

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, 2, MeshField::KokkosController>
64-
omf(mesh);
6559

60+
template <template <typename...> typename Controller>
61+
void doRun(Omega_h::Mesh &mesh,
62+
MeshField::OmegahMeshField<ExecutionSpace, 2, 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, 2, MeshField::CabanaController>
81+
omf(mesh);
82+
doRun<MeshField::CabanaController>(mesh, omf);
83+
}
84+
#endif
85+
{
86+
MeshField::OmegahMeshField<ExecutionSpace, 2, MeshField::KokkosController>
87+
omf(mesh);
88+
doRun<MeshField::KokkosController>(mesh, omf);
89+
}
7590
return 0;
7691
}

0 commit comments

Comments
 (0)