[Trilinos-Users] Import to a map that is not 1 to 1

Jack Chessa jfchessa at utep.edu
Sun May 30 19:09:52 MDT 2010


I have been fooling around with the Epetra Import class to import data  
from a vector defined with a 1 to 1 map to a vector whose map is not 1  
to 1.

 From what I have been reading it seems that this should be possible.

when I execute the following code with three processors

#ifdef HAVE_MPI
	#include "Epetra_MpiComm.h"
#else
	#include "Epetra_SerialComm.h"
#endif

#include "Epetra_IntSerialDenseVector.h"
#include "Epetra_IntVector.h"
#include "Epetra_Export.h"
#include "Epetra_Import.h"

using namespace std;

int main( int argc, char* argv[] )
{

// Epetra Mpi or Serial Comm
#ifdef HAVE_MPI
	MPI_Init(&argc, &argv);
	Epetra_MpiComm MyComm(MPI_COMM_WORLD);
#else
	Epetra_SerialComm MyComm;
#endif	
	
	if ( MyComm.MyPID()==0 )
		cout << "\n--------------------------------------------\n";


	// do some tests with import and export classes
	int numGlobalElem=15;
	Epetra_IntSerialDenseVector myElem(6);
	
	switch ( MyComm.MyPID() )
	{
		case 0:
		myElem[0]=0; myElem[1]=1; myElem[2]=2;
		myElem[3]=3; myElem[4]=4; myElem[5]=5;
		break;
		
		case 1:
		myElem[0]=5; myElem[1]=6; myElem[2]=7;
		myElem[3]=8; myElem[4]=9; myElem[5]=10;
		break;
		
		case 2:
		myElem[0]=10; myElem[1]=11; myElem[2]=12;
		myElem[3]=13; myElem[4]=14; myElem[5]=15;
		break;
	}
	
	/*
	map1 is like an owning dof map and map2 is like a used on processor dof
	map.  We need to communicate between these maps.
	*/
	Epetra_Map map1( numGlobalElem, 0, MyComm );
	Epetra_Map map2( numGlobalElem+3, myElem.Length(), myElem.Values(),  
0, MyComm );
	
	// Define some vectors to operate on
	Epetra_IntSerialDenseVector v1Data(map1.NumMyElements());
	for ( int i=0; i<v1Data.Length(); ++i )
		v1Data[i]=MyComm.MyPID();
		
	Epetra_IntVector v1(View,map1,v1Data.Values()), v2(map2);
	
	Epetra_Import importer( map2, map1 );
	if ( v2.Import( v1, importer, Insert, 0 ) )
		cout << "\nWe have a problem Houston\n";
	
	return 0;
}

I get the following run-time error

terminate called after throwing an instance of 'int'
[compute-0-2:05151] *** Process received signal ***
[compute-0-2:05151] Signal: Aborted (6)
[compute-0-2:05151] Signal code:  (-6)
[compute-0-2:05151] [ 0] /lib64/libpthread.so.0 [0x32dcc0de70]
[compute-0-2:05151] [ 1] /lib64/libc.so.6(gsignal+0x35) [0x32dbc30055]
[compute-0-2:05151] [ 2] /lib64/libc.so.6(abort+0x110) [0x32dbc31af0]
[compute-0-2:05151] [ 3] /usr/lib64/libstdc++.so. 
6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x114) [0x32de8bebf4]
[compute-0-2:05151] [ 4] /usr/lib64/libstdc++.so.6 [0x32de8bcdb6]
[compute-0-2:05151] [ 5] /usr/lib64/libstdc++.so.6 [0x32de8bcde3]
[compute-0-2:05151] [ 6] /usr/lib64/libstdc++.so.6 [0x32de8bceca]
[compute-0-2:05151] [ 7] /home/jfchessa/basso_dev/examples/ 
test(_ZN13Epetra_ImportC1ERK15Epetra_BlockMapS2_+0x6ea) [0x426d2a]
[compute-0-2:05151] [ 8] /home/jfchessa/basso_dev/examples/test(main 
+0x42c) [0x4200d0]
[compute-0-2:05151] [ 9] /lib64/libc.so.6(__libc_start_main+0xf4)  
[0x32dbc1d8a4]
[compute-0-2:05151] [10] /home/jfchessa/basso_dev/examples/ 
test(__gxx_personality_v0+0x181) [0x41fb89]
[compute-0-2:05151] *** End of error message ***

The code basically just imports data from an IntVector, v1,  that has  
a one to on map to a IntVector v2 that is not one to one.  My question  
is should this work?  And if so I assume I have some installation/ 
configuration issue?  This is using Trilinos 8.0 on a intel beowulf  
cluster with centos.

Thanks for any information and/or direction


Jack Chessa
Associate Professor
Department of Mechanical Engineering
University of Texas at El Paso
Email:    jfchessa at utep.edu
Office:    A309
Voice:     (915) 747-6900
Fax:                        (915) 747-5019
Web:       http://utminers.utep.edu/jfchessa/index.html




-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20100530/ae0681d1/attachment.html 


More information about the Trilinos-Users mailing list