Epetra Package Browser (Single Doxygen Collection) Development
Epetra_C_wrappers.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 
00044 #include "Epetra_ConfigDefs.h"
00045 
00046 #ifdef EPETRA_MPI
00047 #include <mpi.h>
00048 #endif
00049 
00050 #include "Epetra_Object.h"
00051 #include "Epetra_Comm.h"
00052 #include "Epetra_SerialComm.h"
00053 #include "Epetra_Map.h"
00054 #include "Epetra_LocalMap.h"
00055 #include "Epetra_BlockMap.h"
00056 #include "Epetra_MultiVector.h"
00057 #include "Epetra_Vector.h"
00058 #include "Epetra_VbrMatrix.h"
00059 #include "Epetra_CrsMatrix.h"
00060 #include "Epetra_C_wrappers.h"
00061 #ifdef EPETRA_MPI
00062 #  include "Epetra_MpiComm.h"
00063 #endif
00064 
00066 //                  Epetra_Comm                    //
00068 
00069 #ifdef EPETRA_MPI
00070   EPETRA_OBJECT_PTR MANGLE(epetra_mpicomm_create1)() {
00071     Epetra_Comm *comm_ = new Epetra_MpiComm(MPI_COMM_WORLD);
00072     return((EPETRA_OBJECT_PTR ) comm_);
00073   }
00074   EPETRA_OBJECT_PTR MANGLE(epetra_mpicomm_create2)(MPI_Comm * comm) {
00075     Epetra_Comm *comm_ = new Epetra_MpiComm(*comm);
00076     return((EPETRA_OBJECT_PTR ) comm_);
00077   }
00078 #endif
00079 
00080   EPETRA_OBJECT_PTR MANGLE(epetra_serialcomm_create)() {
00081     Epetra_Comm *comm = new Epetra_SerialComm();
00082     return((EPETRA_OBJECT_PTR ) comm);
00083   }
00084 
00085   int MANGLE(epetra_comm_mypid)(EPETRA_OBJECT_REF comm) {
00086     Epetra_Comm *comm_ = (Epetra_Comm *) comm;
00087     return(comm_->MyPID());
00088   
00089   }
00090   int MANGLE(epetra_comm_numproc)(EPETRA_OBJECT_REF comm) {
00091     Epetra_Comm* comm_ = (Epetra_Comm *) comm;
00092     return(comm_->NumProc());
00093   
00094   }
00095 
00096   void MANGLE(epetra_comm_barrier)(EPETRA_OBJECT_REF comm) {
00097     Epetra_Comm* comm_ = (Epetra_Comm *) comm;
00098     comm_->Barrier();
00099   
00100   }
00101 
00102   void MANGLE(epetra_comm_destroy)(EPETRA_OBJECT_REF comm) {
00103     delete (Epetra_Comm *) comm;
00104   }
00105 
00107   //                  Epetra_Map                     //
00109 
00110 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00111   EPETRA_OBJECT_PTR MANGLE(epetra_map_create1)(EPETRA_INT numGlobalElements,
00112                  EPETRA_INT indexBase,
00113                  EPETRA_OBJECT_REF comm) {
00114     Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
00115     Epetra_Map *map = new Epetra_Map(EPETRA_DEREF(numGlobalElements), EPETRA_DEREF(indexBase), comm_);
00116     return((EPETRA_OBJECT_PTR ) map);
00117   }
00118 
00119   EPETRA_OBJECT_PTR MANGLE(epetra_map_create2)(EPETRA_INT numGlobalElements,
00120                  EPETRA_INT numMyElements,
00121                  EPETRA_INT indexBase,
00122                  EPETRA_OBJECT_REF comm) {
00123     Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
00124     Epetra_Map *map = new Epetra_Map(EPETRA_DEREF(numGlobalElements), EPETRA_DEREF(numMyElements), 
00125              EPETRA_DEREF(indexBase), comm_);
00126     return((EPETRA_OBJECT_PTR ) map);
00127   }
00128 
00129   EPETRA_OBJECT_PTR MANGLE(epetra_map_create3)(EPETRA_INT numGlobalElements,
00130                  EPETRA_INT numLocalElements,
00131                  int *updateList, 
00132                  EPETRA_INT indexBase,
00133                  EPETRA_OBJECT_REF comm) {
00134     Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
00135     Epetra_Map *map = new Epetra_Map(EPETRA_DEREF(numGlobalElements), EPETRA_DEREF(numLocalElements),
00136              updateList, EPETRA_DEREF(indexBase), comm_);
00137     return((EPETRA_OBJECT_PTR ) map);
00138   }
00139 #endif
00140 
00141 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00142   EPETRA_OBJECT_PTR MANGLE(epetra_map_create1_64)(EPETRA_LONG_LONG numGlobalElements,
00143                  EPETRA_LONG_LONG indexBase,
00144                  EPETRA_OBJECT_REF comm) {
00145     Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
00146     Epetra_Map *map = new Epetra_Map(EPETRA_DEREF(numGlobalElements), EPETRA_DEREF(indexBase), comm_);
00147     return((EPETRA_OBJECT_PTR ) map);
00148   }
00149 
00150   EPETRA_OBJECT_PTR MANGLE(epetra_map_create2_64)(EPETRA_LONG_LONG numGlobalElements,
00151                  EPETRA_INT numMyElements,
00152                  EPETRA_LONG_LONG indexBase,
00153                  EPETRA_OBJECT_REF comm) {
00154     Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
00155     Epetra_Map *map = new Epetra_Map(EPETRA_DEREF(numGlobalElements), EPETRA_DEREF(numMyElements), 
00156              EPETRA_DEREF(indexBase), comm_);
00157     return((EPETRA_OBJECT_PTR ) map);
00158   }
00159 
00160   EPETRA_OBJECT_PTR MANGLE(epetra_map_create3_64)(EPETRA_LONG_LONG numGlobalElements,
00161                  EPETRA_INT numLocalElements,
00162                  long long *updateList, 
00163                  EPETRA_LONG_LONG indexBase,
00164                  EPETRA_OBJECT_REF comm) {
00165     Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
00166     Epetra_Map *map = new Epetra_Map(EPETRA_DEREF(numGlobalElements), EPETRA_DEREF(numLocalElements),
00167              updateList, EPETRA_DEREF(indexBase), comm_);
00168     return((EPETRA_OBJECT_PTR ) map);
00169   }
00170 #endif
00171 
00172   int MANGLE(epetra_map_nummyelements)(EPETRA_OBJECT_REF map) {
00173     Epetra_Map * map_ = (Epetra_Map *) map;
00174     return(map_->NumMyElements());
00175   }
00176 
00177   long long MANGLE(epetra_map_numglobalelements)(EPETRA_OBJECT_REF map) {
00178     Epetra_Map * map_ = (Epetra_Map *) map;
00179     return(map_->NumGlobalElements64());
00180   }
00181 #ifndef EPETRA_FORTRAN  /* Fortran cannot receive a pointer to int */
00182 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00183   int * MANGLE(epetra_map_myglobalelements)(EPETRA_OBJECT_REF map) {
00184     Epetra_Map * map_ = (Epetra_Map *) map;
00185     return(map_->MyGlobalElements());
00186   }
00187 #endif
00188 
00189 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00190   long long * MANGLE(epetra_map_myglobalelements_64)(EPETRA_OBJECT_REF map) {
00191     Epetra_Map * map_ = (Epetra_Map *) map;
00192     return(map_->MyGlobalElements64());
00193   }
00194 #endif
00195 #endif
00196 
00197   EPETRA_OBJECT_PTR MANGLE(epetra_map_comm)(EPETRA_OBJECT_REF map) {
00198     Epetra_Map * map_ = (Epetra_Map *) map;
00199     return((EPETRA_OBJECT_PTR) &(map_->Comm()));
00200   }
00201 
00202   void MANGLE(epetra_map_destroy)(EPETRA_OBJECT_REF map)
00203   {
00204     delete (Epetra_Map *) map;
00205   }
00206 
00208   //                  Epetra_Vector                  //
00210 
00211   EPETRA_OBJECT_PTR MANGLE(epetra_vector_create1)(EPETRA_OBJECT_REF map) {
00212     Epetra_Map& map_ = *(Epetra_Map *) map;
00213     Epetra_Vector *vector = new Epetra_Vector(map_);
00214     return((EPETRA_OBJECT_PTR ) vector);
00215   }
00216 
00217   EPETRA_OBJECT_PTR MANGLE(epetra_vector_create2)(EPETRA_INT CopyValues, EPETRA_OBJECT_REF map,
00218               double * V) {
00219     Epetra_DataAccess CV = View;
00220     if (EPETRA_DEREF(CopyValues)==1) CV = Copy;
00221     Epetra_Map& map_ = *(Epetra_Map *) map;
00222     Epetra_Vector *vector = new Epetra_Vector(CV, map_, V);
00223     return((EPETRA_OBJECT_PTR ) vector);
00224   }
00225 
00226   int MANGLE(epetra_vector_putscalar)(EPETRA_OBJECT_REF x, EPETRA_DOUBLE scalar) {
00227     Epetra_Vector *x_ = (Epetra_Vector *) x;
00228     return(x_->PutScalar(EPETRA_DEREF(scalar)));
00229   }
00230 
00231   int MANGLE(epetra_vector_norm1)(EPETRA_OBJECT_REF x, double *scalar) {
00232     Epetra_Vector *x_ = (Epetra_Vector *) x;
00233     return(x_->Norm1(scalar));
00234   }
00235 
00236   int MANGLE(epetra_vector_norm2)(EPETRA_OBJECT_REF x, double *scalar) {
00237     Epetra_Vector *x_ = (Epetra_Vector *) x;
00238     return(x_->Norm2(scalar));
00239   }
00240 
00241   int MANGLE(epetra_vector_random)(EPETRA_OBJECT_REF x) {
00242     Epetra_Vector *x_ = (Epetra_Vector *) x;
00243     return(x_->Random());
00244   }
00245 
00246   int MANGLE(epetra_vector_update)(EPETRA_OBJECT_REF x, EPETRA_DOUBLE scalara, EPETRA_OBJECT_REF a, 
00247            EPETRA_DOUBLE scalarb, EPETRA_OBJECT_REF b, EPETRA_DOUBLE scalarx) {
00248     Epetra_Vector *x_ = (Epetra_Vector *) x;
00249     Epetra_Vector& a_ = *(Epetra_Vector *) a;
00250     Epetra_Vector& b_ = *(Epetra_Vector *) b;
00251     return(x_->Update(EPETRA_DEREF(scalara), a_, EPETRA_DEREF(scalarb), b_, EPETRA_DEREF(scalarx)));
00252   }
00253 
00254   void MANGLE(epetra_vector_print)(EPETRA_OBJECT_REF x) {
00255     std::cout << *(Epetra_Vector *) x;
00256   }
00257 
00258   void MANGLE(epetra_vector_destroy)(EPETRA_OBJECT_REF x) {
00259     delete (Epetra_Vector *) x;
00260   }
00261 
00263 #ifdef SKIP4NOW /* Comment this out for now */
00264 
00265   //                  Epetra_DVBR_Matrix         //
00267 
00268 
00269   EPETRA_OBJECT_PTR MANGLE(epetra_rdp_dvbr_matrix_create)
00270     (EPETRA_MAP rowmap)
00271   {
00272     Epetra_BlockMap& rowmap_ = *(Epetra_BlockMap *) rowmap;
00273     Epetra_DVBR_Matrix *B = new Epetra_DVBR_Matrix(rowmap_);
00274     return((EPETRA_OBJECT_PTR) B);
00275   }
00276 
00277   int MANGLE(epetra_rdp_dvbr_matrix_allocate)
00278     (EPETRA_MATRIX A, int* numNzBlks, int* blkColInds)
00279   {
00280     Epetra_DVBR_Matrix *B = (Epetra_DVBR_Matrix *) A;
00281     return(B->allocate(numNzBlks, blkColInds));
00282   }
00283   int MANGLE(epetra_rdp_dvbr_matrix_putblockrow)
00284     (EPETRA_MATRIX A, EPETRA_INT blk_row, EPETRA_INT num_nz_blocks, 
00285      double* vals, int* blk_col_inds)
00286   {
00287     Epetra_DVBR_Matrix *B = (Epetra_DVBR_Matrix *) A;
00288     return(B->putBlockRow( EPETRA_DEREF(blk_row), EPETRA_DEREF(num_nz_blocks), vals, 
00289          blk_col_inds));
00290   }
00291 
00292   int MANGLE(epetra_rdp_dvbr_matrix_fillcomplete)(EPETRA_MATRIX A)
00293   {
00294     Epetra_DVBR_Matrix *B = (Epetra_DVBR_Matrix *) A;
00295     return(B->fillComplete());
00296   }
00297 
00298   int MANGLE(epetra_rdp_dvbr_matrix_matvec)(EPETRA_MATRIX A, EPETRA_VECTOR x,
00299               EPETRA_VECTOR y)
00300   {
00301     Epetra_DVBR_Matrix *B = (Epetra_DVBR_Matrix *) A;
00302     const Epetra_Vector& x1 = *(Epetra_Vector *) x;
00303     Epetra_Vector& y1 = *(Epetra_Vector *) y;
00304     return(B->matvec(x1, y1));
00305   }
00306 
00307   int MANGLE(epetra_rdp_dvbr_matrix_matmultivec)(EPETRA_MATRIX A,
00308              EPETRA_MULTIVECTOR x,
00309              EPETRA_MULTIVECTOR y)
00310   {
00311     Epetra_DVBR_Matrix *B = (Epetra_DVBR_Matrix *) A;
00312     const Epetra_MultiVector& x1 = *(Epetra_MultiVector *) x;
00313     Epetra_MultiVector& y1 = *(Epetra_MultiVector *) y;
00314     return(B->matvec(x1, y1));
00315   }
00316 
00317   void MANGLE(epetra_rdp_dvbr_matrix_destroy)(EPETRA_MATRIX A)
00318   {
00319     delete (Epetra_DVBR_Matrix *) A;
00320   }
00321 
00323   //                  Epetra_DCRS_Matrix         //
00325 
00326 
00327   EPETRA_OBJECT_PTR MANGLE(epetra_rdp_dcrs_matrix_create) (EPETRA_MAP rowmap)
00328   {
00329     Epetra_Map& rowmap_ = *(Epetra_Map *) rowmap;
00330     Epetra_DCRS_Matrix *B = new Epetra_DCRS_Matrix(rowmap_);
00331     return((EPETRA_OBJECT_PTR) B);
00332   }
00333 
00334   int MANGLE(epetra_rdp_dcrs_matrix_allocate)
00335     (EPETRA_MATRIX A, int* rowLengths)
00336   {
00337     Epetra_DCRS_Matrix *B = (Epetra_DCRS_Matrix *) A;
00338     return(B->allocate(rowLengths));
00339   }
00340   int MANGLE(epetra_rdp_dcrs_matrix_putrow)(EPETRA_MATRIX A, EPETRA_INT row,
00341               EPETRA_INT num_nz, 
00342               double* vals, int* col_inds)
00343   {
00344     Epetra_DCRS_Matrix *B = (Epetra_DCRS_Matrix *) A;
00345     return(B->putRow( EPETRA_DEREF(row), EPETRA_DEREF(num_nz), vals, col_inds));
00346   }
00347 
00348   int MANGLE(epetra_rdp_dcrs_matrix_sumintodiagonal)
00349     (EPETRA_MATRIX A, double* diagonal)
00350   {
00351     Epetra_DCRS_Matrix *B = (Epetra_DCRS_Matrix *) A;
00352     return(B->sumIntoDiagonal( diagonal));
00353   }
00354 
00355   int MANGLE(epetra_rdp_dcrs_matrix_fillcomplete)(EPETRA_MATRIX A)
00356   {
00357     Epetra_DCRS_Matrix *B = (Epetra_DCRS_Matrix *) A;
00358     return(B->fillComplete());
00359   }
00360 
00361   int MANGLE(epetra_rdp_dcrs_matrix_matvec)(EPETRA_MATRIX A, EPETRA_VECTOR x,
00362               EPETRA_VECTOR y)
00363   {
00364     Epetra_DCRS_Matrix *B = (Epetra_DCRS_Matrix *) A;
00365     const Epetra_Vector& x1 = *(Epetra_Vector *) x;
00366     Epetra_Vector& y1 = *(Epetra_Vector *) y;
00367     return(B->matvec(x1, y1));
00368   }
00369 
00370   int MANGLE(epetra_rdp_dcrs_matrix_matmultivec)(EPETRA_MATRIX A,
00371              EPETRA_MULTIVECTOR x,
00372              EPETRA_MULTIVECTOR y)
00373   {
00374     Epetra_DCRS_Matrix *B = (Epetra_DCRS_Matrix *) A;
00375     const Epetra_MultiVector& x1 = *(Epetra_MultiVector *) x;
00376     Epetra_MultiVector& y1 = *(Epetra_MultiVector *) y;
00377     return(B->matvec(x1, y1));
00378   }
00379 
00380 
00381   void MANGLE(epetra_rdp_dcrs_matrix_destroy)(EPETRA_MATRIX A)
00382   {
00383     delete (Epetra_DCRS_Matrix *) A;
00384   }
00385 
00386   //                  Epetra_MultiVector         //
00388 
00389   EPETRA_OBJECT_PTR MANGLE(epetra_rdp_multivector_create)()
00390   {
00391     Epetra_MultiVector *vector = new Epetra_MultiVector();
00392     return((EPETRA_OBJECT_PTR) vector);
00393   }
00394 
00395   EPETRA_OBJECT_PTR MANGLE(epetra_rdp_multivector_create1)
00396     (EPETRA_MAP map, EPETRA_INT numVectors)
00397   {
00398     Epetra_Map& map_ = *(Epetra_Map *) map;
00399     Epetra_MultiVector *vector = new Epetra_MultiVector(map_, EPETRA_DEREF(numVectors));
00400     return((EPETRA_OBJECT_PTR) vector);
00401   }
00402 
00403   EPETRA_OBJECT_PTR MANGLE(epetra_rdp_multivector_create2)(EPETRA_MAP map, 
00404                     double *A, EPETRA_INT lda, EPETRA_INT numVectors)
00405   {
00406     Epetra_Map& map_ = *(Epetra_Map *) map;
00407     Epetra_MultiVector *vector = new Epetra_MultiVector(map_, A, EPETRA_DEREF(lda),
00408               EPETRA_DEREF(numVectors));
00409     return((EPETRA_OBJECT_PTR) vector);
00410   }
00411 
00412   EPETRA_OBJECT_PTR MANGLE(epetra_rdp_multivector_create3)(EPETRA_MAP map, 
00413                     double **in_multiVector, EPETRA_INT numVectors)
00414   {
00415     Epetra_Map& map_ = *(Epetra_Map *) map;
00416     Epetra_MultiVector *vector = new Epetra_MultiVector(map_, in_multiVector,
00417               EPETRA_DEREF(numVectors));
00418     return((EPETRA_OBJECT_PTR) vector);
00419   }
00420 
00421   EPETRA_OBJECT_PTR MANGLE(epetra_rdp_multivector_create4)
00422     (EPETRA_MULTIVECTOR in_multiVector)
00423   {
00424     Epetra_MultiVector & in_multiVector_ = *(Epetra_MultiVector *) in_multiVector;
00425     Epetra_MultiVector *vector = new Epetra_MultiVector(in_multiVector_);
00426     return((EPETRA_OBJECT_PTR) vector);
00427   }
00428 
00429   EPETRA_OBJECT_PTR MANGLE(epetra_rdp_multivector_create5)(EPETRA_MULTIVECTOR 
00430                     in_multiVector, EPETRA_INT numVectors, int *vecIndices)
00431   {
00432     Epetra_MultiVector & in_multiVector_ = *(Epetra_MultiVector *) in_multiVector;
00433     Epetra_MultiVector *vector = new Epetra_MultiVector(in_multiVector_,
00434               EPETRA_DEREF(numVectors), vecIndices));
00435   return((EPETRA_OBJECT_PTR) vector);
00436 }
00437 
00438 EPETRA_OBJECT_PTR MANGLE(epetra_rdp_multivector_create6)(EPETRA_MULTIVECTOR
00439                   in_multiVector, EPETRA_INT startindex, EPETRA_INT numvectors)
00440 {
00441   Epetra_MultiVector & in_multiVector_ = *(Epetra_MultiVector *) in_multiVector;
00442   Epetra_MultiVector *vector = new Epetra_MultiVector(in_multiVector_, EPETRA_DEREF(startindex),
00443                   EPETRA_DEREF(numvectors));
00444   return((EPETRA_OBJECT_PTR) vector);
00445 }
00446 
00447 int MANGLE(epetra_rdp_multivector_putmultivector)
00448   (EPETRA_MULTIVECTOR multiVector, 
00449    double **in_multiVector)
00450 {
00451   Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
00452   const double ** t = (const double **) in_multiVector;
00453   return(multiVector_->putMultiVector(t));
00454 }
00455 
00456 int MANGLE(epetra_rdp_multivector_allocate)(EPETRA_MULTIVECTOR multiVector, 
00457               EPETRA_MAP map, EPETRA_INT numVectors)
00458 {
00459   Epetra_Map& map_ = *(Epetra_Map *) map;
00460   Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
00461   return(multiVector_->allocate(map_, EPETRA_DEREF(numVectors)));
00462 }
00463 
00464 int MANGLE(epetra_rdp_multivector_putscalar)
00465   (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar)
00466 {
00467   Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
00468   return(multiVector_->putScalar(EPETRA_DEREF(scalar)));
00469 }
00470 
00471 int MANGLE(epetra_rdp_multivector_scale)
00472   (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar)
00473 {
00474   Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
00475   return(multiVector_->scale(EPETRA_DEREF(scalar)));
00476 }
00477 
00478 int MANGLE(epetra_rdp_multivector_scalecopy)
00479   (EPETRA_MULTIVECTOR multiVector, EPETRA_MULTIVECTOR multiVector_in,
00480    EPETRA_DOUBLE scalar)
00481 {
00482   Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
00483   Epetra_MultiVector& multiVector_in_ = *(Epetra_MultiVector *) multiVector_in;
00484   return(multiVector_->scaleCopy(multiVector_in_, EPETRA_DEREF(scalar)));
00485 }
00486 
00487 int MANGLE(epetra_rdp_multivector_dotprod)
00488   (EPETRA_MULTIVECTOR multiVector, EPETRA_MULTIVECTOR multiVector_in,
00489    double *scalar)
00490 {
00491   Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
00492   Epetra_MultiVector& multiVector_in_ = *(Epetra_MultiVector *) multiVector_in;
00493   return(multiVector_->dotProd(multiVector_in_, scalar));
00494 }
00495 
00496 int MANGLE(epetra_rdp_multivector_addvec)
00497   (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar, 
00498    EPETRA_MULTIVECTOR multiVector_in)
00499 {
00500   Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
00501   Epetra_MultiVector& multiVector_in_ = *(Epetra_MultiVector *) multiVector_in;
00502   return(multiVector_->addVec(EPETRA_DEREF(scalar), multiVector_in_)));
00503 }
00504 
00505 int MANGLE(epetra_rdp_multivector_norm1)
00506   (EPETRA_MULTIVECTOR multiVector, double *scalar)
00507 {
00508   Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
00509   return(multiVector_->norm1(scalar));
00510 }
00511 
00512 int MANGLE(epetra_rdp_multivector_norm2)
00513   (EPETRA_MULTIVECTOR multiVector, double *scalar)
00514 {
00515   Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
00516   return(multiVector_->norm2(scalar));
00517 }
00518 
00519 int MANGLE(epetra_rdp_multivector_lincomb)(EPETRA_MULTIVECTOR multiVector,
00520              EPETRA_MULTIVECTOR b, 
00521              EPETRA_DOUBLE scalar, EPETRA_MULTIVECTOR c)
00522 {
00523   Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
00524   Epetra_MultiVector& b_ = *(Epetra_MultiVector *) b;
00525   Epetra_MultiVector& c_ = *(Epetra_MultiVector *) c;
00526   return(multiVector_->linComb(b_,EPETRA_DEREF(scalar,c_)));
00527 }
00528 
00529 int MANGLE(epetra_rdp_multivector_random)
00530   (EPETRA_MULTIVECTOR multiVector)
00531 {
00532   Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
00533   return(multiVector_->random());
00534 }
00535 
00536 int MANGLE(epetra_rdp_multivector_reduce)(EPETRA_MULTIVECTOR multiVector)
00537 {
00538   Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
00539   return(multiVector_->reduce());
00540 }
00541 
00542 int MANGLE(epetra_rdp_multivector_numvectors)(EPETRA_MULTIVECTOR multiVector)
00543 {
00544   Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
00545   return(multiVector_->numVectors());
00546 }
00547 
00548 int MANGLE(epetra_rdp_multivector_gemm)(EPETRA_MULTIVECTOR multiVector,
00549           EPETRA_INT transa, EPETRA_INT transb, EPETRA_DOUBLE alpha,
00550           EPETRA_MULTIVECTOR A, EPETRA_MULTIVECTOR B,
00551           EPETRA_DOUBLE beta )
00552 {
00553   Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
00554   Epetra_MultiVector& A_ = *(Epetra_MultiVector *) A;
00555   Epetra_MultiVector& B_ = *(Epetra_MultiVector *) B;
00556   bool transa_ = !(EPETRA_DEREF(transa==0));
00557   bool transb_ = !(EPETRA_DEREF(transb==0));
00558   return(multiVector_->GEMM(transa_, transb_, EPETRA_DEREF(alpha), A_, B_, EPETRA_DEREF(beta)));
00559 }
00560 
00561 void MANGLE(epetra_rdp_multivector_destroy)(EPETRA_MULTIVECTOR multiVector)
00562 {
00563   delete (Epetra_MultiVector *) multiVector;
00564 }
00565 
00567 //                  Epetra_BlockMap                //
00569 
00570 EPETRA_OBJECT_PTR MANGLE(epetra_blockmap_create1)(
00571               EPETRA_INT numGlobalElements, EPETRA_INT numLocalElements, int *updateList,
00572               EPETRA_INT numGlobalBlocks, EPETRA_INT numLocalBlocks, 
00573               int *blockUpdateList,
00574               int* blockSizes, EPETRA_INT indexBase, EPETRA_COMM comm)
00575 {
00576   Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
00577   Epetra_BlockMap *blockmap = new Epetra_BlockMap(EPETRA_DEREF(numGlobalElements),
00578               EPETRA_DEREF(numLocalElements), updateList,
00579               EPETRA_DEREF(numGlobalBlocks), EPETRA_DEREF(numLocalBlocks),
00580               blockUpdateList,
00581               blockSizes, EPETRA_DEREF(indexBase), comm_);
00582   return((EPETRA_OBJECT_PTR ) blockmap);
00583 }
00584 
00585 EPETRA_OBJECT_PTR MANGLE(epetra_blockmap_create2)(
00586               EPETRA_INT numGlobalBlocks, EPETRA_INT numLocalBlocks, 
00587               int *blockUpdateList,
00588               int* blockSizes, EPETRA_INT indexBase, EPETRA_COMM comm)
00589 {
00590   Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
00591   Epetra_BlockMap *blockmap = new Epetra_BlockMap(
00592               EPETRA_DEREF(numGlobalBlocks), EPETRA_DEREF(numLocalBlocks), 
00593               blockUpdateList,
00594               blockSizes, EPETRA_DEREF(indexBase), comm_);
00595   return((EPETRA_OBJECT_PTR ) blockmap);
00596 }
00597 
00598 void MANGLE(epetra_blockmap_destroy)(EPETRA_BLOCKMAP blockmap)
00599 {
00600   delete (Epetra_BlockMap *) blockmap;
00601 }
00602 
00604 //                  Epetra_LocalMap                //
00606 
00607 EPETRA_OBJECT_PTR MANGLE(epetra_localmap_create)(EPETRA_INT numLocalElements,
00608                    EPETRA_INT indexBase, EPETRA_COMM comm)
00609 {
00610   Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
00611   Epetra_LocalMap *localmap = new Epetra_LocalMap(EPETRA_DEREF(numLocalElements),
00612               EPETRA_DEREF(indexBase), comm_);
00613   return((EPETRA_OBJECT_PTR ) localmap);
00614 }
00615 
00616 void MANGLE(epetra_localmap_destroy)(EPETRA_LOCALMAP localmap)
00617 {
00618   delete (Epetra_LocalMap *) localmap;
00619 }
00620 
00622 //                  Epetra_LocalBlockMap           //
00624 
00625 EPETRA_OBJECT_PTR MANGLE(epetra_localblockmap_create1)(
00626                   EPETRA_INT numLocalElements,
00627                   EPETRA_INT numLocalBlocks,
00628                   int* blockSizes,
00629                   EPETRA_INT indexBase, EPETRA_COMM comm)
00630 {
00631   Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
00632   Epetra_LocalBlockMap *localblockmap = new
00633     Epetra_LocalBlockMap(EPETRA_DEREF(numLocalElements),
00634        EPETRA_DEREF(numLocalBlocks),
00635        blockSizes,
00636        EPETRA_DEREF(indexBase), comm_);
00637   return((EPETRA_OBJECT_PTR ) localblockmap);
00638 }
00639 
00640 EPETRA_OBJECT_PTR MANGLE(epetra_localblockmap_create2)(
00641                   EPETRA_INT numLocalBlocks,
00642                   int* blockSizes,
00643                   EPETRA_INT indexBase, EPETRA_COMM comm)
00644 {
00645   Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
00646   Epetra_LocalBlockMap *localblockmap = new
00647     Epetra_LocalBlockMap(EPETRA_DEREF(numLocalBlocks),
00648        blockSizes,
00649        EPETRA_DEREF(indexBase), comm_);
00650   return((EPETRA_OBJECT_PTR ) localblockmap);
00651 }
00652 
00653 void MANGLE(epetra_localblockmap_destroy)(EPETRA_LOCALBLOCKMAP localblockmap)
00654 {
00655   delete (Epetra_LocalBlockMap *) localblockmap;
00656 }
00657 
00658 
00659 #endif /* 0 */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines