Epetra_C_wrappers.h

Go to the documentation of this file.
00001 
00002 //@HEADER
00003 /*
00004 ************************************************************************
00005 
00006 Epetra: Linear Algebra Services Package 
00007 Copyright (2001) Sandia Corporation
00008 
00009 Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00010 license for use of this work by or on behalf of the U.S. Government.
00011 
00012 This library is free software; you can redistribute it and/or modify
00013 it under the terms of the GNU Lesser General Public License as
00014 published by the Free Software Foundation; either version 2.1 of the
00015 License, or (at your option) any later version.
00016  
00017 This library is distributed in the hope that it will be useful, but
00018 WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 Lesser General Public License for more details.
00021  
00022 You should have received a copy of the GNU Lesser General Public
00023 License along with this library; if not, write to the Free Software
00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025 USA
00026 Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00027 
00028 ************************************************************************
00029 */
00030 //@HEADER
00031 
00032 #ifndef EPETRA_C_WRAPPERS_H
00033 #define EPETRA_C_WRAPPERS_H
00034 
00035 #ifdef EPETRA_FORTRAN
00036 
00037 typedef double * EPETRA_DOUBLE;
00038 typedef int    * EPETRA_INT;
00039 #define EPETRA_DEREF(a) *a
00040 
00041 #ifdef EPETRA_ADDRESS64BIT
00042 
00043 typedef long int EPETRA_OBJECT_PTR;
00044 typedef long int & EPETRA_OBJECT_REF;
00045 
00046 #else
00047 
00048 typedef int EPETRA_OBJECT_PTR;
00049 typedef int & EPETRA_OBJECT_REF;
00050 
00051 #endif
00052 #else
00053 
00054 /* These typedefs act as new types for the Epetra C interface */
00055 
00056 typedef double EPETRA_DOUBLE;
00057 typedef int    EPETRA_INT;
00058 #define EPETRA_DEREF(a) a
00059 
00060 typedef void * EPETRA_OBJECT_PTR;
00061 typedef void * EPETRA_OBJECT_REF;
00062 
00063 
00064 #endif
00065  
00066 #ifdef EPETRA_FORTRAN
00067 #if defined(TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE)
00068 #define MANGLE(x) x
00069 #else
00070 #define MANGLE(x) x ## __
00071 #endif
00072 #else
00073 #define MANGLE(x) x
00074 #endif
00075 
00076 
00077 
00078 #ifdef __cplusplus
00079 extern "C" {
00080 #endif
00081 
00082   /*****************************************************/
00084   /***************************************************/
00085 
00086 #ifdef EPETRA_MPI
00087   EPETRA_OBJECT_PTR MANGLE(epetra_mpicomm_create1)();
00088   EPETRA_OBJECT_PTR MANGLE(epetra_mpicomm_create2)(MPI_Comm * comm);
00089 #endif
00090   EPETRA_OBJECT_PTR MANGLE(epetra_serialcomm_create)();
00091 
00092   int MANGLE(epetra_comm_mypid)(EPETRA_OBJECT_REF communicator);
00093 
00094   int MANGLE(epetra_comm_numproc)(EPETRA_OBJECT_REF communicator);
00095 
00096   void MANGLE(epetra_comm_barrier)(EPETRA_OBJECT_REF communicator);
00097 
00098   void MANGLE(epetra_comm_destroy)(EPETRA_OBJECT_REF communicator);
00099 
00100   /*****************************************************/
00102   /***************************************************/
00103 
00104   EPETRA_OBJECT_PTR MANGLE(epetra_map_create1)(EPETRA_INT numGlobalEquations, 
00105                  EPETRA_INT indexBase,
00106                  EPETRA_OBJECT_REF comm);
00107 
00108   EPETRA_OBJECT_PTR MANGLE(epetra_map_create2)(EPETRA_INT numGlobalEquations, 
00109                  EPETRA_INT numMyElements,
00110                  EPETRA_INT indexBase,
00111                  EPETRA_OBJECT_REF comm);
00112 
00113   EPETRA_OBJECT_PTR MANGLE(epetra_map_create3)(EPETRA_INT numGlobalEquations, 
00114                  EPETRA_INT numlocalEquations,
00115                  int *updateList, EPETRA_INT indexBase,
00116                  EPETRA_OBJECT_REF comm);
00117   int MANGLE(epetra_map_nummyelements)(EPETRA_OBJECT_REF map);
00118   int MANGLE(epetra_map_numglobalelements)(EPETRA_OBJECT_REF map);
00119 
00120 #ifndef EPETRA_FORTRAN  /* Fortran cannot receive a pointer to int */
00121   int * MANGLE(epetra_map_myglobalelements)(EPETRA_OBJECT_REF map);
00122 #endif
00123 
00124   EPETRA_OBJECT_PTR MANGLE(epetra_map_comm)(EPETRA_OBJECT_REF map);
00125 
00126   void MANGLE(epetra_map_destroy)(EPETRA_OBJECT_REF map);
00127 
00128   /*****************************************************/
00130   /***************************************************/
00131 
00132   EPETRA_OBJECT_PTR MANGLE(epetra_vector_create1)(EPETRA_OBJECT_REF map);
00133   EPETRA_OBJECT_PTR MANGLE(epetra_vector_create2)(EPETRA_INT Copy, EPETRA_OBJECT_REF map,
00134               double * V);
00135 
00136   int MANGLE(epetra_vector_putscalar)(EPETRA_OBJECT_REF x, EPETRA_DOUBLE scalar);
00137 
00138   int MANGLE(epetra_vector_update)(EPETRA_OBJECT_REF x, EPETRA_DOUBLE scalara,
00139            EPETRA_OBJECT_REF a,
00140            EPETRA_DOUBLE scalarb, EPETRA_OBJECT_REF b,
00141            EPETRA_DOUBLE scalarx);
00142 
00143   int MANGLE(epetra_vector_norm1)(EPETRA_OBJECT_REF x, double *result);
00144 
00145   int MANGLE(epetra_vector_norm2)(EPETRA_OBJECT_REF x, double *result);
00146 
00147   int MANGLE(epetra_vector_random)(EPETRA_OBJECT_REF x);
00148 
00149   void MANGLE(epetra_vector_print)(EPETRA_OBJECT_REF x);
00150 
00151   void MANGLE(epetra_vector_destroy)(EPETRA_OBJECT_REF x);
00152 
00153 #ifdef SKIP4NOW
00154   /*****************************************************/
00156   /*****************************************************/
00157 
00158   EPETRA_OBJECT_PTR MANGLE(epetra_vbr_matrix_create)(EPETRA_OBJECT_REF rowmap);
00159 
00160   int MANGLE(epetra_vbr_matrix_allocate)(EPETRA_OBJECT_REF A, int* numNzBlks, int* blkColInds);
00161 
00162   int MANGLE(epetra_vbr_matrix_putblockrow)(EPETRA_OBJECT_REF A, EPETRA_INT
00163                blk_row, EPETRA_INT num_nz_blocks,
00164                double* vals, int* blk_col_inds);
00165 
00166   int MANGLE(epetra_vbr_matrix_fillcomplete)(EPETRA_OBJECT_REF A);
00167 
00168   int  MANGLE(epetra_vbr_matrix_matvec)(EPETRA_OBJECT_REF A, EPETRA_VECTOR x, EPETRA_VECTOR y);
00169 
00170   int MANGLE(epetra_vbr_matrix_matmultivec)(EPETRA_OBJECT_REF A,
00171                EPETRA_MULTIVECTOR x,
00172                EPETRA_MULTIVECTOR y);
00173 
00174   void MANGLE(epetra_vbr_matrix_destroy)(EPETRA_OBJECT_REF A);
00175 
00176   /*****************************************************/
00178   /*****************************************************/
00179 
00180   EPETRA_OBJECT_PTR MANGLE(epetra_crs_matrix_create)(EPETRA_OBJECT_REF rowmap);
00181 
00182   int  MANGLE(epetra_crs_matrix_allocate)(EPETRA_OBJECT_REF A, int* rowLengths);
00183 
00184   int MANGLE(epetra_crs_matrix_putrow)(EPETRA_OBJECT_REF A, EPETRA_INT row, 
00185           EPETRA_INT num_nz,
00186           double* vals, int* col_inds);
00187 
00188   int MANGLE(epetra_crs_matrix_sumintodiagonal)(EPETRA_OBJECT_REF A, 
00189              double* diagonal);
00190 
00191   int MANGLE(epetra_crs_matrix_fillcomplete)(EPETRA_OBJECT_REF A);
00192 
00193   int MANGLE(epetra_crs_matrix_matvec)(EPETRA_OBJECT_REF A, EPETRA_VECTOR x, 
00194           EPETRA_VECTOR y);
00195 
00196   int MANGLE(epetra_crs_matrix_matmultivec)(EPETRA_OBJECT_REF A,
00197                EPETRA_MULTIVECTOR x,
00198                EPETRA_MULTIVECTOR y);
00199 
00200   void MANGLE(epetra_crs_matrix_destroy)(EPETRA_OBJECT_REF A);
00201 
00202   /*****************************************************/
00204   /***************************************************/
00205 
00206   /* create empty shell WITHOUT float storage, fill later with put functions */
00207   EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create)();
00208 
00209   /* create empty shell WITH float storage, fill later with put functions */
00210   EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create1)(EPETRA_OBJECT_REF map, EPETRA_INT numvectors);
00211 
00212   /* Build multivector from a Fortran-style 2D array
00213      NOTE: User storage is not copied, user must keep A intact!! */
00214   EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create2)(EPETRA_OBJECT_REF map,
00215                 double *A, EPETRA_INT lda, EPETRA_INT numvectors);
00216 
00217   /* Build multivector from a double **
00218      NOTE: User storage is not copied, user must keep A intact!! */
00219   EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create3)(EPETRA_OBJECT_REF map,
00220                 double **in_multivector, EPETRA_INT numvectors);
00221 
00222   /* Copy constructor */
00223   EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create4)(EPETRA_MULTIVECTOR
00224                 in_multivector);
00225 
00226   /* creates a new multivector from numvector number of vectors of an existing
00227    * multivector where the vectors to be copied are listed in
00228    * vecIndices.  
00229    */
00230   EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create5)(EPETRA_MULTIVECTOR 
00231                 in_multivector, EPETRA_INT numvectors, int *vecIndices);
00232 
00233   EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create6)(EPETRA_MULTIVECTOR
00234                 in_multiVector, EPETRA_INT startindex, EPETRA_INT numvectors);
00235 
00236   int MANGLE(epetra_multivector_putmultivector)(EPETRA_MULTIVECTOR multivector, 
00237             double **in_multivector);
00238 
00239   /* Allocates space for a multivector created by the default
00240    * constructor */
00241   int MANGLE(epetra_multivector_allocate)(EPETRA_MULTIVECTOR multivector, 
00242             EPETRA_OBJECT_REF map, EPETRA_INT numvectors);
00243 
00244   int MANGLE(epetra_multivector_putscalar)(EPETRA_MULTIVECTOR multivector, EPETRA_DOUBLE scalar);
00245 
00246   int MANGLE(epetra_multivector_scale)
00247        (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar);
00248 
00249   int MANGLE(epetra_multivector_scalecopy)
00250        (EPETRA_MULTIVECTOR multiVector, EPETRA_MULTIVECTOR multiVector_in,
00251   EPETRA_DOUBLE scalar);
00252 
00253   int MANGLE(epetra_multivector_dotprod)
00254        (EPETRA_MULTIVECTOR multiVector, EPETRA_MULTIVECTOR multiVector_in,
00255   double *scalar);
00256 
00257   int MANGLE(epetra_multivector_addvec)
00258        (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar, 
00259   EPETRA_MULTIVECTOR multiVector_in);
00260 
00261   int MANGLE(epetra_multivector_norm1)(EPETRA_MULTIVECTOR multivector, double *result);
00262 
00263   int MANGLE(epetra_multivector_norm2)(EPETRA_MULTIVECTOR multivector, double *result);
00264 
00265   int MANGLE(epetra_multivector_lincomb)(EPETRA_MULTIVECTOR multivector,
00266            EPETRA_MULTIVECTOR b, 
00267            EPETRA_DOUBLE scalar, EPETRA_MULTIVECTOR c);
00268 
00269   int MANGLE(epetra_multivector_random)(EPETRA_MULTIVECTOR multivector);
00270 
00271   /* Note: The return value for this function is the number of vectors
00272      in the multivector */
00273   int MANGLE(epetra_multivector_numvectors)(EPETRA_MULTIVECTOR multivector);
00274 
00275   int MANGLE(epetra_multivector_reduce)(EPETRA_MULTIVECTOR multivector);
00276 
00277   int MANGLE(eepetra_multivector_gemm)(EPETRA_MULTIVECTOR multivector,
00278                EPETRA_INT transa, EPETRA_INT transb, EPETRA_DOUBLE alpha,
00279                EPETRA_MULTIVECTOR A, EPETRA_MULTIVECTOR B,
00280                EPETRA_DOUBLE beta );
00281 
00282   void MANGLE(epetra_multivector_destroy)(EPETRA_MULTIVECTOR multivector);
00283 
00284   /*****************************************************/
00286   /***************************************************/
00287 
00288   EPETRA_OBJECT_PTR MANGLE(epetra_blockmap_create1)(
00289                 EPETRA_INT numGlobalEquations, EPETRA_INT numlocalEquations, int *updateList,
00290                 EPETRA_INT numGlobalblocks, EPETRA_INT numlocalblocks, int *blockUpdateList,
00291                 int* blockSizes, EPETRA_INT indexBase, EPETRA_COMM comm);
00292 
00293   EPETRA_OBJECT_PTR MANGLE(epetra_blockmap_create2)(
00294                 EPETRA_INT numGlobalblocks, EPETRA_INT numlocalblocks, int *blockUpdateList,
00295                 int* blockSizes, EPETRA_INT indexBase, EPETRA_COMM comm);
00296 
00297   void MANGLE(epetra_blockmap_destroy)(EPETRA_BLOCKMAP blockmap);
00298 
00299   /*****************************************************/
00301   /***************************************************/
00302 
00303   EPETRA_OBJECT_PTR MANGLE(epetra_localmap_create)(EPETRA_INT numlocalEquations,
00304                EPETRA_INT indexBase, EPETRA_COMM comm);
00305 
00306   void MANGLE(epetra_localmap_destroy)(EPETRA_LOCALMAP localmap);
00307 
00308   /*****************************************************/
00310   /***************************************************/
00311 
00312   EPETRA_OBJECT_PTR MANGLE(epetra_localblockmap_create1)(
00313                     EPETRA_INT numlocalEquations,
00314                     EPETRA_INT numlocalblocks,
00315                     int* blockSizes,
00316                     EPETRA_INT indexBase, EPETRA_COMM comm);
00317 
00318   EPETRA_OBJECT_PTR MANGLE(epetra_localblockmap_create2)(
00319                     EPETRA_INT numlocalblocks,
00320                     int* blockSizes,
00321                     EPETRA_INT indexBase, EPETRA_COMM comm);
00322 
00323   void MANGLE(epetra_localblockmap_destroy)(EPETRA_LOCALBLOCKMAP localblockmap);
00324 #endif /* 0 */
00325 
00326 #ifdef __cplusplus
00327 }
00328 #endif
00329 
00330 #endif /* EPETRA_C_WRAPPERS_H */

Generated on Thu Sep 18 12:37:57 2008 for Epetra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1