60 int MyPID = Comm.
MyPID();
64 if (verbose&&MyPID==0) cout <<
"constructing Epetra_FEVector" << endl;
77 int* ptIndices =
new int[numGlobalIDs];
78 double* ptCoefs =
new double[numGlobalIDs];
83 {
for(
int i=0; i<numGlobalIDs; ++i) {
84 ptIndices[i] = minGID+i;
88 if (verbose&&MyPID==0) {
89 cout <<
"calling A.SumIntoGlobalValues with " << numGlobalIDs <<
" values"<<endl;
93 if (verbose&&MyPID==0) {
94 cout <<
"calling A.SumIntoGlobalValues with " << numGlobalIDs <<
" values"<<endl;
98 if (verbose&&MyPID==0) {
99 cout <<
"calling A.GlobalAssemble()" << endl;
104 if (verbose&&MyPID==0) {
105 cout <<
"after globalAssemble"<<endl;
118 if (nrm2a != nrm2b) {
119 cerr <<
"copy-constructor test failed, norm of copy doesn't equal"
120 <<
" norm of original."<<endl;
133 int NumGlobalRows = 4;
135 Epetra_Map Map(NumGlobalRows, indexBase, Comm);
138 int MyPID = Comm.
MyPID();
140 if (Numprocs != 2)
return(0);
144 int* Indices =
new int[NumCols];
146 double* Values =
new double[NumCols];
179 if (verbose&&MyPID==0) {
189 if (verbose&&MyPID==0) {
207 if (Numprocs != 2)
return(0);
208 int MyPID = Comm.
MyPID();
211 int NumGlobalRows = 6;
212 const int NumVectors = 4;
214 Epetra_Map Map(NumGlobalRows, indexBase, Comm);
254 for(
int i=0; i<NumVectors; ++i) {
261 double nrm2[NumVectors];
265 for(
int i=1; i<NumVectors; ++i) {
266 if (fabs(nrm2[i]-nrm2[0]) > 1.e-12) {
276 for(
int i=0; i<NumVectors; ++i) {
285 if (verbose&&MyPID==0) {
295 if (verbose&&MyPID==0) {
309 int NumGlobalElems = 4;
315 int MyPID = Comm.
MyPID();
317 if (Numprocs != 2)
return(0);
320 int* Indices =
new int[NumCols];
321 int* numValuesPerID =
new int[NumCols];
322 for(
int i=0; i<NumCols; ++i) {
323 numValuesPerID[i] = elemSize;
326 double* Values =
new double[NumCols*elemSize];
363 numValuesPerID, Values),
368 if (verbose&&MyPID==0) {
378 if (verbose&&MyPID==0) {
388 delete [] numValuesPerID;
396 int NumGlobalElems = 4;
402 int MyPID = Comm.
MyPID();
404 if (Numprocs != 2)
return(0);
407 int* Indices =
new int[NumCols];
408 int* numValuesPerID =
new int[NumCols];
409 for(
int i=0; i<NumCols; ++i) {
410 numValuesPerID[i] = elemSize;
413 double* Values =
new double[NumCols*elemSize];
428 for(
int ii=0; ii<NumCols*elemSize; ++ii) {
438 for(
int ii=0; ii<NumCols*elemSize; ++ii) {
445 numValuesPerID, Values),
450 if (verbose&&MyPID==0) {
460 if (verbose&&MyPID==0) {
470 delete [] numValuesPerID;
480 const double value = 1.;
490 if (std::abs(x1.
Values()[Map.
LID(3)] - 1) > 1.e-9)
return -1;
499 x1.GlobalAssemble (
Insert);
503 if (std::abs(x1.Values()[Map.
LID(3)] - 1) > 1.e-9)
return -1;
518 const double value = 1;
522 std::cout <<
"Entry " << GID <<
" after construct & set: "
523 << x1[0][0] << std::endl;
540 std::cout <<
"Entry " << GID <<
" after copy & set: "
541 << x2[0][0] << std::endl;
555 const double value = 1;
559 std::cout <<
"Entry " << GID <<
" after construct & set: "
560 << x1[0][0] << std::endl;
573 if (Comm.
MyPID()==0) {
574 std::cout <<
"Entry " << GID <<
" after PutScalar & set: "
575 << x1[0][0] << std::endl;
576 if (x1[0][0] != value)
return -1;
584 const int NumVectors = 4;
585 const int NumElements = 4;
587 std::vector<double> mydata(NumElements*NumVectors, 1.0);
594 const double value = 1;
598 if (Comm.
MyPID()==0 && x1[0][0] != value)
return -1;
int NumGlobalElements() const
Number of elements across all processors.
Epetra_Map: A class for partitioning vectors and matrices.
Epetra_IntSerialDenseVector: A class for constructing and using dense vectors.
int fevec1(Epetra_Comm &Comm, bool verbose)
#define EPETRA_TEST_ERR(a, b)
int fevec7(Epetra_Comm &Comm, bool verbose)
int PutScalar(double ScalarConstant)
Initialize all values in a multi-vector with constant value.
virtual void Print(std::ostream &os) const
Print method.
int fevec6(Epetra_Comm &Comm, bool verbose)
virtual void Barrier() const =0
Epetra_Comm Barrier function.
virtual int MyPID() const =0
Return my process ID.
Epetra_SerialDenseVector: A class for constructing and using dense vectors.
int MultiVectorTests(const Epetra_Map &Map, int NumVectors, bool verbose)
Epetra_Comm: The Epetra Communication Abstract Base Class.
int fevec5(Epetra_Comm &Comm, bool verbose)
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
int MinAllGID() const
Returns the minimum global ID across the entire map.
int LID(int GID) const
Returns local ID of global ID, return -1 if not found on this processor.
bool MyGID(int GID_in) const
Returns true if the GID passed in belongs to the calling processor in this map, otherwise returns fal...
int fevec2(Epetra_Comm &Comm, bool verbose)
const Epetra_Comm & Comm() const
Access function for Epetra_Comm communicator.
double * Values() const
Get pointer to MultiVector values.
int ReplaceGlobalValues(int numIDs, const int *GIDs, const double *values, int vectorIndex=0)
Copy values into the vector overwriting any values that already exist for the specified indices...
virtual int NumProc() const =0
Returns total number of processes.
int GlobalAssemble(Epetra_CombineMode mode=Add, bool reuse_map_and_exporter=false)
Gather any overlapping/shared data into the non-overlapping partitioning defined by the Map that was ...
Epetra Finite-Element Vector.
int Norm2(double *Result) const
Compute 2-norm of each vector in multi-vector.
int fevec0(Epetra_Comm &Comm, bool verbose)
int fevec3(Epetra_Comm &Comm, bool verbose)
int fevec4(Epetra_Comm &Comm, bool verbose)
int SumIntoGlobalValues(int numIDs, const int *GIDs, const double *values, int vectorIndex=0)
Accumulate values into the vector, adding them to any values that already exist for the specified ind...