本文整理汇总了C++中fei::SharedPtr::isSlaveEqn方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedPtr::isSlaveEqn方法的具体用法?C++ SharedPtr::isSlaveEqn怎么用?C++ SharedPtr::isSlaveEqn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fei::SharedPtr
的用法示例。
在下文中一共展示了SharedPtr::isSlaveEqn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runtime_error
//----------------------------------------------------------------------------
VectorReducer::VectorReducer(fei::SharedPtr<fei::Reducer> reducer,
fei::SharedPtr<fei::Vector> target,
bool isSolutionVector)
: reducer_(reducer),
target_(target),
isSolution_(isSolutionVector)
{
localProc_ = fei::localProc(target->getVectorSpace()->getCommunicator());
numProcs_ = fei::numProcs(target->getVectorSpace()->getCommunicator());
fei::Vector_core* target_core = dynamic_cast<fei::Vector_core*>(target.get());
if (target_core == NULL) {
throw std::runtime_error("fei::VectorReducer ERROR, target vector not dynamic_cast-able to fei::Vector_core.");
}
fei::SharedPtr<fei::VectorSpace> vecspace = target->getVectorSpace();
int numEqns = vecspace->getNumIndices_SharedAndOwned();
std::vector<int> eqns;
vecspace->getIndices_SharedAndOwned(eqns);
std::vector<int> overlap;
for(int i=0; i<numEqns; ++i) {
if (!reducer->isSlaveEqn(eqns[i])) {
overlap.push_back(reducer->translateToReducedEqn(eqns[i]));
}
else {
std::vector<int> masters;
reducer->getSlaveMasterEqns(eqns[i], masters);
for(unsigned j=0; j<masters.size(); ++j) {
overlap.push_back(reducer->translateToReducedEqn(masters[j]));
}
}
}
target_core->setOverlap(overlap.size(), &overlap[0]);
}