Skip to content

Commit 72d7fb8

Browse files
initial pass, not working
1 parent b7420d8 commit 72d7fb8

11 files changed

+2268
-4
lines changed

Code/Source/solver/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,9 @@ if(ENABLE_UNIT_TEST)
313313
enable_testing()
314314
include(GoogleTest)
315315

316-
# add test.cpp for unit test
317-
318-
# remove the main.cpp and add test.cpp
319-
set(TEST_SOURCES "../../../tests/unitTests/test.cpp")
316+
# add modular unit test files using GLOB
317+
# remove the main.cpp and add modular test files
318+
file(GLOB TEST_SOURCES "../../../tests/unitTests/*.cpp")
320319
list(REMOVE_ITEM CSRCS "main.cpp")
321320
list(APPEND CSRCS ${TEST_SOURCES})
322321

tests/unitTests/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Material Model Unit Tests
2+
3+
This directory contains unit tests for material models in the svMultiPhysics codebase. The tests have been modularized to improve maintainability and ease of adding new tests.
4+
5+
## File Structure
6+
7+
### Common Files
8+
- `material_test_common.h` - Common utilities, helper functions, base classes, and material parameter structs shared across all material model tests
9+
10+
### Material Model Test Files
11+
- `material_test_neo_hookean.h/.cpp` - Tests for Neo-Hookean material model
12+
- `material_test_mooney_rivlin.h/.cpp` - Tests for Mooney-Rivlin material model
13+
- `material_test_holzapfel_ogden.h/.cpp` - Tests for Holzapfel-Ogden material model (including Modified Anisotropy variant)
14+
- `material_test_main.cpp` - Main test runner that includes all material model test implementation files
15+
16+
## Naming Convention
17+
18+
All material model test files use the `material_test_` prefix to clearly identify them as material model tests. This allows for future addition of other unit test files (e.g., solver tests, boundary condition tests) with different prefixes.
19+
20+
## Adding New Material Model Tests
21+
22+
To add tests for a new material model:
23+
24+
1. **Create the header file** (`material_test_[model_name].h`):
25+
- Include `material_test_common.h`
26+
- Define test fixture classes for the material model
27+
- Include both STRUCT and USTRUCT variants if applicable
28+
29+
2. **Create the implementation file** (`material_test_[model_name].cpp`):
30+
- Include the corresponding header file
31+
- Implement all test cases for the material model
32+
- Include tests for both STRUCT and USTRUCT variants if applicable
33+
34+
3. **Update the main test file** (`material_test_main.cpp`):
35+
- Add include for the new header file
36+
- Add include for the new implementation file
37+
38+
4. **Update this README** to document the new material model tests
39+
40+
## Test Structure
41+
42+
Each material model test file follows this structure:
43+
44+
### Header File
45+
- Test fixture classes that inherit from `MaterialModelTest`
46+
- Material-specific parameter setup
47+
- STRUCT and USTRUCT variants
48+
49+
### Implementation File
50+
- Identity deformation gradient tests (F = I)
51+
- Triaxial stretch/compression tests
52+
- Biaxial stretch/compression tests
53+
- Random deformation gradient tests (small, medium, large perturbations)
54+
- Material elasticity consistency tests
55+
- Both STRUCT and USTRUCT variants for each test type
56+
57+
## Running Tests
58+
59+
The tests are automatically included in the build system through the existing CMakeLists.txt file, which uses globbing to include all test source files.
60+
61+
## Material Models Currently Tested
62+
63+
1. **Neo-Hookean** - Isotropic hyperelastic material model
64+
2. **Mooney-Rivlin** - Isotropic hyperelastic material model with two parameters
65+
3. **Holzapfel-Ogden** - Anisotropic hyperelastic material model for cardiac tissue
66+
- Standard variant
67+
- Modified Anisotropy variant
68+
69+
## Future Material Models
70+
71+
The modular structure makes it easy to add tests for additional material models such as:
72+
- Guccione material model
73+
- Fung material model
74+
- Ogden material model
75+
- And others...

0 commit comments

Comments
 (0)