[Trilinos-Users] examples from tutorial

Malte Neumann neumann@statik.uni-stuttgart.de
Wed, 3 Mar 2004 16:09:07 +0100


--yLVHuoLXiP9kZBkt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Mike,

Thanks a lot for your wrappers. They are easy to use and helped me a lot at
the beginning.

But now I am stuck in the assembling of a FECrs_Matrix and don't know what
else to try. This is what I have done so far:
(see the attached modified c_main.c)


1. Create an Epetra_Communicator and an Epetra_Map using the given wrappers.


2. Create an Epetra_FECrsMatrix using the Map and an array giving the
approx. number of non-zeros per row.


3. Sum one element stiffness matrix for each process into the global matrix.
Use the function :
(line 185 of Epetra_FECrsMatrix.cpp)

  int Epetra_FECrsMatrix::SumIntoGlobalValues  ( 
    int                     numIndices,
    const int *             indices,
    const double *const *   values,
    int format = Epetra_FECrsMatrix::ROW_MAJOR
  )  	
  	
  Parameters:
    numIndices 	Number of rows (and columns) in the sub-matrix.
    indices 	List of scatter-indices (rows and columns) for 
                the sub-matrix.
    values 	Square sub-matrix of coefficients, provided in a 2-D array,
                or double-pointer.
    format 	This is an optional parameter, default value is ROW_MAJOR.

with the parameters:
double val[2][2]   as values (element stiffness matrix)
int    ind[2]      as indices
       2           as numIndices


No matter what I do this function always returns 2, even when defining the
parameters directly in the c_wrapper and not passing them from c to cpp.

Where is my mistake??
Did I misunderstand the whole concept of the FECrsMatrix or it just a
problem of hte usage??

Thank you very much for your advice.

Malte


On Mon, Mar 01, 2004 at 05:06:29PM -0600, Michael A Heroux wrote:
> Malte,
> 
> I have attached the Epetra_C_wrappers files.  They are works-in-progress
> and represent only one way to try to wrap C++ in a C interface.  Note that
> these files are heavily parametrized because they also provide the Fortran
> wrappers by defining a Fortran flag.
> 
> These files wrap a small subset of the classes and methods that Epetra
> provides, but hopefully you can extend them to the set of classes and
> methods you need.
> 
> I have attached a sample program that illustrates how to call Epetra from
> C.  This test driver does work with the development branch of Epetra, but
> should also work with the release branch.
> 
> Mike
> 
> > -----Original Message----- From: Malte Neumann
> > [mailto:neumann@statik.uni-stuttgart.de] Sent: Friday, February 27, 2004
> > 3:28 AM To: trilinos-users Cc: Michael A Heroux Subject: Re:
> > [Trilinos-Users] examples from tutorial
> >
> >
> > Mike,
> >
> > thanks a lot for the link to the examples. I think they are quite
> > helpful.
> >
> > Regarding the C wrappers, I believe they would help me a lot as a
> > starting point, so I would be grateful if you could send them to me.
> >
> > Thanks for your help
> >
> > Malte
> >
> >
> > On Thu, Feb 26, 2004 at 04:57:58PM -0600, Michael A Heroux wrote:
> > > Malte,
> > >
> > > The examples are not part of the standard distribution.  They are
> > > available from the following URL:
> > >
> > > http://www.cs.sandia.gov/~mheroux/examples.tar.gz
> > >
> > > Regarding the C wrappers, they are not part of this release and are
> > > not fully developed at this point.  Our C user base is very small
> > > right now and has tended to provide their own links to the C++
> > > libraries up to now, so I am not sure that our C interfaces will be
> > > ready for outside use for some time.  If you are interested in what we
> > > have, please let me know and I can send them to you.
> > >
> > > Mike
> > >
> > > > -----Original Message-----
> > > > From: trilinos-users-admin@software.sandia.gov
> > > > [mailto:trilinos-users-admin@software.sandia.gov]On Behalf Of Malte
> > > > Neumann
> > > > Sent: Thursday, February 26, 2004 11:19 AM
> > > > To: Trilinos-Users@software.sandia.gov Subject: [Trilinos-Users]
> > > > examples from tutorial
> > > >
> > > >
> > > > Hello,
> > > >
> > > > I am trying to use Trilinos (especially Epetra, AztecOO and ML) in
> > > > our FE-code. I have two questions:
> > > >
> > > > 1. I am not able to find the code for the examples as stated in the
> > > > Trilinos Tutorial (SAND2004-0154). The directory doc does not exist
> > > > in my trilinos directory. Where can I find these examples?
> > > >
> > > > 2. I would like to use the c wrapper functions to use Epetra objects
> > > > from our existing c code. Where can I find further information about
> > > > these c functions, examples on the usage etc.
> > > >
> > > > Thank you very much for your advice.
> > > >
> > > > regards
> > > >
> > > > Malte Neumann

-- 
--------------------------------------------------------------------------
                              Malte Neumann
--------------------------------------------------------------------------
Institut fuer Baustatik / Institute of Structural Mechanics       
Prof. Dr.-Ing. Ekkehard Ramm                        
Universitaet Stuttgart / University of Stuttgart          
                                 
Pfaffenwaldring 7, D-70550 Stuttgart, Germany

mailto:neumann@statik.uni-stuttgart.de            phone: ++49-711-685-6121
http://www.uni-stuttgart.de/ibs/members/neumann/  fax:   ++49-711-685-6130
--------------------------------------------------------------------------

--yLVHuoLXiP9kZBkt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="c_main.c"

#ifdef EPETRA_MPI
#include <mpi.h>
#endif
#include "Epetra_C_wrappers.h"

int main(int argc, char *argv[]) {
  int i;
  EPETRA_OBJECT_PTR Comm, Map, X, Y, matrix;
  int MyPID, NumProc;
  int NumGlobalElements;
  int NumMyElements;

  int numnz[2];
  int ierr;
  int ind[2];
  double val[2][2];

#ifdef EPETRA_MPI
  MPI_Comm   *comm_p;
#endif

#ifdef EPETRA_MPI
  /* Initialize MPI */
  MPI_Init(&argc,&argv);
  *comm_p = MPI_COMM_WORLD;
  Comm = epetra_mpicomm_create2( comm_p );
  /*Comm = epetra_mpicomm_create2( MPI_COMM_WORLD );*/
#else
  Comm = epetra_serialcomm_create();
#endif

  MyPID = epetra_comm_mypid(Comm);
  NumProc = epetra_comm_numproc(Comm);


  /* Construct a Map that puts 2 elements on each PE */

  NumGlobalElements = 2*NumProc;
  Map = epetra_map_create1(NumGlobalElements, 0, Comm);

  epetra_map_print(Map);


  /* array with number of non-zeros per row */
  numnz[0] = 2;
  numnz[1] = 2;
  /* create an Epetra_FECrsMatrix */
  matrix = epetra_fecrs_matrix_create(Map,&(numnz[0]));

  epetra_fecrs_matrix_print(matrix);


  /* the element stiffness matrix */
  val[0][0] = 1.0;
  val[0][1] = 2.0;
  val[1][0] = 3.0;
  val[1][1] = 4.0;

  /* the global indices for the rows/columns of the element stiffness matrix */
  ind[0] = 2*MyPID;
  ind[1] = 2*MyPID+1;

  /* sum the element stiffness matrix into the global matrix */
  ierr = Epetra_fecrs_matrix_sumintoglobal (
      matrix, 2, ind, val);

  printf("ierr = %3i\n",ierr);

  X = epetra_vector_create1(Map);
  Y = epetra_vector_create1(Map);

  epetra_vector_random(X);
  epetra_vector_random(Y);
  printf("Contents of X vector\n");
  epetra_vector_print(X);


  printf("Contents of Y vector\n");
  epetra_vector_print(Y);

  /* Add X and Y (need to pass Y twice for now, since this is the only update 
     interface wrapped by C at this time) */
  epetra_vector_update(X, 1.0, Y, 0.0, Y, 1.0);

  printf("Sum of X and Y vectors\n");
  epetra_vector_print(X);

  epetra_vector_destroy(X);
  epetra_vector_destroy(Y);
  epetra_fecrs_matrix_destroy(matrix);
  epetra_map_destroy(Map);
  epetra_comm_destroy(Comm);
  
#ifdef EPETRA_MPI
  MPI_Finalize() ;
#endif

/* end main
*/
return 0 ;
}

--yLVHuoLXiP9kZBkt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="Epetra_C_wrappers.cpp"


//@HEADER
// ************************************************************************
// 
//               Epetra: Linear Algebra Services Package 
//                 Copyright (2001) Sandia Corporation
// 
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
// 
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//  
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//  
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
// Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
// 
// ************************************************************************
//@HEADER

#ifdef PARALLEL
#include <mpi.h>
#endif

#include "Epetra_Object.h"
#include "Epetra_Comm.h"
#include "Epetra_SerialComm.h"
#include "Epetra_Map.h"
#include "Epetra_LocalMap.h"
#include "Epetra_BlockMap.h"
#include "Epetra_MultiVector.h"
#include "Epetra_Vector.h"
#include "Epetra_VbrMatrix.h"
#include "Epetra_CrsMatrix.h"
#include "Epetra_FECrsMatrix.h"
#include "Epetra_C_wrappers.h"
#ifdef PARALLEL
#include "Epetra_MpiComm.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

/////////////////////////////////////////////////////
//                  Epetra_Comm                    /
///////////////////////////////////////////////////

#ifdef PARALLEL
  EPETRA_OBJECT_PTR MANGLE(epetra_mpicomm_create1)() {
    Epetra_Comm *comm_ = new Epetra_MpiComm(MPI_COMM_WORLD);
    return((EPETRA_OBJECT_PTR ) comm_);
  }
  EPETRA_OBJECT_PTR MANGLE(epetra_mpicomm_create2)(MPI_Comm * comm) {
    Epetra_Comm *comm_ = new Epetra_MpiComm(*comm);
    return((EPETRA_OBJECT_PTR ) comm_);
  }
#endif

  EPETRA_OBJECT_PTR MANGLE(epetra_serialcomm_create)() {
    Epetra_Comm *comm = new Epetra_SerialComm();
    return((EPETRA_OBJECT_PTR ) comm);
  }

  int MANGLE(epetra_comm_mypid)(EPETRA_OBJECT_REF comm) {
    Epetra_Comm *comm_ = (Epetra_Comm *) comm;
    return(comm_->MyPID());
  
  }
  int MANGLE(epetra_comm_numproc)(EPETRA_OBJECT_REF comm) {
    Epetra_Comm* comm_ = (Epetra_Comm *) comm;
    return(comm_->NumProc());
  
  }

  void MANGLE(epetra_comm_barrier)(EPETRA_OBJECT_REF comm) {
    Epetra_Comm* comm_ = (Epetra_Comm *) comm;
    comm_->Barrier();
  
  }

  void MANGLE(epetra_comm_destroy)(EPETRA_OBJECT_REF comm) {
    delete (Epetra_Comm *) comm;
  }

  /////////////////////////////////////////////////////
  //                  Epetra_Map                    //
  ///////////////////////////////////////////////////

  EPETRA_OBJECT_PTR MANGLE(epetra_map_create1)(EPETRA_INT numGlobalElements,
					       EPETRA_INT indexBase,
					       EPETRA_OBJECT_REF comm) {
    Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
    Epetra_Map *map = new Epetra_Map(EPETRA_DEREF(numGlobalElements), EPETRA_DEREF(indexBase), comm_);
    return((EPETRA_OBJECT_PTR ) map);
  }

  EPETRA_OBJECT_PTR MANGLE(epetra_map_create2)(EPETRA_INT numGlobalElements,
					       EPETRA_INT numMyElements,
					       EPETRA_INT indexBase,
					       EPETRA_OBJECT_REF comm) {
    Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
    Epetra_Map *map = new Epetra_Map(EPETRA_DEREF(numGlobalElements), EPETRA_DEREF(numMyElements), 
				     EPETRA_DEREF(indexBase), comm_);
    return((EPETRA_OBJECT_PTR ) map);
  }

  EPETRA_OBJECT_PTR MANGLE(epetra_map_create3)(EPETRA_INT numGlobalElements,
					       EPETRA_INT numLocalElements,
					       int *updateList, 
					       EPETRA_INT indexBase,
					       EPETRA_OBJECT_REF comm) {
    Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
    Epetra_Map *map = new Epetra_Map(EPETRA_DEREF(numGlobalElements), EPETRA_DEREF(numLocalElements),
				     updateList, EPETRA_DEREF(indexBase), comm_);
    return((EPETRA_OBJECT_PTR ) map);
  }

  int MANGLE(epetra_map_nummyelements)(EPETRA_OBJECT_REF map) {
    Epetra_Map * map_ = (Epetra_Map *) map;
    return(map_->NumMyElements());
  }

  int MANGLE(epetra_map_numglobalelements)(EPETRA_OBJECT_REF map) {
    Epetra_Map * map_ = (Epetra_Map *) map;
    return(map_->NumGlobalElements());
  }
#ifndef EPETRA_FORTRAN  /* Fortran cannot receive a pointer to int */
  int * MANGLE(epetra_map_myglobalelements)(EPETRA_OBJECT_REF map) {
    Epetra_Map * map_ = (Epetra_Map *) map;
    return(map_->MyGlobalElements());
  }
#endif
  EPETRA_OBJECT_PTR MANGLE(epetra_map_comm)(EPETRA_OBJECT_REF map) {
    Epetra_Map * map_ = (Epetra_Map *) map;
    return((EPETRA_OBJECT_PTR) &(map_->Comm()));
  }

  void MANGLE(epetra_map_destroy)(EPETRA_OBJECT_REF map)
  {
    delete (Epetra_Map *) map;
  }


  void MANGLE(epetra_map_print) (EPETRA_OBJECT_REF map)
  {
    cout << *(Epetra_Map *) map;
  }


  /////////////////////////////////////////////////////
  //                  Epetra_Vector                 //
  ///////////////////////////////////////////////////

  EPETRA_OBJECT_PTR MANGLE(epetra_vector_create1)(EPETRA_OBJECT_REF map) {
    Epetra_Map& map_ = *(Epetra_Map *) map;
    Epetra_Vector *vector = new Epetra_Vector(map_);
    return((EPETRA_OBJECT_PTR ) vector);
  }

  EPETRA_OBJECT_PTR MANGLE(epetra_vector_create2)(EPETRA_INT CopyValues, EPETRA_OBJECT_REF map,
						  double * V) {
    Epetra_DataAccess CV = View;
    if (EPETRA_DEREF(CopyValues)==1) CV = Copy;
    Epetra_Map& map_ = *(Epetra_Map *) map;
    Epetra_Vector *vector = new Epetra_Vector(CV, map_, V);
    return((EPETRA_OBJECT_PTR ) vector);
  }

  int MANGLE(epetra_vector_putscalar)(EPETRA_OBJECT_REF x, EPETRA_DOUBLE scalar) {
    Epetra_Vector *x_ = (Epetra_Vector *) x;
    return(x_->PutScalar(EPETRA_DEREF(scalar)));
  }

  int MANGLE(epetra_vector_norm1)(EPETRA_OBJECT_REF x, double *scalar) {
    Epetra_Vector *x_ = (Epetra_Vector *) x;
    return(x_->Norm1(scalar));
  }

  int MANGLE(epetra_vector_norm2)(EPETRA_OBJECT_REF x, double *scalar) {
    Epetra_Vector *x_ = (Epetra_Vector *) x;
    return(x_->Norm2(scalar));
  }

  int MANGLE(epetra_vector_random)(EPETRA_OBJECT_REF x) {
    Epetra_Vector *x_ = (Epetra_Vector *) x;
    return(x_->Random());
  }

  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_Vector *x_ = (Epetra_Vector *) x;
    Epetra_Vector& a_ = *(Epetra_Vector *) a;
    Epetra_Vector& b_ = *(Epetra_Vector *) b;
    return(x_->Update(EPETRA_DEREF(scalara), a_, EPETRA_DEREF(scalarb), b_, EPETRA_DEREF(scalarx)));
  }

  void MANGLE(epetra_vector_print)(EPETRA_OBJECT_REF x) {
    cout << *(Epetra_Vector *) x;
  }

  void MANGLE(epetra_vector_destroy)(EPETRA_OBJECT_REF x) {
    delete (Epetra_Vector *) x;
  }

  //////////////////////////////////////////
  //   EPETRA_FECrsMatrix        by Malte //
  //////////////////////////////////////////   
  EPETRA_OBJECT_PTR MANGLE(epetra_fecrs_matrix_create) (EPETRA_OBJECT_REF rowmap, int* numnz)
  {
    Epetra_Map& rowmap_ = *(Epetra_Map *) rowmap;
    Epetra_FECrsMatrix *B = new Epetra_FECrsMatrix(Copy,rowmap_,numnz);
    return((EPETRA_OBJECT_PTR) B);
  }


  void MANGLE(epetra_fecrs_matrix_print) (EPETRA_OBJECT_REF matrix)
  {
    cout << *(Epetra_FECrsMatrix *) matrix;
  }


  int MANGLE(Epetra_fecrs_matrix_sumintoglobal) (EPETRA_OBJECT_REF matrix,
      int numind, int* lm, double* const* val)
  {
    Epetra_FECrsMatrix *mat = (Epetra_FECrsMatrix *) matrix;
    return( mat->SumIntoGlobalValues( numind, lm, val, Epetra_FECrsMatrix::ROW_MAJOR));
  }


  void MANGLE(epetra_fecrs_matrix_destroy)(EPETRA_OBJECT_REF matrix)
  {
    delete (Epetra_Map *) matrix;
  }


  /////////////////////////////////////////////////////
#ifdef SKIP4NOW /* Comment this out for now */
  /////////////////////////////////////////////////////
  //                  Epetra_DVBR_Matrix            //
  ///////////////////////////////////////////////////


  EPETRA_OBJECT_PTR MANGLE(epetra_rdp_dvbr_matrix_create)
    (EPETRA_MAP rowmap)
  {
    Epetra_BlockMap& rowmap_ = *(Epetra_BlockMap *) rowmap;
    Epetra_DVBR_Matrix *B = new Epetra_DVBR_Matrix(rowmap_);
    return((EPETRA_OBJECT_PTR) B);
  }

  int MANGLE(epetra_rdp_dvbr_matrix_allocate)
    (EPETRA_MATRIX A, int* numNzBlks, int* blkColInds)
  {
    Epetra_DVBR_Matrix *B = (Epetra_DVBR_Matrix *) A;
    return(B->allocate(numNzBlks, blkColInds));
  }
  int MANGLE(epetra_rdp_dvbr_matrix_putblockrow)
    (EPETRA_MATRIX A, EPETRA_INT blk_row, EPETRA_INT num_nz_blocks, 
     double* vals, int* blk_col_inds)
  {
    Epetra_DVBR_Matrix *B = (Epetra_DVBR_Matrix *) A;
    return(B->putBlockRow( EPETRA_DEREF(blk_row), EPETRA_DEREF(num_nz_blocks), vals, 
			   blk_col_inds));
  }

  int MANGLE(epetra_rdp_dvbr_matrix_fillcomplete)(EPETRA_MATRIX A)
  {
    Epetra_DVBR_Matrix *B = (Epetra_DVBR_Matrix *) A;
    return(B->fillComplete());
  }

  int MANGLE(epetra_rdp_dvbr_matrix_matvec)(EPETRA_MATRIX A, EPETRA_VECTOR x,
					    EPETRA_VECTOR y)
  {
    Epetra_DVBR_Matrix *B = (Epetra_DVBR_Matrix *) A;
    const Epetra_Vector& x1 = *(Epetra_Vector *) x;
    Epetra_Vector& y1 = *(Epetra_Vector *) y;
    return(B->matvec(x1, y1));
  }

  int MANGLE(epetra_rdp_dvbr_matrix_matmultivec)(EPETRA_MATRIX A,
						 EPETRA_MULTIVECTOR x,
						 EPETRA_MULTIVECTOR y)
  {
    Epetra_DVBR_Matrix *B = (Epetra_DVBR_Matrix *) A;
    const Epetra_MultiVector& x1 = *(Epetra_MultiVector *) x;
    Epetra_MultiVector& y1 = *(Epetra_MultiVector *) y;
    return(B->matvec(x1, y1));
  }

  void MANGLE(epetra_rdp_dvbr_matrix_destroy)(EPETRA_MATRIX A)
  {
    delete (Epetra_DVBR_Matrix *) A;
  }

  /////////////////////////////////////////////////////
  //                  Epetra_DCRS_Matrix            //
  ///////////////////////////////////////////////////


  EPETRA_OBJECT_PTR MANGLE(epetra_rdp_dcrs_matrix_create) (EPETRA_MAP rowmap)
  {
    Epetra_Map& rowmap_ = *(Epetra_Map *) rowmap;
    Epetra_DCRS_Matrix *B = new Epetra_DCRS_Matrix(rowmap_);
    return((EPETRA_OBJECT_PTR) B);
  }

  int MANGLE(epetra_rdp_dcrs_matrix_allocate)
    (EPETRA_MATRIX A, int* rowLengths)
  {
    Epetra_DCRS_Matrix *B = (Epetra_DCRS_Matrix *) A;
    return(B->allocate(rowLengths));
  }
  int MANGLE(epetra_rdp_dcrs_matrix_putrow)(EPETRA_MATRIX A, EPETRA_INT row,
					    EPETRA_INT num_nz, 
					    double* vals, int* col_inds)
  {
    Epetra_DCRS_Matrix *B = (Epetra_DCRS_Matrix *) A;
    return(B->putRow( EPETRA_DEREF(row), EPETRA_DEREF(num_nz), vals, col_inds));
  }

  int MANGLE(epetra_rdp_dcrs_matrix_sumintodiagonal)
    (EPETRA_MATRIX A, double* diagonal)
  {
    Epetra_DCRS_Matrix *B = (Epetra_DCRS_Matrix *) A;
    return(B->sumIntoDiagonal( diagonal));
  }

  int MANGLE(epetra_rdp_dcrs_matrix_fillcomplete)(EPETRA_MATRIX A)
  {
    Epetra_DCRS_Matrix *B = (Epetra_DCRS_Matrix *) A;
    return(B->fillComplete());
  }

  int MANGLE(epetra_rdp_dcrs_matrix_matvec)(EPETRA_MATRIX A, EPETRA_VECTOR x,
					    EPETRA_VECTOR y)
  {
    Epetra_DCRS_Matrix *B = (Epetra_DCRS_Matrix *) A;
    const Epetra_Vector& x1 = *(Epetra_Vector *) x;
    Epetra_Vector& y1 = *(Epetra_Vector *) y;
    return(B->matvec(x1, y1));
  }

  int MANGLE(epetra_rdp_dcrs_matrix_matmultivec)(EPETRA_MATRIX A,
						 EPETRA_MULTIVECTOR x,
						 EPETRA_MULTIVECTOR y)
  {
    Epetra_DCRS_Matrix *B = (Epetra_DCRS_Matrix *) A;
    const Epetra_MultiVector& x1 = *(Epetra_MultiVector *) x;
    Epetra_MultiVector& y1 = *(Epetra_MultiVector *) y;
    return(B->matvec(x1, y1));
  }


  void MANGLE(epetra_rdp_dcrs_matrix_destroy)(EPETRA_MATRIX A)
  {
    delete (Epetra_DCRS_Matrix *) A;
  }

  //                  Epetra_MultiVector            //
  ///////////////////////////////////////////////////

  EPETRA_OBJECT_PTR MANGLE(epetra_rdp_multivector_create)()
  {
    Epetra_MultiVector *vector = new Epetra_MultiVector();
    return((EPETRA_OBJECT_PTR) vector);
  }

  EPETRA_OBJECT_PTR MANGLE(epetra_rdp_multivector_create1)
    (EPETRA_MAP map, EPETRA_INT numVectors)
  {
    Epetra_Map& map_ = *(Epetra_Map *) map;
    Epetra_MultiVector *vector = new Epetra_MultiVector(map_, EPETRA_DEREF(numVectors));
    return((EPETRA_OBJECT_PTR) vector);
  }

  EPETRA_OBJECT_PTR MANGLE(epetra_rdp_multivector_create2)(EPETRA_MAP map, 
								    double *A, EPETRA_INT lda, EPETRA_INT numVectors)
  {
    Epetra_Map& map_ = *(Epetra_Map *) map;
    Epetra_MultiVector *vector = new Epetra_MultiVector(map_, A, EPETRA_DEREF(lda),
							EPETRA_DEREF(numVectors));
    return((EPETRA_OBJECT_PTR) vector);
  }

  EPETRA_OBJECT_PTR MANGLE(epetra_rdp_multivector_create3)(EPETRA_MAP map, 
								    double **in_multiVector, EPETRA_INT numVectors)
  {
    Epetra_Map& map_ = *(Epetra_Map *) map;
    Epetra_MultiVector *vector = new Epetra_MultiVector(map_, in_multiVector,
							EPETRA_DEREF(numVectors));
    return((EPETRA_OBJECT_PTR) vector);
  }

  EPETRA_OBJECT_PTR MANGLE(epetra_rdp_multivector_create4)
    (EPETRA_MULTIVECTOR in_multiVector)
  {
    Epetra_MultiVector & in_multiVector_ = *(Epetra_MultiVector *) in_multiVector;
    Epetra_MultiVector *vector = new Epetra_MultiVector(in_multiVector_);
    return((EPETRA_OBJECT_PTR) vector);
  }

  EPETRA_OBJECT_PTR MANGLE(epetra_rdp_multivector_create5)(EPETRA_MULTIVECTOR 
								    in_multiVector, EPETRA_INT numVectors, int *vecIndices)
  {
    Epetra_MultiVector & in_multiVector_ = *(Epetra_MultiVector *) in_multiVector;
    Epetra_MultiVector *vector = new Epetra_MultiVector(in_multiVector_,
							EPETRA_DEREF(numVectors), vecIndices));
  return((EPETRA_OBJECT_PTR) vector);
}

EPETRA_OBJECT_PTR MANGLE(epetra_rdp_multivector_create6)(EPETRA_MULTIVECTOR
								  in_multiVector, EPETRA_INT startindex, EPETRA_INT numvectors)
{
  Epetra_MultiVector & in_multiVector_ = *(Epetra_MultiVector *) in_multiVector;
  Epetra_MultiVector *vector = new Epetra_MultiVector(in_multiVector_, EPETRA_DEREF(startindex),
						      EPETRA_DEREF(numvectors));
  return((EPETRA_OBJECT_PTR) vector);
}

int MANGLE(epetra_rdp_multivector_putmultivector)
  (EPETRA_MULTIVECTOR multiVector, 
   double **in_multiVector)
{
  Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
  const double ** t = (const double **) in_multiVector;
  return(multiVector_->putMultiVector(t));
}

int MANGLE(epetra_rdp_multivector_allocate)(EPETRA_MULTIVECTOR multiVector, 
					    EPETRA_MAP map, EPETRA_INT numVectors)
{
  Epetra_Map& map_ = *(Epetra_Map *) map;
  Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
  return(multiVector_->allocate(map_, EPETRA_DEREF(numVectors)));
}

int MANGLE(epetra_rdp_multivector_putscalar)
  (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar)
{
  Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
  return(multiVector_->putScalar(EPETRA_DEREF(scalar)));
}

int MANGLE(epetra_rdp_multivector_scale)
  (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar)
{
  Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
  return(multiVector_->scale(EPETRA_DEREF(scalar)));
}

int MANGLE(epetra_rdp_multivector_scalecopy)
  (EPETRA_MULTIVECTOR multiVector, EPETRA_MULTIVECTOR multiVector_in,
   EPETRA_DOUBLE scalar)
{
  Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
  Epetra_MultiVector& multiVector_in_ = *(Epetra_MultiVector *) multiVector_in;
  return(multiVector_->scaleCopy(multiVector_in_, EPETRA_DEREF(scalar)));
}

int MANGLE(epetra_rdp_multivector_dotprod)
  (EPETRA_MULTIVECTOR multiVector, EPETRA_MULTIVECTOR multiVector_in,
   double *scalar)
{
  Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
  Epetra_MultiVector& multiVector_in_ = *(Epetra_MultiVector *) multiVector_in;
  return(multiVector_->dotProd(multiVector_in_, scalar));
}

int MANGLE(epetra_rdp_multivector_addvec)
  (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar, 
   EPETRA_MULTIVECTOR multiVector_in)
{
  Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
  Epetra_MultiVector& multiVector_in_ = *(Epetra_MultiVector *) multiVector_in;
  return(multiVector_->addVec(EPETRA_DEREF(scalar), multiVector_in_)));
}

int MANGLE(epetra_rdp_multivector_norm1)
  (EPETRA_MULTIVECTOR multiVector, double *scalar)
{
  Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
  return(multiVector_->norm1(scalar));
}

int MANGLE(epetra_rdp_multivector_norm2)
  (EPETRA_MULTIVECTOR multiVector, double *scalar)
{
  Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
  return(multiVector_->norm2(scalar));
}

int MANGLE(epetra_rdp_multivector_lincomb)(EPETRA_MULTIVECTOR multiVector,
					   EPETRA_MULTIVECTOR b, 
					   EPETRA_DOUBLE scalar, EPETRA_MULTIVECTOR c)
{
  Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
  Epetra_MultiVector& b_ = *(Epetra_MultiVector *) b;
  Epetra_MultiVector& c_ = *(Epetra_MultiVector *) c;
  return(multiVector_->linComb(b_,EPETRA_DEREF(scalar,c_)));
}

int MANGLE(epetra_rdp_multivector_random)
  (EPETRA_MULTIVECTOR multiVector)
{
  Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
  return(multiVector_->random());
}

int MANGLE(epetra_rdp_multivector_reduce)(EPETRA_MULTIVECTOR multiVector)
{
  Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
  return(multiVector_->reduce());
}

int MANGLE(epetra_rdp_multivector_numvectors)(EPETRA_MULTIVECTOR multiVector)
{
  Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
  return(multiVector_->numVectors());
}

int MANGLE(epetra_rdp_multivector_gemm)(EPETRA_MULTIVECTOR multiVector,
					EPETRA_INT transa, EPETRA_INT transb, EPETRA_DOUBLE alpha,
					EPETRA_MULTIVECTOR A, EPETRA_MULTIVECTOR B,
					EPETRA_DOUBLE beta )
{
  Epetra_MultiVector *multiVector_ = (Epetra_MultiVector *) multiVector;
  Epetra_MultiVector& A_ = *(Epetra_MultiVector *) A;
  Epetra_MultiVector& B_ = *(Epetra_MultiVector *) B;
  bool transa_ = !(EPETRA_DEREF(transa==0));
  bool transb_ = !(EPETRA_DEREF(transb==0));
  return(multiVector_->GEMM(transa_, transb_, EPETRA_DEREF(alpha), A_, B_, EPETRA_DEREF(beta)));
}

void MANGLE(epetra_rdp_multivector_destroy)(EPETRA_MULTIVECTOR multiVector)
{
  delete (Epetra_MultiVector *) multiVector;
}

/////////////////////////////////////////////////////
//                  Epetra_BlockMap               //
///////////////////////////////////////////////////

EPETRA_OBJECT_PTR MANGLE(epetra_blockmap_create1)(
							EPETRA_INT numGlobalElements, EPETRA_INT numLocalElements, int *updateList,
							EPETRA_INT numGlobalBlocks, EPETRA_INT numLocalBlocks, 
							int *blockUpdateList,
							int* blockSizes, EPETRA_INT indexBase, EPETRA_COMM comm)
{
  Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
  Epetra_BlockMap *blockmap = new Epetra_BlockMap(EPETRA_DEREF(numGlobalElements),
						  EPETRA_DEREF(numLocalElements), updateList,
						  EPETRA_DEREF(numGlobalBlocks), EPETRA_DEREF(numLocalBlocks),
						  blockUpdateList,
						  blockSizes, EPETRA_DEREF(indexBase), comm_);
  return((EPETRA_OBJECT_PTR ) blockmap);
}

EPETRA_OBJECT_PTR MANGLE(epetra_blockmap_create2)(
							EPETRA_INT numGlobalBlocks, EPETRA_INT numLocalBlocks, 
							int *blockUpdateList,
							int* blockSizes, EPETRA_INT indexBase, EPETRA_COMM comm)
{
  Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
  Epetra_BlockMap *blockmap = new Epetra_BlockMap(
						  EPETRA_DEREF(numGlobalBlocks), EPETRA_DEREF(numLocalBlocks), 
						  blockUpdateList,
						  blockSizes, EPETRA_DEREF(indexBase), comm_);
  return((EPETRA_OBJECT_PTR ) blockmap);
}

void MANGLE(epetra_blockmap_destroy)(EPETRA_BLOCKMAP blockmap)
{
  delete (Epetra_BlockMap *) blockmap;
}

/////////////////////////////////////////////////////
//                  Epetra_LocalMap               //
///////////////////////////////////////////////////

EPETRA_OBJECT_PTR MANGLE(epetra_localmap_create)(EPETRA_INT numLocalElements,
						       EPETRA_INT indexBase, EPETRA_COMM comm)
{
  Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
  Epetra_LocalMap *localmap = new Epetra_LocalMap(EPETRA_DEREF(numLocalElements),
						  EPETRA_DEREF(indexBase), comm_);
  return((EPETRA_OBJECT_PTR ) localmap);
}

void MANGLE(epetra_localmap_destroy)(EPETRA_LOCALMAP localmap)
{
  delete (Epetra_LocalMap *) localmap;
}

/////////////////////////////////////////////////////
//                  Epetra_LocalBlockMap          //
///////////////////////////////////////////////////

EPETRA_OBJECT_PTR MANGLE(epetra_localblockmap_create1)(
								  EPETRA_INT numLocalElements,
								  EPETRA_INT numLocalBlocks,
								  int* blockSizes,
								  EPETRA_INT indexBase, EPETRA_COMM comm)
{
  Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
  Epetra_LocalBlockMap *localblockmap = new
    Epetra_LocalBlockMap(EPETRA_DEREF(numLocalElements),
			 EPETRA_DEREF(numLocalBlocks),
			 blockSizes,
			 EPETRA_DEREF(indexBase), comm_);
  return((EPETRA_OBJECT_PTR ) localblockmap);
}

EPETRA_OBJECT_PTR MANGLE(epetra_localblockmap_create2)(
								  EPETRA_INT numLocalBlocks,
								  int* blockSizes,
								  EPETRA_INT indexBase, EPETRA_COMM comm)
{
  Epetra_Comm& comm_ = *(Epetra_Comm *) comm;
  Epetra_LocalBlockMap *localblockmap = new
    Epetra_LocalBlockMap(EPETRA_DEREF(numLocalBlocks),
			 blockSizes,
			 EPETRA_DEREF(indexBase), comm_);
  return((EPETRA_OBJECT_PTR ) localblockmap);
}

void MANGLE(epetra_localblockmap_destroy)(EPETRA_LOCALBLOCKMAP localblockmap)
{
  delete (Epetra_LocalBlockMap *) localblockmap;
}


#endif /* 0 */

#ifdef __cplusplus
}
#endif

--yLVHuoLXiP9kZBkt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="Epetra_C_wrappers.h"


/*
************************************************************************

Epetra: Linear Algebra Services Package 
Copyright (2001) Sandia Corporation

Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
license for use of this work by or on behalf of the U.S. Government.

This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
 
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.
 
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
Questions? Contact Michael A. Heroux (maherou@sandia.gov) 

************************************************************************
*/

#ifndef EPETRA_C_WRAPPERS_H
#define EPETRA_C_WRAPPERS_H

#ifdef EPETRA_FORTRAN

typedef double * EPETRA_DOUBLE;
typedef int    * EPETRA_INT;
#define EPETRA_DEREF(a) *a

#ifdef EPETRA_ADDRESS64BIT

typedef long int EPETRA_OBJECT_PTR;
typedef long int & EPETRA_OBJECT_REF;

#else

typedef int EPETRA_OBJECT_PTR;
typedef int & EPETRA_OBJECT_REF;

#endif
#else

/* These typedefs act as new types for the Epetra C interface */

typedef double EPETRA_DOUBLE;
typedef int    EPETRA_INT;
#define EPETRA_DEREF(a) a

typedef void * EPETRA_OBJECT_PTR;
typedef void * EPETRA_OBJECT_REF;


#endif
 
#ifdef EPETRA_FORTRAN
#if defined(TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE)
#define MANGLE(x) x
#else
#define MANGLE(x) x ## __
#endif
#else
#define MANGLE(x) x
#endif



#ifdef __cplusplus
extern "C" {
#endif

  /*****************************************************/
  /**                  Epetra_Comm                    **/
  /***************************************************/

#ifdef PARALLEL
  EPETRA_OBJECT_PTR MANGLE(epetra_mpicomm_create1)();
  EPETRA_OBJECT_PTR MANGLE(epetra_mpicomm_create2)(MPI_Comm * comm);
#endif
  EPETRA_OBJECT_PTR MANGLE(epetra_serialcomm_create)();

  int MANGLE(epetra_comm_mypid)(EPETRA_OBJECT_REF communicator);

  int MANGLE(epetra_comm_numproc)(EPETRA_OBJECT_REF communicator);

  void MANGLE(epetra_comm_barrier)(EPETRA_OBJECT_REF communicator);

  void MANGLE(epetra_comm_destroy)(EPETRA_OBJECT_REF communicator);

  /*****************************************************/
  /**                  Epetra_Map                     **/
  /***************************************************/

  EPETRA_OBJECT_PTR MANGLE(epetra_map_create1)(EPETRA_INT numGlobalEquations, 
					       EPETRA_INT indexBase,
					       EPETRA_OBJECT_REF comm);

  EPETRA_OBJECT_PTR MANGLE(epetra_map_create2)(EPETRA_INT numGlobalEquations, 
					       EPETRA_INT numMyElements,
					       EPETRA_INT indexBase,
					       EPETRA_OBJECT_REF comm);

  EPETRA_OBJECT_PTR MANGLE(epetra_map_create3)(EPETRA_INT numGlobalEquations, 
					       EPETRA_INT numlocalEquations,
					       int *updateList, EPETRA_INT indexBase,
					       EPETRA_OBJECT_REF comm);
  int MANGLE(epetra_map_nummyelements)(EPETRA_OBJECT_REF map);
  int MANGLE(epetra_map_numglobalelements)(EPETRA_OBJECT_REF map);

#ifndef EPETRA_FORTRAN  /* Fortran cannot receive a pointer to int */
  int * MANGLE(epetra_map_myglobalelements)(EPETRA_OBJECT_REF map);
#endif

  EPETRA_OBJECT_PTR MANGLE(epetra_map_comm)(EPETRA_OBJECT_REF map);

  void MANGLE(epetra_map_destroy)(EPETRA_OBJECT_REF map);

  void MANGLE(epetra_map_print) (EPETRA_OBJECT_REF map);

  /*****************************************************/
  /**              Epetra_Vector                  **/
  /***************************************************/

  EPETRA_OBJECT_PTR MANGLE(epetra_vector_create1)(EPETRA_OBJECT_REF map);
  EPETRA_OBJECT_PTR MANGLE(epetra_vector_create2)(EPETRA_INT Copy, EPETRA_OBJECT_REF map,
						  double * V);

  int MANGLE(epetra_vector_putscalar)(EPETRA_OBJECT_REF x, EPETRA_DOUBLE scalar);

  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);

  int MANGLE(epetra_vector_norm1)(EPETRA_OBJECT_REF x, double *result);

  int MANGLE(epetra_vector_norm2)(EPETRA_OBJECT_REF x, double *result);

  int MANGLE(epetra_vector_random)(EPETRA_OBJECT_REF x);

  void MANGLE(epetra_vector_print)(EPETRA_OBJECT_REF x);

  void MANGLE(epetra_vector_destroy)(EPETRA_OBJECT_REF x);
  
  
  /*
  //////////////////////////////////////////
  //   EPETRA_FECrsMatrix        by Malte //
  //////////////////////////////////////////   
  */
  EPETRA_OBJECT_PTR MANGLE(epetra_fecrs_matrix_create) (
      EPETRA_OBJECT_REF rowmap, int* numnz);


  void MANGLE(epetra_fecrs_matrix_print) (EPETRA_OBJECT_REF matrix);


  int MANGLE(Epetra_fecrs_matrix_sumintoglobal) (
      EPETRA_OBJECT_REF matrix, int numind, int* lm, double* const* val);


  void MANGLE(epetra_fecrs_matrix_destroy)(EPETRA_OBJECT_REF matrix);

#ifdef SKIP4NOW
  /*****************************************************/
  /**              petra_dvbr_matrix             **/
  /***************************************************/

  EPETRA_OBJECT_PTR MANGLE(epetra_dvbr_matrix_create)(EPETRA_MAP rowmap);

  int MANGLE(epetra_dvbr_matrix_allocate)(EPETRA_MATRIX A, int* numNzBlks, int* blkColInds);

  int MANGLE(epetra_dvbr_matrix_putblockrow)(EPETRA_MATRIX A, EPETRA_INT
					     blk_row, EPETRA_INT num_nz_blocks,
					     double* vals, int* blk_col_inds);

  int MANGLE(epetra_dvbr_matrix_fillcomplete)(EPETRA_MATRIX A);

  int  MANGLE(epetra_dvbr_matrix_matvec)(EPETRA_MATRIX A, EPETRA_VECTOR x, EPETRA_VECTOR y);

  int MANGLE(epetra_dvbr_matrix_matmultivec)(EPETRA_MATRIX A,
					     EPETRA_MULTIVECTOR x,
					     EPETRA_MULTIVECTOR y);

  void MANGLE(epetra_dvbr_matrix_destroy)(EPETRA_MATRIX A);

  /*****************************************************/
  /**                  petra_dcrs_matrix         **/
  /***************************************************/

  EPETRA_OBJECT_PTR MANGLE(epetra_dcrs_matrix_create)(EPETRA_MAP rowmap);

  int  MANGLE(epetra_dcrs_matrix_allocate)(EPETRA_MATRIX A, int* rowLengths);

  int MANGLE(epetra_dcrs_matrix_putrow)(EPETRA_MATRIX A, EPETRA_INT row, 
					EPETRA_INT num_nz,
					double* vals, int* col_inds);

  int MANGLE(epetra_dcrs_matrix_sumintodiagonal)(EPETRA_MATRIX A, 
						 double* diagonal);

  int MANGLE(epetra_dcrs_matrix_fillcomplete)(EPETRA_MATRIX A);

  int MANGLE(epetra_dcrs_matrix_matvec)(EPETRA_MATRIX A, EPETRA_VECTOR x, 
					EPETRA_VECTOR y);

  int MANGLE(epetra_dcrs_matrix_matmultivec)(EPETRA_MATRIX A,
					     EPETRA_MULTIVECTOR x,
					     EPETRA_MULTIVECTOR y);

  void MANGLE(epetra_dcrs_matrix_destroy)(EPETRA_MATRIX A);

  /*****************************************************/
  /**               petra_multivector            **/
  /***************************************************/

  /* create empty shell WITHOUT float storage, fill later with put functions */
  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create)();

  /* create empty shell WITH float storage, fill later with put functions */
  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create1)(EPETRA_MAP map, EPETRA_INT numvectors);

  /* Build multivector from a Fortran-style 2D array
     NOTE: User storage is not copied, user must keep A intact!! */
  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create2)(EPETRA_MAP map,
								double *A, EPETRA_INT lda, EPETRA_INT numvectors);

  /* Build multivector from a double **
     NOTE: User storage is not copied, user must keep A intact!! */
  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create3)(EPETRA_MAP map,
								double **in_multivector, EPETRA_INT numvectors);

  /* Copy constructor */
  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create4)(EPETRA_MULTIVECTOR
								in_multivector);

  /* creates a new multivector from numvector number of vectors of an existing
   * multivector where the vectors to be copied are listed in
   * vecIndices.  
   */
  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create5)(EPETRA_MULTIVECTOR 
								in_multivector, EPETRA_INT numvectors, int *vecIndices);

  EPETRA_OBJECT_PTR MANGLE(epetra_multivector_create6)(EPETRA_MULTIVECTOR
								in_multiVector, EPETRA_INT startindex, EPETRA_INT numvectors);

  int MANGLE(epetra_multivector_putmultivector)(EPETRA_MULTIVECTOR multivector, 
						double **in_multivector);

  /* Allocates space for a multivector created by the default
   * constructor */
  int MANGLE(epetra_multivector_allocate)(EPETRA_MULTIVECTOR multivector, 
					  EPETRA_MAP map, EPETRA_INT numvectors);

  int MANGLE(epetra_multivector_putscalar)(EPETRA_MULTIVECTOR multivector, EPETRA_DOUBLE scalar);

  int MANGLE(epetra_multivector_scale)
       (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar);

  int MANGLE(epetra_multivector_scalecopy)
       (EPETRA_MULTIVECTOR multiVector, EPETRA_MULTIVECTOR multiVector_in,
	EPETRA_DOUBLE scalar);

  int MANGLE(epetra_multivector_dotprod)
       (EPETRA_MULTIVECTOR multiVector, EPETRA_MULTIVECTOR multiVector_in,
	double *scalar);

  int MANGLE(epetra_multivector_addvec)
       (EPETRA_MULTIVECTOR multiVector, EPETRA_DOUBLE scalar, 
	EPETRA_MULTIVECTOR multiVector_in);

  int MANGLE(epetra_multivector_norm1)(EPETRA_MULTIVECTOR multivector, double *result);

  int MANGLE(epetra_multivector_norm2)(EPETRA_MULTIVECTOR multivector, double *result);

  int MANGLE(epetra_multivector_lincomb)(EPETRA_MULTIVECTOR multivector,
					 EPETRA_MULTIVECTOR b, 
					 EPETRA_DOUBLE scalar, EPETRA_MULTIVECTOR c);

  int MANGLE(epetra_multivector_random)(EPETRA_MULTIVECTOR multivector);

  /* Note: The return value for this function is the number of vectors
     in the multivector */
  int MANGLE(epetra_multivector_numvectors)(EPETRA_MULTIVECTOR multivector);

  int MANGLE(epetra_multivector_reduce)(EPETRA_MULTIVECTOR multivector);

  int MANGLE(eepetra_multivector_gemm)(EPETRA_MULTIVECTOR multivector,
				       EPETRA_INT transa, EPETRA_INT transb, EPETRA_DOUBLE alpha,
				       EPETRA_MULTIVECTOR A, EPETRA_MULTIVECTOR B,
				       EPETRA_DOUBLE beta );

  void MANGLE(epetra_multivector_destroy)(EPETRA_MULTIVECTOR multivector);

  /*****************************************************/
  /**                  petra_blockmap                **/
  /***************************************************/

  EPETRA_OBJECT_PTR MANGLE(epetra_blockmap_create1)(
							  EPETRA_INT numGlobalEquations, EPETRA_INT numlocalEquations, int *updateList,
							  EPETRA_INT numGlobalblocks, EPETRA_INT numlocalblocks, int *blockUpdateList,
							  int* blockSizes, EPETRA_INT indexBase, EPETRA_COMM comm);

  EPETRA_OBJECT_PTR MANGLE(epetra_blockmap_create2)(
							  EPETRA_INT numGlobalblocks, EPETRA_INT numlocalblocks, int *blockUpdateList,
							  int* blockSizes, EPETRA_INT indexBase, EPETRA_COMM comm);

  void MANGLE(epetra_blockmap_destroy)(EPETRA_BLOCKMAP blockmap);

  /*****************************************************/
  /**                  petra_localmap                **/
  /***************************************************/

  EPETRA_OBJECT_PTR MANGLE(epetra_localmap_create)(EPETRA_INT numlocalEquations,
							 EPETRA_INT indexBase, EPETRA_COMM comm);

  void MANGLE(epetra_localmap_destroy)(EPETRA_LOCALMAP localmap);

  /*****************************************************/
  /**                  petra_localblockmap           **/
  /***************************************************/

  EPETRA_OBJECT_PTR MANGLE(epetra_localblockmap_create1)(
								    EPETRA_INT numlocalEquations,
								    EPETRA_INT numlocalblocks,
								    int* blockSizes,
								    EPETRA_INT indexBase, EPETRA_COMM comm);

  EPETRA_OBJECT_PTR MANGLE(epetra_localblockmap_create2)(
								    EPETRA_INT numlocalblocks,
								    int* blockSizes,
								    EPETRA_INT indexBase, EPETRA_COMM comm);

  void MANGLE(epetra_localblockmap_destroy)(EPETRA_LOCALBLOCKMAP localblockmap);
#endif /* 0 */

#ifdef __cplusplus
}
#endif

#endif /* EPETRA_C_WRAPPERS_H */

--yLVHuoLXiP9kZBkt--