int EpetraVector<T>::ReplaceGlobalValues(const Epetra_IntSerialDenseVector & GIDs, const Epetra_SerialDenseVector & values) { if (GIDs.Length() != values.Length()) { return(-1); } return( inputValues( GIDs.Length(), GIDs.Values(), values.Values(), false) ); }
int Epetra_FEVector::ReplaceGlobalValues(const Epetra_IntSerialDenseVector& GIDs, const Epetra_SerialDenseVector& values, int vectorIndex) { if (GIDs.Length() != values.Length()) { return(-1); } return( inputValues( GIDs.Length(), GIDs.Values(), values.Values(), false, vectorIndex) ); }
int Epetra_FECrsMatrix::ReplaceGlobalValues(const Epetra_IntSerialDenseVector& indices, const Epetra_SerialDenseMatrix& values, int format) { if (indices.Length() != values.M() || indices.Length() != values.N()) { return(-1); } return( ReplaceGlobalValues(indices.Length(), indices.Values(), values.A(), format) ); }
int Epetra_FECrsMatrix::InsertGlobalValues(const Epetra_IntSerialDenseVector& rows, const Epetra_IntSerialDenseVector& cols, const Epetra_SerialDenseMatrix& values, int format) { if (rows.Length() != values.M() || cols.Length() != values.N()) { return(-1); } return( InsertGlobalValues(rows.Length(), rows.Values(), cols.Length(), cols.Values(), values.A(), format) ); }
void MapEpetra::bubbleSort (Epetra_IntSerialDenseVector& elements) { Int hold; for ( Int pass (0); pass < elements.Length() - 1; pass++ ) for ( Int j (0); j < elements.Length() - 1; j++ ) if ( elements[j] > elements[j + 1] ) { hold = elements[j]; elements[j] = elements[j + 1]; elements[j + 1] = hold; } }
int main(int argc, char *argv[]) { #ifdef HAVE_MPI MPI_Init(&argc, &argv); Epetra_MpiComm Comm(MPI_COMM_WORLD); #else Epetra_SerialComm Comm; #endif int NumGlobalElements = 4; // global dimension of the problem int NumMyElements; // local nodes Epetra_IntSerialDenseVector MyGlobalElements; if( Comm.MyPID() == 0 ) { NumMyElements = 3; MyGlobalElements.Size(NumMyElements); MyGlobalElements[0] = 0; MyGlobalElements[1] = 1; MyGlobalElements[2] = 2; } else { NumMyElements = 3; MyGlobalElements.Size(NumMyElements); MyGlobalElements[0] = 1; MyGlobalElements[1] = 2; MyGlobalElements[2] = 3; } // create a map Epetra_Map Map(-1,MyGlobalElements.Length(), MyGlobalElements.Values(),0, Comm); // create a vector based on map Epetra_Vector x(Map); for( int i=0 ; i<NumMyElements ; ++i ) x[i] = 10*( Comm.MyPID()+1 ); cout << x; // create a target map, in which all the elements are on proc 0 int NumMyElements_target; if( Comm.MyPID() == 0 ) NumMyElements_target = NumGlobalElements; else NumMyElements_target = 0; Epetra_Map TargetMap(-1,NumMyElements_target,0,Comm); Epetra_Export Exporter(Map,TargetMap); // work on vectors Epetra_Vector y(TargetMap); y.Export(x,Exporter,Add); cout << y; #ifdef HAVE_MPI MPI_Finalize(); #endif return(EXIT_SUCCESS); }