Repository navigation
Templated tests - #110
Open
jacobmerson wants to merge 19 commits into
Open
Templated tests#110jacobmerson wants to merge 19 commits into
jacobmerson wants to merge 19 commits into
Conversation
This performs interpolation to target elements. We use ownership to avoid having multiple element write to the same dofs on shared entities. This interpolation capability will be used to support generic coordinate field initialization for higher order elements.
cannot have lambdas in function with auto return type with cuda
To support non-isoparametic elements, we split the evaluation of the nodal coefficients and the multiplication with the shape functions
MappedElement composes a field element with a geometry element over the coordinate field (see SCOREC#100)
In the case of affine (straight sided) and isoparametric elements we will want to take compile-time optimized code paths so the performance of a MappedElement is similar to a base FieldElement
The TestHarness runs tests with all available controllers and mesh types. This will improve generalizability as we add additional mesh types e.g., mixed and new element types e.g., quads
This combines the jacobian tests into a single test case
Contributor
Author
|
When this gets reviewed, please consider adding Catch2 as a dependency and using a proper test framework rather than this one that Claude and I came up with. Here is the example of what some of those tests look like with Catch2 instead. But Catch2 also has matchers for comparing floating point values, better reporting of expected values, integration with cmake, etc. // testController.cpp
#ifdef MESHFIELDS_ENABLE_CABANA
#define CONTROLLERS (KokkosRanks, CabanaRanks)
#else
#define CONTROLLERS (KokkosRanks)
#endif
TEMPLATE_PRODUCT_TEST_CASE("fields of each rank", "[controller]",
CONTROLLERS, (int, double)) {
auto c = createRanks<TestType>(); // name: "... - KokkosRanks<int>"
SECTION("rank 1") { testRank<1>(c, rank1); }
SECTION("rank 2") { testRank<2>(c, rank2); }
// ...
}
template <int R, typename Ctrlr> void testRank(Ctrlr &c, Extents n) {
auto field = MeshField::makeField<Ctrlr, R - 1>(c);
CHECK(extentMismatches<R>(field, n) == 0);
fill<R>(field, n);
CHECK(mismatches<R>(field, n) == 0); // failure prints "3 == 0"
}
For the case with several axes (reproduction):
template <template <typename...> class C, size_t D, class E> struct Cfg {
template <typename... Ts> using Controller = C<Ts...>;
static constexpr size_t dim = D; using Element = E;
};
using Configs = CartesianProduct<Controllers, Dims, Elements>; // std::tuple<Cfg<...>...>
TEMPLATE_LIST_TEST_CASE("reproduction", "[reproduction]", Configs) {
using C = TestType;
auto &mesh = cachedMesh<C::dim>();
SECTION("identity") { testOrders<C>(mesh, MeshField::IdentityCoordinateMap{}); }
SECTION("shear") { testOrders<C>(mesh, Shear<C::dim>{}); }
} |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is based on #109 and will look much more sensible after that is merged. Please use merge instead of rebase for that PR as otherwise it'll make merging this PR more challenging.
The goal of this PR is to reduce the repeated test code and make the tests more consistent in terms of what's tested across the different backends/element types.
Once #109 is merged, this PR should net roughly -1800 lines of code despite expanding the coverage and making it easier to add tests for new controllers, element types, etc.