本文整理汇总了C++中fei::SharedPtr::getRowSpace方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedPtr::getRowSpace方法的具体用法?C++ SharedPtr::getRowSpace怎么用?C++ SharedPtr::getRowSpace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fei::SharedPtr
的用法示例。
在下文中一共展示了SharedPtr::getRowSpace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setName
//----------------------------------------------------------------------------
snl_fei::LinearSystem_General::LinearSystem_General(fei::SharedPtr<fei::MatrixGraph>& matrixGraph)
: fei::LinearSystem(matrixGraph),
comm_(matrixGraph->getRowSpace()->getCommunicator()),
essBCvalues_(NULL),
resolveConflictRequested_(false),
bcs_trump_slaves_(false),
explicitBCenforcement_(false),
BCenforcement_no_column_mod_(false),
localProc_(0),
numProcs_(1),
name_(),
named_loadcomplete_counter_(),
iwork_(),
dwork_(),
dbgprefix_("LinSysG: ")
{
localProc_ = fei::localProc(comm_);
numProcs_ = fei::numProcs(comm_);
fei::SharedPtr<fei::VectorSpace> vecSpace = matrixGraph->getRowSpace();
std::vector<int> offsets;
vecSpace->getGlobalIndexOffsets(offsets);
firstLocalOffset_ = offsets[localProc_];
lastLocalOffset_ = offsets[localProc_+1]-1;
setName("dbg");
}
示例2: runtime_error
fei::SharedPtr<fei::Vector>
Factory_Aztec::createVector(fei::SharedPtr<fei::MatrixGraph> matrixGraph,
bool isSolutionVector,
int numVectors)
{
int globalNumSlaves = matrixGraph->getGlobalNumSlaveConstraints();
if (globalNumSlaves > 0 && reducer_.get()==NULL) {
reducer_ = matrixGraph->getReducer();
}
fei::SharedPtr<fei::Vector> feivec, tmpvec;
std::vector<int> indices;
int err = 0, localSize;
fei::SharedPtr<fei::VectorSpace> vecSpace = matrixGraph->getRowSpace();
if (reducer_.get() != NULL) {
indices = reducer_->getLocalReducedEqns();
localSize = indices.size();
}
else {
localSize = vecSpace->getNumIndices_Owned();
indices.resize(localSize);
err = vecSpace->getIndices_Owned(indices);
}
if (err != 0) {
throw std::runtime_error("error in vecSpace->getIndices_Owned");
}
if (reducer_.get() != NULL) {
feivec.reset(new fei::VectorReducer(reducer_, tmpvec, isSolutionVector));
}
else {
feivec = tmpvec;
}
return(feivec);
}
示例3: extractDirichletBCs
//----------------------------------------------------------------------------
int extractDirichletBCs(fei::DirichletBCManager* bcManager,
fei::SharedPtr<fei::MatrixGraph> matrixGraph,
fei::CSVec* essBCvalues,
bool resolveConflictRequested,
bool bcs_trump_slaves)
{
// int numLocalBCs = bcManager->getNumBCRecords();
// int globalNumBCs = 0;
// MPI_Comm comm = matrixGraph->getRowSpace()->getCommunicator();
// fei::GlobalSum(comm, numLocalBCs, globalNumBCs);
// if (globalNumBCs == 0) {
// return(0);
// }
fei::SharedPtr<fei::FillableMat> localBCeqns(new fei::FillableMat);
fei::SharedPtr<fei::Matrix_Impl<fei::FillableMat> > bcEqns;
// matrixGraph->getRowSpace()->initComplete();
int numSlaves = matrixGraph->getGlobalNumSlaveConstraints();
fei::SharedPtr<fei::Reducer> reducer = matrixGraph->getReducer();
int numIndices = numSlaves>0 ?
reducer->getLocalReducedEqns().size() :
matrixGraph->getRowSpace()->getNumIndices_Owned();
bool zeroSharedRows = false;
bcEqns.reset(new fei::Matrix_Impl<fei::FillableMat>(localBCeqns, matrixGraph, numIndices, zeroSharedRows));
fei::SharedPtr<fei::Matrix> bcEqns_reducer;
if (numSlaves > 0) {
bcEqns_reducer.reset(new fei::MatrixReducer(reducer, bcEqns));
}
fei::Matrix& bcEqns_mat = bcEqns_reducer.get()==NULL ?
*bcEqns : *bcEqns_reducer;
CHK_ERR( bcManager->finalizeBCEqns(bcEqns_mat, bcs_trump_slaves) );
if (resolveConflictRequested) {
fei::SharedPtr<fei::FillableMat> mat = bcEqns->getMatrix();
std::vector<int> bcEqnNumbers;
fei::get_row_numbers(*mat, bcEqnNumbers);
CHK_ERR( snl_fei::resolveConflictingCRs(*matrixGraph, bcEqns_mat,
bcEqnNumbers) );
}
std::vector<int> essEqns;
std::vector<double> values;
std::map<int,fei::FillableMat*>& remotes = bcEqns->getRemotelyOwnedMatrices();
std::map<int,fei::FillableMat*>::iterator
it = remotes.begin(),
it_end = remotes.end();
for(; it!=it_end; ++it) {
fei::impl_utils::separate_BC_eqns( *(it->second), essEqns, values);
}
// CHK_ERR( bcEqns->gatherFromOverlap(false) );
fei::impl_utils::separate_BC_eqns( *(bcEqns->getMatrix()), essEqns, values);
if (essEqns.size() > 0) {
int* essEqnsPtr = &essEqns[0];
double* valuesPtr = &values[0];
for(unsigned i=0; i<essEqns.size(); ++i) {
int eqn = essEqnsPtr[i];
double value = valuesPtr[i];
fei::put_entry(*essBCvalues, eqn, value);
}
}
return(0);
}