void CUniqueRenderPage::OnBnClickedUniAdd() { //添加值 CDlgSelectValues dlg; FillValues(dlg.m_allValues); if(dlg.DoModal()==IDOK) { SymbolClass sc; long index =m_IndexList.size(); //将选中的值添加 for(size_t i=0;i<dlg.m_values.size();i++) { sc.strLabel =dlg.m_values[i]; if(sc.strLabel==DEFAULTVALUE) { sc.pSymbol =m_pDefaultSymbol; } else { sc.pSymbol = AddUniquerSymbol(); } sc.index =index; m_list.AddSymbolItem( sc.pSymbol ,sc.strLabel , sc.strLabel, sc.strCount); m_IndexList.push_back(sc.strLabel); m_SymbolMap[sc.strLabel] =sc; index++; } } }
void TripletHelper::FillValues_(Index n_entries, const SymScaledMatrix& matrix, Number* values) { // ToDo: // This method can be made much more efficient for ScaledMatrix with SymTMatrix // contained // Get the matrix values FillValues(n_entries, *GetRawPtr(matrix.GetUnscaledMatrix()), values); // Scale the values // To Do : This assumes 1-base values (like the TMatrices) Index* iRow = new Index[n_entries]; Index* jCol = new Index[n_entries]; FillRowCol(n_entries, *GetRawPtr(matrix.GetUnscaledMatrix()), iRow, jCol, 0, 0); if (IsValid(matrix.RowColScaling())) { Index n_dim = matrix.NRows(); Number* scaling = new Number[n_dim]; FillValuesFromVector(n_dim, *matrix.RowColScaling(), scaling); for (Index i=0; i<n_entries; i++) { values[i] *= scaling[iRow[i]-1]; values[i] *= scaling[jCol[i]-1]; } delete [] scaling; } delete [] iRow; delete [] jCol; }
void TripletHelper::FillValues_(Index n_entries, const SumSymMatrix& matrix, Number* values) { Index total_n_entries = 0; for (Index i=0; i<matrix.NTerms(); i++) { // Fill the values for the individual term Number retFactor = 0.0; SmartPtr<const SymMatrix> retTerm; matrix.GetTerm(i, retFactor, retTerm); Index term_n_entries = GetNumberEntries(*retTerm); total_n_entries += term_n_entries; if (retFactor!=0.0) { FillValues(term_n_entries, *retTerm, values); if (retFactor!=1.) { // Now adjust the values based on the factor IpBlasDscal(term_n_entries, retFactor, values, 1); } } else { const Number zero = 0.; IpBlasDcopy(term_n_entries, &zero, 0, values, 1); } // now shift the values pointer for the next term values += term_n_entries; } DBG_ASSERT(total_n_entries == n_entries); }
void TripletHelper::FillValues_(Index n_entries, const CompoundSymMatrix& matrix, Number* values) { Index total_n_entries = 0; for (Index i=0; i<matrix.NComps_Dim(); i++) { for (Index j=0; j<=i; j++) { // Fill the indices for the individual term SmartPtr<const Matrix> blk_mat = matrix.GetComp(i, j); if (IsValid(blk_mat)) { Index blk_n_entries = GetNumberEntries(*blk_mat); total_n_entries += blk_n_entries; FillValues(blk_n_entries, *blk_mat, values); // now shift the iRow, jCol pointers for the next term values += blk_n_entries; } } } DBG_ASSERT(total_n_entries == n_entries); }