[Trilinos-Users] examples from tutorial

Williams, Alan B william@sandia.gov
Wed, 3 Mar 2004 09:24:43 -0700


Hi Malte,

The return-code of 2 is coming from the underlying CrsMatrix (which is the
base class for FECrsMatrix). When CrsMatrix::SumIntoGlobalValues is called
for matrix positions that don't yet exist, it is an error. To input data for
matrix positions that don't yet exist, it is necessary to use the method
InsertGlobalValues.

We have debated whether this is the best behavior, since it would be natural
for finite-element matrix assembly to use SumIntoGlobalValues for the whole
matrix, from the beginning.

An alternative is to pre-construct the graph of your matrix (using a
CrsGraph object) and construct a FECrsMatrix with that graph. Then
SumIntoGlobalValues can be used.

Alan


> -----Original Message-----
> From: Malte Neumann [mailto:neumann@statik.uni-stuttgart.de]
> Sent: Wednesday, March 03, 2004 8:09 AM
> To: Michael A Heroux
> Cc: trilinos-users
> Subject: Re: [Trilinos-Users] examples from tutorial
> 
> 
> 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
> --------------------------------------------------------------
> ------------
>