RCP<MV> newCorrespondingVector(const Teuchos::RCP<const Tpetra::RowMatrix<Scalar, Ordinal, Ordinal, Node> >& A) { Teuchos::RCP<Tpetra::Map<Ordinal, Ordinal, Node> > mapVec(new Tpetra::Map<Ordinal, Ordinal, Node>(A->getGlobalNumRows(), 0, A->getComm(), Tpetra::GloballyDistributed, Kokkos::DefaultNode::getDefaultNode())); //mapVec_ = rcp(new Tpetra::Map<Ordinal, Ordinal, Node>(A_->getGlobalNumRows(), 0, A_->getComm(), Tpetra::GloballyDistributed, Kokkos::DefaultNode::getDefaultNode())); //Y_ = rcp(new MV(mapVec_, 1)); return rcp(new MV(mapVec, 1)); }
void StilWriter::writePattern(ostream& os, CycleData& cyData, string patName, unsigned long startVec, unsigned long stopVec) { unsigned long numVectors = cyData.getNumVectors(); if(stopVec <= startVec || stopVec >= numVectors) stopVec = numVectors - 1; string startLabel = "start"; string stopLabel = "stop"; // // begin Pattern // os << "Pattern \"" << patName << patNameSuffix << "\" {" << endl; vector<string> signalHeaderComment; getSignalHeaderComment( cyData, signalHeaderComment); for(unsigned int i=0; i < signalHeaderComment.size(); i++) { os << indent << indent << indent << slCommentPrefix << " " << string( std::max( (unsigned int) vectorPrefix.size(), 3U) - 3, ' ') << signalHeaderComment[i] << endl; } // Start label os << startLabel << ":" << endl; string wftRef, prevWftRef; string cycleVec; string stilVec; unsigned long loopCount = 0; unsigned long cycleCount = 0; double simTime = 0.0; unsigned long stilVecCount = 0; unsigned long vecCount = 0; for(vecCount=startVec; vecCount <= stopVec; vecCount++) { CycleData::PeriodData periodData; cyData.getPeriodData( periodData, vecCount); wftRef = periodData.wftRef; loopCount = periodData.loopCount; cycleVec = periodData.getString(); string label = periodData.getLabel(); vector<string> comments = periodData.getComments(); // TODO: FIXME if(cycleVec.size() == 0) continue; if(comments.size() > 0) { os << indent << slCommentPrefix << endl; for(unsigned int i=0; i < comments.size(); i++) { os << indent << slCommentPrefix << " " << comments[i] << endl; } os << indent << slCommentPrefix << endl; } if(label.size() > 0) if(quotedLabel) os << "\"" << label << "\"" << ":" << endl; else os << label << ":" << endl; // write WaveformTable if(wftRef != prevWftRef) { os << indent << "W \"" << wftRef << "\";" << endl; } if(patPinOrder.size() == 0) stilVec = mapVec(cycleVec); else { // TODO stilVec = mapVec( reorder(cycleVec)); } if((vecCount == stopVec) && (loopCount == 0) && (padLastVector == false)) os << stopLabel << ":" << endl; if(loopCount > max( 0U, expandLoopCountBoundary)) { // begin Loop os << indent << "Loop " << (loopCount+1) << "\t {" << endl; // Write vector os << indent << indent << indent << vectorPrefix << stilVec << vectorSuffix; os << " // " << stilVecCount << " " << cycleCount; os << endl; os << indent << "}" << endl; cycleCount += 1 + loopCount; stilVecCount++; } else { // Expand loop for(unsigned int i=0; i <= loopCount; i++) { // Write vector os << indent << indent << indent << vectorPrefix << stilVec << vectorSuffix; os << " // " << stilVecCount << " " << cycleCount; os << endl; cycleCount++; stilVecCount++; } // stilVecCount += loopCount; } if(vecCount == stopVec) if((loopCount > 0) || (padLastVector == true)) { // Stop label os << stopLabel << ":" << endl; // stilVecCount++; cycleCount++; // Write vector os << indent << indent << indent << vectorPrefix << stilVec << vectorSuffix; os << " // " << stilVecCount++ << " " << cycleCount++; os << endl; } prevWftRef = wftRef; } // stop Instruction os << indent << "Stop;" << endl; // end Pattern os << "}" << endl; }