File: MeshDataBaseComm.h

package info (click to toggle)
madlib 1.3.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,196 kB
  • sloc: cpp: 39,851; sh: 10,041; makefile: 473
file content (61 lines) | stat: -rw-r--r-- 2,264 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// -*- C++ -*-
// -------------------------------------------------------------------
// MAdLib - Copyright (C) 2008-2009 Universite catholique de Louvain
//
// See the Copyright.txt and License.txt files for license information. 
// You should have received a copy of these files along with MAdLib. 
// If not, see <http://www.madlib.be/license/>
//
// Please report all bugs and problems to <contrib@madlib.be>
//
// Authors: Cecile Dobrzynski, Jean-Francois Remacle, Gaetan Compere
// -------------------------------------------------------------------

#ifndef _MeshDataBaseCOMM_H
#define _MeshDataBaseCOMM_H

#include "MeshDataBaseInterface.h"

/*
  MDB_DataExchanger is a class that allow user to exchange
  data's between partitions and/or periodic boundaries. User
  has to provide a tag for non synchronous communications. 
  Basically, choose a tag that is higher that 200 for being
  sure that it does not interact with internal messages.
  User has to allocate buffers using malloc.

  User will receive its datas.
*/

namespace MAd {

  class MDB_DataExchanger
  {
  private:
    int tagComm;
  public :
    // get a tag for the communication
    int tag() const { return tagComm; }
    // user allocates sends a message of _size size related to mesh entity pe to proc iProc
    virtual void * sendData (pEntity pe,       // in
                             int iProcDest ,   // in
                             int &_size ) = 0; // out
    // mesh entity pe recieves data *buf form proc iProc.
    // The user shall NOT delete the message !!
    virtual void receiveData (pEntity pe,       //in
                              int iProcSender , //in
                              void *buf ) = 0;  //in
    // In case the user has to delete a data when 'pe' is deleted
    virtual void deleteExternalData (pEntity pe) const {}
    MDB_DataExchanger(int _tag): tagComm(_tag) {}
    virtual ~MDB_DataExchanger() {}
  };
  void exchangeDataOnVertices (pMesh m, MDB_DataExchanger &de );
  void exchangeDataOnEdges    (pMesh m, MDB_DataExchanger &de );
  void exchangeDataOnFaces    (pMesh m, MDB_DataExchanger &de );
  void exchangeDataOnTriangles(pMesh m, MDB_DataExchanger &de );
  void exchangeDataOnQuads    (pMesh m, MDB_DataExchanger &de );

}

#endif