fei_Aztec_Map.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 
00033 namespace fei_trilinos {
00034 
00035 //==============================================================================
00036 Aztec_Map::Aztec_Map(int globalSz, int localSz,
00037                      int localOffs, MPI_Comm comm)
00038   : globalSize_(globalSz),
00039     localSize_(localSz),
00040     localOffset_(localOffs),
00041     comm_(comm)
00042 {
00043     checkInput();
00044 
00045     proc_config_ = new int[AZ_PROC_SIZE];
00046     AZ_set_proc_config(proc_config_, comm_);
00047 }
00048  
00049 //==============================================================================
00050 Aztec_Map::Aztec_Map(const Aztec_Map& map) :
00051     globalSize_(map.globalSize_),
00052     localSize_(map.localSize_),
00053     localOffset_(map.localOffset_),
00054     comm_(map.comm_)
00055 {
00056     proc_config_ = new int[AZ_PROC_SIZE];
00057     AZ_processor_info(proc_config_);
00058 }
00059 
00060 //==============================================================================
00061 Aztec_Map::~Aztec_Map(void)  {
00062 
00063     globalSize_ = 0;
00064     localSize_ = 0;
00065     localOffset_ = 0;
00066 
00067     delete [] proc_config_;
00068     proc_config_ = NULL;
00069 }
00070 
00071 //==============================================================================
00072 void Aztec_Map::checkInput() {
00073 
00074     if (globalSize_ <= 0) {
00075         FEI_CERR << "Aztec_Map: ERROR, globalSize <= 0. Aborting." << FEI_ENDL;
00076         abort();
00077     }
00078 
00079     if (localSize_ < 0) {
00080         FEI_CERR << "Aztec_Map: ERROR, localSize negative. Aborting." << FEI_ENDL;
00081         abort();
00082     }
00083 
00084     if (localOffset_ < 0) {
00085         FEI_CERR << "Aztec_Map: ERROR, localOffset negative. Aborting." << FEI_ENDL;
00086         abort();
00087     }
00088 }
00089 
00090 }//namespace fei_trilinos
00091 
00092 #endif
00093 //HAVE_FEI_AZTECOO
00094 

Generated on Wed May 12 21:30:40 2010 for FEI by  doxygen 1.4.7