本文整理汇总了C++中fei::SharedPtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedPtr::get方法的具体用法?C++ SharedPtr::get怎么用?C++ SharedPtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fei::SharedPtr
的用法示例。
在下文中一共展示了SharedPtr::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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]);
}
示例2: tmp
fei::SharedPtr<fei::MatrixGraph> test_MatrixGraph::create_MatrixGraph(testData* testdata,
int localProc, int numProcs,
bool bothFields, bool nonSymmetric,
const char* name,
fei::SharedPtr<fei::VectorSpace> vectorSpacePtr,
fei::SharedPtr<fei::Factory> factory,
const std::string& path,
bool turnOnDebugOutput)
{
//
//This function creates a MatrixGraph object, and initializes it as follows:
//
//setRowSpace(vectorSpacePtr)
//
//definePattern patternID=0, numIDs=4, idType=testdata->idTypes[0]
// fieldID=testdata->fieldIDs[0] if !bothFields, else
// fieldIDs=testdata->fieldIDs
//
//initConnectivityBlock blockID=0, numConnectivityLists=1
//
//initConnectivity blockID, 0, testdata->ids
//
//If nonSymmetric==true, then also do the following:
// definePattern patternID=1, numIDs=1, idType=testdata->idTypes[0]
// fieldID=testdata->fieldIDs[0] if !bothFields, else
// fieldIDs=testdata->fieldIDs
// definePattern patternID=2, numIDs=4, idType=testdata->idTypes[0]
// fieldID=testdata->fieldIDs[0] if !bothFields, else
// fieldIDs=testdata->fieldIDs
//
//initConnectivityBlock blockID=1, patterns 1 and 2
//
//initConnectivity blockID, 0, testdata->ids
//
fei::SharedPtr<fei::MatrixGraph> mgptr;
if (factory.get() == NULL) {
fei::SharedPtr<fei::MatrixGraph> tmp(new fei::MatrixGraph_Impl2(vectorSpacePtr,
vectorSpacePtr, name));
mgptr = tmp;
}
else {
mgptr = factory->createMatrixGraph(vectorSpacePtr, vectorSpacePtr, name);
}
fei::ParameterSet paramset;
fei::Param param1("name", name);
paramset.add(param1);
if (turnOnDebugOutput) {
if (path.empty()) {
fei::Param param2("debugOutput", ".");
paramset.add(param2);
}
else {
fei::Param param2("debugOutput", path.c_str());
paramset.add(param2);
}
}
fei::MatrixGraph* matrixGraphPtr = mgptr.get();
matrixGraphPtr->setParameters(paramset);
matrixGraphPtr->setRowSpace(vectorSpacePtr);
int patternID = 0;
int numIDs = 4;
int idType = testdata->idTypes[0];
int fieldID = testdata->fieldIDs[0];
if (bothFields) {
std::vector<int> numFieldsPerID(numIDs, 2);
std::vector<int> fieldIDsArray(numIDs*2);
for(int i=0; i<numIDs; ++i) {
fieldIDsArray[i*2] = testdata->fieldIDs[0];
fieldIDsArray[i*2+1] = testdata->fieldIDs[1];
}
patternID = matrixGraphPtr->definePattern(numIDs, idType,
&numFieldsPerID[0],
&fieldIDsArray[0]);
}
else {
patternID = matrixGraphPtr->definePattern(numIDs, idType, fieldID);
}
int blockID = 0;
int numConnectivityLists = 1;
matrixGraphPtr->initConnectivityBlock(blockID,
numConnectivityLists,
patternID);
matrixGraphPtr->initConnectivity(blockID, 0, &(testdata->ids[0]));
if (!nonSymmetric) {
return(mgptr);
}
int patternID1 = 1, patternID2 = 2;
int numRowIDs = 1, numColIDs = 4;
//.........这里部分代码省略.........