parallel/pico/SubDomain.hpp

00001 // -*- C++ -*-
00002 //
00003 //  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00004 //
00005 //                                   Fehmi Cirak
00006 //                        California Institute of Technology
00007 //                           (C) 2004 All Rights Reserved
00008 //
00009 //  <LicenseText>
00010 //
00011 //  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00012 //
00013 // EDITED BY MATT GALLOWAY FOR USE WITH DAPTA
00014 
00015 #ifndef __SUBDOMAIN_HPP__
00016 #define __SUBDOMAIN_HPP__
00017 
00018 #include "CBuffer.hpp"
00019 
00020 namespace DAPTA { // Define namespace DAPTA
00021 
00022 namespace pico { // Define namespace pico
00023 
00024 template <typename V>
00025 class SubDomain {
00026    public:
00027       typedef V                             VertexType;
00028       typedef V*                            VertexHandle;
00029       
00030       SubDomain(const VertexType& lo, const VertexType& up, double maxElemSize=0.0);
00031       ~SubDomain();
00032       
00033       // memory management
00034       void allocateReceiveBuffer(const size_t& size);
00035       void registerSendBuffer(const char * const start, const size_t& size);
00036       
00037       // accessors
00038       VertexType lowerPoint() const { return _low; }
00039       VertexType upperPoint() const { return _upp; }
00040       
00041       void setSendMsgSize(const size_t& size) { _sendMsgSize=size; }
00042       
00043       int sendMsgSize() const    { return _sendMsgSize; }
00044       int recvBufferSize() const { return _rBuf->size(); }
00045       
00046       char* sendBuffer() { return _sBuf->start(); }
00047       char* recvBuffer() { return _rBuf->start(); }
00048       
00049       double maxElemSize() const { return _maxElemSize; }
00050       
00051       // intersection test
00052       bool checkOverlap(const SubDomain<V> * const b) const;
00053       
00054    private:
00055       // copy and equality constructor
00056       SubDomain(const SubDomain<V> &);
00057       const SubDomain<V> & operator=(const SubDomain<V> &);
00058    
00059    private:
00060       bool isIn(const VertexType& point) const;
00061    
00062    private:
00063       // lower and upper corner of bounding box
00064       VertexType   _low;
00065       VertexType   _upp;
00066       
00067       // max size of one finite element
00068       double       _maxElemSize;
00069       
00070       // buffers for mpi
00071       CBuffer      *_rBuf;
00072       CBuffer      *_sBuf;
00073       
00074       int          _sendMsgSize;
00075 };
00076 
00077 } // namespace pico
00078 
00079 } // namespace DAPTA
00080 
00081 #include "SubDomain.cpp"
00082 
00083 #endif

Generated on Tue May 29 17:13:49 2007 for DAPTA by  doxygen 1.5.1