resolver.hpp serif/discretization/domain/concepts.hpp serif/discretization/domain/ids/lists/concepts.hpp serif/discretization/domain/ids/lists/lists.hpp src/include/serif/discretization/domain/relation/validation/validation.hpp src/include/serif/discretization/domain/schema/domain_schema.hpp serif::discretization::domain::DomainIDResolver< DomainT, ids::lists::DomainIDList< DomainIDTs... > > serif::discretization::domain::DomainIDResolver< DomainSet< DomainTs... >, ids::lists::DomainIDList< DomainIDTs... > > serif::discretization::domain::BoundaryIDResolver< BoundaryT, ids::lists::BoundaryIDList< BoundaryIDTs... > > serif::discretization::domain::BoundaryIDResolver< BoundarySet< BoundaryTs... >, ids::lists::BoundaryIDList< BoundaryIDTs... > > serif serif::discretization serif::discretization::domain File containing the DomainIDResolver and BoundaryIDResolver structs. These structs are used to resolve the domain and boundary IDs for a given domain or boundary type. Emily M. Boudreaux #pragmaonce #include"serif/discretization/domain/concepts.hpp" #include"serif/discretization/domain/ids/lists/concepts.hpp" #include"serif/discretization/domain/ids/lists/lists.hpp" namespaceserif::discretization::domain{ template<typenameDomainT,typenameDomainIDListT> structDomainIDResolver; //Inthefollowingtwostructsthereisalotoffolding,again(Iamwritingthiscommentafterthecommentregardingfoldinginutils/misc/traits/type_uniqueness.hppwaswritten). //Anywayabriefoverviewofthefoldinginthesestructsfollow //#Forthesingledomainspecialization: //1.WemakeregisteredusingafoldthatchecksthatthedomainistaggedbyatleastoneoftheIDsinthelist. //2.contains_idthenchecksthatboththedomainistaggedbyatleastoneentryandthattheentrytaggingthedomainhastheIDvaluethatispassedin. //notethatthislattercheckiswhywecannotsimplycheckregisteredagain. //3.idfirstvalidatesthatthedomainisregisteredproperly(e.g.thedomainistaggedbyatleastoneoftheIDsinthelist)and //thenitusesafoldtoreturntheIDvalueoftheentrythattagsthedomainusingaternary.Readthisasloopingoverallentriesinthe //list,theniftheentrytagsthedomainthenaccumulatethatID,otherwiseaccumulate0.NotethatMFEMconventionhasitthatelementattributesstart //atone.Thisisalegitimatesafetyconcernwemaywanttoaddressatsomepointgiventhatthereisnothingstoppingsomeonefrommakingameshwith //anattributeof0. //#Forthemultipledomainspecialization: //1.Wemakeahelperaliaswhichletsusquerythesingledomainresolverforeachdomainintheset. //2.registeredthereforeasksifallofthedomainsinthesetareregisteredwiththeIDlistbyfoldingoveralldomainsandthenaskingthesingledomainresolverifthatdomainisregisteredwiththeIDlist. //3.contains_iddoesbasicallythesamethingasregistered,butinsteadofaskingifthedomainisregistereditasksifthedomaincontainstheIDthatispassedin. template<IsDomainDomainT,ids::IsDomainID...DomainIDTs> structDomainIDResolver<DomainT,ids::lists::DomainIDList<DomainIDTs...>>{ staticconstexprboolregistered=(DomainIsIdentifiedBy<DomainT, DomainIDTs>||...); [[nodiscard]]staticconstexprboolcontains_id(constintdomainID)noexcept{ return((DomainIsIdentifiedBy<DomainT, DomainIDTs>&&DomainIDTs::ID==domainID)||...); } [[nodiscard]]staticconstevalintid(){ static_assert(registered,"Requesteddomainisnotregisteredinthisschema."); return((DomainIsIdentifiedBy<DomainT, DomainIDTs>?DomainIDTs::ID:0)+...); } }; //ThisspecializationresolvestheelementattributesforasetofDomains template<IsDomain...DomainTs,ids::IsDomainID...DomainIDTs> structDomainIDResolver<DomainSet<DomainTs...>,ids::lists::DomainIDList<DomainIDTs...>>{ template<typenameD> usingResolverFor=DomainIDResolver<D,ids::lists::DomainIDList<DomainIDTs...>>; staticconstexprboolregistered=(ResolverFor<DomainTs>::registered&&...); [[nodiscard]]staticconstexprboolcontains_id(constintdomainID)noexcept{ return(ResolverFor<DomainTs>::contains_id(domainID)||...); } }; template<typenameBoundaryT,typenameBoundaryIDListT> structBoundaryIDResolver; template<IsBoundaryBoundaryT,ids::IsBoundaryID...BoundaryIDTs> structBoundaryIDResolver<BoundaryT,ids::lists::BoundaryIDList<BoundaryIDTs...>>{ staticconstexprboolregistered=(BoundaryIsIdentifiedBy<BoundaryT, BoundaryIDTs>||...); [[nodiscard]]staticconstexprboolcontains_id(constintboundaryID)noexcept{ return((BoundaryIsIdentifiedBy<BoundaryT, BoundaryIDTs>&&BoundaryIDTs::ID==boundaryID)||...); } [[nodiscard]]staticconstevalintid(){ static_assert(registered,"Requestedboundaryisnotregisteredinthisschema."); return((BoundaryIsIdentifiedBy<BoundaryT, BoundaryIDTs>?BoundaryIDTs::ID:0)+...); } }; template<IsBoundary...BoundaryTs,ids::IsBoundaryID...BoundaryIDTs> structBoundaryIDResolver<BoundarySet<BoundaryTs...>,ids::lists::BoundaryIDList<BoundaryIDTs...>>{ template<typenameB> usingResolverFor=BoundaryIDResolver<B,ids::lists::BoundaryIDList<BoundaryIDTs...>>; staticconstexprboolregistered=(ResolverFor<BoundaryTs>::registered&&...); [[nodiscard]]staticconstexprboolcontains_id(constintboundaryID)noexcept{ return(ResolverFor<BoundaryTs>::contains_id(boundaryID)||...); } }; }