-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add benchmarks for the new multipole constructor
- Loading branch information
1 parent
4cbbfa7
commit e4db894
Showing
3 changed files
with
68 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#include <catch2/catch_test_macros.hpp> | ||
#include <catch2/benchmark/catch_benchmark_all.hpp> | ||
|
||
#include <symtensor/Multipole.h> | ||
|
||
using namespace symtensor; | ||
|
||
TEST_CASE("benchmark: Multipole construction from a vector", "[Multipole]") { | ||
|
||
SymmetricTensor3f<1> vector{1, 2, 3}; | ||
|
||
// Quadrupole | ||
{ | ||
|
||
BENCHMARK("Quadrupole constructor") { return Quadrupole3f{vector}; }; | ||
BENCHMARK("Quadrupole manual construction") { | ||
return std::tuple< | ||
SymmetricTensor3f<1>, | ||
SymmetricTensor3f<2> | ||
>{ | ||
vector, | ||
SymmetricTensor3f<2>::CartesianPower(vector) | ||
}; | ||
}; | ||
} | ||
|
||
// Octupole | ||
{ | ||
|
||
BENCHMARK("Octupole constructor") { return Octupole3f{vector}; }; | ||
BENCHMARK("Octupole manual construction") { | ||
return std::tuple< | ||
SymmetricTensor3f<1>, | ||
SymmetricTensor3f<2>, | ||
SymmetricTensor3f<3> | ||
>{ | ||
vector, | ||
SymmetricTensor3f<2>::CartesianPower(vector), | ||
SymmetricTensor3f<3>::CartesianPower(vector) | ||
}; | ||
}; | ||
} | ||
|
||
// Hexadecupole | ||
{ | ||
|
||
BENCHMARK("Hexadecupole constructor") { return Hexadecupole3f{vector}; }; | ||
BENCHMARK("Hexadecupole manual construction") { | ||
return std::tuple< | ||
SymmetricTensor3f<1>, | ||
SymmetricTensor3f<2>, | ||
SymmetricTensor3f<3>, | ||
SymmetricTensor3f<4> | ||
>{ | ||
vector, | ||
SymmetricTensor3f<2>::CartesianPower(vector), | ||
SymmetricTensor3f<3>::CartesianPower(vector), | ||
SymmetricTensor3f<4>::CartesianPower(vector) | ||
}; | ||
}; | ||
} | ||
|
||
} |
This file contains 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