reconstruction.hpp memory vector mfem/fem/fe/fe_base.hpp serif/discretization/blocks/fields.hpp serif/discretization/reconstruction/surface_power.hpp src/include/serif/backend/mfem/discretization/dof_map.hpp src/include/serif/backend/mfem/discretization/tensor_basis.hpp src/lib/serif/backend/mfem/discretization/reconstruction.cpp serif::discretization::backend::mfem::ElementReconstruction serif::discretization::backend::mfem::ReconstructionPlan mfem serif serif::discretization serif::discretization::backend serif::discretization::backend::mfem #pragmaonce #include<memory> #include<vector> #include"mfem/fem/fe/fe_base.hpp" #include"serif/discretization/blocks/fields.hpp" #include"serif/discretization/reconstruction/surface_power.hpp" namespacemfem{classFiniteElementSpace;} namespaceserif::discretization::backend::mfem{ classDofMap; structElementReconstruction{ constreconstruction::RadialProfile*profile{nullptr}; intinward_axis{0}; boolsurface_at_high_coordinate{false}; booloperator==(constElementReconstruction&)const=default; voidradial(const::mfem::FiniteElement&element,doublecoordinate,::mfem::Vector&values,::mfem::Vector&derivatives)const; voidsample(const::mfem::FiniteElement&element,const::mfem::IntegrationPoint&point, ::mfem::Vector&values,::mfem::DenseMatrix&derivatives)const; }; classReconstructionPlanfinal{ public: ReconstructionPlan(constDofMap&binding,intboundary_attribute,std::shared_ptr<constreconstruction::RadialProfile>profile); voidvalidate_binding(constDofMap&binding)const; [[nodiscard]]constElementReconstruction*element(intindex)const; [[nodiscard]]constreconstruction::RadialProfile&profile()constnoexcept{return*m_profile;} [[nodiscard]]intboundary_attribute()constnoexcept{returnm_boundary_attribute;} [[nodiscard]]intintegration_order_increment()constnoexcept{return8;} private: voidvalidate_interfaces(constDofMap&binding)const; const::mfem::FiniteElementSpace*m_space; longm_space_sequence; longm_mesh_sequence; std::vector<int>m_domain_attributes,m_boundary_attributes,m_element_support; intm_boundary_attribute; std::shared_ptr<constreconstruction::RadialProfile>m_profile; std::vector<ElementReconstruction>m_elements; }; } namespaceserif::discretization::backend::mfem{ template<typenameTerm,typenameBinding> [[nodiscard]]std::shared_ptr<constReconstructionPlan>make_reconstruction( constreconstruction::SurfacePower<Term>&specification,constBinding&binding){ usingnamespaceutils::errors; ifconstexpr(!std::same_as<Term,blocks::density::mass>){ serif_error<std::invalid_argument,SERiFErrorCode::INVALID_ARGUMENT>("SurfacePowersupportsonlyscalarH1massdensity;therequestedfieldhasnovalidatedreconstruction."); return{}; }else{ intboundary_attribute=0; for(constauto&boundary:Binding::Schema::boundary_descriptors()){ if(boundary.name==specification.region.boundary_name){boundary_attribute=boundary.ID;} } serif_ensure<SERiFErrorCode::INVALID_ARGUMENT>(boundary_attribute!=0, "SurfacePowerboundary'{}'isnotregisteredinthisdiscretization'sdomainschema.",specification.region.boundary_name); autoprofile=std::make_shared<constreconstruction::SurfacePowerProfile>(specification.density_exponent); if(specification.density_exponent==1.0){return{};} returnstd::make_shared<constReconstructionPlan>(binding,boundary_attribute,std::move(profile)); } } }