docs(discretization/domain/schema/validation): updated docs and brought some imports over from the new backend/mfem
This commit is contained in:
@@ -4,11 +4,9 @@
|
||||
* @file all.hpp
|
||||
* @author Emily M. Boudreaux
|
||||
*
|
||||
* @brief File containing the overloads of validate_schema which automatically distributes the mesh to the correct validation function based on the schema type
|
||||
* @brief File containing validate_schema, which selects the topology validators required by the schema type.
|
||||
*/
|
||||
|
||||
#include <mfem.hpp>
|
||||
|
||||
#include "serif/discretization/domain/mesh/topology.hpp"
|
||||
#include "serif/discretization/domain/schema/concepts.hpp"
|
||||
#include "serif/discretization/domain/schema/validation/results.hpp"
|
||||
@@ -16,8 +14,8 @@
|
||||
|
||||
// Every RelationValidator specialization must be visible before
|
||||
// SchemaRelationValidator is instantiated, so they are all included here and
|
||||
// validate_schema is defined only in this header. Include this file to validate
|
||||
// a mesh; including validator.hpp alone is not enough.
|
||||
// the topology overload of validate_schema is defined here. Include this file
|
||||
// to validate topology; including validator.hpp alone is not enough.
|
||||
#include "serif/discretization/domain/schema/validation/boundary.hpp"
|
||||
#include "serif/discretization/domain/schema/validation/connected.hpp"
|
||||
#include "serif/discretization/domain/schema/validation/inscribed.hpp"
|
||||
@@ -36,19 +34,4 @@ namespace serif::discretization::domain::schema::validation {
|
||||
return SchemaRelationValidator<SchemaT, RelationsT>::validate(topology);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Validate a mesh against a schema.
|
||||
*
|
||||
* @tparam SchemaT The schema type to validate against.
|
||||
* @param mfemMesh The MFEM mesh to validate.
|
||||
* @return A SchemaValidationResult containing the validation results.
|
||||
*
|
||||
* @note This overload is provided for convenience. It constructs a MeshTopology from the given MFEM mesh and then calls the other overload of validate_schema. It
|
||||
* may be more efficient to construct a MeshTopology once and reuse it for multiple validations, rather than constructing it each time.
|
||||
*/
|
||||
template <IsSchema SchemaT>
|
||||
[[nodiscard]] SchemaValidationResult validate_schema(const mfem::Mesh &mfemMesh) {
|
||||
const mesh::MeshTopology topology{mfemMesh};
|
||||
return validate_schema<SchemaT>(topology);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,10 +66,10 @@ namespace serif::discretization::domain::schema::validation {
|
||||
if (domainElementCount == 0) {
|
||||
return {
|
||||
.failure = RelationValidationFailure::DomainAbsent,
|
||||
.connectedDiagnostics = std::make_optional<RelationValidationResult::ConnectedDiagnostics>({
|
||||
.connectedDiagnostics = RelationValidationResult::ConnectedDiagnostics{
|
||||
.domainElementCount = 0,
|
||||
.visitedElementCount = 0
|
||||
})};
|
||||
}};
|
||||
}
|
||||
|
||||
std::vector<bool> visited(static_cast<std::size_t>(elementCount), false);
|
||||
@@ -102,9 +102,7 @@ namespace serif::discretization::domain::schema::validation {
|
||||
|
||||
if (visitedElementCount == domainElementCount) {
|
||||
return {
|
||||
.connectedDiagnostics = std::make_optional<RelationValidationResult::ConnectedDiagnostics>(
|
||||
{.domainElementCount = domainElementCount, .visitedElementCount = visitedElementCount}
|
||||
)
|
||||
.connectedDiagnostics = RelationValidationResult::ConnectedDiagnostics{.domainElementCount = domainElementCount, .visitedElementCount = visitedElementCount}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -121,11 +119,11 @@ namespace serif::discretization::domain::schema::validation {
|
||||
|
||||
return {
|
||||
.failure = RelationValidationFailure::DomainDisconnected,
|
||||
.connectedDiagnostics = std::make_optional<RelationValidationResult::ConnectedDiagnostics>({
|
||||
.connectedDiagnostics = RelationValidationResult::ConnectedDiagnostics{
|
||||
.elementID = disconnectedElementID,
|
||||
.domainElementCount = domainElementCount,
|
||||
.visitedElementCount = visitedElementCount
|
||||
})};
|
||||
}};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -86,10 +86,10 @@ namespace serif::discretization::domain::schema::validation {
|
||||
if (adjacentElementID < 0) {
|
||||
return {
|
||||
.failure = RelationValidationFailure::InnerDomainTouchesMeshBoundary,
|
||||
.inscribedDiagnostics = std::make_optional<RelationValidationResult::InscribedDiagnostics>({
|
||||
.inscribedDiagnostics = RelationValidationResult::InscribedDiagnostics{
|
||||
.faceID = faceID,
|
||||
.innerElementID = innerElementID,
|
||||
})};
|
||||
}};
|
||||
}
|
||||
|
||||
const int adjacentDomainID = topology.element_domain_id(adjacentElementID);
|
||||
@@ -97,12 +97,12 @@ namespace serif::discretization::domain::schema::validation {
|
||||
if (!SchemaT::template domain_id_belongs_to<OuterT>(adjacentDomainID)) {
|
||||
return {
|
||||
.failure = RelationValidationFailure::InnerDomainTouchesUnexpectedDomain,
|
||||
.inscribedDiagnostics = std::make_optional<RelationValidationResult::InscribedDiagnostics>({
|
||||
.inscribedDiagnostics = RelationValidationResult::InscribedDiagnostics{
|
||||
.faceID = faceID,
|
||||
.innerElementID = innerElementID,
|
||||
.adjacentElementID = adjacentElementID,
|
||||
.adjacentDomainID = adjacentDomainID
|
||||
})};
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "serif/backend/mfem/discretization/schema.hpp"
|
||||
|
||||
namespace serif::discretization::domain::schema::validation {
|
||||
using serif::backend::mfem::discretization::validate_schema;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ namespace serif::discretization::domain::schema::validation {
|
||||
* @tparam RelationTs The list of relations to validate.
|
||||
*/
|
||||
template <IsSchema SchemaT, IsRelation... RelationTs>
|
||||
struct SchemaRelationValidator<SchemaT, RelationList<RelationTs...>> {
|
||||
struct SchemaRelationValidator<SchemaT, relation::lists::RelationList<RelationTs...>> {
|
||||
/**
|
||||
* @brief Validate a mesh against a schema, running one validator per declared relation in the schema.
|
||||
* @param topology The mesh topology to validate against the schema.
|
||||
|
||||
Reference in New Issue
Block a user