Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Epetra_C_wrappers.h
Go to the documentation of this file.
1 /*
2 //@HEADER
3 // ************************************************************************
4 //
5 // Epetra: Linear Algebra Services Package
6 // Copyright 2011 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ************************************************************************
41 //@HEADER
42 */
43 
44 #ifndef EPETRA_C_WRAPPERS_H
45 #define EPETRA_C_WRAPPERS_H
46 
47 #include "Epetra_ConfigDefs.h"
48 
49 #ifdef EPETRA_FORTRAN
50 
51 typedef double * EPETRA_DOUBLE;
52 typedef int * EPETRA_INT;
53 typedef long long * EPETRA_LONG_LONG;
54 #define EPETRA_DEREF(a) *a
55 
56 #ifdef EPETRA_ADDRESS64BIT
57 
58 typedef long long int EPETRA_OBJECT_PTR;
59 typedef long long int & EPETRA_OBJECT_REF;
60 
61 #else
62 
63 typedef int EPETRA_OBJECT_PTR;
64 typedef int & EPETRA_OBJECT_REF;
65 
66 #endif
67 #else
68 
69 /* These typedefs act as new types for the Epetra C interface */
70 
71 typedef double EPETRA_DOUBLE;
72 typedef int EPETRA_INT;
73 typedef long long EPETRA_LONG_LONG;
74 #define EPETRA_DEREF(a) a
75 
76 typedef void * EPETRA_OBJECT_PTR;
77 typedef void * EPETRA_OBJECT_REF;
78 
79 
80 #endif
81 
82 #ifdef EPETRA_FORTRAN
83 #if defined(TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE)
84 #define MANGLE(x) x
85 #else
86 #define MANGLE(x) x ## __
87 #endif
88 #else
89 #define MANGLE(x) x
90 #endif
91 
92 
93 
94 #ifdef __cplusplus
95 extern "C" {
96 #endif
97 
98  /*****************************************************/
100  /***************************************************/
101 
102 #ifdef EPETRA_MPI
105 #endif
107 
108  int MANGLE(epetra_comm_mypid)(EPETRA_OBJECT_REF communicator);
109 
110  int MANGLE(epetra_comm_numproc)(EPETRA_OBJECT_REF communicator);
111 
112  void MANGLE(epetra_comm_barrier)(EPETRA_OBJECT_REF communicator);
113 
114  void MANGLE(epetra_comm_destroy)(EPETRA_OBJECT_REF communicator);
115 
116  /*****************************************************/
118  /***************************************************/
119 
120 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
121 
123  EPETRA_INT indexBase,
124  EPETRA_OBJECT_REF comm);
125 
127  EPETRA_INT numMyElements,
128  EPETRA_INT indexBase,
129  EPETRA_OBJECT_REF comm);
130 
132  EPETRA_INT numlocalEquations,
133  int *updateList, EPETRA_INT indexBase,
134  EPETRA_OBJECT_REF comm);
135 #endif
136 
137 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
139  EPETRA_LONG_LONG indexBase,
140  EPETRA_OBJECT_REF comm);
141 
143  EPETRA_INT numMyElements,
144  EPETRA_INT indexBase,
145  EPETRA_OBJECT_REF comm);
146 
148  EPETRA_INT numlocalEquations,
149  long long *updateList, EPETRA_INT indexBase,
150  EPETRA_OBJECT_REF comm);
151 #endif
152 
155 
156 #ifndef EPETRA_FORTRAN /* Fortran cannot receive a pointer to int */
157 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
159 #endif
160 
161 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
163 #endif
164 #endif
165 
167 
169 
170  /*****************************************************/
172  /***************************************************/
173 
176  double * V);
177 
179 
182  EPETRA_DOUBLE scalarb, EPETRA_OBJECT_REF b,
183  EPETRA_DOUBLE scalarx);
184 
185  int MANGLE(epetra_vector_norm1)(EPETRA_OBJECT_REF x, double *result);
186 
187  int MANGLE(epetra_vector_norm2)(EPETRA_OBJECT_REF x, double *result);
188 
190 
192 
194 
195 #ifdef SKIP4NOW
196  /*****************************************************/
198  /*****************************************************/
199 
200  EPETRA_OBJECT_PTR MANGLE(epetra_vbr_matrix_create)(EPETRA_OBJECT_REF rowmap);
201 
202  int MANGLE(epetra_vbr_matrix_allocate)(EPETRA_OBJECT_REF A, int* numNzBlks, int* blkColInds);
203 
204  int MANGLE(epetra_vbr_matrix_putblockrow)(EPETRA_OBJECT_REF A, EPETRA_INT
205  blk_row, EPETRA_INT num_nz_blocks,
206  double* vals, int* blk_col_inds);
207 
208  int MANGLE(epetra_vbr_matrix_fillcomplete)(EPETRA_OBJECT_REF A);
209 
210  int MANGLE(epetra_vbr_matrix_matvec)(EPETRA_OBJECT_REF A, EPETRA_VECTOR x, EPETRA_VECTOR y);
211 
212  int MANGLE(epetra_vbr_matrix_matmultivec)(EPETRA_OBJECT_REF A,
213  EPETRA_MULTIVECTOR x,
214  EPETRA_MULTIVECTOR y);
215 
216  void MANGLE(epetra_vbr_matrix_destroy)(EPETRA_OBJECT_REF A);
217 
218  /*****************************************************/
220  /*****************************************************/
221 
222  EPETRA_OBJECT_PTR MANGLE(epetra_crs_matrix_create)(EPETRA_OBJECT_REF rowmap);
223 
224  int MANGLE(epetra_crs_matrix_allocate)(EPETRA_OBJECT_REF A, int* rowLengths);
225 
226  int MANGLE(epetra_crs_matrix_putrow)(EPETRA_OBJECT_REF A, EPETRA_INT row,
227  EPETRA_INT num_nz,
228  double* vals, int* col_inds);
229 
230  int MANGLE(epetra_crs_matrix_sumintodiagonal)(EPETRA_OBJECT_REF A,
231  double* diagonal);
232 
233  int MANGLE(epetra_crs_matrix_fillcomplete)(EPETRA_OBJECT_REF A);
234 
235  int MANGLE(epetra_crs_matrix_matvec)(EPETRA_OBJECT_REF A, EPETRA_VECTOR x,
236  EPETRA_VECTOR y);
237 
238  int MANGLE(epetra_crs_matrix_matmultivec)(EPETRA_OBJECT_REF A,
239  EPETRA_MULTIVECTOR x,
240  EPETRA_MULTIVECTOR y);
241 
242  void MANGLE(epetra_crs_matrix_destroy)(EPETRA_OBJECT_REF A);
243 
244  /*****************************************************/
246  /***************************************************/
247 
248  /* create empty shell WITHOUT float storage, fill later with put functions */
249  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create)();
250 
251  /* create empty shell WITH float storage, fill later with put functions */
252  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create1)(EPETRA_OBJECT_REF map, EPETRA_INT numvectors);
253 
254  /* Build multivector from a Fortran-style 2D array
255  NOTE: User storage is not copied, user must keep A intact!! */
256  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create2)(EPETRA_OBJECT_REF map,
257  double *A, EPETRA_INT lda, EPETRA_INT numvectors);
258 
259  /* Build multivector from a double **
260  NOTE: User storage is not copied, user must keep A intact!! */
261  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create3)(EPETRA_OBJECT_REF map,
262  double **in_multivector, EPETRA_INT numvectors);
263 
264  /* Copy constructor */
265  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create4)(EPETRA_MULTIVECTOR
266  in_multivector);
267 
268  /* creates a new multivector from numvector number of vectors of an existing
269  * multivector where the vectors to be copied are listed in
270  * vecIndices.
271  */
272  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create5)(EPETRA_MULTIVECTOR
273  in_multivector, EPETRA_INT numvectors, int *vecIndices);
274 
275  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create6)(EPETRA_MULTIVECTOR
276  in_multiVector, EPETRA_INT startindex, EPETRA_INT numvectors);
277 
278  int MANGLE(epetra_multivector_putmultivector)(EPETRA_MULTIVECTOR multivector,
279  double **in_multivector);
280 
281  /* Allocates space for a multivector created by the default
282  * constructor */
283  int MANGLE(epetra_multivector_allocate)(EPETRA_MULTIVECTOR multivector,
284  EPETRA_OBJECT_REF map, EPETRA_INT numvectors);
285 
286  int MANGLE(epetra_multivector_putscalar)(EPETRA_MULTIVECTOR multivector, EPETRA_DOUBLE scalar);
287 
288  int MANGLE(epetra_multivector_scale)
289  (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar);
290 
291  int MANGLE(epetra_multivector_scalecopy)
292  (EPETRA_MULTIVECTOR multiVector, EPETRA_MULTIVECTOR multiVector_in,
293  EPETRA_DOUBLE scalar);
294 
295  int MANGLE(epetra_multivector_dotprod)
296  (EPETRA_MULTIVECTOR multiVector, EPETRA_MULTIVECTOR multiVector_in,
297  double *scalar);
298 
299  int MANGLE(epetra_multivector_addvec)
300  (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar,
301  EPETRA_MULTIVECTOR multiVector_in);
302 
303  int MANGLE(epetra_multivector_norm1)(EPETRA_MULTIVECTOR multivector, double *result);
304 
305  int MANGLE(epetra_multivector_norm2)(EPETRA_MULTIVECTOR multivector, double *result);
306 
307  int MANGLE(epetra_multivector_lincomb)(EPETRA_MULTIVECTOR multivector,
308  EPETRA_MULTIVECTOR b,
309  EPETRA_DOUBLE scalar, EPETRA_MULTIVECTOR c);
310 
311  int MANGLE(epetra_multivector_random)(EPETRA_MULTIVECTOR multivector);
312 
313  /* Note: The return value for this function is the number of vectors
314  in the multivector */
315  int MANGLE(epetra_multivector_numvectors)(EPETRA_MULTIVECTOR multivector);
316 
317  int MANGLE(epetra_multivector_reduce)(EPETRA_MULTIVECTOR multivector);
318 
319  int MANGLE(eepetra_multivector_gemm)(EPETRA_MULTIVECTOR multivector,
320  EPETRA_INT transa, EPETRA_INT transb, EPETRA_DOUBLE alpha,
321  EPETRA_MULTIVECTOR A, EPETRA_MULTIVECTOR B,
322  EPETRA_DOUBLE beta );
323 
324  void MANGLE(epetra_multivector_destroy)(EPETRA_MULTIVECTOR multivector);
325 
326  /*****************************************************/
328  /***************************************************/
329 
330  EPETRA_OBJECT_PTR MANGLE(epetra_blockmap_create1)(
331  EPETRA_INT numGlobalEquations, EPETRA_INT numlocalEquations, int *updateList,
332  EPETRA_INT numGlobalblocks, EPETRA_INT numlocalblocks, int *blockUpdateList,
333  int* blockSizes, EPETRA_INT indexBase, EPETRA_COMM comm);
334 
335  EPETRA_OBJECT_PTR MANGLE(epetra_blockmap_create2)(
336  EPETRA_INT numGlobalblocks, EPETRA_INT numlocalblocks, int *blockUpdateList,
337  int* blockSizes, EPETRA_INT indexBase, EPETRA_COMM comm);
338 
339  void MANGLE(epetra_blockmap_destroy)(EPETRA_BLOCKMAP blockmap);
340 
341  /*****************************************************/
343  /***************************************************/
344 
345  EPETRA_OBJECT_PTR MANGLE(epetra_localmap_create)(EPETRA_INT numlocalEquations,
346  EPETRA_INT indexBase, EPETRA_COMM comm);
347 
348  void MANGLE(epetra_localmap_destroy)(EPETRA_LOCALMAP localmap);
349 
350  /*****************************************************/
352  /***************************************************/
353 
354  EPETRA_OBJECT_PTR MANGLE(epetra_localblockmap_create1)(
355  EPETRA_INT numlocalEquations,
356  EPETRA_INT numlocalblocks,
357  int* blockSizes,
358  EPETRA_INT indexBase, EPETRA_COMM comm);
359 
360  EPETRA_OBJECT_PTR MANGLE(epetra_localblockmap_create2)(
361  EPETRA_INT numlocalblocks,
362  int* blockSizes,
363  EPETRA_INT indexBase, EPETRA_COMM comm);
364 
365  void MANGLE(epetra_localblockmap_destroy)(EPETRA_LOCALBLOCKMAP localblockmap);
366 #endif /* 0 */
367 
368 #ifdef __cplusplus
369 }
370 #endif
371 
372 #endif /* EPETRA_C_WRAPPERS_H */
void MANGLE() epetra_vector_destroy(EPETRA_OBJECT_REF x)
int EPETRA_INT
EPETRA_OBJECT_PTR MANGLE() epetra_map_create2_64(EPETRA_LONG_LONG numGlobalElements, EPETRA_INT numMyElements, EPETRA_LONG_LONG indexBase, EPETRA_OBJECT_REF comm)
EPETRA_OBJECT_PTR MANGLE() epetra_serialcomm_create()
void * EPETRA_OBJECT_PTR
EPETRA_OBJECT_PTR MANGLE() epetra_mpicomm_create1()
Epetra_Comm.
int MANGLE() epetra_vector_putscalar(EPETRA_OBJECT_REF x, EPETRA_DOUBLE scalar)
void MANGLE() epetra_comm_barrier(EPETRA_OBJECT_REF comm)
void * EPETRA_OBJECT_REF
int MANGLE() epetra_map_nummyelements(EPETRA_OBJECT_REF map)
long long MANGLE() epetra_map_numglobalelements(EPETRA_OBJECT_REF map)
double EPETRA_DOUBLE
EPETRA_OBJECT_PTR MANGLE() epetra_map_create3(EPETRA_INT numGlobalElements, EPETRA_INT numLocalElements, int *updateList, EPETRA_INT indexBase, EPETRA_OBJECT_REF comm)
int MANGLE() epetra_comm_numproc(EPETRA_OBJECT_REF comm)
EPETRA_OBJECT_PTR MANGLE() epetra_map_comm(EPETRA_OBJECT_REF map)
int *MANGLE() epetra_map_myglobalelements(EPETRA_OBJECT_REF map)
EPETRA_OBJECT_PTR MANGLE() epetra_map_create1_64(EPETRA_LONG_LONG numGlobalElements, EPETRA_LONG_LONG indexBase, EPETRA_OBJECT_REF comm)
void MANGLE() epetra_comm_destroy(EPETRA_OBJECT_REF comm)
int MANGLE() epetra_vector_norm2(EPETRA_OBJECT_REF x, double *scalar)
int MANGLE() epetra_vector_norm1(EPETRA_OBJECT_REF x, double *scalar)
void MANGLE() epetra_vector_print(EPETRA_OBJECT_REF x)
EPETRA_OBJECT_PTR MANGLE() epetra_map_create1(EPETRA_INT numGlobalElements, EPETRA_INT indexBase, EPETRA_OBJECT_REF comm)
Epetra_Map.
EPETRA_OBJECT_PTR MANGLE() epetra_vector_create1(EPETRA_OBJECT_REF map)
Epetra_Vector.
int MANGLE() epetra_comm_mypid(EPETRA_OBJECT_REF comm)
int MANGLE() epetra_vector_random(EPETRA_OBJECT_REF x)
EPETRA_OBJECT_PTR MANGLE() epetra_map_create3_64(EPETRA_LONG_LONG numGlobalElements, EPETRA_INT numLocalElements, long long *updateList, EPETRA_LONG_LONG indexBase, EPETRA_OBJECT_REF comm)
#define MANGLE(x)
int MANGLE() epetra_vector_update(EPETRA_OBJECT_REF x, EPETRA_DOUBLE scalara, EPETRA_OBJECT_REF a, EPETRA_DOUBLE scalarb, EPETRA_OBJECT_REF b, EPETRA_DOUBLE scalarx)
EPETRA_OBJECT_PTR MANGLE() epetra_mpicomm_create2(MPI_Comm *comm)
EPETRA_OBJECT_PTR MANGLE() epetra_vector_create2(EPETRA_INT CopyValues, EPETRA_OBJECT_REF map, double *V)
void MANGLE() epetra_map_destroy(EPETRA_OBJECT_REF map)
EPETRA_OBJECT_PTR MANGLE() epetra_map_create2(EPETRA_INT numGlobalElements, EPETRA_INT numMyElements, EPETRA_INT indexBase, EPETRA_OBJECT_REF comm)
long long EPETRA_LONG_LONG
long long *MANGLE() epetra_map_myglobalelements_64(EPETRA_OBJECT_REF map)