12 #include "../../config/config.hpp" 39 MFEM_ABORT(
"Can't find a relation between the two GridFunctions");
62 root_gc_ = &root_fes_->GroupComm();
63 CommunicateIndicesSet(sub1_to_parent_map_, root_fes_->GetVSize());
65 z_.
SetSize(root_fes_->GetVSize());
80 CommunicateIndicesSet(sub1_to_parent_map_, dst.
Size());
96 MFEM_ABORT(
"Trying to do a transfer between GridFunctions but none of them is defined on a SubMesh");
106 for (
int i = 0; i < sub1_to_parent_map_.
Size(); i++)
108 dst(i) = src(sub1_to_parent_map_[i]);
118 for (
int i = 0; i < sub1_to_parent_map_.
Size(); i++)
120 dst(sub1_to_parent_map_[i]) = src(i);
123 CommunicateSharedVdofs(dst);
133 for (
int i = 0; i < sub2_to_parent_map_.
Size(); i++)
135 z_(sub2_to_parent_map_[i]) = dst(i);
138 for (
int i = 0; i < sub1_to_parent_map_.
Size(); i++)
140 z_(sub1_to_parent_map_[i]) = src(i);
143 CommunicateSharedVdofs(z_);
145 for (
int i = 0; i < sub2_to_parent_map_.
Size(); i++)
147 dst(i) = z_(sub2_to_parent_map_[i]);
152 MFEM_ABORT(
"unknown TransferCategory: " << category_);
156 void ParTransferMap::CommunicateIndicesSet(
Array<int> &map,
int dst_sz)
158 indices_set_local_.
SetSize(dst_sz);
159 indices_set_local_ = 0;
160 for (
int i = 0; i < map.
Size(); i++)
162 indices_set_local_[map[i]] = 1;
164 indices_set_global_ = indices_set_local_;
166 root_gc_->
Bcast(indices_set_global_);
169 void ParTransferMap::CommunicateSharedVdofs(
Vector &
f)
const 178 const int j = group_ldof.
GetJ()[i];
179 if (indices_set_global_[j] != 0 && indices_set_local_[j] == 0)
193 const int j = group_ldof.
GetJ()[i];
194 if (indices_set_global_[j] != 0)
196 f(j) /= indices_set_global_[j];
202 for (
int gr = 1; gr < group_ldof.
Size(); gr++)
204 for (
int i = 0; i < group_ldof.
RowSize(gr); i++)
206 const int j = group_ldof.
GetRow(gr)[i];
207 if (indices_set_global_[j] == 0)
214 root_gc_->
Bcast<
double>(
f.HostReadWrite());
217 #endif // MFEM_USE_MPI
void BuildVdofToVdofMap(const FiniteElementSpace &subfes, const FiniteElementSpace &parentfes, const SubMesh::From &from, const Array< int > &parent_element_ids, Array< int > &vdof_to_vdof_map)
Build the vdof to vdof mapping between two FiniteElementSpace objects.
const Array< int > & GetParentElementIDMap() const
Get the parent element id map.
void Bcast(T *ldata, int layout) const
Broadcast within each group where the master is the root.
void SetSize(int s)
Resize the vector to size s.
int Size() const
Returns the size of the vector.
Abstract parallel finite element space.
SubMesh::From GetFrom()
Get the From indicator.
Subdomain representation of a topological parent in another ParMesh.
double f(const Vector &xvec)
static void Sum(OpData< T >)
Reduce operation Sum, instantiated for int and double.
ParMesh * GetParMesh() const
static bool IsParSubMesh(const ParMesh *m)
Check if ParMesh m is a ParSubMesh.
void GetRow(int i, Array< int > &row) const
Return row i in array row (the Table must be finalized)
void Transfer(const ParGridFunction &src, ParGridFunction &dst) const
Transfer the source ParGridFunction to the destination ParGridFunction.
const GroupTopology & GetGroupTopology()
Get a reference to the associated GroupTopology object.
ParFiniteElementSpace * ParFESpace() const
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
GroupCommunicator & GroupComm()
Return a reference to the internal GroupCommunicator (on VDofs)
RT GetRootParent(const T &m)
Identify the root parent of a given SubMesh.
Table & GroupLDofTable()
Fill-in the returned Table reference to initialize the GroupCommunicator then call Finalize()...
int GetGroupSize(int g) const
Get the number of processors in a group.
int Size() const
Returns the number of TYPE I elements.
void Reduce(T *ldata, void(*Op)(OpData< T >)) const
Reduce within each group where the master is the root.
int Size_of_connections() const
int Size() const
Return the logical size of the array.
ParTransferMap(const ParGridFunction &src, const ParGridFunction &dst)
Construct a new ParTransferMap object which transfers degrees of freedom from the source ParGridFunct...
Class for parallel grid function.
Class for parallel meshes.