28 #define fei_file "fei_FEI_Impl.cpp"
47 soln_fei_matrix_(NULL),
48 soln_fei_vector_(NULL),
50 masterRank_(masterRank),
58 matScalarsSet_(false),
60 rhsScalarsSet_(false),
64 index_current_rhs_row_(0),
67 setSolveTypeCalled_(false),
68 initPhaseIsComplete_(false),
69 aggregateSystemFormed_(false),
70 newMatrixDataLoaded_(0),
78 nodeset_filled_(false),
79 block_dof_per_elem_(),
80 any_blocks_have_elem_dof_(false)
98 createdFactory_(false),
106 soln_fei_matrix_(NULL),
107 soln_fei_vector_(NULL),
109 masterRank_(masterRank),
117 matScalarsSet_(false),
119 rhsScalarsSet_(false),
123 index_current_rhs_row_(0),
126 setSolveTypeCalled_(false),
127 initPhaseIsComplete_(false),
128 aggregateSystemFormed_(false),
129 newMatrixDataLoaded_(0),
134 solnReturnTime_(0.0),
137 nodeset_filled_(false),
138 block_dof_per_elem_(),
139 any_blocks_have_elem_dof_(false)
145 if (snlfactory != NULL) {
156 for(
int k=0; k<numParams_; k++) {
157 delete [] paramStrings_[k];
159 delete [] paramStrings_;
161 if (soln_fei_matrix_ != NULL && wrapper_[0].
get() != NULL) {
163 if (lsc.
get() != NULL) {
165 delete soln_fei_matrix_;
166 soln_fei_matrix_ = NULL;
170 if (soln_fei_vector_ != NULL && wrapper_[0].
get() != NULL) {
172 if (lsc.
get() != NULL) {
174 delete soln_fei_vector_;
175 soln_fei_vector_ = NULL;
185 constraintID_ = localProc_*100000;
187 matrixIDs_.resize(1);
194 rowSpace_ = factory_[0]->createVectorSpace(comm_, (
const char*)NULL);
196 rowSpace_->defineIDTypes(1, &nodeIDType_);
197 rowSpace_->defineIDTypes(1, &elemIDType_);
198 rowSpace_->defineIDTypes(1, &constraintIDType_);
200 matGraph_ = factory_[0]->createMatrixGraph(rowSpace_, rowSpace_,(
const char*)NULL);
201 if (matGraph_.get() == NULL) {
207 const int* matrixIDs,
211 if (numMatrices < 1 || numRHSs < 1) {
212 fei::console_out() <<
"fei::FEI_Impl::setIDLists ERROR, numMatrices and numRHSs "
213 <<
"must both be greater than 0."<<
FEI_ENDL;
217 matrixIDs_.resize(0);
218 A_.resize(numMatrices);
219 for(
int i=0; i<numMatrices; ++i) {
222 if ((
int)matrixIDs_.size() != numMatrices) {
229 for(
int i=0; i<numRHSs; ++i) {
232 if ((
int)rhsIDs_.size() != numRHSs) {
237 if (wrapper_[0].
get() != NULL) {
239 if (linSysCore.
get() != NULL) {
253 const char *
const* paramStrings)
257 paramStrings, numParams);
259 if (wrapper_[0].
get() != NULL) {
260 if (wrapper_[0]->haveLinearSystemCore()) {
261 CHK_ERR( wrapper_[0]->getLinearSystemCore()->
parameters(numParams, (
char**)paramStrings) );
263 if (wrapper_[0]->haveFiniteElementData()) {
264 CHK_ERR( wrapper_[0]->getFiniteElementData()->
parameters(numParams, (
char**)paramStrings) );
268 std::vector<std::string> stdstrings;
272 factory_[0]->parameters(paramset);
279 solveType_ = solveType;
280 setSolveTypeCalled_ =
true;
286 const int *fieldSizes,
288 const int *fieldTypes)
290 rowSpace_->defineFields(numFields, fieldIDs, fieldSizes, fieldTypes);
297 int numNodesPerElement,
298 const int* numFieldsPerNode,
299 const int*
const* nodalFieldIDs,
300 int numElemDofFieldsPerElement,
301 const int* elemDOFFieldIDs,
302 int interleaveStrategy)
307 int numIDs = numNodesPerElement;
308 if (numElemDofFieldsPerElement > 0) ++numIDs;
309 std::vector<int> idTypes;
310 std::vector<int> numFieldsPerID;
311 std::vector<int> fieldIDs;
314 for(i=0; i<numNodesPerElement; ++i) {
315 idTypes.push_back(nodeIDType_);
316 numFieldsPerID.push_back(numFieldsPerNode[i]);
318 for(j=0; j<numFieldsPerNode[i]; ++j) {
319 fieldIDs.push_back(nodalFieldIDs[i][j]);
323 if (numElemDofFieldsPerElement>0) {
324 idTypes.push_back(elemIDType_);
325 numFieldsPerID.push_back(numElemDofFieldsPerElement);
326 for(i=0; i<numElemDofFieldsPerElement; ++i) {
327 fieldIDs.push_back(elemDOFFieldIDs[i]);
330 block_dof_per_elem_.insert(std::pair<int,int>(elemBlockID, numElemDofFieldsPerElement));
331 any_blocks_have_elem_dof_ =
true;
334 int pattID = matGraph_->definePattern(numIDs,
340 CHK_ERR( matGraph_->initConnectivityBlock(elemBlockID, numElements,
350 bool elemdof =
false;
352 if (any_blocks_have_elem_dof_) {
353 std::map<int,int>::const_iterator
354 b_iter = block_dof_per_elem_.find(elemBlockID);
355 if (b_iter != block_dof_per_elem_.end()) {
356 int numIDs = matGraph_->getNumIDsPerConnectivityList(elemBlockID);
357 iwork_.resize(numIDs);
358 int* iworkPtr = &iwork_[0];
359 for(
int i=0; i<numIDs-1; ++i) {
360 iworkPtr[i] = elemConn[i];
362 iworkPtr[numIDs-1] = elemID;
364 CHK_ERR( matGraph_->initConnectivity(elemBlockID, elemID, iworkPtr) );
370 CHK_ERR( matGraph_->initConnectivity(elemBlockID, elemID, elemConn) );
373 nodeset_filled_ =
false;
380 int offsetIntoSlaveField,
383 const int* masterFieldIDs,
384 const double* weights,
387 throw std::runtime_error(
"FEI_Impl::initSlaveVariable not implemented.");
393 throw std::runtime_error(
"FEI_Impl::deleteMultCRs not implemented.");
399 const int* numProcsPerNode,
400 const int *
const *sharingProcIDs)
402 CHK_ERR( rowSpace_->initSharedIDs(numSharedNodes,
413 const int *CRFieldIDs,
416 iwork_.assign(numCRNodes,nodeIDType_);
418 CRID = constraintID_++;
420 CHK_ERR( matGraph_->initLagrangeConstraint(CRID,
432 const int *CRFieldIDs,
435 iwork_.assign(numCRNodes, nodeIDType_);
437 CRID = constraintID_++;
439 CHK_ERR( matGraph_->initPenaltyConstraint(CRID,
451 CHK_ERR( matGraph_->initComplete() );
453 if (matrixIDs_.size() < 1 || factory_.size() < 1 ||
454 A_.size() < 1 || b_.size() < 1) {
458 A_[0] = factory_[0]->createMatrix(matGraph_);
460 std::vector<std::string> stdstrings;
467 b_[0] = factory_[0]->createVector(matGraph_);
469 if (matrixIDs_.size() > 1) {
470 bool multiple_factories =
false;
472 if (wrapper_[0].
get() != NULL) {
473 multiple_factories =
true;
476 if (linsyscore.
get() == NULL) {
477 fei::console_out() <<
"fei::FEI_Impl ERROR, multiple matrix/rhs assembly not supported "
478 <<
"non-null LibraryWrapper holds null LinearSystemCore."<<
FEI_ENDL;
482 wrapper_.resize(matrixIDs_.size());
483 factory_.resize(matrixIDs_.size());
484 for(
unsigned i=1; i<matrixIDs_.size(); ++i) {
492 for(
unsigned i=1; i<matrixIDs_.size(); ++i) {
493 factory = multiple_factories ? factory_[i] : factory_[0];
499 for(
unsigned i=1; i<rhsIDs_.size(); ++i) {
500 factory = multiple_factories ? factory_[i] : factory_[0];
505 if (wrapper_[0].
get() != NULL) {
507 = wrapper_[0]->getLinearSystemCore();
511 unsigned num = rhsIDs_.size();
512 if (matrixIDs_.size() < num) num = matrixIDs_.size();
513 for(
unsigned i=1; i<num; ++i) {
516 if (i==num-1 && rhsIDs_.size() > num) {
517 int numRHSs = rhsIDs_.size() - matrixIDs_.size() + 1;
525 if (rhsIDs_.size() < matrixIDs_.size()) {
527 for(
unsigned i=rhsIDs_.size(); i<matrixIDs_.size(); ++i) {
528 wrapper_[i]->getLinearSystemCore()->setNumRHSVectors(1, &dummyID);
533 for(
unsigned i=1; i<matrixIDs_.size(); ++i) {
534 factory = multiple_factories ? factory_[i] : factory_[0];
540 for(
unsigned i=1; i<rhsIDs_.size(); ++i) {
541 factory = multiple_factories ? factory_[i] : factory_[0];
547 x_ = factory_[0]->createVector(matGraph_,
true);
549 linSys_ = factory_[0]->createLinearSystem(matGraph_);
551 CHK_ERR( linSys_->parameters(numParams_, paramStrings_) );
553 linSys_->setMatrix(A_[0]);
554 linSys_->setRHS(b_[0]);
555 linSys_->setSolutionVector(x_);
562 std::vector<int>::const_iterator
563 iter = std::lower_bound(matrixIDs_.begin(), matrixIDs_.end(), matID);
564 if (iter == matrixIDs_.end() || *iter != matID) {
570 index_current_ = iter-matrixIDs_.begin();
577 std::vector<int>::const_iterator
578 iter = std::lower_bound(rhsIDs_.begin(), rhsIDs_.end(), rhsID);
579 if (iter == rhsIDs_.end() || *iter != rhsID) {
580 fei::console_out() <<
"fei::FEI_Impl::setCurrentRHS: rhsID ("<<rhsID<<
") not found."
585 index_current_rhs_row_ = iter - rhsIDs_.begin();
592 int err = A_[index_current_]->putScalar(s);
593 err += x_->putScalar(s);
594 err += b_[index_current_rhs_row_]->putScalar(s);
601 return( A_[index_current_]->putScalar(s) );
606 return( b_[index_current_rhs_row_]->putScalar(s) );
611 return( x_->putScalar(s) );
617 const int* offsetsIntoField,
618 const double* prescribedValues)
620 CHK_ERR( linSys_->loadEssentialBCs(numNodes, nodeIDs,
621 nodeIDType_, fieldID,
622 offsetsIntoField, prescribedValues) );
632 const double *
const *alpha,
633 const double *
const *beta,
634 const double *
const *gamma)
636 throw std::runtime_error(
"FEI_Impl::loadElemBCs not implemented.");
643 const double*
const* elemStiffness,
644 const double* elemLoad,
647 CHK_ERR( A_[index_current_]->sumIn(elemBlockID, elemID, elemStiffness, elemFormat) );
649 int num = matGraph_->getConnectivityNumIndices(elemBlockID);
650 std::vector<int> indices(num);
651 CHK_ERR( matGraph_->getConnectivityIndices(elemBlockID, elemID, num,
653 CHK_ERR( b_[index_current_rhs_row_]->sumIn(num, &indices[0], elemLoad, 0) );
663 const double*
const* elemStiffness,
666 CHK_ERR( A_[index_current_]->sumIn(elemBlockID, elemID, elemStiffness, elemFormat) );
676 const double* elemLoad)
678 int num = matGraph_->getConnectivityNumIndices(elemBlockID);
679 std::vector<int> indices(num);
680 CHK_ERR( matGraph_->getConnectivityIndices(elemBlockID, elemID, num,
682 CHK_ERR( b_[index_current_rhs_row_]->sumIn(num, &indices[0], elemLoad, 0) );
692 const int* CRFieldIDs,
693 const double* CRWeights,
698 CHK_ERR( linSys_->loadLagrangeConstraint(CRMultID, CRWeights, CRValue) );
706 const int* CRFieldIDs,
707 const double* CRWeights,
713 CHK_ERR( linSys_->loadPenaltyConstraint(CRPenID, CRWeights, penValue, CRValue) );
722 const double* coefficients)
724 CHK_ERR( inputRHS(IDType, fieldID, numIDs, IDs, coefficients,
false) );
735 const double* coefficients)
737 CHK_ERR( inputRHS(IDType, fieldID, numIDs, IDs, coefficients,
true) );
748 const double* coefficients,
751 int fieldSize = rowSpace_->getFieldSize(fieldID);
754 for(
int i=0; i<numIDs; ++i) {
756 CHK_ERR( rowSpace_->getGlobalIndex(IDType, IDs[i], globalIndex) );
758 for(
int j=0; j<fieldSize; ++j) {
759 int eqn = globalIndex+j;
761 CHK_ERR( b_[index_current_rhs_row_]->sumIn(1, &eqn, &(coefficients[offset++])) );
764 CHK_ERR( b_[index_current_rhs_row_]->copyIn(1, &eqn, &(coefficients[offset++])) );
774 const double* scalars)
776 matScalars_.resize(matrixIDs_.size());
778 for(
int i=0; i<numScalars; ++i) {
779 std::vector<int>::const_iterator
780 iter = std::lower_bound(matrixIDs_.begin(), matrixIDs_.end(), IDs[i]);
781 if (iter == matrixIDs_.end() || *iter != IDs[i]) {
785 unsigned index = iter - matrixIDs_.begin();
786 matScalars_[index] = scalars[i];
789 matScalarsSet_ =
true;
796 const double* scalars)
798 rhsScalars_.resize(rhsIDs_.size());
800 for(
int i=0; i<numScalars; ++i) {
801 std::vector<int>::const_iterator
802 iter = std::lower_bound(rhsIDs_.begin(), rhsIDs_.end(), IDs[i]);
803 if (iter == rhsIDs_.end() || *iter != IDs[i]) {
807 unsigned index = iter - rhsIDs_.begin();
808 rhsScalars_[index] = scalars[i];
811 rhsScalarsSet_ =
true;
823 if (linSys_.get() == NULL) {
824 fei::console_out() <<
"fei::FEI_Impl::loadComplete: loadComplete can not be called"
825 <<
" until after initComplete has been called."<<
FEI_ENDL;
830 for(
unsigned i=0; i<A_.size(); ++i) {
831 CHK_ERR( A_[i]->gatherFromOverlap() );
834 for(
unsigned j=0; j<b_.size(); ++j) {
835 CHK_ERR( b_[j]->gatherFromOverlap() );
841 CHK_ERR( linSys_->loadComplete(applyBCs, globalAssemble) );
845 for(
unsigned i=0; i<b_.size(); ++i) {
847 osstr <<
"rhs_" << rhs_counter++;
848 CHK_ERR( linSys_->putAttribute(osstr.str().c_str(), b_[i].get()) );
859 if (wrapper_[0].
get() == NULL) {
863 if (wrapper_[0].
get() != NULL) {
864 CHK_ERR( aggregateSystem_LinSysCore() );
873 if (lsc.
get() == NULL)
return(-1);
875 if (soln_fei_matrix_ == NULL) {
876 soln_fei_matrix_ =
new Data();
881 if (soln_fei_vector_ == NULL) {
882 soln_fei_vector_ =
new Data();
889 for(
unsigned i=0; i<matrixIDs_.size(); ++i) {
891 if (lsci.
get() == NULL)
return(-1);
902 int last_mat = matrixIDs_.size() - 1;
903 for(
unsigned i=0; i<rhsIDs_.size(); ++i) {
905 wrapper_[i]->getLinearSystemCore() : wrapper_[last_mat]->getLinearSystemCore();
928 matGraph_->getRowSpace();
931 std::vector<double> residValues(numLocalEqns);
932 double* residValuesPtr = &residValues[0];
934 std::vector<int> globalEqnOffsets;
936 int firstLocalOffset = globalEqnOffsets[localProc_];
938 if (wrapper_[0].
get() == NULL) {
942 CHK_ERR( A_[index_current_]->multiply(x_.get(), r.
get()) );
945 CHK_ERR( r->
update(1.0, b_[index_current_rhs_row_].get(), -1.0) );
948 for(
int ii=0; ii<numLocalEqns; ++ii) {
949 int index = firstLocalOffset+ii;
955 if (linSysCore.
get() != NULL) {
959 fei::console_out() <<
"FEI_Impl::residualNorm: warning: residualNorm not implemented"
960 <<
" for FiniteElementData."<<
FEI_ENDL;
962 for(
int ii=0; ii<numFields; ++ii) {
964 for(
int jj=0; jj<fieldSize; ++jj) {
965 norms[offset++] = -99.9;
973 std::vector<int> nodeIDs(numLocalNodes);
974 int* nodeIDsPtr = &nodeIDs[0];
977 nodeIDsPtr, check) );
978 std::vector<int> indices(numLocalEqns);
979 int* indicesPtr = &indices[0];
981 std::vector<double> tmpNorms(numFields, 0.0);
983 for(
int i=0; i<numFields; ++i) {
987 nodeIDType_, fieldIDs[i],
991 for(
int j=0; j<fieldSize*numLocalNodes; ++j) {
992 if (indicesPtr[j] < 0) {
996 double val = std::abs(residValuesPtr[indicesPtr[j]-firstLocalOffset]);
999 if (val > tmp) tmp = val;
1008 fei::console_out() <<
"FEI_Impl::residualNorm: whichNorm="<<whichNorm<<
" not recognized"
1016 std::vector<double> normsArray(numFields);
1017 for(
int i=0; i<numFields; ++i) {
1018 normsArray[i] = norms[i];
1029 for(
int i=0; i<numFields; ++i) {
1030 norms[i] = normsArray[i];
1033 if (whichNorm == 2) {
1034 for(
int ii=0; ii<numFields; ++ii) {
1035 norms[ii] = std::sqrt(norms[ii]);
1048 std::vector<std::string> stdstrings;
1053 int err = solver->
solve(linSys_.get(),
1055 params, iterations_, status);
1057 CHK_ERR( x_->scatterToOverlap() );
1064 itersTaken = iterations_;
1079 double& solnReturnTime)
1081 initTime = initTime_;
1082 loadTime = loadTime_;
1083 solveTime = solveTime_;
1084 solnReturnTime = solnReturnTime_;
1096 return ( getNodalSolution(numNodes, nodeIDs, offsets, results) );
1106 std::vector<int> fieldIDs;
1107 for(
int i=0; i<numNodes; ++i) {
1108 offsets[i] = offset;
1112 int numFields = rowSpace_->getNumFields(nodeIDType_, nodeID);
1113 iwork_.resize( numFields*2 );
1114 int* fieldSizes = &iwork_[0];
1115 rowSpace_->getFields(nodeIDType_, nodeID, fieldIDs);
1118 for(j=0; j<numFields; ++j) {
1119 fieldSizes[j] = rowSpace_->getFieldSize(fieldIDs[j]);
1120 numDOF += fieldSizes[j];
1123 if (!rowSpace_->isLocal(nodeIDType_, nodeID)) {
1128 int results_offset = offset;
1129 for(j=0; j<numFields; ++j) {
1130 CHK_ERR( x_->copyOutFieldData(fieldIDs[j], nodeIDType_,
1132 &(results[results_offset])));
1134 results_offset += fieldSizes[j];
1140 offsets[numNodes] = offset;
1151 throw std::runtime_error(
"FEI_Impl::getBlockFieldNodeSolution not implemented.");
1158 int& numElemDOFPerElement,
1161 std::map<int,int>::const_iterator b_iter = block_dof_per_elem_.find(elemBlockID);
1162 if (b_iter == block_dof_per_elem_.end())
return(-1);
1163 numElemDOFPerElement = (*b_iter).second;
1168 osstr<<
"fei::FEI_Impl::getBlockElemSolution ERROR, elemBlockID "
1169 << elemBlockID <<
" not valid.";
1170 throw std::runtime_error(osstr.str());
1180 std::vector<int> fieldIDs;
1183 for(i=0; i<numIDs; ++i) {
1184 if (idTypes[i] == elemIDType_) {
1185 for(
int j=0; j<numFieldsPerID[i]; ++j) {
1186 fieldIDs.push_back(fIDs[foffset++]);
1190 foffset += numFieldsPerID[i];
1193 if (fieldIDs.size() < 1) {
1198 for(i=0; i<numElems; ++i) {
1200 for(
size_t j=0; j<fieldIDs.size(); ++j) {
1204 CHK_ERR( x_->copyOutFieldData(fieldIDs[j], elemIDType_, 1, &(elemIDs[i]),
1205 &(results[foffset])) );
1206 foffset += fieldSize;
1209 offset += numElemDOFPerElement;
1217 numMultCRs = rowSpace_->getNumOwnedAndSharedIDs(constraintIDType_);
1224 CHK_ERR( rowSpace_->getOwnedAndSharedIDs(constraintIDType_, numMultCRs,
1225 multIDs, checkNum) );
1231 double *multipliers)
1233 iwork_.resize(numCRs);
1235 for(
int i=0; i<numCRs; ++i) {
1236 CHK_ERR( rowSpace_->getGlobalIndex(constraintIDType_, CRIDs[i], iwork_[i]));
1239 CHK_ERR( x_->copyOut(numCRs, &iwork_[0], multipliers) );
1248 const double *estimates)
1250 throw std::runtime_error(
"FEI_Impl::putBlockNodeSolution not implemented.");
1258 const double *estimates)
1260 throw std::runtime_error(
"FEI_Impl::putBlockFieldNodeSolution not implemented.");
1268 const double *estimates)
1270 throw std::runtime_error(
"FEI_Impl::putBlockElemSolution not implemented.");
1276 const double* multEstimates)
1278 throw std::runtime_error(
"FEI_Impl::putCRMultipliers not implemented.");
1286 if (!nodeset_filled_ || elemBlockID != nodeset_blockid_) {
1287 CHK_ERR( fillNodeset(elemBlockID) );
1296 if (nodeset_filled_ && blockID == nodeset_blockid_) {
1303 osstr<<
"fei::FEI_Impl::fillNodeset ERROR, blockID "
1304 << blockID <<
" not valid.";
1305 throw std::runtime_error(osstr.str());
1310 matGraph_->getRowSpace()->getRecordCollection(nodeType, nodeRecords);
1315 for(
unsigned i=0; i<nodes.size(); ++i) {
1319 nodeset_filled_ =
true;
1320 nodeset_blockid_ = blockID;
1332 osstr<<
"fei::FEI_Impl::getBlockElemIDList ERROR, elemBlockID "
1333 << elemBlockID <<
" not valid.";
1334 throw std::runtime_error(osstr.str());
1346 numSolnParams = rowSpace_->getNumDegreesOfFreedom( nodeIDType_, nodeID);
1352 numElemBlocks = matGraph_->getNumConnectivityBlocks();
1358 if (!nodeset_filled_ || blockID != nodeset_blockid_) {
1359 CHK_ERR( fillNodeset(blockID) );
1362 numNodes = nodeset_.size();
1368 throw std::runtime_error(
"fei::FEI_Impl::getNumBlockActEqns not implemented.");
1374 nodesPerElem = matGraph_->getNumIDsPerConnectivityList(blockID);
1380 numEqns = matGraph_->getConnectivityNumIndices(blockID);
1387 matGraph_->getConnectivityBlock(blockID);
1388 if (cblock != NULL) {
1399 std::map<int,int>::const_iterator b_iter = block_dof_per_elem_.find(blockID);
1400 if (b_iter == block_dof_per_elem_.end()) DOFPerElem = 0;
1401 else DOFPerElem = (*b_iter).second;
1408 numParams = numParams_;
1409 paramStrings = paramStrings_;
1415 numScalars = rowSpace_->getFieldSize(fieldID);
1425 numEqns = rowSpace_->getFieldSize(fieldID);
1426 CHK_ERR( rowSpace_->getGlobalIndices(1, &ID, idType, fieldID, eqnNumbers) );
1435 CHK_ERR( x_->copyOutFieldData(fieldID, nodeIDType_, numNodes,
1436 nodeIDs, results) );
1442 numNodes = rowSpace_->getNumOwnedAndSharedIDs(nodeIDType_);
1450 CHK_ERR( rowSpace_->getOwnedAndSharedIDs(nodeIDType_, lenNodeIDs, nodeIDs, numNodes) );
1457 const double* nodeData)
1461 bool data_passed =
false;
1462 if (wrapper_[0].
get() != NULL) {
1463 std::vector<int> numbers(numNodes);
1464 for(
int i=0; i<numNodes; ++i) {
1465 err = rowSpace_->getGlobalBlkIndex(nodeIDType_, nodeIDs[i], numbers[i]);
1468 << nodeIDs[i] <<
" not found."<<
FEI_ENDL;
1475 fieldSize = rowSpace_->getFieldSize(fieldID);
1477 catch (std::runtime_error& exc) {
1483 if (linSysCore.
get() != NULL) {
1485 &numbers[0], numNodes, nodeData);
1492 if (fedata.
get() != NULL) {
1494 &numbers[0], nodeData);
1502 if (wrapper_[0].
get() == NULL) {
1506 numNodes, nodeIDs, nodeData) );
1507 if (fieldID == -3) {
1508 CHK_ERR( linSys_->putAttribute(
"coordinates", dataVector.
get()) );
1512 osstr <<
"fieldID:" << fieldID;
1513 CHK_ERR( linSys_->putAttribute(osstr.str().c_str(), dataVector.
get()) );
1517 fei::console_out() <<
"fei::FEI_Impl::putNodalFieldData ERROR, non-null LibraryWrapper"
1518 <<
" contains neither LinearSystemCore or FiniteElementData. " <<
FEI_ENDL;
1525 CHK_ERR( x_->copyInFieldData(fieldID, nodeIDType_,
1526 numNodes, nodeIDs, nodeData));
virtual int setRHSID(int rhsID)=0
int GlobalSum(MPI_Comm comm, std::vector< T > &local, std::vector< T > &global)
int setSolveType(int solveType)
int sortedListInsert(const T &item, std::vector< T > &list)
int getNumLocalNodes(int &numNodes)
int putNodalFieldData(int fieldID, int numNodes, const GlobalID *nodeIDs, const double *nodeData)
void char_ptrs_to_strings(int numStrings, const char *const *charstrings, std::vector< std::string > &stdstrings)
int sumIntoRHS(int IDType, int fieldID, int numIDs, const GlobalID *IDs, const double *coefficients)
int getNumCRMultipliers(int &numMultCRs)
const int * getIDTypes() const
const std::map< int, int > & getConnectivityIDs() const
int iterations(int &itersTaken) const
int version(const char *&versionString)
#define FEI_AGGREGATE_SUM
int fillNodeset(int blockID) const
const int * getNumFieldsPerID() const
int setIDLists(int numMatrices, const int *matrixIDs, int numRHSs, const int *rhsIDs)
fei::SharedPtr< fei::LinearSystem > getLinearSystem()
virtual int copyOutRHSVector(double scalar, Data &data)=0
int getBlockElemSolution(GlobalID elemBlockID, int numElems, const GlobalID *elemIDs, int &numElemDOFPerElement, double *results)
int getParameters(int &numParams, char **¶mStrings)
int getOwnedIDs(int idtype, int lenList, int *IDs, int &numLocalIDs)
int initCRPen(int numCRNodes, const GlobalID *CRNodeIDs, const int *CRFieldIDs, int &CRID)
int aggregateSystem_LinSysCore()
virtual int putNodalFieldData(int fieldID, int fieldSize, int *nodeNumbers, int numNodes, const double *data)=0
int initFields(int numFields, const int *fieldSizes, const int *fieldIDs, const int *fieldTypes=NULL)
const int * getFieldIDs() const
virtual int sumInRHSVector(double scalar, const Data &data)=0
void copySetToArray(const SET_TYPE &set_obj, int lenList, int *list)
int getFieldSize(int fieldID, int &numScalars)
int getNumSolnParams(GlobalID nodeID, int &numSolnParams) const
int getBlockNodeIDList(GlobalID elemBlockID, int numNodes, GlobalID *nodeIDs)
fei::SharedPtr< LibraryWrapper > get_LibraryWrapper() const
static unsigned getFieldSize(int fieldID, fei::VectorSpace *space1, fei::VectorSpace *space2)
int check(Epetra_CrsGraph &A, int NumMyRows1, int NumGlobalRows1, int NumMyNonzeros1, int NumGlobalNonzeros1, int *MyGlobalElements, bool verbose)
int putBlockFieldNodeSolution(GlobalID elemBlockID, int fieldID, int numNodes, const GlobalID *nodeIDs, const double *estimates)
int setCurrentMatrix(int matrixID)
int getCRMultipliers(int numCRs, const int *CRIDs, double *multipliers)
int cumulative_cpu_times(double &initTime, double &loadTime, double &solveTime, double &solnReturnTime)
virtual int getMatrixPtr(Data &data)=0
int mergeStringLists(char **&strings, int &numStrings, const char *const *stringsToMerge, int numStringsToMerge)
int setCurrentRHS(int rhsID)
void copyKeysToArray(const MAP_TYPE &map_obj, unsigned lenList, int *list)
virtual int update(double a, const fei::Vector *x, double b)=0
int putBlockNodeSolution(GlobalID elemBlockID, int numNodes, const GlobalID *nodeIDs, const int *offsets, const double *estimates)
std::vector< int > & getRowConnectivities()
int parameters(int numParams, const char *const *paramStrings)
int resetSystem(double s=0.0)
int getGlobalIndices(int numIDs, const int *IDs, int idType, int fieldID, int *globalIndices)
int loadComplete(bool applyBCs=true, bool globalAssemble=true)
virtual int copyOutMatrix(double scalar, Data &data)=0
virtual int putNodalFieldData(int fieldID, int fieldSize, int numNodes, const int *nodeNumbers, const double *coefs)=0
virtual LinearSystemCore * clone()=0
int getBlockNodeSolution(GlobalID elemBlockID, int numNodes, const GlobalID *nodeIDs, int *offsets, double *results)
int getEqnNumbers(GlobalID ID, int idType, int fieldID, int &numEqns, int *eqnNumbers)
int getNodalSolution(int numNodes, const GlobalID *nodeIDs, int *offsets, double *results)
int initElemBlock(GlobalID elemBlockID, int numElements, int numNodesPerElement, const int *numFieldsPerNode, const int *const *nodalFieldIDs, int numElemDofFieldsPerElement, const int *elemDOFFieldIDs, int interleaveStrategy)
int putCRMultipliers(int numMultCRs, const int *CRIDs, const double *multEstimates)
int getCRMultIDList(int numMultCRs, int *multIDs)
int getNumNodesPerElement(GlobalID blockID, int &nodesPerElem) const
int getNumOwnedIDs(int idType)
int sumInElem(GlobalID elemBlockID, GlobalID elemID, const GlobalID *elemConn, const double *const *elemStiffness, const double *elemLoad, int elemFormat)
int initSharedNodes(int numSharedNodes, const GlobalID *sharedNodeIDs, const int *numProcsPerNode, const int *const *sharingProcIDs)
std::vector< fei::SharedPtr< LibraryWrapper > > wrapper_
int getNumBlockElemDOF(GlobalID blockID, int &DOFPerElem) const
int sumInElemMatrix(GlobalID elemBlockID, GlobalID elemID, const GlobalID *elemConn, const double *const *elemStiffness, int elemFormat)
int putBlockElemSolution(GlobalID elemBlockID, int numElems, const GlobalID *elemIDs, int dofPerElem, const double *estimates)
void basic_initializations()
int resetInitialGuess(double s=0.0)
int resetRHSVector(double s=0.0)
virtual int copyInFieldData(int fieldID, int idType, int numIDs, const int *IDs, const double *data, int vectorIndex=0)=0
int setMatScalars(int numScalars, const int *IDs, const double *scalars)
virtual int getRHSVectorPtr(Data &data)=0
virtual fei::SharedPtr< fei::Vector > createVector(fei::SharedPtr< fei::VectorSpace > vecSpace, int numVectors=1)=0
virtual int copyInMatrix(double scalar, const Data &data)=0
virtual fei::SharedPtr< Factory > clone() const =0
int initSlaveVariable(GlobalID slaveNodeID, int slaveFieldID, int offsetIntoSlaveField, int numMasterNodes, const GlobalID *masterNodeIDs, const int *masterFieldIDs, const double *weights, double rhsValue)
int getNumElemBlocks(int &numElemBlocks) const
virtual int setNumRHSVectors(int numRHSs, const int *rhsIDs)=0
std::ostream & console_out()
fei::Record< int > * getRecordWithLocalID(int lid)
int getNumBlockActNodes(GlobalID blockID, int &numNodes) const
void getGlobalIndexOffsets(std::vector< int > &globalOffsets) const
void parse_strings(std::vector< std::string > &stdstrings, const char *separator_string, fei::ParameterSet ¶mset)
int GlobalMax(MPI_Comm comm, std::vector< T > &local, std::vector< T > &global)
virtual int destroyVectorData(Data &data)=0
int residualNorm(int whichNorm, int numFields, int *fieldIDs, double *norms)
int inputRHS(int IDType, int fieldID, int numIDs, const GlobalID *IDs, const double *rhsEntries, bool sumInto)
int putIntoRHS(int IDType, int fieldID, int numIDs, const GlobalID *IDs, const double *coefficients)
int localProc(MPI_Comm comm)
int resetMatrix(double s=0.0)
std::vector< fei::SharedPtr< fei::Factory > > factory_
int loadCRPen(int CRPenID, int numCRNodes, const GlobalID *CRNodeIDs, const int *CRFieldIDs, const double *CRWeights, double CRValue, double penValue)
int getNumBlockActEqns(GlobalID blockID, int &numEqns) const
virtual int solve(fei::LinearSystem *linearSystem, fei::Matrix *preconditioningMatrix, const fei::ParameterSet ¶meterSet, int &iterationsTaken, int &status)
int initCRMult(int numCRNodes, const GlobalID *CRNodeIDs, const int *CRFieldIDs, int &CRID)
virtual int sumInMatrix(double scalar, const Data &data)=0
int loadCRMult(int CRMultID, int numCRNodes, const GlobalID *CRNodeIDs, const int *CRFieldIDs, const double *CRWeights, double CRValue)
unsigned getFieldSize(int fieldID)
int getNumEqnsPerElement(GlobalID blockID, int &numEqns) const
int getNumBlockElements(GlobalID blockID, int &numElems) const
int initElem(GlobalID elemBlockID, GlobalID elemID, const GlobalID *elemConn)
int getBlockFieldNodeSolution(GlobalID elemBlockID, int fieldID, int numNodes, const GlobalID *nodeIDs, double *results)
int loadNodeBCs(int numNodes, const GlobalID *nodeIDs, int fieldID, const int *offsetsIntoField, const double *prescribedValues)
int setRHSScalars(int numScalars, const int *IDs, const double *scalars)
int getLocalNodeIDList(int &numNodes, GlobalID *nodeIDs, int lenNodeIDs)
int loadElemBCs(int numElems, const GlobalID *elemIDs, int fieldID, const double *const *alpha, const double *const *beta, const double *const *gamma)
virtual fei::SharedPtr< fei::Matrix > createMatrix(fei::SharedPtr< fei::MatrixGraph > matrixGraph)=0
virtual int formResidual(double *values, int len)=0
int getBlockElemIDList(GlobalID elemBlockID, int numElems, GlobalID *elemIDs)
int getNodalFieldSolution(int fieldID, int numNodes, const GlobalID *nodeIDs, double *results)
#define FEI_OSTRINGSTREAM
int sumInElemRHS(GlobalID elemBlockID, GlobalID elemID, const GlobalID *elemConn, const double *elemLoad)
virtual int copyOut(int numValues, const int *indices, double *values, int vectorIndex=0) const =0
const fei::Pattern * getRowPattern() const
virtual int destroyMatrixData(Data &data)=0
virtual int copyInRHSVector(double scalar, const Data &data)=0
int numProcs(MPI_Comm comm)
int getNumIndices_Owned() const
FEI_Impl(fei::SharedPtr< LibraryWrapper > wrapper, MPI_Comm comm, int masterRank=0)