// valueが返却されるよう修正した。 // 元はprintRow(rowResult)だった std::string returnValue(const std::vector<TRowResult> &rowResult, HPacket *hpacket) { std::string str = ""; for (size_t i = 0; i < rowResult.size(); i++) { // std::cout << "row: " << rowResult[i].row << ", cols: "; for (CellMap::const_iterator it = rowResult[i].columns.begin(); it != rowResult[i].columns.end(); ++it) { // std::cout << it->first << " => " << it->second.value << "; "; if (hpacket->op == 3) { // if (i == rowResult.size() - 1) { if (i == 0) { std::string startrow(hpacket->row); std::string stoprow(hpacket->stoprow); // std::cout << "startrow:" << hpacket->row << "stoprow:" << hpacket->stoprow << std::endl; str += "startrow:" + startrow + ",stoprow:" + stoprow + " "; } str += (rowResult[i].row + ":" + it->second.value + ","); } else if (hpacket->op == 1) { str += it->second.value; } } // std::cout << std::endl; } return str; }
//--------------------------------------------------------- void NDG2D::OutputSampleELMT2D(int sample_N, IMat& ELMT) //--------------------------------------------------------- { int Nel = OutputSampleNelmt2D(sample_N); int Nvert=3, sk=0, i=0, j=0; int sampleNq = sample_N+1; IVec startrow(sampleNq); sk=0; for (i=0; i<sampleNq; ++i) { startrow[i] = sk; sk += sampleNq-i; } ELMT.resize(Nel,Nvert); // contruct triangulation sk = 1; for (i=0; i<sampleNq-1; ++i) { for (j=0; j<sampleNq-1-i; ++j, ++sk) { ELMT(sk,1) = startrow[i ]+j; ELMT(sk,2) = startrow[i ]+j+1; ELMT(sk,3) = startrow[i+1]+j; } } for (i=0; i<sampleNq-2; ++i) { for (j=0; j<sampleNq-2-i; ++j, ++sk) { ELMT(sk,1) = startrow[i ]+j+1; ELMT(sk,2) = startrow[i+1]+j+1; ELMT(sk,3) = startrow[i+1]+j; } } }
// scannerOpenとscannerCloseした方がいいかもしれない。 // けど今のところ問題ないのでこのままいく std::string scanRowFunc(std::string t, char startrowbuf[ROW_SIZE], char stoprowbuf[ROW_SIZE], char colbuf[COLUMN_SIZE], std::vector<TRowResult> rowResult, HbaseClient client, HPacket *hpacket) { const std::map<Text, Text> dummyAttributes; // see HBASE-6806 HBASE-4658 std::string startrow(startrowbuf); std::string stoprow(stoprowbuf); std::string col(colbuf); std::vector<Text> column; int scannerID; int maxRowNum = 10; // column.push_back(colbuf); column.push_back("entry:" + col); // scannerID = client.scannerOpen (t, startrow, column, dummyAttributes); scannerID = client.scannerOpenWithStop (t, startrow, stoprow, column, dummyAttributes); client.scannerGetList (rowResult, scannerID, maxRowNum); // client.scannerGet (rowResult, scannerID); return returnValue(rowResult, hpacket); }