24 const int n2 = A.
Size();
25 const int n =
static_cast<const int>(sqrt(n2));
41 for (
int i = 0; i < n; ++i)
43 const real_t h = gll_pts[i+1] - gll_pts[i];
45 for (
int iq = 0; iq < ir.
Size(); ++iq)
48 const real_t x = gll_pts[i] + h*ip.
x;
51 for (
int j = 0; j < n; ++j)
61 const int n =
static_cast<const int>(sqrt(B.
Size()));
63 for (
int i=0; i<n; ++i)
for (
int j=0; j<n; ++j) { Bt[i+j*n] = B[j+i*n]; }
71 MFEM_VERIFY(fec1,
"Must be L2 finite element space");
73 const int btype = fec1->GetBasisType();
77 if (no_op) {
return; }
83 MFEM_VERIFY(tbe !=
nullptr,
"Must be a tensor element.");
87 const int pp1 =
p + 1;
104 if (no_op) { y = x;
return; }
107 const int nd = dof2quad.
ndof;
108 const int nq = dof2quad.
nqpt;
109 QuadratureInterpolator::TensorEvalKernels::Run(
111 y.
Write(), 1, nd, nq);
116 if (no_op) { y = x;
return; }
119 const int nd = dof2quad.
ndof;
120 const int nq = dof2quad.
nqpt;
121 QuadratureInterpolator::TensorEvalKernels::Run(
123 y.
Write(), 1, nd, nq);
131 p(fes.GetMaxElementOrder())
135 MFEM_VERIFY(elem_restr != NULL,
"Missing element restriction.");
138 MFEM_VERIFY(rt_fec,
"Must be RT finite element space.");
140 const int cb_type = rt_fec->GetClosedBasisType();
141 const int ob_type = rt_fec->GetOpenBasisType();
145 if (no_op) {
return; }
147 const int pp1 = p + 1;
156 for (
int i = 0; i < pp1; ++i)
158 cbasis.
Eval(cpts2[i],
b);
159 for (
int j = 0; j < pp1; ++j)
161 Bci_1d[i + j*pp1] =
b[j];
172const real_t *ChangeOfBasis_RT::GetOpenMap(Mode mode)
const
183const real_t *ChangeOfBasis_RT::GetClosedMap(Mode mode)
const
198 const int D1D = p + 1;
199 const int ND = (p+1)*p;
200 const real_t *BC = GetClosedMap(mode);
201 const real_t *BO = GetOpenMap(mode);
207 for (
int c = 0; c <
DIM; ++c)
209 const int nx = (c == 0) ? D1D : D1D-1;
210 const int ny = (c == 1) ? D1D : D1D-1;
211 const real_t *Bx = (c == 0) ? BC : BO;
212 const real_t *By = (c == 1) ? BC : BO;
214 for (
int i = 0; i < ND; ++i)
216 Y(i + c*ND, e) = 0.0;
218 for (
int iy = 0; iy < ny; ++ iy)
220 real_t xx[DofQuadLimits::MAX_D1D];
221 for (
int ix = 0; ix < nx; ++ix) { xx[ix] = 0.0; }
222 for (
int jx = 0; jx < nx; ++jx)
224 const real_t val = X(jx + iy*nx + c*nx*ny, e);
225 for (
int ix = 0; ix < nx; ++ix)
227 xx[ix] += val*Bx[ix + jx*nx];
230 for (
int jy = 0; jy < ny; ++jy)
232 const real_t b = By[jy + iy*ny];
233 for (
int ix = 0; ix < nx; ++ix)
235 Y(ix + jy*nx + c*nx*ny, e) += xx[ix]*
b;
247 const int D1D = p + 1;
248 const int ND = (p+1)*p*p;
249 const real_t *BC = GetClosedMap(mode);
250 const real_t *BO = GetOpenMap(mode);
256 for (
int c = 0; c <
DIM; ++c)
258 const int nx = (c == 0) ? D1D : D1D-1;
259 const int ny = (c == 1) ? D1D : D1D-1;
260 const int nz = (c == 2) ? D1D : D1D-1;
261 const real_t *Bx = (c == 0) ? BC : BO;
262 const real_t *By = (c == 1) ? BC : BO;
263 const real_t *Bz = (c == 2) ? BC : BO;
265 for (
int i = 0; i < ND; ++i)
267 Y(i + c*ND, e) = 0.0;
269 for (
int iz = 0; iz < nz; ++ iz)
271 real_t xy[DofQuadLimits::MAX_D1D][DofQuadLimits::MAX_D1D];
272 for (
int iy = 0; iy < ny; ++iy)
274 for (
int ix = 0; ix < nx; ++ix)
279 for (
int iy = 0; iy < ny; ++iy)
281 real_t xx[DofQuadLimits::MAX_D1D];
282 for (
int ix = 0; ix < nx; ++ix) { xx[ix] = 0.0; }
283 for (
int ix = 0; ix < nx; ++ix)
285 const real_t val = X(ix + iy*nx + iz*nx*ny + c*ND, e);
286 for (
int jx = 0; jx < nx; ++jx)
288 xx[jx] += val*Bx[jx + ix*nx];
291 for (
int jy = 0; jy < ny; ++jy)
293 const real_t b = By[jy + iy*ny];
294 for (
int jx = 0; jx < nx; ++jx)
296 xy[jy][jx] += xx[jx] *
b;
300 for (
int jz = 0; jz < nz; ++jz)
302 const real_t b = Bz[jz + iz*nz];
303 for (
int jy = 0; jy < ny; ++jy)
305 for (
int jx = 0; jx < nx; ++jx)
307 Y(jx + jy*nx + jz*nx*ny + c*ND, e) += xy[jy][jx] *
b;
316void ChangeOfBasis_RT::Mult(
const Vector &x,
Vector &y, Mode mode)
const
318 if (no_op) { y = x;
return; }
337 elem_restr->
Mult(x_l, x_e);
339 if (dim == 2) {
MultRT_2D(x_e, y_e, mode); }
345 if (R) { R->
Mult(y_l, y); }
346 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)