本文整理汇总了C++中Epetra_BlockMap::MinAllGID方法的典型用法代码示例。如果您正苦于以下问题:C++ Epetra_BlockMap::MinAllGID方法的具体用法?C++ Epetra_BlockMap::MinAllGID怎么用?C++ Epetra_BlockMap::MinAllGID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Epetra_BlockMap
的用法示例。
在下文中一共展示了Epetra_BlockMap::MinAllGID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: roundRobinMapShared
ArrayRCP<zgno_t> roundRobinMap(const Epetra_BlockMap &emap)
{
const Epetra_Comm &comm = emap.Comm();
int proc = comm.MyPID();
int nprocs = comm.NumProc();
zgno_t basegid = emap.MinAllGID();
zgno_t maxgid = emap.MaxAllGID();
size_t nglobalrows = emap.NumGlobalElements();
return roundRobinMapShared(proc, nprocs, basegid, maxgid, nglobalrows);
}
示例2: MultiVectorTests
int MultiVectorTests(const Epetra_BlockMap & Map, int NumVectors, bool verbose)
{
(void)NumVectors;
const Epetra_Comm & Comm = Map.Comm();
int ierr = 0;
/* get number of processors and the name of this processor */
// int NumProc = Comm.getNumProc();
int MyPID = Comm.MyPID();
// Construct FEVector
if (verbose&&MyPID==0) cout << "constructing Epetra_FEVector" << endl;
Epetra_FEVector A(Map, 1);
//For an extreme test, we'll have each processor sum-in a 1.0 for All
//global ids.
int minGID = Map.MinAllGID();
int numGlobalIDs = Map.NumGlobalElements();
//For now we're going to have just one point associated with
//each GID (element).
int* ptIndices = new int[numGlobalIDs];
double* ptCoefs = new double[numGlobalIDs];
Epetra_IntSerialDenseVector epetra_indices(View, ptIndices, numGlobalIDs);
Epetra_SerialDenseVector epetra_coefs(View, ptCoefs, numGlobalIDs);
{for(int i=0; i<numGlobalIDs; ++i) {
ptIndices[i] = minGID+i;
ptCoefs[i] = 1.0;
}}
if (verbose&&MyPID==0) {
cout << "calling A.SumIntoGlobalValues with " << numGlobalIDs << " values"<<endl;
}
EPETRA_TEST_ERR( A.SumIntoGlobalValues(numGlobalIDs, ptIndices, ptCoefs), ierr);
if (verbose&&MyPID==0) {
cout << "calling A.SumIntoGlobalValues with " << numGlobalIDs << " values"<<endl;
}
EPETRA_TEST_ERR( A.SumIntoGlobalValues(epetra_indices, epetra_coefs), ierr);
if (verbose&&MyPID==0) {
cout << "calling A.GlobalAssemble()" << endl;
}
EPETRA_TEST_ERR( A.GlobalAssemble(), ierr );
if (verbose&&MyPID==0) {
cout << "after globalAssemble"<<endl;
}
if (verbose) {
A.Print(cout);
}
//now do a quick test of the copy constructor
Epetra_FEVector B(A);
double nrm2a, nrm2b;
A.Norm2(&nrm2a);
B.Norm2(&nrm2b);
if (nrm2a != nrm2b) {
cerr << "copy-constructor test failed, norm of copy doesn't equal"
<< " norm of original."<<endl;
return(-1);
}
delete [] ptIndices;
delete [] ptCoefs;
return(ierr);
}
示例3: checkmap
int checkmap(Epetra_BlockMap & Map, int NumGlobalElements, int NumMyElements,
int *MyGlobalElements, int ElementSize, int * ElementSizeList,
int NumGlobalPoints, int NumMyPoints,
int IndexBase, Epetra_Comm& Comm,
bool DistributedGlobal,
bool IsOneToOne)
{
int i, ierr=0, forierr=0;// forierr is used in for loops, then is tested
// after for loop completes to see if it is non zero - potentially prevents
// thousands of error messages
if (ElementSizeList==0)
{
EPETRA_TEST_ERR(!Map.ConstantElementSize(),ierr);
}
else
EPETRA_TEST_ERR(Map.ConstantElementSize(),ierr);
EPETRA_TEST_ERR(DistributedGlobal!=Map.DistributedGlobal(),ierr);
EPETRA_TEST_ERR(IsOneToOne!=Map.IsOneToOne(),ierr);
int *MyElementSizeList;
if (ElementSizeList==0)
{
EPETRA_TEST_ERR(Map.ElementSize()!=ElementSize,ierr);
MyElementSizeList = new int[NumMyElements];
EPETRA_TEST_ERR(Map.ElementSizeList(MyElementSizeList)!=0,ierr);
forierr = 0;
for (i=0; i<NumMyElements; i++)
forierr += MyElementSizeList[i]!=ElementSize;
EPETRA_TEST_ERR(forierr,ierr);
EPETRA_TEST_ERR(Map.MaxMyElementSize() != ElementSize,ierr);
EPETRA_TEST_ERR(Map.MinMyElementSize() != ElementSize,ierr);
}
else
{
MyElementSizeList = new int[NumMyElements];
EPETRA_TEST_ERR(Map.ElementSizeList(MyElementSizeList)!=0,ierr);
int MaxSize = MyElementSizeList[0];
int MinSize = MyElementSizeList[0];
forierr=0;
for (i=0; i<NumMyElements; i++) {
forierr += MyElementSizeList[i]!=ElementSizeList[i];
if (MyElementSizeList[i] > MaxSize)
MaxSize = MyElementSizeList[i];
if (MyElementSizeList[i] < MinSize)
MinSize = MyElementSizeList[i];
// Test ElementSize(int LID) method
forierr += Map.ElementSize(Map.LID(MyGlobalElements[i])) != ElementSizeList[i];
}
EPETRA_TEST_ERR(forierr,ierr);
EPETRA_TEST_ERR(MaxSize !=Map.MaxMyElementSize(),ierr);
EPETRA_TEST_ERR(MinSize !=Map.MinMyElementSize(),ierr);
}
const Epetra_Comm & Comm1 = Map.Comm();
EPETRA_TEST_ERR(Comm1.NumProc()!=Comm.NumProc(),ierr);
EPETRA_TEST_ERR(Comm1.MyPID()!=Comm.MyPID(),ierr);
EPETRA_TEST_ERR(Map.IndexBase()!=IndexBase,ierr);
EPETRA_TEST_ERR(!Map.LinearMap() && MyGlobalElements==0,ierr);
EPETRA_TEST_ERR(Map.LinearMap() && MyGlobalElements!=0,ierr);
EPETRA_TEST_ERR(Map.MaxAllGID()!=NumGlobalElements-1+IndexBase,ierr);
EPETRA_TEST_ERR(Map.MaxElementSize()!=ElementSize,ierr);
int MaxLID = Map.MaxLID();
EPETRA_TEST_ERR(MaxLID!=NumMyElements-1,ierr);
int MaxMyGID = (Comm.MyPID()+1)*NumMyElements-1+IndexBase;
if (Comm.MyPID()>2) MaxMyGID+=3;
if (!DistributedGlobal) MaxMyGID = NumMyElements-1+IndexBase;
EPETRA_TEST_ERR(Map.MaxMyGID()!=MaxMyGID,ierr);
EPETRA_TEST_ERR(Map.MinAllGID()!=IndexBase,ierr);
if (ElementSizeList==0)
{
EPETRA_TEST_ERR(Map.MinElementSize()!=ElementSize,ierr);
}
else EPETRA_TEST_ERR(Map.MinElementSize()!=2,ierr);
int MinLID = Map.MinLID();
EPETRA_TEST_ERR(MinLID!=0,ierr);
int MinMyGID = Comm.MyPID()*NumMyElements+IndexBase;
//.........这里部分代码省略.........