Epetra Package Browser (Single Doxygen Collection) Development
Epetra_SerialComm.cpp
Go to the documentation of this file.
00001 
00002 //@HEADER
00003 // ************************************************************************
00004 //
00005 //               Epetra: Linear Algebra Services Package
00006 //                 Copyright 2011 Sandia Corporation
00007 //
00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009 // the U.S. Government retains certain rights in this software.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00039 //
00040 // ************************************************************************
00041 //@HEADER
00042 
00043 #include "Epetra_SerialComm.h"
00044 #include "Epetra_BasicDirectory.h"
00045 #include "Epetra_SerialDistributor.h"
00046 
00047 //=============================================================================
00048 Epetra_SerialComm::Epetra_SerialComm()
00049   : Epetra_Object("Epetra::Comm"),
00050     SerialCommData_(new Epetra_SerialCommData()) {}
00051 
00052 //=============================================================================
00053 Epetra_SerialComm::Epetra_SerialComm(const Epetra_SerialComm& Comm)
00054   : Epetra_Object(Comm.Label()),
00055     SerialCommData_(Comm.SerialCommData_)
00056 {
00057   SerialCommData_->IncrementReferenceCount();
00058 }
00059 //=============================================================================
00060 void Epetra_SerialComm::Barrier() const {}
00061 //=============================================================================
00062 int Epetra_SerialComm::Broadcast(double * Values, int Count, int Root) const {
00063   (void)Values;
00064   (void)Count;
00065   (void)Root;
00066   return(0);
00067 }
00068 //=============================================================================
00069 int Epetra_SerialComm::Broadcast(int * Values, int Count, int Root) const {
00070   (void)Values;
00071   (void)Count;
00072   (void)Root;
00073   return(0);
00074 }
00075 //=============================================================================
00076 int Epetra_SerialComm::Broadcast(long * Values, int Count, int Root) const {
00077   (void)Values;
00078   (void)Count;
00079   (void)Root;
00080   return(0);
00081 }
00082 //=============================================================================
00083 int Epetra_SerialComm::Broadcast(long long * Values, int Count, int Root) const{
00084   (void)Values;
00085   (void)Count;
00086   (void)Root;
00087   return(0);
00088 }
00089 //=============================================================================
00090 int Epetra_SerialComm::Broadcast(char * Values, int Count, int Root) const {
00091   (void)Values;
00092   (void)Count;
00093   (void)Root;
00094   return(0);
00095 }
00096 //=============================================================================
00097 int Epetra_SerialComm::GatherAll(double * MyVals, double * AllVals, int Count) const {
00098   for (int i=0; i<Count; ++i) AllVals[i] = MyVals[i];
00099   return(0);
00100 }
00101 //=============================================================================
00102 int Epetra_SerialComm::GatherAll(int * MyVals, int * AllVals, int Count) const {
00103   for (int i=0; i<Count; ++i) AllVals[i] = MyVals[i];
00104   return(0);
00105 }
00106 //=============================================================================
00107 int Epetra_SerialComm::GatherAll(long * MyVals, long * AllVals, int Count) const {
00108   for (int i=0; i<Count; ++i) AllVals[i] = MyVals[i];
00109   return(0);
00110 }
00111 //=============================================================================
00112 int Epetra_SerialComm::GatherAll(long long * MyVals, long long * AllVals, int Count) const {
00113   for (int i=0; i<Count; ++i) AllVals[i] = MyVals[i];
00114   return(0);
00115 }
00116 //=============================================================================
00117 int Epetra_SerialComm::SumAll(double * PartialSums, double * GlobalSums, int Count) const {
00118   for (int i=0; i<Count; i++) GlobalSums[i] = PartialSums[i];
00119   return(0);
00120 }
00121 //=============================================================================
00122 int Epetra_SerialComm::SumAll(int * PartialSums, int * GlobalSums, int Count) const {
00123   for (int i=0; i<Count; i++) GlobalSums[i] = PartialSums[i];
00124   return(0);
00125 }
00126 //=============================================================================
00127 int Epetra_SerialComm::SumAll(long * PartialSums, long * GlobalSums, int Count) const {
00128   for (int i=0; i<Count; i++) GlobalSums[i] = PartialSums[i];
00129   return(0);
00130 }
00131 //=============================================================================
00132 int Epetra_SerialComm::SumAll(long long * PartialSums, long long * GlobalSums, int Count) const {
00133   for (int i=0; i<Count; i++) GlobalSums[i] = PartialSums[i];
00134   return(0);
00135 }
00136 //=============================================================================
00137 int Epetra_SerialComm::MaxAll(double * PartialMaxs, double * GlobalMaxs, int Count) const {
00138   for (int i=0; i<Count; i++) GlobalMaxs[i] = PartialMaxs[i];
00139   return(0);
00140 }
00141 //=============================================================================
00142 int Epetra_SerialComm::MaxAll(int * PartialMaxs, int * GlobalMaxs, int Count) const {
00143   for (int i=0; i<Count; i++) GlobalMaxs[i] = PartialMaxs[i];
00144   return(0);
00145 }
00146 //=============================================================================
00147 int Epetra_SerialComm::MaxAll(long * PartialMaxs, long * GlobalMaxs, int Count) const {
00148   for (int i=0; i<Count; i++) GlobalMaxs[i] = PartialMaxs[i];
00149   return(0);
00150 }
00151 //=============================================================================
00152 int Epetra_SerialComm::MaxAll(long long * PartialMaxs, long long * GlobalMaxs, int Count) const {
00153   for (int i=0; i<Count; i++) GlobalMaxs[i] = PartialMaxs[i];
00154   return(0);
00155 }
00156 //=============================================================================
00157 int Epetra_SerialComm::MinAll(double * PartialMins, double * GlobalMins, int Count) const {
00158   for (int i=0; i<Count; i++) GlobalMins[i] = PartialMins[i];
00159   return(0);
00160 }
00161 //=============================================================================
00162 int Epetra_SerialComm::MinAll(int * PartialMins, int * GlobalMins, int Count) const {
00163   for (int i=0; i<Count; i++) GlobalMins[i] = PartialMins[i];
00164   return(0);
00165 }
00166 //=============================================================================
00167 int Epetra_SerialComm::MinAll(long * PartialMins, long * GlobalMins, int Count) const {
00168   for (int i=0; i<Count; i++) GlobalMins[i] = PartialMins[i];
00169   return(0);
00170 }
00171 //=============================================================================
00172 int Epetra_SerialComm::MinAll(long long * PartialMins, long long * GlobalMins, int Count) const {
00173   for (int i=0; i<Count; i++) GlobalMins[i] = PartialMins[i];
00174   return(0);
00175 }
00176 //=============================================================================
00177 int Epetra_SerialComm::ScanSum(double * MyVals, double * ScanSums, int Count) const {
00178   for (int i=0; i<Count; i++) ScanSums[i] = MyVals[i];
00179   return(0);
00180 }
00181 //=============================================================================
00182 int Epetra_SerialComm::ScanSum(int * MyVals, int * ScanSums, int Count) const {
00183   for (int i=0; i<Count; i++) ScanSums[i] = MyVals[i];
00184   return(0);
00185 }
00186 //=============================================================================
00187 int Epetra_SerialComm::ScanSum(long * MyVals, long * ScanSums, int Count) const {
00188   for (int i=0; i<Count; i++) ScanSums[i] = MyVals[i];
00189   return(0);
00190 }
00191 //=============================================================================
00192 int Epetra_SerialComm::ScanSum(long long * MyVals, long long * ScanSums, int Count) const {
00193   for (int i=0; i<Count; i++) ScanSums[i] = MyVals[i];
00194   return(0);
00195 }
00196 //=============================================================================
00197 Epetra_Distributor * Epetra_SerialComm::CreateDistributor() const {
00198 
00199   Epetra_Distributor * dist = dynamic_cast<Epetra_Distributor *>(new Epetra_SerialDistributor(*this));
00200   return(dist);
00201 }
00202 //=============================================================================
00203 Epetra_Directory * Epetra_SerialComm::CreateDirectory(const Epetra_BlockMap & map) const {
00204 
00205   Epetra_Directory * dir = dynamic_cast<Epetra_Directory *>(new Epetra_BasicDirectory(map));
00206   return(dir);
00207 }
00208 //=============================================================================
00209 Epetra_SerialComm::~Epetra_SerialComm()  {
00210   CleanupData();
00211 }
00212 //=============================================================================
00213 Epetra_SerialComm& Epetra_SerialComm::operator= (const Epetra_SerialComm & Comm) {
00214   if((this != &Comm) && (SerialCommData_ != Comm.SerialCommData_)) {
00215     CleanupData();
00216     SerialCommData_ = Comm.SerialCommData_;
00217     SerialCommData_->IncrementReferenceCount();
00218   }
00219   return(*this);
00220 }
00221 //=============================================================================
00222 void Epetra_SerialComm::CleanupData() {
00223   if(SerialCommData_ != 0) {
00224     SerialCommData_->DecrementReferenceCount();
00225     if(SerialCommData_->ReferenceCount() == 0) {
00226       delete SerialCommData_;
00227       SerialCommData_ = 0;
00228     }
00229   }
00230 }
00231 //=============================================================================
00232 int Epetra_SerialComm::ReferenceCount() const {
00233   return(SerialCommData_->ReferenceCount());
00234 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines