Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add interface for per element operations #35

Merged
merged 159 commits into from
Jan 9, 2025
Merged
Changes from 1 commit
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
872abd4
don't repeat yourself
cwsmith Sep 10, 2024
4903d9e
initial element interface
cwsmith Sep 10, 2024
46b49cc
move shape functions to their own header
cwsmith Sep 10, 2024
934a146
todo
cwsmith Sep 10, 2024
c5e76c7
pass field to fieldElement
cwsmith Sep 12, 2024
5e593ee
mem error note
cwsmith Sep 12, 2024
3346ffa
add map functor
cwsmith Sep 13, 2024
23d8d53
memory error fixed
cwsmith Sep 13, 2024
8acf93b
one namespace 'MeshField'
cwsmith Sep 13, 2024
cc5d2dd
remove hardcoded types and sizes
cwsmith Sep 13, 2024
c95193a
pass rank 2 view of coordinates
cwsmith Sep 15, 2024
b8b26e0
set array
cwsmith Sep 15, 2024
90a1295
not using kokkos_stdalgorithms
cwsmith Sep 15, 2024
4c63fcf
whitespace
cwsmith Sep 16, 2024
60d591d
quadratic tri WIP
cwsmith Sep 16, 2024
6817a44
compiles
cwsmith Sep 18, 2024
2865d95
wip: create quadratic tri element
cwsmith Sep 18, 2024
b144dfb
compiles
cwsmith Sep 19, 2024
20a6891
loop over topology to support quadratic elm
cwsmith Sep 19, 2024
0148f99
wip: create field based on distribution
cwsmith Sep 20, 2024
a87fe0e
first pass at field creation helper function
cwsmith Sep 23, 2024
a5b8f1d
use meshinfo struct
cwsmith Sep 23, 2024
c0a5796
todo
cwsmith Sep 23, 2024
a4a80fa
evaluate: support dofs with multiple components
cwsmith Sep 23, 2024
368e104
todo
cwsmith Sep 23, 2024
ad87418
handle quadratic fields... wip
cwsmith Sep 24, 2024
a7879cb
more prototyping
cwsmith Sep 25, 2024
4e4b82c
mixins for multi field access... WIP
cwsmith Sep 25, 2024
d020e7b
use the field creation interface
cwsmith Sep 25, 2024
1bf12ae
more
cwsmith Sep 25, 2024
350e50b
add topology type to element-to-dofholder map
cwsmith Sep 26, 2024
795f668
executes
cwsmith Sep 26, 2024
0552c2d
run clang-format
cwsmith Sep 26, 2024
0682d80
don't need logging yet
cwsmith Sep 26, 2024
611c064
explicit support for dimension
cwsmith Sep 26, 2024
018fdb0
formatting
cwsmith Sep 26, 2024
b016138
silence
cwsmith Sep 26, 2024
f6aca98
noop commit - testing coverage
cwsmith Sep 26, 2024
b4b03c9
noop commit - testing coverage
cwsmith Sep 26, 2024
e118072
add quadratic tet
cwsmith Sep 26, 2024
141e212
support cab controller WIP
cwsmith Sep 27, 2024
18264e0
Revert "support cab controller WIP"
cwsmith Nov 8, 2024
733eec4
specify return type for cuda build
cwsmith Nov 8, 2024
e3fcab2
silence warning
cwsmith Nov 8, 2024
4031d1b
formatting
cwsmith Nov 8, 2024
2257be1
needs to be device accessible
cwsmith Nov 8, 2024
82fccbb
note to self
cwsmith Nov 8, 2024
a0289da
Revert "note to self"
cwsmith Nov 11, 2024
8debc89
pass --expt-relaxed-constexpr to cuda compiler
cwsmith Nov 11, 2024
606f2ea
element test using omegah mesh WIP
cwsmith Nov 12, 2024
33b5758
Merge branch 'main' into cws/elementInterface
cwsmith Nov 12, 2024
eccc07e
compiles and executes
cwsmith Nov 12, 2024
478ff7e
support setting the field
cwsmith Nov 13, 2024
5f7fbdc
check result of evaluate WIP
cwsmith Nov 13, 2024
48d3456
formatting
cwsmith Nov 13, 2024
7145221
evaluation test passing
cwsmith Nov 13, 2024
d49551c
use reduction, return error
cwsmith Nov 13, 2024
19dfd92
formatting
cwsmith Nov 13, 2024
cac3501
reduce error tolerance
cwsmith Nov 13, 2024
c69fdc2
starting cleanup
cwsmith Nov 14, 2024
f4d472b
check parametric coords
cwsmith Nov 15, 2024
b8bc4ac
formatting
cwsmith Nov 15, 2024
bd95dae
todo
cwsmith Nov 15, 2024
4ee8433
define fail helper functions
cwsmith Nov 16, 2024
526741c
format: header order
cwsmith Nov 16, 2024
52b92ea
throw exceptions if enabled
cwsmith Nov 16, 2024
efbc9dd
doc string
cwsmith Nov 18, 2024
7d3aece
call fail [skip ci]
cwsmith Nov 18, 2024
c1662ed
assert -> fail
cwsmith Nov 18, 2024
e166681
WIP generalize omegah test helper [skip ci]
cwsmith Nov 18, 2024
4da0442
eval coord field to get global coords [skip ci]
cwsmith Nov 19, 2024
9061bfa
WIP coord field test [skip ci]
cwsmith Nov 19, 2024
3d1aa98
coordinate field test runs
cwsmith Nov 19, 2024
0bb2510
element test runs
cwsmith Nov 19, 2024
b6fde97
non-centroid interior test
cwsmith Nov 20, 2024
3112310
formatting
cwsmith Nov 20, 2024
82f3a4f
vertex test
cwsmith Nov 20, 2024
c832e68
Fix code scanning alert no. 67: Wrong type of arguments to formatting…
cwsmith Nov 20, 2024
afda367
type specifier
cwsmith Nov 20, 2024
fe2e8a1
don't repeat yourself
cwsmith Nov 20, 2024
184b9dc
WIP add quadratic test, compiles [skip ci]
cwsmith Nov 20, 2024
fe7df1b
whoops
cwsmith Nov 20, 2024
a31aff4
fail: support std::string
cwsmith Nov 20, 2024
34b26b3
test quadratic shape with linear field/function
cwsmith Nov 20, 2024
bc5ebc5
WIP field to tag for vtk viz
cwsmith Nov 21, 2024
a608de4
failing test case for serialization
cwsmith Dec 3, 2024
0da172c
fix serialization bug #39
cwsmith Dec 3, 2024
fd161ab
get field type
cwsmith Dec 3, 2024
a8f8b0d
formatting
cwsmith Dec 3, 2024
33f0e9f
WIP documentation [skip ci]
cwsmith Dec 3, 2024
b93753b
WIP more docs [skip ci]
cwsmith Dec 3, 2024
03a57ee
WIP more docs [skip ci]
cwsmith Dec 4, 2024
38f1b0e
check parametric coords, fix testing bug
cwsmith Dec 4, 2024
2c711dc
WIP more docs [skip ci]
cwsmith Dec 4, 2024
c4a105e
generate doxygen docs
cwsmith Dec 4, 2024
a3fa38c
doxygen: don't recurse dir tree
cwsmith Dec 4, 2024
d0018a2
doxygen: wildcards didn't work
cwsmith Dec 5, 2024
3cb685a
attempt self-hosted comment triggered runner
cwsmith Dec 5, 2024
d1fbebf
actions: a few fixes
cwsmith Dec 5, 2024
6d7e6fe
revert: self-hosted github actions
cwsmith Dec 5, 2024
5db32da
Merge branch 'main' into cws/elementInterface
cwsmith Dec 5, 2024
ace4dd0
Merge branch 'main' into cws/elementInterface
cwsmith Dec 5, 2024
91db845
WIP: notes, start CSR based evaluate [skip ci]
cwsmith Dec 8, 2024
ee60cb1
implement getLastValue
cwsmith Dec 9, 2024
bec0706
formatting
cwsmith Dec 9, 2024
e3db7b8
use CSR evaluate interface
cwsmith Dec 9, 2024
cd7d8c9
multi-point evaluate passes for linear field
cwsmith Dec 9, 2024
2535f17
run multi point case through all tests
cwsmith Dec 9, 2024
0cb191c
WIP starting nomenclature [skip ci]
cwsmith Dec 10, 2024
91e3c33
WIP: documentation [skip ci]
cwsmith Dec 10, 2024
8715ae4
WIP docs [skip ci]
cwsmith Dec 10, 2024
7fd0461
Field docs [skip ci]
cwsmith Dec 10, 2024
fa6b781
MeshField docs [skip ci]
cwsmith Dec 11, 2024
d8dd122
WIP move setField to Field class [skip ci]
cwsmith Dec 11, 2024
8c55a0a
move setField into Field class
cwsmith Dec 11, 2024
c9653b5
more Field documentation
cwsmith Dec 11, 2024
ef4837f
doc tweaks
cwsmith Dec 11, 2024
a95971e
WIP removing Element class [skip ci]
cwsmith Dec 11, 2024
54de8a0
remove Element class
cwsmith Dec 12, 2024
d798862
WIP remove MeshField, parallel fns free [skip ci]
cwsmith Dec 12, 2024
15aa710
all tests pass
cwsmith Dec 13, 2024
d57861c
WIP start on mesh wrapper [skip ci]
cwsmith Dec 13, 2024
d57524d
WIP mesh wrapper, better file names [skip ci]
cwsmith Dec 13, 2024
6f8e0c1
wrong dir [skip ci]
cwsmith Dec 13, 2024
43eed38
don't need a separate namespace [skip ci]
cwsmith Dec 16, 2024
560013e
wrong header
cwsmith Dec 16, 2024
694bb8d
WIP meshfield wrapper [skip ci]
cwsmith Dec 16, 2024
b632332
WIP almost compiles [skip ci]
cwsmith Dec 17, 2024
027e543
compiles, element tests fail [skip ci]
cwsmith Dec 17, 2024
06887c0
cleaner declaration of coordField [skip ci]
cwsmith Dec 17, 2024
2de9f74
serial+cab compiles
cwsmith Dec 18, 2024
60b6985
resolve more compile errors [skip ci]
cwsmith Dec 18, 2024
3d02409
nvcc doesn't support ext. lambda and auto return type
cwsmith Dec 18, 2024
27eff75
off by one in topo enum, testElement passes
cwsmith Dec 18, 2024
e762fd1
formatting
cwsmith Dec 18, 2024
438cbc6
pass mesh by ref, fixes OmegahElementTest
cwsmith Dec 18, 2024
67752a2
try to get coverage test failure info
cwsmith Dec 18, 2024
26b6a14
failing test: attempt to get stack
cwsmith Dec 19, 2024
54477fa
try again
cwsmith Dec 19, 2024
3031e0b
install gdb
cwsmith Dec 19, 2024
9c2311f
where is the core file
cwsmith Dec 19, 2024
e70b3eb
try again
cwsmith Dec 19, 2024
173d8d1
run valgrind
cwsmith Dec 19, 2024
0404049
more debug attempts
cwsmith Dec 19, 2024
1ff3fd5
one test case
cwsmith Dec 19, 2024
c8d28a9
fixes gcc 11.4.0 error #41
cwsmith Dec 19, 2024
8424f00
formatting
cwsmith Dec 19, 2024
241f317
revert debug edits
cwsmith Dec 19, 2024
fa4527f
check result
cwsmith Dec 19, 2024
da162d4
clean up test
cwsmith Dec 20, 2024
dbe3390
WIP quadratic test fails check [skip ci]
cwsmith Dec 20, 2024
40012fc
remove hardcoded shape order [skip ci]
cwsmith Jan 3, 2025
48ce42b
quadratic allverts test passes
cwsmith Jan 8, 2025
54c3199
remove debug prints
cwsmith Jan 8, 2025
722ed88
remove unused var and debug print
cwsmith Jan 8, 2025
315938d
formatting
cwsmith Jan 8, 2025
a87c33c
quadratic field, linear function - all tests pass
cwsmith Jan 9, 2025
d9855e9
remove commented code
cwsmith Jan 9, 2025
ab09a10
coverage: yes to all + quiet apt install
cwsmith Jan 9, 2025
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
Prev Previous commit
Next Next commit
more
cwsmith committed Sep 25, 2024
commit 1bf12ae4b3e895c68101e0cc895fd7ec1a141070
4 changes: 3 additions & 1 deletion src/MeshField_Defines.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef MESHFIELD_DEFINES_H
#define MESHFIELD_DEFINES_H
namespace MeshField {
using Real = double;
using Real8 = double;
using Real4 = double;
using Real = Real8; //a sane default
using LO = int;
enum Mesh_Topology {
Vertex,
2 changes: 1 addition & 1 deletion src/MeshField_Element.hpp
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ template <typename FieldAccessor, template<typename, typename> class ElementType
struct FieldElement {
//TODO add static asserts for functions provided by the templated types
const size_t numMeshEnts;
const FieldAccessor field; //FIXME - need to support multiple fields associated with different mesh entity order/type
const FieldAccessor field;
ElementType<ShapeType, ElementToDofHolderMap> elm;
static const size_t MeshEntDim = ShapeType::meshEntDim;
FieldElement(size_t in_numMeshEnts, const FieldAccessor& fieldIn, const ElementType<ShapeType, ElementToDofHolderMap> elmIn) :
19 changes: 13 additions & 6 deletions src/MeshField_ShapeField.hpp
Original file line number Diff line number Diff line change
@@ -40,12 +40,14 @@ struct QuadraticAccessor {
constexpr static const Mesh_Topology topo[2] = {Vertex, Edge};
VtxAccessor vtxField;
EdgeAccessor edgeField;
auto operator()(int node, int component, int entity, Mesh_Topology t) {
using BaseType = typename VtxAccessor::BaseType;
auto operator()(int node, int component, int entity, Mesh_Topology t) const {
if(t == Vertex) {
return vtxField(node,component,entity);
} else if(t == Edge) {
return edgeField(node,component,entity);
} else {
Kokkos::printf("%d is not a support topology\n", t);
assert(false);
}
}
@@ -55,25 +57,30 @@ template<typename VtxAccessor>
struct LinearAccessor {
constexpr static const Mesh_Topology topo[1] = {Vertex};
VtxAccessor vtxField;
auto operator()(int node, int component, int entity, Mesh_Topology t) {
using BaseType = typename VtxAccessor::BaseType;
auto operator()(int node, int component, int entity, Mesh_Topology t) const {
if(t == Vertex) {
return vtxField(node,component,entity);
} else {
assert(false);
Kokkos::printf("%d is not a support topology\n", t);
assert(false); //HERE - topology in LinearEdgeToVertexField in test/testElement.cc does not match
}
}
};


template <typename ExecutionSpace, size_t order>
template <typename ExecutionSpace, typename DataType, size_t order>
auto CreateLagrangeField(MeshInfo& meshInfo) { //FIXME assumes 2d, search for 'Triangle'
static_assert( (std::is_same_v<Real4, DataType> == true ||
std::is_same_v<Real8, DataType> == true ),
"CreateLagrangeField only supports single and double precision floating point fields\n");
static_assert((order == 1 || order == 2),
"CreateLagrangeField only supports linear and quadratic fields\n");
using MemorySpace = typename ExecutionSpace::memory_space;
if constexpr (order == 1) {
assert(meshInfo.numVtx > 0);
using Ctrlr =
Controller::KokkosController<MemorySpace, ExecutionSpace, double ***>;
Controller::KokkosController<MemorySpace, ExecutionSpace, DataType ***>;
Ctrlr kk_ctrl({/*field 0*/ 1, 1, meshInfo.numVtx}); //1 dof with 1 component per vtx
MeshField<Ctrlr> kokkosMeshField(kk_ctrl);
auto vtxField = kokkosMeshField.template makeField<0>();
@@ -85,7 +92,7 @@ auto CreateLagrangeField(MeshInfo& meshInfo) { //FIXME assumes 2d, search for 'T
assert(meshInfo.numVtx > 0);
assert(meshInfo.numEdge > 0);
using Ctrlr =
Controller::KokkosController<MemorySpace, ExecutionSpace, double ***, double ***>;
Controller::KokkosController<MemorySpace, ExecutionSpace, DataType ***, DataType ***>;
Ctrlr kk_ctrl({/*field 0*/ 1, 1, meshInfo.numVtx, //1 dof with 1 component per vtx
/*field 1*/ 1, 1, meshInfo.numEdge}); //1 dof with 1 component per edge
MeshField<Ctrlr> kokkosMeshField(kk_ctrl);
20 changes: 10 additions & 10 deletions test/testElement.cpp
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ void triangleLocalPointEval() {
MeshField::MeshInfo meshInfo;
meshInfo.numVtx = 5;
meshInfo.numTri = 3;
auto field = MeshField::CreateLagrangeField<ExecutionSpace, 1>(meshInfo);
auto field = MeshField::CreateLagrangeField<ExecutionSpace, MeshField::Real, 1>(meshInfo);

// MeshField::Element elm{ MeshField::LinearTriangleShape(), LinearTriangleToVertexField() };
//
@@ -77,15 +77,15 @@ void edgeLocalPointEval() {
MeshField::MeshInfo meshInfo;
meshInfo.numVtx = 5;
meshInfo.numEdge = 7;
auto field = MeshField::CreateLagrangeField<ExecutionSpace, 1>(meshInfo);
auto field = MeshField::CreateLagrangeField<ExecutionSpace, MeshField::Real, 1>(meshInfo);

// MeshField::Element elm{MeshField::LinearEdgeShape(), LinearEdgeToVertexField()};
//
// MeshField::FieldElement f(numEdges, field0, elm);
//
// Kokkos::View<MeshField::Real[7][2]> lc("localCoords");
// Kokkos::deep_copy(lc, 0.5);
// auto x = MeshField::evaluate(f, lc);
MeshField::Element elm{MeshField::LinearEdgeShape(), LinearEdgeToVertexField()};

MeshField::FieldElement f(meshInfo.numEdge, field, elm);

Kokkos::View<MeshField::Real[7][2]> lc("localCoords");
Kokkos::deep_copy(lc, 0.5);
auto x = MeshField::evaluate(f, lc);
}

struct QuadraticTriangleToField {
@@ -113,7 +113,7 @@ void quadraticTriangleLocalPointEval() {
meshInfo.numVtx = 5;
meshInfo.numEdge = 7;
meshInfo.numTri = 3;
auto field = MeshField::CreateLagrangeField<ExecutionSpace, 2>(meshInfo);
auto field = MeshField::CreateLagrangeField<ExecutionSpace, MeshField::Real, 2>(meshInfo);

// MeshField::Element elm{ MeshField::QuadraticTriangleShape(), LinearTriangleToVertexField() };