12 #include "../../config/config.hpp"
36 if (SubMeshUtils::GetRootParent<ParSubMesh, ParMesh>(*src_sm) !=
37 SubMeshUtils::GetRootParent<ParSubMesh, ParMesh>(*dst_sm))
39 MFEM_ABORT(
"Can't find a relation between the two GridFunctions");
45 *
const_cast<ParMesh *
>(SubMeshUtils::GetRootParent<ParSubMesh, ParMesh>
63 CommunicateIndicesSet(sub1_to_parent_map_, 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);
222 #endif // MFEM_USE_MPI
int Size() const
Return the logical size of the array.
void Reduce(T *ldata, void(*Op)(OpData< T >)) const
Reduce within each group where the master is the root.
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
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.
void Bcast(T *ldata, int layout) const
Broadcast within each group where the master is the root.
ParMesh * GetParMesh() const
void SetSize(int s)
Resize the vector to size s.
int GetGroupSize(int g) const
Get the number of processors in a group.
int Size() const
Returns the size of the vector.
void GetRow(int i, Array< int > &row) const
Return row i in array row (the Table must be finalized)
Abstract parallel finite element space.
SubMesh::From GetFrom()
Get the From indicator.
int Size_of_connections() const
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.
static bool IsParSubMesh(const ParMesh *m)
Check if ParMesh m is a ParSubMesh.
void Transfer(const ParGridFunction &src, ParGridFunction &dst) const
Transfer the source ParGridFunction to the destination ParGridFunction.
int Size() const
Returns the number of TYPE I elements.
const GroupTopology & GetGroupTopology()
Get a reference to the associated GroupTopology object.
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)
Table & GroupLDofTable()
Fill-in the returned Table reference to initialize the GroupCommunicator then call Finalize()...
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.
const Array< int > & GetParentElementIDMap() const
Get the parent element id map.
ParFiniteElementSpace * ParFESpace() const