#pragma once /** * @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 */ #include #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 { /** * @brief Validate a mesh against a schema. * * @tparam SchemaT The schema type to validate against. * @param topology The mesh topology to validate. * @return A SchemaValidationResult containing the validation results. */ template [[nodiscard]] SchemaValidationResult validate_schema(const mesh::MeshTopology &topology) { using RelationsT = typename SchemaT::relations_type; return SchemaRelationValidator::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 [[nodiscard]] SchemaValidationResult validate_schema(const mfem::Mesh &mfemMesh) { const mesh::MeshTopology topology{mfemMesh}; return validate_schema(topology); } }