本文整理汇总了C++中Epetra_MpiComm::Comm方法的典型用法代码示例。如果您正苦于以下问题:C++ Epetra_MpiComm::Comm方法的具体用法?C++ Epetra_MpiComm::Comm怎么用?C++ Epetra_MpiComm::Comm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Epetra_MpiComm
的用法示例。
在下文中一共展示了Epetra_MpiComm::Comm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: myComm
// This constructor is for just one subdomain, so only adds the info
// for multiple time steps on the domain. No two-level parallelism.
MultiMpiComm::MultiMpiComm(const Epetra_MpiComm& EpetraMpiComm_, int numTimeSteps_,
const Teuchos::EVerbosityLevel verbLevel) :
Epetra_MpiComm(EpetraMpiComm_),
Teuchos::VerboseObject<MultiMpiComm>(verbLevel),
myComm(Teuchos::rcp(new Epetra_MpiComm(EpetraMpiComm_))),
subComm(0)
{
numSubDomains = 1;
subDomainRank = 0;
numTimeSteps = numTimeSteps_;
numTimeStepsOnDomain = numTimeSteps_;
firstTimeStepOnDomain = 0;
subComm = new Epetra_MpiComm(EpetraMpiComm_);
// Create split communicators for time domain
MPI_Comm time_split_MPI_Comm;
int rank = EpetraMpiComm_.MyPID();
(void) MPI_Comm_split(EpetraMpiComm_.Comm(), rank, rank,
&time_split_MPI_Comm);
timeComm = new Epetra_MpiComm(time_split_MPI_Comm);
numTimeDomains = EpetraMpiComm_.NumProc();
timeDomainRank = rank;
}
示例2: minimumSpaceDimension
int ARPACKm3::reSolve(int numEigen, Epetra_MultiVector &Q, double *lambda, int startingEV) {
// Computes eigenvalues and the corresponding eigenvectors
// of the generalized eigenvalue problem
//
// K X = M X Lambda
//
// using ARPACK (mode 3).
//
// The convergence test is provided by ARPACK.
//
// Note that if M is not specified, then K X = X Lambda is solved.
// (using the mode for generalized eigenvalue problem).
//
// Input variables:
//
// numEigen (integer) = Number of eigenmodes requested
//
// Q (Epetra_MultiVector) = Initial search space
// The number of columns of Q defines the size of search space (=NCV).
// The rows of X are distributed across processors.
// As a rule of thumb in ARPACK User's guide, NCV >= 2*numEigen.
// At exit, the first numEigen locations contain the eigenvectors requested.
//
// lambda (array of doubles) = Converged eigenvalues
// The length of this array is equal to the number of columns in Q.
// At exit, the first numEigen locations contain the eigenvalues requested.
//
// startingEV (integer) = Number of eigenmodes already stored in Q
// A linear combination of these vectors is made to define the starting
// vector, placed in resid.
//
// Return information on status of computation
//
// info >= 0 >> Number of converged eigenpairs at the end of computation
//
// // Failure due to input arguments
//
// info = - 1 >> The stiffness matrix K has not been specified.
// info = - 2 >> The maps for the matrix K and the matrix M differ.
// info = - 3 >> The maps for the matrix K and the preconditioner P differ.
// info = - 4 >> The maps for the vectors and the matrix K differ.
// info = - 5 >> Q is too small for the number of eigenvalues requested.
// info = - 6 >> Q is too small for the computation parameters.
//
// info = - 8 >> numEigen must be smaller than the dimension of the matrix.
//
// info = - 30 >> MEMORY
//
// See ARPACK documentation for the meaning of INFO
if (numEigen <= startingEV) {
return numEigen;
}
int info = myVerify.inputArguments(numEigen, K, M, 0, Q, minimumSpaceDimension(numEigen));
if (info < 0)
return info;
int myPid = MyComm.MyPID();
int localSize = Q.MyLength();
int NCV = Q.NumVectors();
int knownEV = 0;
if (NCV > Q.GlobalLength()) {
if (numEigen >= Q.GlobalLength()) {
cerr << endl;
cerr << " !! The number of requested eigenvalues must be smaller than the dimension";
cerr << " of the matrix !!\n";
cerr << endl;
return -8;
}
NCV = Q.GlobalLength();
}
int localVerbose = verbose*(myPid == 0);
// Define data for ARPACK
highMem = (highMem > currentSize()) ? highMem : currentSize();
int ido = 0;
int lwI = 22 + NCV;
int *wI = new (nothrow) int[lwI];
if (wI == 0) {
return -30;
}
memRequested += sizeof(int)*lwI/(1024.0*1024.0);
int *iparam = wI;
int *ipntr = wI + 11;
int *select = wI + 22;
int lworkl = NCV*(NCV+8);
int lwD = lworkl + 4*localSize;
double *wD = new (nothrow) double[lwD];
if (wD == 0) {
delete[] wI;
return -30;
//.........这里部分代码省略.........
示例3: approxEV
int ModifiedARPACKm3::reSolve(int numEigen, Epetra_MultiVector &Q, double *lambda,
int startingEV, const Epetra_MultiVector *orthoVec) {
// Computes the smallest eigenvalues and the corresponding eigenvectors
// of the generalized eigenvalue problem
//
// K X = M X Lambda
//
// using ModifiedARPACK (mode 3).
//
// The convergence test is performed outisde of ARPACK
//
// || Kx - Mx lambda || < tol*lambda
//
// The norm ||.|| can be specified by the user through the array normWeight.
// By default, the L2 Euclidean norm is used.
//
// Note that if M is not specified, then K X = X Lambda is solved.
// (using the mode for generalized eigenvalue problem).
//
// Input variables:
//
// numEigen (integer) = Number of eigenmodes requested
//
// Q (Epetra_MultiVector) = Initial search space
// The number of columns of Q defines the size of search space (=NCV).
// The rows of X are distributed across processors.
// As a rule of thumb in ARPACK User's guide, NCV >= 2*numEigen.
// At exit, the first numEigen locations contain the eigenvectors requested.
//
// lambda (array of doubles) = Converged eigenvalues
// The length of this array is equal to the number of columns in Q.
// At exit, the first numEigen locations contain the eigenvalues requested.
//
// startingEV (integer) = Number of eigenmodes already stored in Q
// A linear combination of these vectors is made to define the starting
// vector, placed in resid.
//
// orthoVec (Pointer to Epetra_MultiVector) = Space to be orthogonal to
// The computation is performed in the orthogonal of the space spanned
// by the columns vectors in orthoVec.
//
// Return information on status of computation
//
// info >= 0 >> Number of converged eigenpairs at the end of computation
//
// // Failure due to input arguments
//
// info = - 1 >> The stiffness matrix K has not been specified.
// info = - 2 >> The maps for the matrix K and the matrix M differ.
// info = - 3 >> The maps for the matrix K and the preconditioner P differ.
// info = - 4 >> The maps for the vectors and the matrix K differ.
// info = - 5 >> Q is too small for the number of eigenvalues requested.
// info = - 6 >> Q is too small for the computation parameters.
//
// info = - 8 >> numEigen must be smaller than the dimension of the matrix.
//
// info = - 30 >> MEMORY
//
// See ARPACK documentation for the meaning of INFO
if (numEigen <= startingEV) {
return numEigen;
}
int info = myVerify.inputArguments(numEigen, K, M, 0, Q, minimumSpaceDimension(numEigen));
if (info < 0)
return info;
int myPid = MyComm.MyPID();
int localSize = Q.MyLength();
int NCV = Q.NumVectors();
int knownEV = 0;
if (NCV > Q.GlobalLength()) {
if (numEigen >= Q.GlobalLength()) {
cerr << endl;
cerr << " !! The number of requested eigenvalues must be smaller than the dimension";
cerr << " of the matrix !!\n";
cerr << endl;
return -8;
}
NCV = Q.GlobalLength();
}
// Get the weight for approximating the M-inverse norm
Epetra_Vector *vectWeight = 0;
if (normWeight) {
vectWeight = new Epetra_Vector(View, Q.Map(), normWeight);
}
int localVerbose = verbose*(myPid == 0);
// Define data for ARPACK
//
// UH (10/17/03) Note that workl is also used
// * to store the eigenvectors of the tridiagonal matrix
// * as a workspace for DSTEQR
// * as a workspace for recovering the global eigenvectors
//.........这里部分代码省略.........