feat: add property model foundation
This commit is contained in:
@@ -39,7 +39,7 @@ void add_four_nodes(fesa::core::Domain& domain) {
|
||||
|
||||
void add_material_and_property(fesa::core::Domain& domain) {
|
||||
domain.addMaterial(std::make_unique<fesa::material::LinearElasticMaterial>(700, 210.0, 0.3));
|
||||
domain.addShellProperty(fesa::property::ShellProperty{500, 700, 0.01});
|
||||
domain.addShellProperty(std::make_unique<fesa::property::ShellProperty>(500, 700, 0.01));
|
||||
}
|
||||
|
||||
void add_element(fesa::core::Domain& domain) {
|
||||
@@ -215,21 +215,29 @@ int add_and_retrieve_material_and_property() {
|
||||
return result;
|
||||
}
|
||||
|
||||
const fesa::property::ShellProperty* property = domain.findShellProperty(500);
|
||||
const fesa::property::Property* property = domain.findProperty(500);
|
||||
if (const int result = require(property != nullptr); result != 0) {
|
||||
return result;
|
||||
}
|
||||
if (const int result = require(property->materialId() == 700); result != 0) {
|
||||
if (const int result = require(property->kind() == fesa::property::PropertyKind::Shell); result != 0) {
|
||||
return result;
|
||||
}
|
||||
if (const int result = require(property->thickness() == 0.01); result != 0) {
|
||||
|
||||
const fesa::property::ShellProperty* shell_property = domain.findShellProperty(500);
|
||||
if (const int result = require(shell_property != nullptr); result != 0) {
|
||||
return result;
|
||||
}
|
||||
if (const int result = require(shell_property->materialId() == 700); result != 0) {
|
||||
return result;
|
||||
}
|
||||
if (const int result = require(shell_property->thickness() == 0.01); result != 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (const int result = require(domain.material(700).id() == 700); result != 0) {
|
||||
return result;
|
||||
}
|
||||
return require(domain.shellProperty(500).id() == 500);
|
||||
return require(domain.property(500).id() == 500);
|
||||
}
|
||||
|
||||
int duplicate_material_and_property_ids_throw() {
|
||||
@@ -244,7 +252,7 @@ int duplicate_material_and_property_ids_throw() {
|
||||
}
|
||||
|
||||
return require_throws<std::invalid_argument>([&domain]() {
|
||||
domain.addShellProperty(fesa::property::ShellProperty{500, 700, 0.02});
|
||||
domain.addShellProperty(std::make_unique<fesa::property::ShellProperty>(500, 700, 0.02));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -252,7 +260,15 @@ int shell_property_referencing_missing_material_throws() {
|
||||
fesa::core::Domain domain;
|
||||
|
||||
return require_throws<std::invalid_argument>([&domain]() {
|
||||
domain.addShellProperty(fesa::property::ShellProperty{500, 700, 0.01});
|
||||
domain.addShellProperty(std::make_unique<fesa::property::ShellProperty>(500, 700, 0.01));
|
||||
});
|
||||
}
|
||||
|
||||
int null_property_rejected() {
|
||||
fesa::core::Domain domain;
|
||||
|
||||
return require_throws<std::invalid_argument>([&domain]() {
|
||||
domain.addProperty(nullptr);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -517,6 +533,10 @@ int const_domain_retrieval_returns_const_runtime_model_data() {
|
||||
result != 0) {
|
||||
return result;
|
||||
}
|
||||
if (const int result = require((std::is_same<decltype(const_domain.property(500)), const fesa::property::Property&>::value));
|
||||
result != 0) {
|
||||
return result;
|
||||
}
|
||||
if (const int result = require((std::is_same<decltype(const_domain.shellProperty(500)), const fesa::property::ShellProperty&>::value));
|
||||
result != 0) {
|
||||
return result;
|
||||
@@ -567,7 +587,7 @@ int failed_inserts_do_not_mutate_counts() {
|
||||
}
|
||||
|
||||
if (const int result = require_throws<std::invalid_argument>([&domain]() {
|
||||
domain.addShellProperty(fesa::property::ShellProperty{501, 404, 0.01});
|
||||
domain.addShellProperty(std::make_unique<fesa::property::ShellProperty>(501, 404, 0.01));
|
||||
});
|
||||
result != 0) {
|
||||
return result;
|
||||
@@ -642,6 +662,9 @@ int run_domain_storage_tests() {
|
||||
if (const int result = shell_property_referencing_missing_material_throws(); result != 0) {
|
||||
return result;
|
||||
}
|
||||
if (const int result = null_property_rejected(); result != 0) {
|
||||
return result;
|
||||
}
|
||||
if (const int result = add_and_retrieve_sets(); result != 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user