24 MFEM_VERIFY(lf->
Size() == fes.
GetVSize(),
"LinearForm size does not "
25 "match the number of vector dofs!");
32 for (
int k = 0; k < domain_integs.
Size(); ++k)
35 const Array<int> *domain_integs_marker_k = domain_integs_marker[k];
38 const bool has_markers_k = domain_integs_marker_k !=
nullptr;
43 MFEM_VERIFY(mesh_attributes_max == domain_integs_marker_k->
Size(),
44 "invalid element marker for domain linear form "
45 "integrator #" << k <<
", counting from zero");
53 const int NE = fes.
GetNE();
54 const auto attr = attributes.
Read();
55 const auto dimk = domain_integs_marker_k->
Read();
56 auto markers_w = markers.
Write();
59 markers_w[e] = dimk[attr[e]-1] == 1;
65 domain_integs[k]->AssembleDevice(fes, markers, b);
75 for (
int k = 0; k < boundary_integs.
Size(); ++k)
78 const Array<int> *boundary_integs_marker_k = boundary_integs_marker[k];
81 const bool has_markers_k = boundary_integs_marker_k !=
nullptr;
86 MFEM_VERIFY(bdr_attributes_max == boundary_integs_marker_k->
Size(),
87 "invalid boundary marker for boundary linear form "
88 "integrator #" << k <<
", counting from zero");
92 if (!has_markers_k) { bdr_markers.
HostReadWrite(); bdr_markers = 1; }
96 const int NBE = bdr_attributes.
Size();
97 const auto attr = bdr_attributes.
Read();
98 const auto attr_markers = boundary_integs_marker_k->
Read();
99 auto markers_w = bdr_markers.
Write();
102 markers_w[e] = attr_markers[attr[e]-1] == 1;
108 boundary_integs[k]->AssembleDevice(fes, bdr_markers, bdr_b);
123 const int NE = fes.
GetNE();
129 for (
int i = 0; i < NE; ++i) { attributes[i] = mesh.
GetAttribute(i); }
132 MFEM_VERIFY(elem_restrict_lex,
"Element restriction not available");
148 std::unordered_map<int,int> f_to_be;
149 for (
int i = 0; i < mesh.
GetNBE(); ++i)
154 MFEM_VERIFY(
size_t(nf_bdr) == f_to_be.size(),
"Incompatible sizes");
155 bdr_attributes.
SetSize(nf_bdr);
159 if (f_to_be.find(
f) != f_to_be.end())
161 const int be = f_to_be[
f];
171 MFEM_VERIFY(bdr_restrict_lex,
"Face restriction not available");
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
T * Write(bool on_dev=true)
Shortcut for mfem::Write(a.GetMemory(), a.Size(), on_dev).
const T * Read(bool on_dev=true) const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), on_dev).
T * HostReadWrite()
Shortcut for mfem::ReadWrite(a.GetMemory(), a.Size(), false).
static MemoryType GetMemoryType()
(DEPRECATED) Equivalent to GetDeviceMemoryType().
void AddMultTranspose(const Vector &x, Vector &y, const real_t a=1.0) const override=0
Add the E-vector degrees of freedom x to the L-vector degrees of freedom y.
Base class for operators that extracts Face degrees of freedom.
virtual void AddMultTranspose(const Vector &x, Vector &y, const real_t a=1.0) const override=0
Add the face degrees of freedom x to the element degrees of freedom y.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
int GetNE() const
Returns number of elements in the mesh.
const ElementRestrictionOperator * GetElementRestriction(ElementDofOrdering e_ordering) const
Return an Operator that converts L-vectors to E-vectors.
int GetNFbyType(FaceType type) const
Returns the number of faces according to the requested type.
Mesh * GetMesh() const
Returns the mesh.
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
virtual const FaceRestriction * GetFaceRestriction(ElementDofOrdering f_ordering, FaceType, L2FaceValues mul=L2FaceValues::DoubleValued) const
Return an Operator that converts L-vectors to E-vectors on each face.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
int GetAttribute(int i) const
Return the attribute of element i.
int GetBdrAttribute(int i) const
Return the attribute of boundary element i.
int GetBdrElementFaceIndex(int be_idx) const
Return the local face (codimension-1) index for the given boundary element index.
int GetNBE() const
Returns number of boundary elements.
Array< int > attributes
A list of all unique element attributes used by the Mesh.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
int Size() const
Returns the size of the vector.
virtual void UseDevice(bool use_dev) const
Enable execution of Vector operations using the mfem::Device.
void SetSize(int s)
Resize the vector to size s.
ElementDofOrdering
Constants describing the possible orderings of the DOFs in one element.
@ LEXICOGRAPHIC
Lexicographic ordering for tensor-product FiniteElements.
std::function< real_t(const Vector &)> f(real_t mass_coeff)
void forall(int N, lambda &&body)