Back to index

salome-med  6.5.0
Public Member Functions | Private Member Functions | Private Attributes
ParaMEDMEM::ExplicitMapping Class Reference

#include <ExplicitMapping.hxx>

Collaboration diagram for ParaMEDMEM::ExplicitMapping:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ExplicitMapping ()
 ~ExplicitMapping ()
void pushBackElem (std::pair< int, int > idistant)
void setDistantElem (int ilocal, std::pair< int, int > idistant)
int nbDistantDomains ()
std::pair< int, int > getDistantNumbering (int ielem) const
int getDistantDomain (int i)
int getNbDistantElems (int i)
int * serialize (int idproc)
void unserialize (int nbprocs, int *sizes, int nbtarget, int *targetrank, int *commbuffer)
int * getBufferIndex () const
int * getCounts () const

Private Member Functions

void computeNumbers ()

Private Attributes

std::vector< std::pair< int,
int > > 
_mapping
std::set< int > _distant_domains
int * _numbers
int * _domains
int * _comm_buffer
int * _buffer_index
int * _send_counts

Detailed Description

Definition at line 29 of file ExplicitMapping.hxx.


Constructor & Destructor Documentation

Definition at line 33 of file ExplicitMapping.hxx.

:_numbers(0), _domains(0), _comm_buffer(0) { }

Definition at line 35 of file ExplicitMapping.hxx.

    {
      if (_domains!=0) delete[] _domains;
      if (_numbers!=0) delete[] _numbers;
      if (_comm_buffer!=0) delete[] _comm_buffer;
    }

Member Function Documentation

void ParaMEDMEM::ExplicitMapping::computeNumbers ( ) [inline, private]

Definition at line 148 of file ExplicitMapping.hxx.

    {
      std::map <int,int> counts;
      if (_numbers==0)
        {
          _numbers=new int[nbDistantDomains()];
          _domains=new int[nbDistantDomains()];
          for (int i=0; i<(int)_mapping.size(); i++)
            {
              if ( counts.find(_mapping[i].first) == counts.end())
                counts.insert(std::make_pair(_mapping[i].first,1));
              else
                (counts[_mapping[i].first])++;
            }
          int counter=0;
          for (std::map<int,int>::const_iterator iter=counts.begin(); 
               iter!=counts.end(); 
               iter++)
            {
              _numbers[counter]=iter->second;
              _domains[counter]=iter->first;
              counter++;
            }
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 137 of file ExplicitMapping.hxx.

{ return _buffer_index; }

Here is the caller graph for this function:

int* ParaMEDMEM::ExplicitMapping::getCounts ( ) const [inline]

Definition at line 138 of file ExplicitMapping.hxx.

{ return _send_counts; }

Here is the caller graph for this function:

Definition at line 69 of file ExplicitMapping.hxx.

    {
      if (_domains==0)
        computeNumbers();

      return _domains[i];
    }

Here is the call graph for this function:

Here is the caller graph for this function:

std::pair<int,int> ParaMEDMEM::ExplicitMapping::getDistantNumbering ( int  ielem) const [inline]

Definition at line 64 of file ExplicitMapping.hxx.

    {
      return _mapping[ielem];
    }

Here is the caller graph for this function:

Definition at line 77 of file ExplicitMapping.hxx.

    {
      if (_numbers==0)
        computeNumbers();
      return _numbers[i];    
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 52 of file ExplicitMapping.hxx.

    {
      if (_distant_domains.empty())
        {
          for (std::vector <std::pair<int,int> >::const_iterator iter= _mapping.begin();
               iter!=_mapping.end();
               iter++)
            _distant_domains.insert(iter->first);
        }
      return _distant_domains.size();
    }

Here is the caller graph for this function:

void ParaMEDMEM::ExplicitMapping::pushBackElem ( std::pair< int, int >  idistant) [inline]

Definition at line 42 of file ExplicitMapping.hxx.

    {
      _mapping.push_back(idistant);
    }

Here is the caller graph for this function:

int* ParaMEDMEM::ExplicitMapping::serialize ( int  idproc) [inline]

Definition at line 84 of file ExplicitMapping.hxx.

    {
      _comm_buffer=new int[_mapping.size()*2];
      std::vector<int> offsets(_distant_domains.size());
      offsets[0]=0;
      for (int i=1; i<(int)_distant_domains.size();i++)
        offsets[i]=offsets[i-1]+_numbers[i-1];
      
      for (int i=0; i<(int)_mapping.size(); i++)
        {
          int offset= offsets[_mapping[i].first];
          _comm_buffer[offset*2]=idproc;
          _comm_buffer[offset*2+1]=_mapping[i].second;
          offsets[_mapping[i].first]++;
        }
      return _comm_buffer;
    }

Here is the caller graph for this function:

void ParaMEDMEM::ExplicitMapping::setDistantElem ( int  ilocal,
std::pair< int, int >  idistant 
) [inline]

Definition at line 47 of file ExplicitMapping.hxx.

    {
      _mapping[ilocal]=idistant;
    }
void ParaMEDMEM::ExplicitMapping::unserialize ( int  nbprocs,
int *  sizes,
int  nbtarget,
int *  targetrank,
int *  commbuffer 
) [inline]

Definition at line 102 of file ExplicitMapping.hxx.

    {
      int total_size=0;
      for (int i=0; i< nbprocs; i++)
        total_size+=sizes[i];
      
      _mapping.resize(total_size);
      _buffer_index=new int[total_size];
      int indmap=0;
      for (int i=0; i<nbprocs; i++)
        for (int ielem=0; ielem<sizes[i]; ielem++)
          {
            _mapping[indmap].first=i;
            _mapping[indmap].second=commbuffer[indmap*2+1];
            _buffer_index[indmap]=commbuffer[indmap*2+1];
            indmap++;
          }  
      _numbers=new int [nbtarget];
      _domains=new int [nbtarget];
      
      int index=0;      
      for (int i=0; i<nbtarget; i++)
        {
          if (sizes[targetrank[i]]>0)
            {
              _numbers[index]=sizes[targetrank[i]];
              _domains[index]=i;
              index++;
            }
        }
      _send_counts=new int[nbprocs];
      for (int i=0; i<nbprocs; i++)
        _send_counts[i]=sizes[i];
    }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 145 of file ExplicitMapping.hxx.

Definition at line 144 of file ExplicitMapping.hxx.

Definition at line 141 of file ExplicitMapping.hxx.

Definition at line 143 of file ExplicitMapping.hxx.

std::vector<std::pair<int,int> > ParaMEDMEM::ExplicitMapping::_mapping [private]

Definition at line 140 of file ExplicitMapping.hxx.

Definition at line 142 of file ExplicitMapping.hxx.

Definition at line 146 of file ExplicitMapping.hxx.


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