From 1f8d203cb7b8a084b7c7e462828714552a17971b Mon Sep 17 00:00:00 2001 From: Kenneth Assogba Date: Sun, 24 Nov 2024 23:04:23 +0100 Subject: [PATCH] Test Material Class in python --- README.md | 6 +++--- tests/regress/test00.py | 18 +++++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5b9fa90..9f9edfc 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,11 @@ The physics is coded in C++, with Python as user interface for easy and fast usa - [x] Setup Cmake. - [x] Add and test Eigen. -- [x] Setup directory structure vector-of-bool/pitchfork. +- [x] Setup directory structure. - [x] Code and test Material class. - [x] Collect source and compile. - [x] Setup nanobind and write Python bindings for Material. -- [ ] Write a python test for Material class. +- [x] Write a python test for Material class. - [ ] Code and test Geometry class. - [ ] Cell - [ ] PinCell @@ -38,7 +38,7 @@ The physics is coded in C++, with Python as user interface for easy and fast usa - [x] Setup clang-tidy. - [x] Fix how to launch clang-tidy locally and on action. - [ ] Add a Logger (spdlog, or nanolog or fmtlog) and std::format. -- [ ] Use docstest unit tests. +- [ ] Use doctest for unit tests in c++ and python. - [ ] Maybe switch to include/demeter, src, src/binding, test, extra directory structure - [ ] Add -Werror flag - [ ] Setup gcc analizer. diff --git a/tests/regress/test00.py b/tests/regress/test00.py index e6be238..92acf27 100644 --- a/tests/regress/test00.py +++ b/tests/regress/test00.py @@ -2,18 +2,26 @@ import numpy as np import matplotlib.pyplot as plt +# "sigma_t"_a, "sigma_s"_a, "sigma_a"_a, "sigma_f"_a, "nu_sigma_f"_a, + # "chi"_a, "name"_a # Create materials -sigma_t = np.array([0.1, 0.2, 0.3]) -sigma_f = np.array([0.01, 0.02, 0.03]), -sigma_a = np.array([0.001, 0.002, 0.003]) -uO2 = Material(sigma_t, sigma_f, sigma_a, name= 'uO2') +sigma_t = np.array([0.222222, 0.833333]) +sigma_s = np.array([[0.00, 0.02], + [0.00, 0.00]]) +sigma_a = np.array([0.010120, 0.080032]) +sigma_f = np.array([0., 0.135]) +nu_sigma_f = np.array([0., 0.135]) +chi = np.array([1., 0.]) + +uO2 = Material(sigma_t, sigma_s, sigma_a, sigma_f, nu_sigma_f, chi, name= 'uO2') +""" sigma_t = np.array([0.1, 0.2, 0.3]) sigma_f = np.array([0.01, 0.02, 0.03]), sigma_a = np.array([0.001, 0.002, 0.003]) h20 = Material(sigma_t, sigma_f, sigma_a, name= 'H20') -""" + # Create pin cells uO2_cell = PinCell(0.5, uO2) h2O_cell = PinCell(0.5, h20)