26 const int n2 = A.
Size();
27 const int n = sqrt(n2);
43 for (
int i = 0; i < n; ++i)
45 const real_t h = gll_pts[i+1] - gll_pts[i];
47 for (
int iq = 0; iq < ir.
Size(); ++iq)
50 const real_t x = gll_pts[i] + h*ip.
x;
53 for (
int j = 0; j < n; ++j)
63 const int n = sqrt(B.
Size());
65 for (
int i=0; i<n; ++i)
for (
int j=0; j<n; ++j) { Bt[i+j*n] = B[j+i*n]; }
73 MFEM_VERIFY(fec1,
"Must be L2 finite element space");
75 const int btype = fec1->GetBasisType();
79 if (no_op) {
return; }
85 MFEM_VERIFY(tbe !=
nullptr,
"Must be a tensor element.");
89 const int pp1 =
p + 1;
106 if (no_op) { y = x;
return; }
109 const int nd = dof2quad.
ndof;
110 const int nq = dof2quad.
nqpt;
111 QuadratureInterpolator::TensorEvalKernels::Run(
113 y.
Write(), 1, nd, nq);
118 if (no_op) { y = x;
return; }
121 const int nd = dof2quad.
ndof;
122 const int nq = dof2quad.
nqpt;
123 QuadratureInterpolator::TensorEvalKernels::Run(
125 y.
Write(), 1, nd, nq);
133 p(fes.GetMaxElementOrder())
137 MFEM_VERIFY(elem_restr != NULL,
"Missing element restriction.");
140 MFEM_VERIFY(rt_fec,
"Must be RT finite element space.");
142 const int cb_type = rt_fec->GetClosedBasisType();
143 const int ob_type = rt_fec->GetOpenBasisType();
147 if (no_op) {
return; }
149 const int pp1 = p + 1;
158 for (
int i = 0; i < pp1; ++i)
160 cbasis.
Eval(cpts2[i],
b);
161 for (
int j = 0; j < pp1; ++j)
163 Bci_1d[i + j*pp1] =
b[j];
174const real_t *ChangeOfBasis_RT::GetOpenMap(Mode mode)
const
185const real_t *ChangeOfBasis_RT::GetClosedMap(Mode mode)
const
200 const int D1D = p + 1;
201 const int ND = (p+1)*p;
202 const real_t *BC = GetClosedMap(mode);
203 const real_t *BO = GetOpenMap(mode);
209 for (
int c = 0; c <
DIM; ++c)
211 const int nx = (c == 0) ? D1D : D1D-1;
212 const int ny = (c == 1) ? D1D : D1D-1;
213 const real_t *Bx = (c == 0) ? BC : BO;
214 const real_t *By = (c == 1) ? BC : BO;
216 for (
int i = 0; i < ND; ++i)
218 Y(i + c*ND, e) = 0.0;
220 for (
int iy = 0; iy < ny; ++ iy)
222 real_t xx[DofQuadLimits::MAX_D1D];
223 for (
int ix = 0; ix < nx; ++ix) { xx[ix] = 0.0; }
224 for (
int jx = 0; jx < nx; ++jx)
226 const real_t val = X(jx + iy*nx + c*nx*ny, e);
227 for (
int ix = 0; ix < nx; ++ix)
229 xx[ix] += val*Bx[ix + jx*nx];
232 for (
int jy = 0; jy < ny; ++jy)
234 const real_t b = By[jy + iy*ny];
235 for (
int ix = 0; ix < nx; ++ix)
237 Y(ix + jy*nx + c*nx*ny, e) += xx[ix]*
b;
249 const int D1D = p + 1;
250 const int ND = (p+1)*p*p;
251 const real_t *BC = GetClosedMap(mode);
252 const real_t *BO = GetOpenMap(mode);
258 for (
int c = 0; c <
DIM; ++c)
260 const int nx = (c == 0) ? D1D : D1D-1;
261 const int ny = (c == 1) ? D1D : D1D-1;
262 const int nz = (c == 2) ? D1D : D1D-1;
263 const real_t *Bx = (c == 0) ? BC : BO;
264 const real_t *By = (c == 1) ? BC : BO;
265 const real_t *Bz = (c == 2) ? BC : BO;
267 for (
int i = 0; i < ND; ++i)
269 Y(i + c*ND, e) = 0.0;
271 for (
int iz = 0; iz < nz; ++ iz)
273 real_t xy[DofQuadLimits::MAX_D1D][DofQuadLimits::MAX_D1D];
274 for (
int iy = 0; iy < ny; ++iy)
276 for (
int ix = 0; ix < nx; ++ix)
281 for (
int iy = 0; iy < ny; ++iy)
283 real_t xx[DofQuadLimits::MAX_D1D];
284 for (
int ix = 0; ix < nx; ++ix) { xx[ix] = 0.0; }
285 for (
int ix = 0; ix < nx; ++ix)
287 const real_t val = X(ix + iy*nx + iz*nx*ny + c*ND, e);
288 for (
int jx = 0; jx < nx; ++jx)
290 xx[jx] += val*Bx[jx + ix*nx];
293 for (
int jy = 0; jy < ny; ++jy)
295 const real_t b = By[jy + iy*ny];
296 for (
int jx = 0; jx < nx; ++jx)
298 xy[jy][jx] += xx[jx] *
b;
302 for (
int jz = 0; jz < nz; ++jz)
304 const real_t b = Bz[jz + iz*nz];
305 for (
int jy = 0; jy < ny; ++jy)
307 for (
int jx = 0; jx < nx; ++jx)
309 Y(jx + jy*nx + jz*nx*ny + c*ND, e) += xy[jy][jx] *
b;
318void ChangeOfBasis_RT::Mult(
const Vector &x,
Vector &y, Mode mode)
const
320 if (no_op) { y = x;
return; }
339 elem_restr->
Mult(x_l, x_e);
341 if (dim == 2) {
MultRT_2D(x_e, y_e, mode); }
347 if (R) { R->
Mult(y_l, y); }
348 else { MFEM_VERIFY(P == NULL,
"Invalid state."); }
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
void MakeRef(T *data_, int size_, bool own_data=false)
Make this Array a reference to a pointer.
T * GetData()
Returns the data.
const T * Read(bool on_dev=true) const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), on_dev).
@ GaussLobatto
Closed type.
@ IntegratedGLL
Integrated GLL indicator functions.
void MultTranspose(const Vector &x, Vector &y) const override
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
void Mult(const Vector &x, Vector &y) const override
Operator application: y=A(x).
ChangeOfBasis_L2(FiniteElementSpace &fes)
ChangeOfBasis_RT(FiniteElementSpace &fes)
void MultTranspose(const Vector &x, Vector &y) const override
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
void MultInverse(const Vector &x, Vector &y) const
void MultRT_2D(const Vector &x, Vector &y, Mode mode) const
void MultRT_3D(const Vector &x, Vector &y, Mode mode) const
Mode mode
Describes the contents of the B, Bt, G, and Gt arrays, see Mode.
@ TENSOR
Tensor product representation using 1D matrices/tensors with dimensions using 1D number of quadrature...
Array< real_t > B
Basis functions evaluated at quadrature points.
int ndof
Number of degrees of freedom = number of basis functions. When mode is TENSOR, this is the 1D number.
const class FiniteElement * FE
The FiniteElement that created and owns this object.
int nqpt
Number of quadrature points. When mode is TENSOR, this is the 1D number.
Operator that converts FiniteElementSpace L-vectors to E-vectors.
void Mult(const Vector &x, Vector &y) const override
Operator application: y=A(x).
void MultLeftInverse(const Vector &x, Vector &y) const
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
virtual const Operator * GetProlongationMatrix() const
virtual const Operator * GetRestrictionOperator() const
An abstract operator that performs the same action as GetRestrictionMatrix.
const ElementRestrictionOperator * GetElementRestriction(ElementDofOrdering e_ordering) const
Return an Operator that converts L-vectors to E-vectors.
const FiniteElementCollection * FEColl() const
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
const FiniteElement * GetTypicalFE() const
Return GetFE(0) if the local mesh is not empty; otherwise return a typical FE based on the Geometry t...
virtual int GetMaxElementOrder() const
Return the maximum polynomial order over all elements.
Abstract class for all finite elements.
int GetDim() const
Returns the reference space dimension for the finite element.
Class for integration point with weight.
Class for an integration rule - an Array of IntegrationPoint.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
Arbitrary order "L2-conforming" discontinuous finite elements.
bool Factor(int m, real_t TOL=0.0) override
Compute the LU factorization of the current matrix.
void GetInverseMatrix(int m, real_t *X) const override
Assuming L.U = P.A factored data of size (m x m), compute X <- A^{-1}.
Operator(int s=0)
Construct a square Operator with given size s (default 0).
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
Class for evaluating 1D nodal, positive (Bernstein), or integrated (Gerritsma) bases.
void Eval(const real_t x, Vector &u) const
Evaluate the basis functions at point x in [0,1].
const real_t * GetPoints(const int p, const int btype, bool on_device=false)
Get the coordinates of the points of the given BasisType, btype.
Basis & GetBasis(const int p, const int btype)
Get a Poly_1D::Basis object of the given degree and BasisType, btype.
Arbitrary order H(div)-conforming Raviart-Thomas finite elements.
virtual const real_t * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
void SetSize(int s)
Resize the vector to size s.
virtual real_t * Write(bool on_dev=true)
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), on_dev).
void MakeRef(Vector &base, int offset, int size)
Reset the Vector to be a reference to a sub-vector of base.
real_t u(const Vector &xvec)
void SubcellIntegrals(int n, const Poly_1D::Basis &basis, Array< real_t > &B)
void ComputeInverse(const Array< real_t > &A, Array< real_t > &Ainv)
Compute the inverse of the matrix A and store the result in Ainv.
void Transpose(const Table &A, Table &At, int ncols_A_)
Transpose a Table.
MFEM_HOST_DEVICE DeviceTensor< sizeof...(Dims), T > Reshape(T *ptr, Dims... dims)
Wrap a pointer as a DeviceTensor with automatically deduced template parameters.
bool IsIdentityProlongation(const Operator *P)
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
real_t p(const Vector &x, real_t t)