test(tests): added test suite
The test suite is extensive. Note that LLMs were used to aid in the development of the test suite. All LLM generated code was manually reviewed.
This commit is contained in:
@@ -1,14 +1,36 @@
|
||||
#include <cmath>
|
||||
#include <print>
|
||||
|
||||
#include "serif/mapping/context.hpp"
|
||||
#include "serif/mapping/variation.hpp"
|
||||
#include "serif/mapping/compactification/compactification.hpp"
|
||||
#include "serif/mapping/status.hpp"
|
||||
#include "serif/mapping/compactification/kelvin.hpp"
|
||||
#include "serif/mapping/domain_mapper.hpp"
|
||||
#include "serif/mapping/transformations.hpp"
|
||||
#include "serif/mapping/mapping.hpp"
|
||||
#include "serif/types.hpp"
|
||||
|
||||
#include "serif/utils/user_options/mapping/compactification/kelvin.hpp"
|
||||
/** @brief Map an exterior reference point toward physical infinity using the selected native vector storage. */
|
||||
int main() {
|
||||
std::println("Hello, World!");
|
||||
}
|
||||
namespace mapping = serif::mapping;
|
||||
namespace compactification = mapping::compactification;
|
||||
|
||||
const compactification::KelvinCompactification exterior({.r_star_ref = 1.0, .r_inf_ref = 4.0});
|
||||
serif::Vector position(3), coordinate_gradient(3);
|
||||
position = 0.0;
|
||||
position[0] = 2.0;
|
||||
coordinate_gradient = 0.0;
|
||||
coordinate_gradient[0] = 1.0 / 3.0;
|
||||
serif::DenseMatrix displacement_jacobian(3);
|
||||
displacement_jacobian = 0.0;
|
||||
for (int dimension = 0; dimension < 3; ++dimension) {
|
||||
displacement_jacobian(dimension, dimension) = 1.0;
|
||||
}
|
||||
const compactification::ExteriorMapInput input{
|
||||
.reference_position = position, .displaced_position = position,
|
||||
.displacement_jacobian = displacement_jacobian,
|
||||
.compactification_coordinate_gradient = coordinate_gradient,
|
||||
.compactification_coordinate = 1.0 / 3.0};
|
||||
compactification::ExteriorMapResult result;
|
||||
const auto status = exterior.evaluate(input, result);
|
||||
if (status != mapping::MappingStatus::VALID) {
|
||||
std::println(stderr, "Exterior mapping failed.");
|
||||
return 1;
|
||||
}
|
||||
std::println("Reference radius {} maps to physical radius {}", position[0], result.physical_position[0]);
|
||||
return std::isfinite(result.physical_position[0]) ? 0 : 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user