shape.hpp memory vector serif/geometry/deformation/computations.hpp serif/model/backend/mfem/actions.hpp serif/model/backend/mfem/deformation.hpp serif/model/backend/mfem/volume.hpp serif/model/computations/interior.hpp src/include/serif/model/graph.hpp serif::model::computations::ShapeContribution serif serif::model serif::model::computations #pragmaonce #include<memory> #include<vector> #include"serif/geometry/deformation/computations.hpp" #include"serif/model/backend/mfem/actions.hpp" #include"serif/model/backend/mfem/deformation.hpp" #include"serif/model/backend/mfem/volume.hpp" #include"serif/model/computations/interior.hpp" namespaceserif::model::computations { structShapeContribution { }; template<typenameEquation,typenameLayout> [[nodiscard]]autoshape_contribution(constLayout&layout) { usingnamespaceutils::dependencies; usingnamespacediscretization::blocks; usingVolume=typenameoperators::backend::mfem::volume_keys::Scoped<surface_deformation::shape_equilibrium>::Linearization; returnmake_owning_computation<ShapeContribution,InputList<Volume,ShapeDerivatives>>( [layout](constauto&accepted_volume,constauto&shape) { constauto&tangent=shape->tangent; constauto&projection=shape->projection; constautopullback=backend::mfem::transpose_block(tangent); constintrow_offset=static_cast<int>(layout.templateoffset<RepresentedValueKind::residual,surface_deformation::shape_equilibrium>()); ::mfem::Vectorresidual(tangent.action()->Width()); tangent.action()->MultTranspose(accepted_volume->residual,residual); Contributionsresult; result.residual.push_back({row_offset,std::vector<double>(residual.GetData(),residual.GetData()+residual.Size())}); operators::EquationPlan<Equation>::for_each_column([&]<typenameColumn>(Column,std::size_t) { usingField=typenameColumn::term_type; ifconstexpr(ContainsKey<Field,typenameLayout::Values>) { result.jacobian.push_back({row_offset,static_cast<int>(layout.templateoffset<RepresentedValueKind::value,Field>()), backend::mfem::compose_blocks(pullback,operators::backend::mfem::volume_field_block<Field>(accepted_volume))}); } }); ::mfem::Vectorfull_force(projection.action()->Width()); projection.action()->MultTranspose(accepted_volume->residual,full_force); constautocurvature=backend::mfem::deformation_curvature(shape->deformation,std::vector<double>(full_force.GetData(),full_force.GetData()+full_force.Size())); constautomaterial=backend::mfem::compose_blocks(pullback,backend::mfem::compose_blocks(backend::mfem::volume_geometry_block(accepted_volume),tangent)); result.jacobian.push_back({row_offset,static_cast<int>(layout.templateoffset<RepresentedValueKind::value,surface_deformation::coefficients>()), backend::mfem::sum_blocks(tangent.action()->Width(),tangent.action()->Width(),{material,curvature})}); constintshape_offset=static_cast<int>(layout.templateoffset<RepresentedValueKind::value,surface_deformation::coefficients>()); constautocomplete_force=backend::mfem::volume_row_action(accepted_volume,layout,backend::mfem::ColumnContribution{shape_offset,tangent}); result.actions=std::vector<backend::mfem::JacobianContribution>{ {row_offset,0,backend::mfem::compose_blocks(pullback,complete_force)},{row_offset,shape_offset,curvature}}; returnresult; }); } }//namespaceserif::model::computations