feat(mean_field): added dimensions, discritization, and start of eos
The full rewrite of mean_field into something maintainable is progressing. dimensions is mostly done, discritization (domain, blocks, and fields) is done, and eos is progressing quickly
This commit is contained in:
24
tests/sandbox/discritization_sandbox.cpp
Normal file
24
tests/sandbox/discritization_sandbox.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <print>
|
||||
|
||||
#include "serif/discretization/domain/schema/schemas.hpp"
|
||||
#include "mfem.hpp"
|
||||
#include "serif/discretization/domain/schema/validation/all.hpp"
|
||||
#include "serif/discretization/domain/schema/validation/results.hpp"
|
||||
#include "stroid/stroid.h"
|
||||
#include "serif/discretization/blocks/base.hpp"
|
||||
|
||||
int main() {
|
||||
using serif::discretization::domain::schema::validation::SchemaValidationResult;
|
||||
using serif::discretization::domain::schema::validation::validate_schema;
|
||||
using serif::discretization::domain::schema::CoreEnvelopeVacuumDomainSchema;
|
||||
|
||||
const auto smesh_result = stroid::IO::LoadStroidMesh("sandbox.smesh");
|
||||
if (not smesh_result.has_value()) {
|
||||
throw std::runtime_error("Failed to load sandbox.smesh");
|
||||
}
|
||||
|
||||
const stroid::StroidMesh& smesh = smesh_result.value();
|
||||
|
||||
SchemaValidationResult result = validate_schema<CoreEnvelopeVacuumDomainSchema>(*smesh.mesh);
|
||||
std::println("{}", result);
|
||||
}
|
||||
11
tests/sandbox/eos_sandbox.cpp
Normal file
11
tests/sandbox/eos_sandbox.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <print>
|
||||
|
||||
#include "serif/eos/models/polytropic.hpp"
|
||||
#include "serif/eos/evaluation.hpp"
|
||||
#include "serif/dimensions/type_alias.hpp"
|
||||
int main() {
|
||||
const serif::eos::models::Polytrope polytrope(1, 0.6);
|
||||
std::println("Density: {}", serif::eos::evaluate<serif::dimensions::Density>(polytrope, serif::dimensions::SpecificEnthalpyValue{1.0}).value());
|
||||
|
||||
|
||||
}
|
||||
26
tests/sandbox/finite_sandbox.cpp
Normal file
26
tests/sandbox/finite_sandbox.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "serif/utils/misc/finite.hpp"
|
||||
#include <limits>
|
||||
|
||||
enum class [[maybe_unused]] TestErrorCode {
|
||||
NotFinite
|
||||
};
|
||||
|
||||
namespace {
|
||||
class test_exception : public std::runtime_error {
|
||||
public:
|
||||
test_exception(TestErrorCode error_code, const std::string& message)
|
||||
: std::runtime_error(message), m_error_code(error_code) {}
|
||||
|
||||
TestErrorCode error_code() const noexcept {
|
||||
return m_error_code;
|
||||
}
|
||||
private:
|
||||
TestErrorCode m_error_code;
|
||||
};
|
||||
}
|
||||
|
||||
int main() {
|
||||
double a = std::numeric_limits<double>::infinity();
|
||||
|
||||
serif::utils::misc::validate_finite<test_exception>(a, TestErrorCode::NotFinite);
|
||||
}
|
||||
14
tests/sandbox/meson.build
Normal file
14
tests/sandbox/meson.build
Normal file
@@ -0,0 +1,14 @@
|
||||
sandboxes = [
|
||||
'discritization_sandbox',
|
||||
'eos_sandbox',
|
||||
'finite_sandbox',
|
||||
]
|
||||
|
||||
foreach sandbox: sandboxes
|
||||
executable(
|
||||
sandbox,
|
||||
sandbox + '.cpp',
|
||||
dependencies: [serif_dep, stroid_dep],
|
||||
build_rpath: mfem_runtime_prefix == '' ? '' : mfem_runtime_prefix / 'lib',
|
||||
)
|
||||
endforeach
|
||||
Reference in New Issue
Block a user