13 #include "../general/forall.hpp" 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();
57 MFEM_FORALL(e, NE, markers_w[e] = dimk[attr[e]-1] == 1;);
62 domain_integs[k]->AssembleDevice(fes, markers, b);
72 for (
int k = 0; k < boundary_integs.
Size(); ++k)
75 const Array<int> *boundary_integs_marker_k = boundary_integs_marker[k];
78 const bool has_markers_k = boundary_integs_marker_k !=
nullptr;
83 MFEM_VERIFY(bdr_attributes_max == boundary_integs_marker_k->
Size(),
84 "invalid boundary marker for boundary linear form " 85 "integrator #" << k <<
", counting from zero");
89 if (!has_markers_k) { bdr_markers.
HostReadWrite(); bdr_markers = 1; }
93 const int NBE = bdr_attributes.
Size();
94 const auto attr = bdr_attributes.
Read();
95 const auto attr_markers = boundary_integs_marker_k->
Read();
96 auto markers_w = bdr_markers.
Write();
97 MFEM_FORALL(e, NBE, markers_w[e] = attr_markers[attr[e]-1] == 1;);
102 boundary_integs[k]->AssembleDevice(fes, bdr_markers, bdr_b);
117 const int NE = fes.
GetNE();
123 for (
int i = 0; i < NE; ++i) { attributes[i] = mesh.
GetAttribute(i); }
126 MFEM_VERIFY(elem_restrict_lex,
"Element restriction not available");
142 std::unordered_map<int,int> f_to_be;
143 for (
int i = 0; i < mesh.
GetNBE(); ++i)
148 MFEM_VERIFY(
size_t(nf_bdr) == f_to_be.size(),
"Incompatible sizes");
149 bdr_attributes.
SetSize(nf_bdr);
153 if (f_to_be.find(
f) != f_to_be.end())
155 const int be = f_to_be[
f];
165 MFEM_VERIFY(bdr_restrict_lex,
"Face restriction not available");
const T * Read(bool on_dev=true) const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), on_dev).
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 ...
T * HostReadWrite()
Shortcut for mfem::ReadWrite(a.GetMemory(), a.Size(), false).
int GetBdrElementEdgeIndex(int i) const
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
void SetSize(int s)
Resize the vector to size s.
virtual void UseDevice(bool use_dev) const
Enable execution of Vector operations using the mfem::Device.
int Size() const
Returns the size of the vector.
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void AddMultTranspose(const Vector &x, Vector &y, const double a=1.0) const override=0
Add the E-vector degrees of freedom x to the L-vector degrees of freedom y.
int GetNBE() const
Returns number of boundary elements.
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.
int GetAttribute(int i) const
Return the attribute of element i.
double f(const Vector &xvec)
virtual void AddMultTranspose(const Vector &x, Vector &y, const double a=1.0) const override=0
Add the face degrees of freedom x to the element degrees of freedom y.
static MemoryType GetMemoryType()
(DEPRECATED) Equivalent to GetDeviceMemoryType().
int GetNE() const
Returns number of elements in the mesh.
int GetBdrAttribute(int i) const
Return the attribute of boundary element i.
Mesh * GetMesh() const
Returns the mesh.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
ElementDofOrdering
Constants describing the possible orderings of the DOFs in one element.
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
Lexicographic ordering for tensor-product FiniteElements.
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).
virtual const FaceRestriction * GetFaceRestriction(ElementDofOrdering e_ordering, FaceType, L2FaceValues mul=L2FaceValues::DoubleValued) const
Return an Operator that converts L-vectors to E-vectors on each face.
Base class for operators that extracts Face degrees of freedom.
Array< int > attributes
A list of all unique element attributes used by the Mesh.