MFEM v4.8.0
Finite element discretization library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
mfem::GSOPGSLIB Class Reference

Class for gather-scatter (gs) operations on Vectors based on corresponding global identifiers. More...

#include <gslib.hpp>

Public Types

enum  GSOp { ADD , MUL , MIN , MAX }
 Supported operation types. See class description. More...
 

Public Member Functions

 GSOPGSLIB (Array< long long > &ids)
 
 GSOPGSLIB (MPI_Comm comm_, Array< long long > &ids)
 
virtual ~GSOPGSLIB ()
 
void UpdateIdentifiers (const Array< long long > &ids)
 
void GS (Vector &senddata, GSOp op)
 

Protected Attributes

struct gslib::crystal * cr
 
struct gslib::comm * gsl_comm
 
struct gslib::gs_data * gsl_data = NULL
 
int num_ids
 

Detailed Description

Class for gather-scatter (gs) operations on Vectors based on corresponding global identifiers.

This functionality is useful for gs-ops on DOF values across processor boundary, where the global identifier would be the corresponding true DOF index. Operations currently supported are min, max, sum, and multiplication. Note: identifier 0 does not participate in the gather-scatter operation and a given identifier can be included multiple times on a given rank. For example, consider a vector, v:

  • v = [0.3, 0.4, 0.25, 0.7] on rank1,
  • v = [0.6, 0.1] on rank 2,
  • v = [-0.2, 0.3, 0.7, 0.] on rank 3.

Consider a corresponding Array<int>, a:

  • a = [1, 2, 3, 1] on rank 1,
  • a = [3, 2] on rank 2,
  • a = [1, 2, 0, 3] on rank 3.

A gather-scatter "minimum" operation, done as follows: GSOPGSLIB gs = GSOPGSLIB(MPI_COMM_WORLD, a); gs.GS(v, GSOp::MIN); would return into v:

  • v = [-0.2, 0.1, 0., -0.2] on rank 1,
  • v = [0., 0.1] on rank 2,
  • v = [-0.2, 0.1, 0.7, 0.] on rank 3, where the values have been compared across all processors based on the integer identifier.

Definition at line 459 of file gslib.hpp.

Member Enumeration Documentation

◆ GSOp

Supported operation types. See class description.

Enumerator
ADD 
MUL 
MIN 
MAX 

Definition at line 477 of file gslib.hpp.

Constructor & Destructor Documentation

◆ GSOPGSLIB() [1/2]

mfem::GSOPGSLIB::GSOPGSLIB ( Array< long long > & ids)

Definition at line 2567 of file gslib.cpp.

◆ GSOPGSLIB() [2/2]

mfem::GSOPGSLIB::GSOPGSLIB ( MPI_Comm comm_,
Array< long long > & ids )

Definition at line 2585 of file gslib.cpp.

◆ ~GSOPGSLIB()

mfem::GSOPGSLIB::~GSOPGSLIB ( )
virtual

Definition at line 2596 of file gslib.cpp.

Member Function Documentation

◆ GS()

void mfem::GSOPGSLIB::GS ( Vector & senddata,
GSOp op )

Gather-Scatter operation on senddata. Must match length of unique identifiers used in the constructor. See class description.

Definition at line 2621 of file gslib.cpp.

◆ UpdateIdentifiers()

void mfem::GSOPGSLIB::UpdateIdentifiers ( const Array< long long > & ids)

Update the identifiers used for the gather-scatter operator. Same ids get grouped together and id == 0 does not participate. See class description.

Definition at line 2605 of file gslib.cpp.

Member Data Documentation

◆ cr

struct gslib::crystal* mfem::GSOPGSLIB::cr
protected

Definition at line 462 of file gslib.hpp.

◆ gsl_comm

struct gslib::comm* mfem::GSOPGSLIB::gsl_comm
protected

Definition at line 463 of file gslib.hpp.

◆ gsl_data

struct gslib::gs_data* mfem::GSOPGSLIB::gsl_data = NULL
protected

Definition at line 464 of file gslib.hpp.

◆ num_ids

int mfem::GSOPGSLIB::num_ids
protected

Definition at line 465 of file gslib.hpp.


The documentation for this class was generated from the following files: