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