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 #if defined(Epetra_SHOW_DEPRECATED_WARNINGS)
48 #ifdef __GNUC__
49 #warning "The Epetra package is deprecated"
50 #endif
51 #endif
52 
53 
54 
55 #include "Epetra_ConfigDefs.h"
56 
57 #ifdef EPETRA_FORTRAN
58 
59 typedef double * EPETRA_DOUBLE;
60 typedef int * EPETRA_INT;
61 typedef long long * EPETRA_LONG_LONG;
62 #define EPETRA_DEREF(a) *a
63 
64 #ifdef EPETRA_ADDRESS64BIT
65 
66 typedef long long int EPETRA_OBJECT_PTR;
67 typedef long long int & EPETRA_OBJECT_REF;
68 
69 #else
70 
71 typedef int EPETRA_OBJECT_PTR;
72 typedef int & EPETRA_OBJECT_REF;
73 
74 #endif
75 #else
76 
77 /* These typedefs act as new types for the Epetra C interface */
78 
79 typedef double EPETRA_DOUBLE;
80 typedef int EPETRA_INT;
81 typedef long long EPETRA_LONG_LONG;
82 #define EPETRA_DEREF(a) a
83 
84 typedef void * EPETRA_OBJECT_PTR;
85 typedef void * EPETRA_OBJECT_REF;
86 
87 
88 #endif
89 
90 #ifdef EPETRA_FORTRAN
91 #if defined(TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE)
92 #define MANGLE(x) x
93 #else
94 #define MANGLE(x) x ## __
95 #endif
96 #else
97 #define MANGLE(x) x
98 #endif
99 
100 
101 
102 #ifdef __cplusplus
103 extern "C" {
104 #endif
105 
106  /*****************************************************/
108  /***************************************************/
109 
110 #ifdef EPETRA_MPI
113 #endif
115 
116  int MANGLE(epetra_comm_mypid)(EPETRA_OBJECT_REF communicator);
117 
118  int MANGLE(epetra_comm_numproc)(EPETRA_OBJECT_REF communicator);
119 
120  void MANGLE(epetra_comm_barrier)(EPETRA_OBJECT_REF communicator);
121 
122  void MANGLE(epetra_comm_destroy)(EPETRA_OBJECT_REF communicator);
123 
124  /*****************************************************/
126  /***************************************************/
127 
128 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
129 
131  EPETRA_INT indexBase,
132  EPETRA_OBJECT_REF comm);
133 
135  EPETRA_INT numMyElements,
136  EPETRA_INT indexBase,
137  EPETRA_OBJECT_REF comm);
138 
140  EPETRA_INT numlocalEquations,
141  int *updateList, EPETRA_INT indexBase,
142  EPETRA_OBJECT_REF comm);
143 #endif
144 
145 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
147  EPETRA_LONG_LONG indexBase,
148  EPETRA_OBJECT_REF comm);
149 
151  EPETRA_INT numMyElements,
152  EPETRA_INT indexBase,
153  EPETRA_OBJECT_REF comm);
154 
156  EPETRA_INT numlocalEquations,
157  long long *updateList, EPETRA_INT indexBase,
158  EPETRA_OBJECT_REF comm);
159 #endif
160 
163 
164 #ifndef EPETRA_FORTRAN /* Fortran cannot receive a pointer to int */
165 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
167 #endif
168 
169 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
171 #endif
172 #endif
173 
175 
177 
178  /*****************************************************/
180  /***************************************************/
181 
184  double * V);
185 
187 
190  EPETRA_DOUBLE scalarb, EPETRA_OBJECT_REF b,
191  EPETRA_DOUBLE scalarx);
192 
193  int MANGLE(epetra_vector_norm1)(EPETRA_OBJECT_REF x, double *result);
194 
195  int MANGLE(epetra_vector_norm2)(EPETRA_OBJECT_REF x, double *result);
196 
198 
200 
202 
203 #ifdef SKIP4NOW
204  /*****************************************************/
206  /*****************************************************/
207 
208  EPETRA_OBJECT_PTR MANGLE(epetra_vbr_matrix_create)(EPETRA_OBJECT_REF rowmap);
209 
210  int MANGLE(epetra_vbr_matrix_allocate)(EPETRA_OBJECT_REF A, int* numNzBlks, int* blkColInds);
211 
212  int MANGLE(epetra_vbr_matrix_putblockrow)(EPETRA_OBJECT_REF A, EPETRA_INT
213  blk_row, EPETRA_INT num_nz_blocks,
214  double* vals, int* blk_col_inds);
215 
216  int MANGLE(epetra_vbr_matrix_fillcomplete)(EPETRA_OBJECT_REF A);
217 
218  int MANGLE(epetra_vbr_matrix_matvec)(EPETRA_OBJECT_REF A, EPETRA_VECTOR x, EPETRA_VECTOR y);
219 
220  int MANGLE(epetra_vbr_matrix_matmultivec)(EPETRA_OBJECT_REF A,
221  EPETRA_MULTIVECTOR x,
222  EPETRA_MULTIVECTOR y);
223 
224  void MANGLE(epetra_vbr_matrix_destroy)(EPETRA_OBJECT_REF A);
225 
226  /*****************************************************/
228  /*****************************************************/
229 
230  EPETRA_OBJECT_PTR MANGLE(epetra_crs_matrix_create)(EPETRA_OBJECT_REF rowmap);
231 
232  int MANGLE(epetra_crs_matrix_allocate)(EPETRA_OBJECT_REF A, int* rowLengths);
233 
234  int MANGLE(epetra_crs_matrix_putrow)(EPETRA_OBJECT_REF A, EPETRA_INT row,
235  EPETRA_INT num_nz,
236  double* vals, int* col_inds);
237 
238  int MANGLE(epetra_crs_matrix_sumintodiagonal)(EPETRA_OBJECT_REF A,
239  double* diagonal);
240 
241  int MANGLE(epetra_crs_matrix_fillcomplete)(EPETRA_OBJECT_REF A);
242 
243  int MANGLE(epetra_crs_matrix_matvec)(EPETRA_OBJECT_REF A, EPETRA_VECTOR x,
244  EPETRA_VECTOR y);
245 
246  int MANGLE(epetra_crs_matrix_matmultivec)(EPETRA_OBJECT_REF A,
247  EPETRA_MULTIVECTOR x,
248  EPETRA_MULTIVECTOR y);
249 
250  void MANGLE(epetra_crs_matrix_destroy)(EPETRA_OBJECT_REF A);
251 
252  /*****************************************************/
254  /***************************************************/
255 
256  /* create empty shell WITHOUT float storage, fill later with put functions */
257  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create)();
258 
259  /* create empty shell WITH float storage, fill later with put functions */
260  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create1)(EPETRA_OBJECT_REF map, EPETRA_INT numvectors);
261 
262  /* Build multivector from a Fortran-style 2D array
263  NOTE: User storage is not copied, user must keep A intact!! */
264  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create2)(EPETRA_OBJECT_REF map,
265  double *A, EPETRA_INT lda, EPETRA_INT numvectors);
266 
267  /* Build multivector from a double **
268  NOTE: User storage is not copied, user must keep A intact!! */
269  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create3)(EPETRA_OBJECT_REF map,
270  double **in_multivector, EPETRA_INT numvectors);
271 
272  /* Copy constructor */
273  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create4)(EPETRA_MULTIVECTOR
274  in_multivector);
275 
276  /* creates a new multivector from numvector number of vectors of an existing
277  * multivector where the vectors to be copied are listed in
278  * vecIndices.
279  */
280  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create5)(EPETRA_MULTIVECTOR
281  in_multivector, EPETRA_INT numvectors, int *vecIndices);
282 
283  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create6)(EPETRA_MULTIVECTOR
284  in_multiVector, EPETRA_INT startindex, EPETRA_INT numvectors);
285 
286  int MANGLE(epetra_multivector_putmultivector)(EPETRA_MULTIVECTOR multivector,
287  double **in_multivector);
288 
289  /* Allocates space for a multivector created by the default
290  * constructor */
291  int MANGLE(epetra_multivector_allocate)(EPETRA_MULTIVECTOR multivector,
292  EPETRA_OBJECT_REF map, EPETRA_INT numvectors);
293 
294  int MANGLE(epetra_multivector_putscalar)(EPETRA_MULTIVECTOR multivector, EPETRA_DOUBLE scalar);
295 
296  int MANGLE(epetra_multivector_scale)
297  (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar);
298 
299  int MANGLE(epetra_multivector_scalecopy)
300  (EPETRA_MULTIVECTOR multiVector, EPETRA_MULTIVECTOR multiVector_in,
301  EPETRA_DOUBLE scalar);
302 
303  int MANGLE(epetra_multivector_dotprod)
304  (EPETRA_MULTIVECTOR multiVector, EPETRA_MULTIVECTOR multiVector_in,
305  double *scalar);
306 
307  int MANGLE(epetra_multivector_addvec)
308  (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar,
309  EPETRA_MULTIVECTOR multiVector_in);
310 
311  int MANGLE(epetra_multivector_norm1)(EPETRA_MULTIVECTOR multivector, double *result);
312 
313  int MANGLE(epetra_multivector_norm2)(EPETRA_MULTIVECTOR multivector, double *result);
314 
315  int MANGLE(epetra_multivector_lincomb)(EPETRA_MULTIVECTOR multivector,
316  EPETRA_MULTIVECTOR b,
317  EPETRA_DOUBLE scalar, EPETRA_MULTIVECTOR c);
318 
319  int MANGLE(epetra_multivector_random)(EPETRA_MULTIVECTOR multivector);
320 
321  /* Note: The return value for this function is the number of vectors
322  in the multivector */
323  int MANGLE(epetra_multivector_numvectors)(EPETRA_MULTIVECTOR multivector);
324 
325  int MANGLE(epetra_multivector_reduce)(EPETRA_MULTIVECTOR multivector);
326 
327  int MANGLE(eepetra_multivector_gemm)(EPETRA_MULTIVECTOR multivector,
328  EPETRA_INT transa, EPETRA_INT transb, EPETRA_DOUBLE alpha,
329  EPETRA_MULTIVECTOR A, EPETRA_MULTIVECTOR B,
330  EPETRA_DOUBLE beta );
331 
332  void MANGLE(epetra_multivector_destroy)(EPETRA_MULTIVECTOR multivector);
333 
334  /*****************************************************/
336  /***************************************************/
337 
338  EPETRA_OBJECT_PTR MANGLE(epetra_blockmap_create1)(
339  EPETRA_INT numGlobalEquations, EPETRA_INT numlocalEquations, int *updateList,
340  EPETRA_INT numGlobalblocks, EPETRA_INT numlocalblocks, int *blockUpdateList,
341  int* blockSizes, EPETRA_INT indexBase, EPETRA_COMM comm);
342 
343  EPETRA_OBJECT_PTR MANGLE(epetra_blockmap_create2)(
344  EPETRA_INT numGlobalblocks, EPETRA_INT numlocalblocks, int *blockUpdateList,
345  int* blockSizes, EPETRA_INT indexBase, EPETRA_COMM comm);
346 
347  void MANGLE(epetra_blockmap_destroy)(EPETRA_BLOCKMAP blockmap);
348 
349  /*****************************************************/
351  /***************************************************/
352 
353  EPETRA_OBJECT_PTR MANGLE(epetra_localmap_create)(EPETRA_INT numlocalEquations,
354  EPETRA_INT indexBase, EPETRA_COMM comm);
355 
356  void MANGLE(epetra_localmap_destroy)(EPETRA_LOCALMAP localmap);
357 
358  /*****************************************************/
360  /***************************************************/
361 
362  EPETRA_OBJECT_PTR MANGLE(epetra_localblockmap_create1)(
363  EPETRA_INT numlocalEquations,
364  EPETRA_INT numlocalblocks,
365  int* blockSizes,
366  EPETRA_INT indexBase, EPETRA_COMM comm);
367 
368  EPETRA_OBJECT_PTR MANGLE(epetra_localblockmap_create2)(
369  EPETRA_INT numlocalblocks,
370  int* blockSizes,
371  EPETRA_INT indexBase, EPETRA_COMM comm);
372 
373  void MANGLE(epetra_localblockmap_destroy)(EPETRA_LOCALBLOCKMAP localblockmap);
374 #endif /* 0 */
375 
376 #ifdef __cplusplus
377 }
378 #endif
379 
380 #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)