Epetra Package Browser (Single Doxygen Collection) Development
Epetra_C_wrappers.h
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 #ifndef EPETRA_C_WRAPPERS_H
00045 #define EPETRA_C_WRAPPERS_H
00046 
00047 #include "Epetra_ConfigDefs.h"
00048 
00049 #ifdef EPETRA_FORTRAN
00050 
00051 typedef double     * EPETRA_DOUBLE;
00052 typedef int        * EPETRA_INT;
00053 typedef long long  * EPETRA_LONG_LONG;
00054 #define EPETRA_DEREF(a) *a
00055 
00056 #ifdef EPETRA_ADDRESS64BIT
00057 
00058 typedef long int EPETRA_OBJECT_PTR;
00059 typedef long int & EPETRA_OBJECT_REF;
00060 
00061 #else
00062 
00063 typedef int EPETRA_OBJECT_PTR;
00064 typedef int & EPETRA_OBJECT_REF;
00065 
00066 #endif
00067 #else
00068 
00069 /* These typedefs act as new types for the Epetra C interface */
00070 
00071 typedef double    EPETRA_DOUBLE;
00072 typedef int       EPETRA_INT;
00073 typedef long long EPETRA_LONG_LONG;
00074 #define EPETRA_DEREF(a) a
00075 
00076 typedef void * EPETRA_OBJECT_PTR;
00077 typedef void * EPETRA_OBJECT_REF;
00078 
00079 
00080 #endif
00081  
00082 #ifdef EPETRA_FORTRAN
00083 #if defined(TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE)
00084 #define MANGLE(x) x
00085 #else
00086 #define MANGLE(x) x ## __
00087 #endif
00088 #else
00089 #define MANGLE(x) x
00090 #endif
00091 
00092 
00093 
00094 #ifdef __cplusplus
00095 extern "C" {
00096 #endif
00097 
00098   /*****************************************************/
00100   /***************************************************/
00101 
00102 #ifdef EPETRA_MPI
00103   EPETRA_OBJECT_PTR MANGLE(epetra_mpicomm_create1)();
00104   EPETRA_OBJECT_PTR MANGLE(epetra_mpicomm_create2)(MPI_Comm * comm);
00105 #endif
00106   EPETRA_OBJECT_PTR MANGLE(epetra_serialcomm_create)();
00107 
00108   int MANGLE(epetra_comm_mypid)(EPETRA_OBJECT_REF communicator);
00109 
00110   int MANGLE(epetra_comm_numproc)(EPETRA_OBJECT_REF communicator);
00111 
00112   void MANGLE(epetra_comm_barrier)(EPETRA_OBJECT_REF communicator);
00113 
00114   void MANGLE(epetra_comm_destroy)(EPETRA_OBJECT_REF communicator);
00115 
00116   /*****************************************************/
00118   /***************************************************/
00119 
00120 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00121 
00122   EPETRA_OBJECT_PTR MANGLE(epetra_map_create1)(EPETRA_INT numGlobalEquations, 
00123                  EPETRA_INT indexBase,
00124                  EPETRA_OBJECT_REF comm);
00125 
00126   EPETRA_OBJECT_PTR MANGLE(epetra_map_create2)(EPETRA_INT numGlobalEquations, 
00127                  EPETRA_INT numMyElements,
00128                  EPETRA_INT indexBase,
00129                  EPETRA_OBJECT_REF comm);
00130 
00131   EPETRA_OBJECT_PTR MANGLE(epetra_map_create3)(EPETRA_INT numGlobalEquations, 
00132                  EPETRA_INT numlocalEquations,
00133                  int *updateList, EPETRA_INT indexBase,
00134                  EPETRA_OBJECT_REF comm);
00135 #endif
00136 
00137 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00138   EPETRA_OBJECT_PTR MANGLE(epetra_map_create1_64)(EPETRA_LONG_LONG numGlobalEquations, 
00139                  EPETRA_LONG_LONG indexBase,
00140                  EPETRA_OBJECT_REF comm);
00141 
00142   EPETRA_OBJECT_PTR MANGLE(epetra_map_create2_64)(EPETRA_LONG_LONG numGlobalEquations, 
00143                  EPETRA_INT numMyElements,
00144                  EPETRA_INT indexBase,
00145                  EPETRA_OBJECT_REF comm);
00146 
00147   EPETRA_OBJECT_PTR MANGLE(epetra_map_create3_64)(EPETRA_LONG_LONG numGlobalEquations, 
00148                  EPETRA_INT numlocalEquations,
00149                  long long *updateList, EPETRA_INT indexBase,
00150                  EPETRA_OBJECT_REF comm);
00151 #endif
00152 
00153   int MANGLE(epetra_map_nummyelements)(EPETRA_OBJECT_REF map);
00154   long long MANGLE(epetra_map_numglobalelements)(EPETRA_OBJECT_REF map);
00155 
00156 #ifndef EPETRA_FORTRAN  /* Fortran cannot receive a pointer to int */
00157 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00158   int * MANGLE(epetra_map_myglobalelements)(EPETRA_OBJECT_REF map);
00159 #endif
00160 
00161 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00162   long long * MANGLE(epetra_map_myglobalelements_64)(EPETRA_OBJECT_REF map);
00163 #endif
00164 #endif
00165 
00166   EPETRA_OBJECT_PTR MANGLE(epetra_map_comm)(EPETRA_OBJECT_REF map);
00167 
00168   void MANGLE(epetra_map_destroy)(EPETRA_OBJECT_REF map);
00169 
00170   /*****************************************************/
00172   /***************************************************/
00173 
00174   EPETRA_OBJECT_PTR MANGLE(epetra_vector_create1)(EPETRA_OBJECT_REF map);
00175   EPETRA_OBJECT_PTR MANGLE(epetra_vector_create2)(EPETRA_INT Copy, EPETRA_OBJECT_REF map,
00176               double * V);
00177 
00178   int MANGLE(epetra_vector_putscalar)(EPETRA_OBJECT_REF x, EPETRA_DOUBLE scalar);
00179 
00180   int MANGLE(epetra_vector_update)(EPETRA_OBJECT_REF x, EPETRA_DOUBLE scalara,
00181            EPETRA_OBJECT_REF a,
00182            EPETRA_DOUBLE scalarb, EPETRA_OBJECT_REF b,
00183            EPETRA_DOUBLE scalarx);
00184 
00185   int MANGLE(epetra_vector_norm1)(EPETRA_OBJECT_REF x, double *result);
00186 
00187   int MANGLE(epetra_vector_norm2)(EPETRA_OBJECT_REF x, double *result);
00188 
00189   int MANGLE(epetra_vector_random)(EPETRA_OBJECT_REF x);
00190 
00191   void MANGLE(epetra_vector_print)(EPETRA_OBJECT_REF x);
00192 
00193   void MANGLE(epetra_vector_destroy)(EPETRA_OBJECT_REF x);
00194 
00195 #ifdef SKIP4NOW
00196   /*****************************************************/
00198   /*****************************************************/
00199 
00200   EPETRA_OBJECT_PTR MANGLE(epetra_vbr_matrix_create)(EPETRA_OBJECT_REF rowmap);
00201 
00202   int MANGLE(epetra_vbr_matrix_allocate)(EPETRA_OBJECT_REF A, int* numNzBlks, int* blkColInds);
00203 
00204   int MANGLE(epetra_vbr_matrix_putblockrow)(EPETRA_OBJECT_REF A, EPETRA_INT
00205                blk_row, EPETRA_INT num_nz_blocks,
00206                double* vals, int* blk_col_inds);
00207 
00208   int MANGLE(epetra_vbr_matrix_fillcomplete)(EPETRA_OBJECT_REF A);
00209 
00210   int  MANGLE(epetra_vbr_matrix_matvec)(EPETRA_OBJECT_REF A, EPETRA_VECTOR x, EPETRA_VECTOR y);
00211 
00212   int MANGLE(epetra_vbr_matrix_matmultivec)(EPETRA_OBJECT_REF A,
00213                EPETRA_MULTIVECTOR x,
00214                EPETRA_MULTIVECTOR y);
00215 
00216   void MANGLE(epetra_vbr_matrix_destroy)(EPETRA_OBJECT_REF A);
00217 
00218   /*****************************************************/
00220   /*****************************************************/
00221 
00222   EPETRA_OBJECT_PTR MANGLE(epetra_crs_matrix_create)(EPETRA_OBJECT_REF rowmap);
00223 
00224   int  MANGLE(epetra_crs_matrix_allocate)(EPETRA_OBJECT_REF A, int* rowLengths);
00225 
00226   int MANGLE(epetra_crs_matrix_putrow)(EPETRA_OBJECT_REF A, EPETRA_INT row, 
00227           EPETRA_INT num_nz,
00228           double* vals, int* col_inds);
00229 
00230   int MANGLE(epetra_crs_matrix_sumintodiagonal)(EPETRA_OBJECT_REF A, 
00231              double* diagonal);
00232 
00233   int MANGLE(epetra_crs_matrix_fillcomplete)(EPETRA_OBJECT_REF A);
00234 
00235   int MANGLE(epetra_crs_matrix_matvec)(EPETRA_OBJECT_REF A, EPETRA_VECTOR x, 
00236           EPETRA_VECTOR y);
00237 
00238   int MANGLE(epetra_crs_matrix_matmultivec)(EPETRA_OBJECT_REF A,
00239                EPETRA_MULTIVECTOR x,
00240                EPETRA_MULTIVECTOR y);
00241 
00242   void MANGLE(epetra_crs_matrix_destroy)(EPETRA_OBJECT_REF A);
00243 
00244   /*****************************************************/
00246   /***************************************************/
00247 
00248   /* create empty shell WITHOUT float storage, fill later with put functions */
00249   EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create)();
00250 
00251   /* create empty shell WITH float storage, fill later with put functions */
00252   EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create1)(EPETRA_OBJECT_REF map, EPETRA_INT numvectors);
00253 
00254   /* Build multivector from a Fortran-style 2D array
00255      NOTE: User storage is not copied, user must keep A intact!! */
00256   EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create2)(EPETRA_OBJECT_REF map,
00257                 double *A, EPETRA_INT lda, EPETRA_INT numvectors);
00258 
00259   /* Build multivector from a double **
00260      NOTE: User storage is not copied, user must keep A intact!! */
00261   EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create3)(EPETRA_OBJECT_REF map,
00262                 double **in_multivector, EPETRA_INT numvectors);
00263 
00264   /* Copy constructor */
00265   EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create4)(EPETRA_MULTIVECTOR
00266                 in_multivector);
00267 
00268   /* creates a new multivector from numvector number of vectors of an existing
00269    * multivector where the vectors to be copied are listed in
00270    * vecIndices.  
00271    */
00272   EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create5)(EPETRA_MULTIVECTOR 
00273                 in_multivector, EPETRA_INT numvectors, int *vecIndices);
00274 
00275   EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create6)(EPETRA_MULTIVECTOR
00276                 in_multiVector, EPETRA_INT startindex, EPETRA_INT numvectors);
00277 
00278   int MANGLE(epetra_multivector_putmultivector)(EPETRA_MULTIVECTOR multivector, 
00279             double **in_multivector);
00280 
00281   /* Allocates space for a multivector created by the default
00282    * constructor */
00283   int MANGLE(epetra_multivector_allocate)(EPETRA_MULTIVECTOR multivector, 
00284             EPETRA_OBJECT_REF map, EPETRA_INT numvectors);
00285 
00286   int MANGLE(epetra_multivector_putscalar)(EPETRA_MULTIVECTOR multivector, EPETRA_DOUBLE scalar);
00287 
00288   int MANGLE(epetra_multivector_scale)
00289        (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar);
00290 
00291   int MANGLE(epetra_multivector_scalecopy)
00292        (EPETRA_MULTIVECTOR multiVector, EPETRA_MULTIVECTOR multiVector_in,
00293   EPETRA_DOUBLE scalar);
00294 
00295   int MANGLE(epetra_multivector_dotprod)
00296        (EPETRA_MULTIVECTOR multiVector, EPETRA_MULTIVECTOR multiVector_in,
00297   double *scalar);
00298 
00299   int MANGLE(epetra_multivector_addvec)
00300        (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar, 
00301   EPETRA_MULTIVECTOR multiVector_in);
00302 
00303   int MANGLE(epetra_multivector_norm1)(EPETRA_MULTIVECTOR multivector, double *result);
00304 
00305   int MANGLE(epetra_multivector_norm2)(EPETRA_MULTIVECTOR multivector, double *result);
00306 
00307   int MANGLE(epetra_multivector_lincomb)(EPETRA_MULTIVECTOR multivector,
00308            EPETRA_MULTIVECTOR b, 
00309            EPETRA_DOUBLE scalar, EPETRA_MULTIVECTOR c);
00310 
00311   int MANGLE(epetra_multivector_random)(EPETRA_MULTIVECTOR multivector);
00312 
00313   /* Note: The return value for this function is the number of vectors
00314      in the multivector */
00315   int MANGLE(epetra_multivector_numvectors)(EPETRA_MULTIVECTOR multivector);
00316 
00317   int MANGLE(epetra_multivector_reduce)(EPETRA_MULTIVECTOR multivector);
00318 
00319   int MANGLE(eepetra_multivector_gemm)(EPETRA_MULTIVECTOR multivector,
00320                EPETRA_INT transa, EPETRA_INT transb, EPETRA_DOUBLE alpha,
00321                EPETRA_MULTIVECTOR A, EPETRA_MULTIVECTOR B,
00322                EPETRA_DOUBLE beta );
00323 
00324   void MANGLE(epetra_multivector_destroy)(EPETRA_MULTIVECTOR multivector);
00325 
00326   /*****************************************************/
00328   /***************************************************/
00329 
00330   EPETRA_OBJECT_PTR MANGLE(epetra_blockmap_create1)(
00331                 EPETRA_INT numGlobalEquations, EPETRA_INT numlocalEquations, int *updateList,
00332                 EPETRA_INT numGlobalblocks, EPETRA_INT numlocalblocks, int *blockUpdateList,
00333                 int* blockSizes, EPETRA_INT indexBase, EPETRA_COMM comm);
00334 
00335   EPETRA_OBJECT_PTR MANGLE(epetra_blockmap_create2)(
00336                 EPETRA_INT numGlobalblocks, EPETRA_INT numlocalblocks, int *blockUpdateList,
00337                 int* blockSizes, EPETRA_INT indexBase, EPETRA_COMM comm);
00338 
00339   void MANGLE(epetra_blockmap_destroy)(EPETRA_BLOCKMAP blockmap);
00340 
00341   /*****************************************************/
00343   /***************************************************/
00344 
00345   EPETRA_OBJECT_PTR MANGLE(epetra_localmap_create)(EPETRA_INT numlocalEquations,
00346                EPETRA_INT indexBase, EPETRA_COMM comm);
00347 
00348   void MANGLE(epetra_localmap_destroy)(EPETRA_LOCALMAP localmap);
00349 
00350   /*****************************************************/
00352   /***************************************************/
00353 
00354   EPETRA_OBJECT_PTR MANGLE(epetra_localblockmap_create1)(
00355                     EPETRA_INT numlocalEquations,
00356                     EPETRA_INT numlocalblocks,
00357                     int* blockSizes,
00358                     EPETRA_INT indexBase, EPETRA_COMM comm);
00359 
00360   EPETRA_OBJECT_PTR MANGLE(epetra_localblockmap_create2)(
00361                     EPETRA_INT numlocalblocks,
00362                     int* blockSizes,
00363                     EPETRA_INT indexBase, EPETRA_COMM comm);
00364 
00365   void MANGLE(epetra_localblockmap_destroy)(EPETRA_LOCALBLOCKMAP localblockmap);
00366 #endif /* 0 */
00367 
00368 #ifdef __cplusplus
00369 }
00370 #endif
00371 
00372 #endif /* EPETRA_C_WRAPPERS_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines