fei::Vector_Impl<T>::Vector_Impl(fei::SharedPtr<fei::VectorSpace> vecSpace, T* vector, int numLocalEqns, bool isSolutionVector, bool deleteVector) : Vector_core(vecSpace, numLocalEqns), vector_(vector), isSolution_(isSolutionVector), deleteVector_(deleteVector), localProc_(0), numProcs_(1), dbgprefix_("VecImpl: ") { if (strcmp(snl_fei::FEVectorTraits<T>::typeName(), "unsupported")) { setFEVector(true); } else { setFEVector(false); } localProc_ = fei::localProc(vecSpace->getCommunicator()); numProcs_ = fei::numProcs(vecSpace->getCommunicator()); if (output_level_ >= fei::BRIEF_LOGS && output_stream_ != NULL) { FEI_OSTREAM& os = *output_stream_; os << dbgprefix_<<" ctor, numLocalEqns="<<numLocalEqns <<", typeName: "<<typeName()<<FEI_ENDL; } }
fei::Vector_core::Vector_core(fei::SharedPtr<fei::VectorSpace> vecSpace, int numLocalEqns) : eqnComm_(), vecSpace_(vecSpace), comm_(vecSpace->getCommunicator()), firstLocalOffset_(0), lastLocalOffset_(0), numLocal_(0), work_indices_(), work_indices2_(), haveFEVector_(false), remotelyOwned_(), overlapAlreadySet_(false), dbgprefix_("Vcore: ") { eqnComm_.reset(new fei::EqnComm(comm_,numLocalEqns)); remotelyOwned_.resize(fei::numProcs(comm_)); for(unsigned i=0; i<remotelyOwned_.size(); ++i) { remotelyOwned_[i] = new CSVec; } const std::vector<int>& offsets = eqnComm_->getGlobalOffsets(); firstLocalOffset_ = offsets[fei::localProc(comm_)]; lastLocalOffset_ = offsets[fei::localProc(comm_)+1] - 1; numLocal_ = lastLocalOffset_ - firstLocalOffset_ + 1; if (output_level_ >= fei::BRIEF_LOGS && output_stream_ != NULL) { FEI_OSTREAM& os = *output_stream_; os<<dbgprefix_<<" ctor firstLocal="<<firstLocalOffset_<<", lastLocal=" <<lastLocalOffset_<<FEI_ENDL; } }
fei::Vector_Impl<T>::Vector_Impl(fei::SharedPtr<fei::VectorSpace> vecSpace, T* vector, int numLocalEqns, bool isSolutionVector, bool deleteVector) : Vector_core(vecSpace, numLocalEqns), vector_(vector), isSolution_(isSolutionVector), deleteVector_(deleteVector), localProc_(0), numProcs_(1), dbgprefix_("VecImpl: ") { if (strcmp(snl_fei::FEVectorTraits<T>::typeName(), "unsupported")) { setFEVector(true); } else { setFEVector(false); } localProc_ = fei::localProc(vecSpace->getCommunicator()); numProcs_ = fei::numProcs(vecSpace->getCommunicator()); if (output_level_ >= fei::BRIEF_LOGS && output_stream_ != NULL) { FEI_OSTREAM& os = *output_stream_; os << dbgprefix_<<" ctor, numLocalEqns="<<numLocalEqns <<", typeName: "<<typeName()<<FEI_ENDL; } std::vector<int> idTypes; vecSpace->getIDTypes(idTypes); std::vector<int> eqns; std::vector<double> zeros; for(size_t i=0; i<idTypes.size(); ++i) { int idType = idTypes[i]; fei::SharedIDs<int>& sharedIDs = vecSpace->getSharedIDs(idType); const fei::SharedIDs<int>::map_type& idMap = sharedIDs.getSharedIDs(); fei::SharedIDs<int>::map_type::const_iterator iter = idMap.begin(), iterEnd = idMap.end(); for(; iter!=iterEnd; ++iter) { int ID = iter->first; int eqn; vecSpace->getGlobalIndex(idType, ID, eqn); int ndof = vecSpace->getNumDegreesOfFreedom(idType, ID); eqns.resize(ndof); zeros.resize(ndof, 0.0); for(int j=0; j<ndof; ++j) eqns[j] = eqn+j; if (!isSolutionVector) { sumIn(ndof, &eqns[0], &zeros[0]); } else { copyIn(ndof, &eqns[0], &zeros[0]); } } } setCommSizes(); std::vector<CSVec*>& remoteVecs = remotelyOwned(); for(size_t i=0; i<remoteVecs.size(); ++i) { remoteVecs[i]->clear(); } }