message: Fix `InitBasisWithIndices`.
diff: @@ -98,6 +98,66 @@ static void InitTensorBasis(const mfem::FiniteElementSpace &fes,
  qW.GetData(), basis);
  }
  +static void InitNonTensorBasisWithIndices(
  + const mfem::FiniteElementSpace &fes,
  + const mfem::IntegrationRule &ir,
  + int nelem,
  + const int* indices,
  + Ceed ceed, CeedBasis *basis)
  +{
  + const mfem::DofToQuad &maps = fes.GetFE(indices[0])->
  + GetDofToQuad(ir,mfem::DofToQuad::FULL);
  + mfem::Mesh *mesh = fes.GetMesh();
  + const int dim = mesh->Dimension();
  + const int ndofs = maps.ndof;
  + const int nqpts = maps.nqpt;
  + mfem::DenseMatrix qX(dim,nqpts);
  + mfem::Vector qW(nqpts);
  + for (int i = 0; i < nqpts; i++)
  + {
  + const mfem::IntegrationPoint &ip = ir.IntPoint(i);
  + qX(0,i) = ip.x;
  + if (dim>1) { qX(1,i) = ip.y; }
  + if (dim>2) { qX(2,i) = ip.z; }
  + qW(i) = ip.weight;
  + }
  + CeedBasisCreateH1(ceed, GetCeedTopology(fes.GetFE(indices[0])->GetGeomType()),
  + fes.GetVDim(), ndofs, nqpts,
  + maps.Bt.GetData(), maps.Gt.GetData(),
  + qX.GetData(), qW.GetData(), basis);
  +}
  +
  +static void InitTensorBasisWithIndices(
  + const mfem::FiniteElementSpace &fes,
  + const mfem::IntegrationRule &ir,
  + int nelem,
  + const int* indices,
  + Ceed ceed, CeedBasis *basis)
  +{
  + const mfem::DofToQuad &maps =
  + fes.GetFE(indices[0])->GetDofToQuad(ir, mfem::DofToQuad::TENSOR);
  + mfem::Mesh *mesh = fes.GetMesh();
  + const int ndofs = maps.ndof;
  + const int nqpts = maps.nqpt;
  + mfem::Vector qX(nqpts), qW(nqpts);
  + // The x-coordinates of the first `nqpts` points of the integration rule are
  + // the points of the corresponding 1D rule. We also scale the weights
  + // accordingly.
  + double w_sum = 0.0;
  + for (int i = 0; i < nqpts; i++)
  + {
  + const mfem::IntegrationPoint &ip = ir.IntPoint(i);
  + qX(i) = ip.x;
  + qW(i) = ip.weight;
  + w_sum += ip.weight;
  + }
  + qW *= 1.0/w_sum;
  + CeedBasisCreateTensorH1(ceed, mesh->Dimension(), fes.GetVDim(), ndofs,
  + nqpts, maps.Bt.GetData(),
  + maps.Gt.GetData(), qX.GetData(),
  + qW.GetData(), basis);
  +}
  +
  void InitBasis(const FiniteElementSpace &fes,
  const IntegrationRule &irm,
  Ceed ceed, CeedBasis *basis)
  @@ -150,11 +210,11 @@ void InitBasisWithIndices(const FiniteElementSpace &fes,
  {
  if (tensor)
  {
  - InitTensorBasis(fes, irm, ceed, basis);
  + InitTensorBasisWithIndices(fes, irm, nelem, indices, ceed, basis);
  }
  else
  {
  - InitNonTensorBasis(fes, irm, ceed, basis);
  + InitNonTensorBasisWithIndices(fes, irm, nelem, indices, ceed, basis);
  }
  mfem::internal::ceed_basis_map[basis_key] = *basis;
  }
  