// @HEADER // ***************************************************************************** // Rapid Optimization Library (ROL) Package // // Copyright 2014 NTESS and the ROL contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER /*! \file pde.hpp \brief Implements the local PDE interface for the fractional Poisson control problem. */ #ifndef PDE_FRACTIONAL_POISSON_HPP #define PDE_FRACTIONAL_POISSON_HPP #include "../../TOOLS/pde.hpp" #include "../../TOOLS/fe.hpp" #include "Intrepid_HGRAD_QUAD_C1_FEM.hpp" #include "Intrepid_HGRAD_QUAD_C2_FEM.hpp" #include "Intrepid_HGRAD_LINE_C1_FEM.hpp" #include "Intrepid_HGRAD_LINE_Cn_FEM.hpp" #include "Intrepid_DefaultCubatureFactory.hpp" #include "Intrepid_FunctionSpaceTools.hpp" #include "Intrepid_CellTools.hpp" #include "ROL_Ptr.hpp" template class PDE_Fractional_Poisson_Local : public PDE { private: // Finite element basis information ROL::Ptr > > basisPtr_; std::vector > > > basisPtrs_; // Cell cubature information ROL::Ptr > cellCub_; // Cell node information ROL::Ptr > volCellNodes_; std::vector > > > bdryCellNodes_; std::vector > > bdryCellLocIds_; // Finite element definition ROL::Ptr > fe_vol_; // Local degrees of freedom on boundary, for each side of the reference cell (first index). std::vector > fidx_; // Coordinates of degrees freedom on boundary cells. // Indexing: [sideset number][local side id](cell number, value at dof) std::vector > > > bdryCellDofValues_; // Diffusivity Coefficient ROL::Ptr > kappa_; // Right hand side ROL::Ptr > rhs_; Real fracPower_; Real alpha_; public: PDE_Fractional_Poisson_Local(Teuchos::ParameterList &parlist) { // Finite element fields. int basisOrder = parlist.sublist("Problem").get("Diffusion FE Basis Order",1); if (basisOrder == 1) { basisPtr_ = ROL::makePtr >>(); } else if (basisOrder == 2) { basisPtr_ = ROL::makePtr >>(); } basisPtrs_.clear(); basisPtrs_.push_back(basisPtr_); // Quadrature rules. shards::CellTopology cellType = basisPtr_->getBaseCellTopology(); // get the cell type from any basis Intrepid::DefaultCubatureFactory cubFactory; // create cubature factory int cubDegree = parlist.sublist("Problem").get("Diffusion Cubature Degree",2); // set cubature degree, e.g., 2 cellCub_ = cubFactory.create(cellType, cubDegree); // create default cubature // Coefficients fracPower_ = parlist.sublist("Problem").get("Fractional Power",0.5); alpha_ = static_cast(1) - static_cast(2)*fracPower_; } void residual(ROL::Ptr > & res, const ROL::Ptr > & u_coeff, const ROL::Ptr > & z_coeff = ROL::nullPtr, const ROL::Ptr > & z_param = ROL::nullPtr) { // GET DIMENSIONS const int c = fe_vol_->gradN()->dimension(0); const int f = fe_vol_->gradN()->dimension(1); const int p = fe_vol_->gradN()->dimension(2); const int d = fe_vol_->gradN()->dimension(3); // INITIALIZE RESIDUAL res = ROL::makePtr>(c, f); // COMPUTE STIFFNESS TERM ROL::Ptr > gradU_eval = ROL::makePtr>(c, p, d); fe_vol_->evaluateGradient(gradU_eval, u_coeff); ROL::Ptr > kappa_gradU_eval = ROL::makePtr>(c, p, d); Intrepid::FunctionSpaceTools::tensorMultiplyDataData(*kappa_gradU_eval,*kappa_,*gradU_eval); Intrepid::FunctionSpaceTools::integrate(*res, *kappa_gradU_eval, *(fe_vol_->gradNdetJ()), Intrepid::COMP_CPP, false); // ADD RHS TO RESIDUAL Intrepid::FunctionSpaceTools::integrate(*res, *rhs_, *(fe_vol_->NdetJ()), Intrepid::COMP_CPP, true); // ADD CONTROL TERM TO RESIDUAL ROL::Ptr > valZ_eval = ROL::makePtr>(c, p); fe_vol_->evaluateValue(valZ_eval, z_coeff); Intrepid::RealSpaceTools::scale(*valZ_eval,static_cast(-1)); Intrepid::FunctionSpaceTools::integrate(*res, *valZ_eval, *(fe_vol_->NdetJ()), Intrepid::COMP_CPP, true); // APPLY DIRICHLET CONDITIONS int numSideSets = bdryCellLocIds_.size(); if (numSideSets > 0) { for (int i = 0; i < numSideSets; ++i) { int numLocalSideIds = bdryCellLocIds_[i].size(); for (int j = 0; j < numLocalSideIds; ++j) { int numCellsSide = bdryCellLocIds_[i][j].size(); int numBdryDofs = fidx_[j].size(); for (int k = 0; k < numCellsSide; ++k) { int cidx = bdryCellLocIds_[i][j][k]; for (int l = 0; l < numBdryDofs; ++l) { (*res)(cidx,fidx_[j][l]) = (*u_coeff)(cidx,fidx_[j][l]) - (*bdryCellDofValues_[i][j])(k,fidx_[j][l]); } } } } } } void Jacobian_1(ROL::Ptr > & jac, const ROL::Ptr > & u_coeff, const ROL::Ptr > & z_coeff = ROL::nullPtr, const ROL::Ptr > & z_param = ROL::nullPtr) { // GET DIMENSIONS const int c = fe_vol_->gradN()->dimension(0); const int f = fe_vol_->gradN()->dimension(1); const int p = fe_vol_->gradN()->dimension(2); const int d = fe_vol_->gradN()->dimension(3); // INITILAIZE JACOBIAN jac = ROL::makePtr>(c, f, f); // COMPUTE STIFFNESS TERM ROL::Ptr > kappa_gradN_eval = ROL::makePtr>(c, f, p, d); Intrepid::FunctionSpaceTools::tensorMultiplyDataField(*kappa_gradN_eval,*kappa_,*(fe_vol_->gradN())); Intrepid::FunctionSpaceTools::integrate(*jac, *kappa_gradN_eval, *(fe_vol_->gradNdetJ()), Intrepid::COMP_CPP, false); // APPLY DIRICHLET CONDITIONS int numSideSets = bdryCellLocIds_.size(); if (numSideSets > 0) { for (int i = 0; i < numSideSets; ++i) { int numLocalSideIds = bdryCellLocIds_[i].size(); for (int j = 0; j < numLocalSideIds; ++j) { int numCellsSide = bdryCellLocIds_[i][j].size(); int numBdryDofs = fidx_[j].size(); for (int k = 0; k < numCellsSide; ++k) { int cidx = bdryCellLocIds_[i][j][k]; for (int l = 0; l < numBdryDofs; ++l) { for (int m = 0; m < f; ++m) { (*jac)(cidx,fidx_[j][l],m) = static_cast(0); } (*jac)(cidx,fidx_[j][l],fidx_[j][l]) = static_cast(1); } } } } } } void Jacobian_2(ROL::Ptr > & jac, const ROL::Ptr > & u_coeff, const ROL::Ptr > & z_coeff = ROL::nullPtr, const ROL::Ptr > & z_param = ROL::nullPtr) { // GET DIMENSIONS const int c = fe_vol_->gradN()->dimension(0); const int f = fe_vol_->gradN()->dimension(1); // INITIALIZE JACOBIAN jac = ROL::makePtr>(c, f, f); // ADD CONTROL TERM *jac = *fe_vol_->massMat(); Intrepid::RealSpaceTools::scale(*jac, static_cast(-1)); // APPLY DIRICHLET CONDITIONS int numSideSets = bdryCellLocIds_.size(); if (numSideSets > 0) { for (int i = 0; i < numSideSets; ++i) { int numLocalSideIds = bdryCellLocIds_[i].size(); for (int j = 0; j < numLocalSideIds; ++j) { int numCellsSide = bdryCellLocIds_[i][j].size(); int numBdryDofs = fidx_[j].size(); for (int k = 0; k < numCellsSide; ++k) { int cidx = bdryCellLocIds_[i][j][k]; for (int l = 0; l < numBdryDofs; ++l) { for (int m = 0; m < f; ++m) { (*jac)(cidx,fidx_[j][l],m) = static_cast(0); } } } } } } } void Hessian_11(ROL::Ptr > & hess, const ROL::Ptr > & l_coeff, const ROL::Ptr > & u_coeff, const ROL::Ptr > & z_coeff = ROL::nullPtr, const ROL::Ptr > & z_param = ROL::nullPtr) { throw Exception::Zero(">>> (PDE_Poisson::Hessian_11): Hessian is zero."); } void Hessian_12(ROL::Ptr > & hess, const ROL::Ptr > & l_coeff, const ROL::Ptr > & u_coeff, const ROL::Ptr > & z_coeff = ROL::nullPtr, const ROL::Ptr > & z_param = ROL::nullPtr) { throw Exception::Zero(">>> (PDE_Poisson::Hessian_12): Hessian is zero."); } void Hessian_21(ROL::Ptr > & hess, const ROL::Ptr > & l_coeff, const ROL::Ptr > & u_coeff, const ROL::Ptr > & z_coeff = ROL::nullPtr, const ROL::Ptr > & z_param = ROL::nullPtr) { throw Exception::Zero(">>> (PDE_Poisson::Hessian_21): Hessian is zero."); } void Hessian_22(ROL::Ptr > & hess, const ROL::Ptr > & l_coeff, const ROL::Ptr > & u_coeff, const ROL::Ptr > & z_coeff = ROL::nullPtr, const ROL::Ptr > & z_param = ROL::nullPtr) { throw Exception::Zero(">>> (PDE_Poisson::Hessian_22): Hessian is zero."); } void RieszMap_1(ROL::Ptr > & riesz) { // GET DIMENSIONS const int c = fe_vol_->gradN()->dimension(0); const int f = fe_vol_->gradN()->dimension(1); // INITIALIZE RIESZ MAP riesz = ROL::makePtr>(c, f, f); *riesz = *fe_vol_->massMat(); // APPLY DIRICHLET CONDITIONS int numSideSets = bdryCellLocIds_.size(); if (numSideSets > 0) { for (int i = 0; i < numSideSets; ++i) { int numLocalSideIds = bdryCellLocIds_[i].size(); for (int j = 0; j < numLocalSideIds; ++j) { int numCellsSide = bdryCellLocIds_[i][j].size(); int numBdryDofs = fidx_[j].size(); for (int k = 0; k < numCellsSide; ++k) { int cidx = bdryCellLocIds_[i][j][k]; for (int l = 0; l < numBdryDofs; ++l) { for (int m = 0; m < f; ++m) { (*riesz)(cidx,fidx_[j][l],m) = static_cast(0); } (*riesz)(cidx,fidx_[j][l],fidx_[j][l]) = static_cast(1); } } } } } } void RieszMap_2(ROL::Ptr > & riesz) { // GET DIMENSIONS const int c = fe_vol_->gradN()->dimension(0); const int f = fe_vol_->gradN()->dimension(1); // INITIALIZE RIESZ MAP riesz = ROL::makePtr>(c, f, f); *riesz = *fe_vol_->massMat(); } std::vector > > > getFields() { return basisPtrs_; } void setCellNodes(const ROL::Ptr > &volCellNodes, const std::vector > > > &bdryCellNodes, const std::vector > > &bdryCellLocIds) { volCellNodes_ = volCellNodes; bdryCellNodes_ = bdryCellNodes; bdryCellLocIds_ = bdryCellLocIds; // Finite element definition. fe_vol_ = ROL::makePtr>(volCellNodes_,basisPtr_,cellCub_); // Set local boundary DOFs. fidx_ = fe_vol_->getBoundaryDofs(); // Compute Dirichlet values at DOFs. int d = basisPtr_->getBaseCellTopology().getDimension(); int numSidesets = bdryCellLocIds_.size(); bdryCellDofValues_.resize(numSidesets); for (int i=0; igetCardinality(); bdryCellDofValues_[i][j] = ROL::makePtr>(c, f); ROL::Ptr > coords = ROL::makePtr>(c, f, d); if (c > 0) { fe_vol_->computeDofCoords(coords, bdryCellNodes_[i][j]); } for (int k=0; k dofpoint(d); for (int m=0; mgradN()->dimension(0); const int p = fe_vol_->gradN()->dimension(2); kappa_ = ROL::makePtr>(c,p); rhs_ = ROL::makePtr>(c,p); computeCoefficients(kappa_,rhs_); } const ROL::Ptr > getFE(void) const { return fe_vol_; } private: Real diffusivityFunc(const std::vector &x) const { return static_cast(1); } Real rhsFunc(const std::vector &x) const { const Real lambda = M_PI*M_PI*static_cast(8); const Real twoPi = static_cast(2) * M_PI; return std::pow(lambda,fracPower_)*std::sin(twoPi*x[0])*std::sin(twoPi*x[1]); } Real DirichletFunc(const std::vector & coords, int sideset, int locSideId) const { return 0; } void computeCoefficients(const ROL::Ptr > &kappa, const ROL::Ptr > &rhs) const { // GET DIMENSIONS int c = fe_vol_->gradN()->dimension(0); int p = fe_vol_->gradN()->dimension(2); int d = fe_vol_->gradN()->dimension(3); std::vector pt(d), adv(d); for (int i = 0; i < c; ++i) { for (int j = 0; j < p; ++j) { for ( int k = 0; k < d; ++k) { pt[k] = (*fe_vol_->cubPts())(i,j,k); } // Compute diffusivity kappa (*kappa)(i,j) = diffusivityFunc(pt); // Compute right hand side (*rhs)(i,j) = -rhsFunc(pt); } } } }; // PDE_Fractional_Poisson_Local template class PDE_Fractional_Poisson_Cylinder : public PDE { private: // Finite element basis information ROL::Ptr > > basisPtr_; std::vector > > > basisPtrs_; // Cell cubature information ROL::Ptr > cellCub_; // Cell node information ROL::Ptr > volCellNodes_; std::vector > > > bdryCellNodes_; std::vector > > bdryCellLocIds_; // Finite element definition ROL::Ptr > fe_vol_; // Local degrees of freedom on boundary, for each side of the reference cell (first index). std::vector > fidx_; // Coordinates of degrees freedom on boundary cells. // Indexing: [sideset number][local side id](cell number, value at dof) std::vector > > > bdryCellDofValues_; Real fracPower_; Real alpha_; Real diffusivityFunc(const std::vector &x) const { Real alpha = alpha_; std::vector param = PDE::getParameter(); if (param.size()) { alpha = static_cast(1) - static_cast(2)*param[0]; } return std::pow(x[0],alpha); } Real DirichletFunc(const std::vector & coords, int sideset, int locSideId) const { return 0; } void computeCoefficients(ROL::Ptr > &kappa) const { // GET DIMENSIONS int c = fe_vol_->gradN()->dimension(0); int p = fe_vol_->gradN()->dimension(2); int d = fe_vol_->gradN()->dimension(3); std::vector pt(d), adv(d); for (int i = 0; i < c; ++i) { for (int j = 0; j < p; ++j) { for ( int k = 0; k < d; ++k) { pt[k] = (*fe_vol_->cubPts())(i,j,k); } // Compute diffusivity kappa (*kappa)(i,j) = diffusivityFunc(pt); } } } public: PDE_Fractional_Poisson_Cylinder(Teuchos::ParameterList &parlist) { // Finite element fields. int basisOrder = parlist.sublist("Problem").get("Cylinder FE Basis Order",1); if (basisOrder == 1) { basisPtr_ = ROL::makePtr >>(); } else if (basisOrder >= 2) { basisPtr_ = ROL::makePtr >>(basisOrder,Intrepid::POINTTYPE_EQUISPACED); } basisPtrs_.clear(); basisPtrs_.push_back(basisPtr_); // Quadrature rules. shards::CellTopology cellType = basisPtr_->getBaseCellTopology(); // get the cell type from any basis Intrepid::DefaultCubatureFactory cubFactory; // create cubature factory int cubDegree = parlist.sublist("Problem").get("Cylinder Cubature Degree",2); // set cubature degree, e.g., 2 cellCub_ = cubFactory.create(cellType, cubDegree); // create default cubature // Coefficients fracPower_ = parlist.sublist("Problem").get("Fractional Power",0.5); alpha_ = static_cast(1) - static_cast(2)*fracPower_; } void residual(ROL::Ptr > & res, const ROL::Ptr > & u_coeff, const ROL::Ptr > & z_coeff = ROL::nullPtr, const ROL::Ptr > & z_param = ROL::nullPtr) { // GET DIMENSIONS const int c = fe_vol_->gradN()->dimension(0); const int f = fe_vol_->gradN()->dimension(1); const int p = fe_vol_->gradN()->dimension(2); const int d = fe_vol_->gradN()->dimension(3); // INITIALIZE RESIDUAL res = ROL::makePtr>(c, f); // EVALUATE DIFFUSIVITY ROL::Ptr > kappa = ROL::makePtr>(c, p); computeCoefficients(kappa); // COMPUTE STIFFNESS TERM ROL::Ptr > gradU_eval = ROL::makePtr>(c, p, d); ROL::Ptr > kappa_gradU_eval = ROL::makePtr>(c, p, d); fe_vol_->evaluateGradient(gradU_eval, u_coeff); Intrepid::FunctionSpaceTools::tensorMultiplyDataData(*kappa_gradU_eval,*kappa,*gradU_eval); Intrepid::FunctionSpaceTools::integrate(*res, *kappa_gradU_eval, *(fe_vol_->gradNdetJ()), Intrepid::COMP_CPP, false); // ADD CONTROL TERM TO RESIDUAL ROL::Ptr > valZ_eval = ROL::makePtr>(c, p); fe_vol_->evaluateValue(valZ_eval, z_coeff); Intrepid::RealSpaceTools::scale(*valZ_eval,static_cast(-1)); Intrepid::FunctionSpaceTools::integrate(*res, *valZ_eval, *(fe_vol_->NdetJ()), Intrepid::COMP_CPP, true); // APPLY DIRICHLET CONDITIONS int numSideSets = bdryCellLocIds_.size(); if (numSideSets > 0) { for (int i = 0; i < numSideSets; ++i) { if (i==1) { int numLocalSideIds = bdryCellLocIds_[i].size(); for (int j = 0; j < numLocalSideIds; ++j) { int numCellsSide = bdryCellLocIds_[i][j].size(); int numBdryDofs = fidx_[j].size(); for (int k = 0; k < numCellsSide; ++k) { int cidx = bdryCellLocIds_[i][j][k]; for (int l = 0; l < numBdryDofs; ++l) { (*res)(cidx,fidx_[j][l]) = (*u_coeff)(cidx,fidx_[j][l]) - (*bdryCellDofValues_[i][j])(k,fidx_[j][l]); } } } } } } } void Jacobian_1(ROL::Ptr > & jac, const ROL::Ptr > & u_coeff, const ROL::Ptr > & z_coeff = ROL::nullPtr, const ROL::Ptr > & z_param = ROL::nullPtr) { // GET DIMENSIONS const int c = fe_vol_->gradN()->dimension(0); const int f = fe_vol_->gradN()->dimension(1); const int p = fe_vol_->gradN()->dimension(2); const int d = fe_vol_->gradN()->dimension(3); // INITILAIZE JACOBIAN jac = ROL::makePtr>(c, f, f); // EVALUATE DIFFUSIVITY ROL::Ptr > kappa = ROL::makePtr>(c, p); computeCoefficients(kappa); // COMPUTE STIFFNESS TERM ROL::Ptr > kappa_gradN_eval = ROL::makePtr>(c, f, p, d); Intrepid::FunctionSpaceTools::tensorMultiplyDataField(*kappa_gradN_eval,*kappa,*(fe_vol_->gradN())); Intrepid::FunctionSpaceTools::integrate(*jac, *kappa_gradN_eval, *(fe_vol_->gradNdetJ()), Intrepid::COMP_CPP, false); // APPLY DIRICHLET CONDITIONS int numSideSets = bdryCellLocIds_.size(); if (numSideSets > 0) { for (int i = 0; i < numSideSets; ++i) { if (i==1) { int numLocalSideIds = bdryCellLocIds_[i].size(); for (int j = 0; j < numLocalSideIds; ++j) { int numCellsSide = bdryCellLocIds_[i][j].size(); int numBdryDofs = fidx_[j].size(); for (int k = 0; k < numCellsSide; ++k) { int cidx = bdryCellLocIds_[i][j][k]; for (int l = 0; l < numBdryDofs; ++l) { for (int m = 0; m < f; ++m) { (*jac)(cidx,fidx_[j][l],m) = static_cast(0); } (*jac)(cidx,fidx_[j][l],fidx_[j][l]) = static_cast(1); } } } } } } } void Jacobian_2(ROL::Ptr > & jac, const ROL::Ptr > & u_coeff, const ROL::Ptr > & z_coeff = ROL::nullPtr, const ROL::Ptr > & z_param = ROL::nullPtr) { // GET DIMENSIONS const int c = fe_vol_->gradN()->dimension(0); const int f = fe_vol_->gradN()->dimension(1); // INITIALIZE JACOBIAN jac = ROL::makePtr>(c, f, f); // ADD CONTROL TERM *jac = *fe_vol_->massMat(); Intrepid::RealSpaceTools::scale(*jac, static_cast(-1)); // APPLY DIRICHLET CONDITIONS int numSideSets = bdryCellLocIds_.size(); if (numSideSets > 0) { for (int i = 0; i < numSideSets; ++i) { int numLocalSideIds = bdryCellLocIds_[i].size(); for (int j = 0; j < numLocalSideIds; ++j) { int numCellsSide = bdryCellLocIds_[i][j].size(); int numBdryDofs = fidx_[j].size(); for (int k = 0; k < numCellsSide; ++k) { int cidx = bdryCellLocIds_[i][j][k]; for (int l = 0; l < numBdryDofs; ++l) { for (int m = 0; m < f; ++m) { (*jac)(cidx,fidx_[j][l],m) = static_cast(0); } } } } } } } void Hessian_11(ROL::Ptr > & hess, const ROL::Ptr > & l_coeff, const ROL::Ptr > & u_coeff, const ROL::Ptr > & z_coeff = ROL::nullPtr, const ROL::Ptr > & z_param = ROL::nullPtr) { throw Exception::Zero(">>> (PDE_Fractional_Poisson_Cylinder::Hessian_11): Hessian is zero."); } void Hessian_12(ROL::Ptr > & hess, const ROL::Ptr > & l_coeff, const ROL::Ptr > & u_coeff, const ROL::Ptr > & z_coeff = ROL::nullPtr, const ROL::Ptr > & z_param = ROL::nullPtr) { throw Exception::Zero(">>> (PDE_Fractional_Poisson_Cylinder::Hessian_12): Hessian is zero."); } void Hessian_21(ROL::Ptr > & hess, const ROL::Ptr > & l_coeff, const ROL::Ptr > & u_coeff, const ROL::Ptr > & z_coeff = ROL::nullPtr, const ROL::Ptr > & z_param = ROL::nullPtr) { throw Exception::Zero(">>> (PDE_Fractional_Poisson_Cylinder::Hessian_21): Hessian is zero."); } void Hessian_22(ROL::Ptr > & hess, const ROL::Ptr > & l_coeff, const ROL::Ptr > & u_coeff, const ROL::Ptr > & z_coeff = ROL::nullPtr, const ROL::Ptr > & z_param = ROL::nullPtr) { throw Exception::Zero(">>> (PDE_Fractional_Poisson_Cylinder::Hessian_22): Hessian is zero."); } void RieszMap_1(ROL::Ptr > & riesz) { // GET DIMENSIONS const int c = fe_vol_->gradN()->dimension(0); const int f = fe_vol_->gradN()->dimension(1); const int p = fe_vol_->gradN()->dimension(2); // INITIALIZE RIESZ MAP riesz = ROL::makePtr>(c, f, f); // EVALUATE DIFFUSIVITY ROL::Ptr > kappa = ROL::makePtr>(c, p); computeCoefficients(kappa); // COMPUTE RIESZ MAP ROL::Ptr > kappa_N_eval = ROL::makePtr>(c, f, p); Intrepid::FunctionSpaceTools::scalarMultiplyDataField(*kappa_N_eval,*kappa,*(fe_vol_->N())); Intrepid::FunctionSpaceTools::integrate(*riesz, *kappa_N_eval, *(fe_vol_->NdetJ()), Intrepid::COMP_CPP, false); // APPLY DIRICHLET CONDITIONS int numSideSets = bdryCellLocIds_.size(); if (numSideSets > 0) { for (int i = 0; i < numSideSets; ++i) { if (i==1) { int numLocalSideIds = bdryCellLocIds_[i].size(); for (int j = 0; j < numLocalSideIds; ++j) { int numCellsSide = bdryCellLocIds_[i][j].size(); int numBdryDofs = fidx_[j].size(); for (int k = 0; k < numCellsSide; ++k) { int cidx = bdryCellLocIds_[i][j][k]; for (int l = 0; l < numBdryDofs; ++l) { for (int m = 0; m < f; ++m) { (*riesz)(cidx,fidx_[j][l],m) = static_cast(0); } (*riesz)(cidx,fidx_[j][l],fidx_[j][l]) = static_cast(1); } } } } } } } void RieszMap_2(ROL::Ptr > & riesz) { // GET DIMENSIONS const int c = fe_vol_->gradN()->dimension(0); const int f = fe_vol_->gradN()->dimension(1); // INITIALIZE RIESZ MAP riesz = ROL::makePtr>(c, f, f); *riesz = *fe_vol_->massMat(); } std::vector > > > getFields() { return basisPtrs_; } void setCellNodes(const ROL::Ptr > &volCellNodes, const std::vector > > > &bdryCellNodes, const std::vector > > &bdryCellLocIds) { volCellNodes_ = volCellNodes; bdryCellNodes_ = bdryCellNodes; bdryCellLocIds_ = bdryCellLocIds; // Finite element definition. fe_vol_ = ROL::makePtr>(volCellNodes_,basisPtr_,cellCub_); // Set local boundary DOFs. fidx_ = fe_vol_->getBoundaryDofs(); // Compute Dirichlet values at DOFs. int d = basisPtr_->getBaseCellTopology().getDimension(); int numSidesets = bdryCellLocIds_.size(); bdryCellDofValues_.resize(numSidesets); for (int i=0; igetCardinality(); bdryCellDofValues_[i][j] = ROL::makePtr>(c, f); ROL::Ptr > coords = ROL::makePtr>(c, f, d); if (c > 0) { fe_vol_->computeDofCoords(coords, bdryCellNodes_[i][j]); } for (int k=0; k dofpoint(d); for (int m=0; m > getFE(void) const { return fe_vol_; } }; // PDE_Fractional_Poisson_Local #endif