def get_global_dof_component(global_dof, V, global_to_local=None, local_dof_to_component=None): if global_to_local is None: global_to_local = get_global_dof_to_local_dof_map(V, V.dofmap()) if local_dof_to_component is None: local_dof_to_component = get_local_dof_to_component_map(V) mpi_comm = V.mesh().mpi_comm() if not has_pybind11(): mpi_comm = mpi_comm.tompi4py() dof_component = None dof_component_processor = -1 if global_dof in global_to_local: dof_component = local_dof_to_component[global_to_local[global_dof]] dof_component_processor = mpi_comm.rank dof_component_processor = mpi_comm.allreduce(dof_component_processor, op=MAX) assert dof_component_processor >= 0 return mpi_comm.bcast(dof_component, root=dof_component_processor)
def get_global_dof_coordinates(global_dof, V, global_to_local=None, local_dof_to_coordinates=None): if global_to_local is None: global_to_local = get_global_dof_to_local_dof_map(V, V.dofmap()) if local_dof_to_coordinates is None: local_dof_to_coordinates = _get_local_dof_to_coordinates_map(V) mpi_comm = V.mesh().mpi_comm() dof_coordinates = None dof_coordinates_processor = -1 if global_dof in global_to_local: dof_coordinates = local_dof_to_coordinates[global_to_local[global_dof]] dof_coordinates_processor = mpi_comm.rank dof_coordinates_processor = mpi_comm.allreduce(dof_coordinates_processor, op=MAX) assert dof_coordinates_processor >= 0 return mpi_comm.bcast(dof_coordinates, root=dof_coordinates_processor)