Files
MeanField_SERiF/src/include/serif/discretization/domain/schema/validation/all.hpp

34 lines
1.6 KiB
C++
Raw Normal View History

#pragma once
#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"
#include "serif/discretization/domain/schema/validation/validator.hpp"
// 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.
#include "serif/discretization/domain/schema/validation/boundary.hpp"
#include "serif/discretization/domain/schema/validation/connected.hpp"
#include "serif/discretization/domain/schema/validation/inscribed.hpp"
namespace serif::discretization::domain::schema::validation {
// Validate against connectivity that has already been extracted. Prefer
// this overload when validating several schemas against the same mesh.
template <IsSchema SchemaT>
[[nodiscard]] SchemaValidationResult validate_schema(const mesh::MeshTopology &topology) {
using RelationsT = typename SchemaT::relations_type;
return SchemaRelationValidator<SchemaT, RelationsT>::validate(topology);
}
// Extract the mesh connectivity once, then check every relation against it.
template <IsSchema SchemaT>
[[nodiscard]] SchemaValidationResult validate_schema(const mfem::Mesh &mfemMesh) {
const mesh::MeshTopology topology{mfemMesh};
return validate_schema<SchemaT>(topology);
}
}