comobject_mpi.hpp

Go to the documentation of this file.
00001 /* Kernel Independent Fast Multipole Method
00002    Copyright (C) 2004 Lexing Ying, New York University
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation; either version 2, or (at your option)
00007 any later version.
00008 
00009 This program is distributed in the hope that it will be useful, but WITHOUT
00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00012 for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; see the file COPYING.  If not, write to the Free
00016 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00017 02111-1307, USA.  */
00018 #ifndef _COMOBJECT_HPP_
00019 #define _COMOBJECT_HPP_
00020 
00021 #include "common/commoninc.hpp"
00022 #include "petscsnes.h"
00023 
00024 using std::string;
00025 using std::map;
00026 
00028 class ComObject_MPI
00029 {
00030 protected:
00032   string _prefix;
00033 public:
00035   ComObject_MPI(const string& prefix): _prefix(prefix) {;}
00036   virtual ~ComObject_MPI() {;}
00037   //-------------------------
00039   const string& prefix() { return _prefix; }
00041   const MPI_Comm& mpiComm( ) const { return PETSC_COMM_WORLD; }
00043   int mpiRank() const { int rank; MPI_Comm_rank(PETSC_COMM_WORLD, &rank); return rank; }
00045   int mpiSize() const { int size; MPI_Comm_size(PETSC_COMM_WORLD, &size); return size; }
00046 };
00047 
00049 #define pC(fun)  { int ierr=fun; CHKERRQ(ierr); }
00050 
00051 #define pA(expr) { if(!(expr)) SETERRQ(1, "Assertion: "#expr" failed!"); }
00052 
00053 #endif

Generated on Sun Dec 4 21:12:40 2005 for fmm3d_mpi by  doxygen 1.4.5