fei_Aztec_BlockMap.cpp

00001 /*--------------------------------------------------------------------*/
00002 /*    Copyright 2005 Sandia Corporation.                              */
00003 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00004 /*    non-exclusive license for use of this work by or on behalf      */
00005 /*    of the U.S. Government.  Export of this program may require     */
00006 /*    a license from the United States Government.                    */
00007 /*--------------------------------------------------------------------*/
00008 
00009 #include <fei_trilinos_macros.hpp>
00010 #include <fei_iostream.hpp>
00011 
00012 #ifdef HAVE_FEI_AZTECOO
00013 
00014 #include <assert.h>
00015 #include <stdio.h>
00016 #include <stdlib.h>
00017 
00018 #include <fei_mpi.h>
00019 
00020 #ifndef FEI_SER
00021 
00022 #define AZTEC_MPI AZTEC_MPI
00023 #define AZ_MPI AZ_MPI
00024 #ifndef MPI
00025 #define MPI MPI
00026 #endif
00027 
00028 #endif
00029 
00030 #include <az_aztec.h>
00031 #include <fei_Aztec_Map.hpp>
00032 #include <fei_Aztec_BlockMap.hpp>
00033 
00034 namespace fei_trilinos {
00035 
00036 //==============================================================================
00037 Aztec_BlockMap::Aztec_BlockMap(int globalSz, int N_update, const int* update, int localOffs,
00038                           MPI_Comm comm,
00039                           int numGlobalBlocks, int numLocalBlocks,
00040                           const int* blkUpdate,
00041                           int localBlockOffset, int* blockSizes)
00042 
00043   : Aztec_Map(globalSz, N_update, update, localOffs, comm),
00044     numGlobalBlocks_(numGlobalBlocks),
00045     numLocalBlocks_(numLocalBlocks),
00046     localBlockOffset_(localBlockOffset)
00047 {
00048     checkInput();
00049 
00050     blockSizes_ = new int[numLocalBlocks_];
00051     blockUpdate_ = new int[numLocalBlocks_];
00052 
00053     for(int i=0; i<numLocalBlocks_; i++) {
00054         blockSizes_[i] = blockSizes[i];
00055         blockUpdate_[i] = blkUpdate[i];
00056     }
00057 }
00058  
00059 //==============================================================================
00060 Aztec_BlockMap::Aztec_BlockMap(const Aztec_BlockMap& map)
00061   : Aztec_Map(map.globalSize(), map.localSize(), &map.update[0], map.localOffset(),
00062               map.getCommunicator()),
00063     numGlobalBlocks_(map.numGlobalBlocks_),
00064     numLocalBlocks_(map.numLocalBlocks_),
00065     localBlockOffset_(map.localBlockOffset_)
00066 {
00067     blockSizes_ = new int[numLocalBlocks_];
00068     blockUpdate_ = new int[numLocalBlocks_];
00069 
00070     for(int i=0; i<numLocalBlocks_; i++) {
00071         blockSizes_[i] = map.blockSizes_[i];
00072         blockUpdate_[i] = map.blockUpdate_[i];
00073     }
00074 }
00075 
00076 //==============================================================================
00077 Aztec_BlockMap::~Aztec_BlockMap(void)  {
00078 
00079     delete [] blockSizes_;
00080     blockSizes_ = NULL;
00081 
00082     delete [] blockUpdate_;
00083     blockUpdate_ = NULL;
00084 
00085     numGlobalBlocks_ = 0;
00086     numLocalBlocks_ = 0;
00087     localBlockOffset_ = 0;
00088 }
00089 
00090 //==============================================================================
00091 void Aztec_BlockMap::checkInput() {
00092 
00093     if (numGlobalBlocks_ <= 0) {
00094        FEI_CERR << "Aztec_BlockMap: ERROR, numGlobalBlocks <= 0. Aborting."
00095             << FEI_ENDL;
00096        abort();
00097     }
00098 
00099     if (localBlockOffset_ < 0) {
00100        FEI_CERR << "Aztec_BlockMap: ERROR, negative localBlockOffset. Aborting."
00101             << FEI_ENDL;
00102        abort();
00103     }
00104 }
00105 
00106 }//namespace fei_trilinos
00107 
00108 #endif
00109 //HAVE_FEI_AZTECOO
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends
Generated on Wed Apr 13 10:08:23 2011 for FEI by  doxygen 1.6.3