这篇教程C++ Dimension函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中Dimension函数的典型用法代码示例。如果您正苦于以下问题:C++ Dimension函数的具体用法?C++ Dimension怎么用?C++ Dimension使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了Dimension函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: matfloat cMatrix::Minor( int nRow, int nCol ){ cMatrix mat(Dimension() - 1); int nMinorRow = 0; int nMinorCol = 0; for (int i = 0; i < Dimension(); ++i) { if (nRow == i) { continue; } nMinorCol = 0; for (int j = 0; j < Dimension(); ++j) { if (nCol == j) { continue; } mat[nMinorRow][nMinorCol] = (*this)[i][j]; ++nMinorCol; } ++nMinorRow; } return mat.Determinent();}
开发者ID:gawallsibya,项目名称:SGA_Direct3D,代码行数:31,
示例2: cell_indexint GridSampleHolder::Add(const Sample & sample){ if(sample.coordinate.Dimension() != Dimension()) return 0; vector<int> cell_index(Dimension()); if(! LocateCell(sample, cell_index)) { return 0; } Cell cell; if(!_cells.Get(cell_index, cell)) { return 0; } #ifndef _ALLOW_MULTIPLE_SAMPLES_PER_CELL if(cell.samples.size() > 0) { return 0; } else#endif { cell.samples.push_back(&sample); if(!_cells.Put(cell_index, cell)) return 0; return 1; }}
开发者ID:Ahdhn,项目名称:DifferentialDomainAnalysis-,代码行数:30,
示例3: root_db/* ************************************************************************* * * Read data from restart database. * ************************************************************************* */void CVODEModel::getFromRestart(){ std::shared_ptr<Database> root_db( RestartManager::getManager()->getRootDatabase()); if (!root_db->isDatabase(d_object_name)) { TBOX_ERROR("Restart database corresponding to " << d_object_name << " not found in the restart file."); } std::shared_ptr<Database> db(root_db->getDatabase(d_object_name)); int ver = db->getInteger("CVODE_MODEL_VERSION"); if (ver != CVODE_MODEL_VERSION) { TBOX_ERROR( d_object_name << ": " << "Restart file version different than class version."); } d_initial_value = db->getDouble("d_initial_value"); d_scalar_bdry_edge_conds = db->getIntegerVector("d_scalar_bdry_edge_conds"); d_scalar_bdry_node_conds = db->getIntegerVector("d_scalar_bdry_node_conds"); if (d_dim == Dimension(2)) { d_bdry_edge_val = db->getDoubleVector("d_bdry_edge_val"); } else if (d_dim == Dimension(3)) { d_scalar_bdry_face_conds = db->getIntegerVector("d_scalar_bdry_face_conds"); d_bdry_face_val = db->getDoubleVector("d_bdry_face_val"); }}
开发者ID:LLNL,项目名称:SAMRAI,代码行数:41,
示例4: fflushvoid CVODEModel::printClassData( ostream& os) const{ fflush(stdout); int j; os << "ptr CVODEModel = " << (CVODEModel *)this << endl; os << "d_object_name = " << d_object_name << endl; os << "d_soln_cur_id = " << d_soln_cur_id << endl; os << "d_soln_scr_id = " << d_soln_scr_id << endl; os << "d_initial_value = " << d_initial_value << endl; os << "Boundary Condition data..." << endl; if (d_dim == Dimension(2)) { for (j = 0; j < static_cast<int>(d_scalar_bdry_edge_conds.size()); ++j) { os << " d_scalar_bdry_edge_conds[" << j << "] = " << d_scalar_bdry_edge_conds[j] << endl; if (d_scalar_bdry_edge_conds[j] == BdryCond::DIRICHLET) { os << " d_bdry_edge_val[" << j << "] = " << d_bdry_edge_val[j] << endl; } } os << endl; for (j = 0; j < static_cast<int>(d_scalar_bdry_node_conds.size()); ++j) { os << " d_scalar_bdry_node_conds[" << j << "] = " << d_scalar_bdry_node_conds[j] << endl; os << " d_node_bdry_edge[" << j << "] = " << d_node_bdry_edge[j] << endl; } } else if (d_dim == Dimension(3)) { for (j = 0; j < static_cast<int>(d_scalar_bdry_face_conds.size()); ++j) { os << " d_scalar_bdry_face_conds[" << j << "] = " << d_scalar_bdry_face_conds[j] << endl; if (d_scalar_bdry_face_conds[j] == BdryCond::DIRICHLET) { os << " d_bdry_face_val[" << j << "] = " << d_bdry_face_val[j] << endl; } } os << endl; for (j = 0; j < static_cast<int>(d_scalar_bdry_edge_conds.size()); ++j) { os << " d_scalar_bdry_edge_conds[" << j << "] = " << d_scalar_bdry_edge_conds[j] << endl; os << " d_edge_bdry_face[" << j << "] = " << d_edge_bdry_face[j] << endl; } os << endl; for (j = 0; j < static_cast<int>(d_scalar_bdry_node_conds.size()); ++j) { os << " d_scalar_bdry_node_conds[" << j << "] = " << d_scalar_bdry_node_conds[j] << endl; os << " d_node_bdry_face[" << j << "] = " << d_node_bdry_face[j] << endl; } }}
开发者ID:LLNL,项目名称:SAMRAI,代码行数:58,
示例5: setw/****************************************************************************************** * void K_MeansPredict::Output( ostream& stream ) const * purpose: * outputs predictor to stream * * 02.18.2006 djh added isnan and isinf flags in _upper and lower pi prints * 03.08.2006 djh replaced _totalUpper/_totalLowerConfBound with _totalBoundStub * added isnan and isinf flags to _key_variances prints *****************************************************************************************/ void K_MeansPredict::Output( ostream& stream ) const { stream << setw(15) << _k << setw(15) << Dimension() << endl; stream << _withinClusterScatter << endl; // for( int i=0;i<_means.size(); i++ ) { for(int j=0; j<Dimension(); j++) { stream << setw(15) << _means[i][j]; } stream << endl; } // for( int i=0;i<_key_supports.size(); i++ ) { stream << setw(15) << _key_supports[i]; } stream << endl; // for( int i=0;i<_key_means.size(); i++ ) { stream << setw(15) << _key_means[i]; } stream << endl; // for( int i=0;i<_key_variances.size(); i++ ){ if( isinf(abs(_key_variances[i])) || isnan(_key_variances[i]) ) stream << setw(15) << 0.0; else stream << setw(15) << _key_variances[i]; } stream << endl; // for( int i=0;i<_errMean.size(); i++ ) { stream << setw(15) << _errMean[i]; } stream << endl; // for( int i=0;i<_upperConfBound.size(); i++ ) { if( isinf(abs(_upperConfBound[i])) || isnan(_upperConfBound[i]) ) stream << setw(15) << 0.0; else stream << setw(15) << _upperConfBound[i]; } stream << endl; // for( int i=0;i<_lowerConfBound.size(); i++ ) { if( isinf(abs(_lowerConfBound[i])) || isnan(_lowerConfBound[i]) ) stream << setw(15) << 0.0; else stream << setw(15) << _lowerConfBound[i]; } stream << endl; //stream << setw(15) << _totalErrMean << setw(15) << _totalLowerConfBound << setw(15) << _totalUpperConfBound; stream << setw(15) << _totalErrMean << setw(15) << _totalBoundStub; }
开发者ID:EISALab,项目名称:DBN,代码行数:63,
示例6: matRetcMatrix cMatrix::Adjoint(){ cMatrix matRet(Dimension()); for (int i = 0; i < Dimension(); ++i) { for (int j = 0; j < Dimension(); ++j) { matRet[i][j] = Cofactor(j, i); } } return matRet;}
开发者ID:gawallsibya,项目名称:SGA_Direct3D,代码行数:12,
示例7: bool cMatrix::operator==( cMatrix mat ){ for (int i = 0; i < Dimension(); ++i) { for (int j = 0; j < Dimension(); ++j) { if(fabs((*this)[i][j] - mat[i][j]) > 0.00001f) return false; } } return true;}
开发者ID:gawallsibya,项目名称:SGA_Direct3D,代码行数:12,
示例8: componentvoid ChessVector::set_up(){ as_vector.zero(); Species setup[8] = {rook, knight, bishop, queen, king, bishop, knight, rook}; for(int file = 0; file < 8; file++) { component(Dimension(0, file, black, setup[file])) = 1.0; // black back component(Dimension(1, file, black, pawn)) = 1.0; // black fore component(Dimension(6, file, white, pawn)) = 1.0; // white back component(Dimension(7, file, white, setup[file])) = 1.0; // white fore }}
开发者ID:PhaneendraGunda,项目名称:Linear-Chess,代码行数:13,
示例9: dict /** * Initalizes the game * @param newLineInterval The time in miliseconds, when a new line of letters * should be created on the gametable */ Game::Game(unsigned int newLineInterval) : dict(WORD_MIN_LENGTH, WORD_MAX_LENGTH) // horiz vert vorne breite hoehe tiefe , backGround(Point(-32.0f, 0.0f, -32.0f), Dimension(64.0f, 0.0f, 64.0f)) //point(x, y, z), Dimension(x, y, z) , gameTable(Point(0.0f, 0.0f, -9.0f), Dimension(6.0f, 0.5f, (6.0f/8.0f)*GAMETABLE_ROWS_NUM)) , scorePanel(Point(0.0f, 0.0f, -11.0f), Dimension(6.0f, 0.5f, 1.0f)) , letterShelf(Point(0.0f, 0.0f, 0.0f), Dimension(6.0f, 0.5f, 1.0f)) { this->dict.load(DICTIONARY_PATH); this->newLineInterval = newLineInterval; this->gameTable.addNewLine(); this->initLetterPoints(); }
开发者ID:MaliusArth,项目名称:CSE,代码行数:18,
示例10: DrawCheckbox void DrawCheckbox(StyledWindow *window, wxGraphicsContext *g) const { static const int radius = 0; static const wxColour borderColor = "#1c1617"; static const wxColour bottomHighlight = "#46474B"; static const wxColour topHighlight = "#606268"; static const wxColour backgroundColor = "#2b2a2a"; static const wxColour checkedBorder = "#2f4b20"; const int h = window->GetSize().GetHeight(); const int w = h - 1; DrawRectangleInstruction bottomHighlightInstruction(DrawShapeInstruction::Params() .SetColor(bottomHighlight) .SetCornerRadius(radius) .SetRect(DimRect(0, 0, Dimension(w, 0), Dimension(h, 0.0)))); DrawRectangleInstruction borderInstruction = DrawRectangleInstruction(DrawShapeInstruction::Params() .SetColor(borderColor) .SetCornerRadius(radius) .SetRect(DimRect(0, 0, Dimension(w, 0), Dimension(h-1, 0)))); DrawRectangleInstruction backgroundColorInstruction(DrawShapeInstruction::Params() .SetColor(backgroundColor) .SetCornerRadius(radius) .SetRect(DimRect(1, 1, Dimension(w-2, 0), Dimension(h-3, 0)))); GradientDefinitionPtr gradient = std::make_shared<LinearGradientDefinition>(LinearGradientDefinition::Direction::VERTICAL); gradient->AddColorStop(0, "#61ae36"); gradient->AddColorStop(1, "#3b6b21"); DrawRectangleInstruction checkedBackgroundInstruction(DrawShapeInstruction::Params() .SetGradientDefinition(gradient) .SetCornerRadius(radius) .SetRect(DimRect(2, 2, Dimension(w-4, 0), Dimension(h-5, 0)))); DrawRectangleInstruction checkedBorderInstruction(DrawShapeInstruction::Params() .SetColor(checkedBorder) .SetCornerRadius(radius) .SetRect(DimRect(1, 1, Dimension(w-2, 0), Dimension(h-3, 0)))); bottomHighlightInstruction.Draw(g, window->GetSize()); borderInstruction.Draw(g, window->GetSize()); backgroundColorInstruction.Draw(g, window->GetSize()); if (static_cast<StyledCheckBox*>(window)->IsChecked()) { checkedBackgroundInstruction.Draw(g, window->GetSize()); } }
开发者ID:alexpana,项目名称:wxStyle,代码行数:49,
示例11: NULL_USE/* ************************************************************************* * * Get data from input database. * ************************************************************************* */voidCVODEModel::getFromInput( std::shared_ptr<Database> input_db, bool is_from_restart){ NULL_USE(is_from_restart); d_initial_value = input_db->getDoubleWithDefault("initial_value", 0.0); IntVector periodic(d_grid_geometry->getPeriodicShift(IntVector(d_dim, 1))); int num_per_dirs = 0; for (int id = 0; id < d_dim.getValue(); ++id) { if (periodic(id)) ++num_per_dirs; } if (input_db->keyExists("Boundary_data")) { std::shared_ptr<Database> boundary_db( input_db->getDatabase("Boundary_data")); if (d_dim == Dimension(2)) { CartesianBoundaryUtilities2::getFromInput(this, boundary_db, d_scalar_bdry_edge_conds, d_scalar_bdry_node_conds, periodic); } else if (d_dim == Dimension(3)) { CartesianBoundaryUtilities3::getFromInput(this, boundary_db, d_scalar_bdry_face_conds, d_scalar_bdry_edge_conds, d_scalar_bdry_node_conds, periodic); } } else { TBOX_WARNING( d_object_name << ": " << "Key data `Boundary_data' not found in input. " << endl); }#ifdef USE_FAC_PRECONDITIONER d_use_neumann_bcs = input_db->getBoolWithDefault("use_neumann_bcs", d_use_neumann_bcs); d_print_solver_info = input_db->getBoolWithDefault("print_solver_info", d_print_solver_info);#endif}
开发者ID:LLNL,项目名称:SAMRAI,代码行数:56,
示例12: createAlignedPosition void RadioButton::positionRadioButton() { radioButtonPosition = createAlignedPosition( getRadioButtonAlignment(),getInnerRectangle(), Dimension(getRadioButtonRadius() * 2, getRadioButtonRadius() * 2)); radioButtonPosition = Point( radioButtonPosition.getX() + (getRadioButtonRadius() ), radioButtonPosition.getY() + (getRadioButtonRadius() )); radioButtonRect = Rectangle(Point( radioButtonPosition.getX() - getRadioButtonRadius(), radioButtonPosition.getY() - getRadioButtonRadius()), Dimension(getRadioButtonRadius() * 2, getRadioButtonRadius() * 2)); }
开发者ID:jmasterx,项目名称:Agui,代码行数:15,
示例13: returnfloat cMatrix::Determinent(){ if(Dimension() == 2) { return (*this)[0][0] * (*this)[1][1] - (*this)[1][0] * (*this)[0][1]; } float fDeterminent = 0.0f; for (int i = 0; i < Dimension(); ++i) { fDeterminent += ((*this)[i][0] * Cofactor(i, 0)); } return fDeterminent;}
开发者ID:gawallsibya,项目名称:SGA_Direct3D,代码行数:15,
示例14: Dimensionvoid Vector::Dimension(int d, double value) { int original = dim; Dimension(d); for (int i = original; i < dim; i++) data[i] = value;}
开发者ID:zhanxw,项目名称:rvtests,代码行数:7,
示例15: DimensionON_BOOL32 ON_Geometry::SwapCoordinates( int i, int j // indices of coords to swap ){ ON_BOOL32 rc = false; const int dim = Dimension(); if ( dim > 0 && dim <= 3 && i >= 0 && i < 3 && j >= 0 && j < 3 ) { if ( i == j ) { rc = true; } else { int k; ON_Xform swapij(0.0); for ( k = 0; k < 4; k++ ) { if ( i == k ) swapij[k][j] = 1.0; else if ( j == k ) swapij[k][i] = 1.0; else swapij[k][k] = 1.0; } rc = Transform( swapij ); } } return rc;}
开发者ID:ckvk,项目名称:opennurbs,代码行数:26,
示例16: mprintf// TODO: Each data set needs dimension information.Analysis::RetType Analysis_Spline::Analyze() { double mmin, mmax; int msize; for (unsigned int idx = 0; idx < input_dsets_.size(); idx++) { DataSet_1D const& ds = static_cast<DataSet_1D const&>(*input_dsets_[idx]); if (useDefaultMin_) mmin = meshmin_; else mmin = ds.Min(); if (useDefaultMax_) mmax = meshmax_; else mmax = ds.Max(); if (meshfactor_ > 0) msize = (int)((double)ds.Size() * meshfactor_); else msize = meshsize_; // Set up output dimension mprintf("/t%s: Setting mesh from %f->%f, size=%i,", ds.legend(), mmin, mmax, msize); output_dsets_[idx]->SetDim( Dimension::X, Dimension(mmin, (mmax - mmin)/(double)msize, ds.Dim(0).Label()) ); output_dsets_[idx]->CalculateMeshX(msize, mmin, mmax); mprintf(" set min=%f, set step=%f/n", ds.Dim(0).Min(), ds.Dim(0).Step()); // Calculate mesh Y values. output_dsets_[idx]->SetSplinedMesh( ds ); // DEBUG //for (unsigned int i = 0; i < output_dsets_[idx]->Size(); i++) // mprintf("/t%12.4f %12.4g/n", output_dsets_[idx]->X(i), output_dsets_[idx]->Y(i)); } return Analysis::OK;}
开发者ID:jcr13,项目名称:cpptraj,代码行数:32,
示例17: bool VECTOR3::IsSame(VECTOR3& a){ for(int i = 0; i < Dimension(); i++) if(vec[i] != a(i)) return false; return true;}
开发者ID:ChengLiOSU,项目名称:OSUFlow,代码行数:7,
示例18: updateScrollBars void ScrollPane::setSize( const Dimension &size ) { Widget::setSize(size); updateScrollBars(); pChildContent->setSize(Dimension(getContentWidth(),getContentHeight())); }
开发者ID:jmasterx,项目名称:Agui,代码行数:7,
示例19: Dimensionvoid FloatVector::SetMultiple(double k, FloatVector & v) { Dimension(v.dim); for (int i = 0; i < dim; i++) data[i] = k * v[i]; }
开发者ID:hilarymartin,项目名称:MAE_project,代码行数:7,
示例20: ChebyshevSet /*! * Take as parameters:/n * The label of the set * The dimension of the vector space./n */ ChebyshevSet(const std::string _setLabel, my::integer _vecDim ): setLabel_(_setLabel), vecDim_(_vecDim), num_cheb_set_(2) { memorySize_= NumOfSets()*3*Dimension(); ///The linear memory blocks tries to allocate the appropiate ammount of memory linearMemBlock_=new my::scalar [ memorySize_ ]; if(linearMemBlock_ == NULL) { std::cerr<<"Unable to allocate the ammount of requested memory: " << sizeof(my::scalar)*memorySize_/1048576<<" Mb"<<std::endl <<"the program will be terminated "<<std::endl; std::exit(-1); } //Initialize each of the requested chebyshev set, (by default 2) ChebVecs_= std::vector< std::vector< my::scalar* > >( NumOfSets() ); for(my::integer i=0;i<NumOfSets();i++) { //Each of this sets has kpm::VECPERSET=3 Chebyshev vectors ChebVecs_[i]=std::vector< my::scalar* >(kpm::VECPERSET); //Which are setted intercalated into a huge block of memory for(my::integer j=0;j<kpm::VECPERSET;j++) ChebVecs_[i][j]=&linearMemBlock_[NumOfSets()*j+i]; } }
开发者ID:adamecius,项目名称:TB-QuantumTransp,代码行数:31,
示例21: CVbool ON_BezierCage::GetCV( int i, int j, int k, ON::point_style style, double* Point ) const{ const double* cv = CV(i,j,k); if ( !cv ) return false; int dim = Dimension(); double w = ( IsRational() ) ? cv[dim] : 1.0; switch(style) { case ON::euclidean_rational: Point[dim] = w; // no break here case ON::not_rational: if ( w == 0.0 ) return false; w = 1.0/w; while(dim--) *Point++ = *cv++ * w; break; case ON::homogeneous_rational: Point[dim] = w; memcpy( Point, cv, dim*sizeof(*Point) ); break; default: return false; } return true;}
开发者ID:raazui,项目名称:3D-Surface-Reconstruction,代码行数:26,
示例22: add void ScrollPane::add( Widget *widget ) { pChildContent->add(widget); pChildContent->setSize(Dimension(getContentWidth(),getContentHeight())); updateScrollBars(); }
开发者ID:jmasterx,项目名称:Agui,代码行数:7,
示例23: ParsedISymbol::ISymbol(){ Parsed()=0; Visited()=0; Type()=(SymbolType) -1; ListType()=unknown_; Dimension()=0; SimpleType()=true; Required()=false; Abstract()=false; Compositor()=0; DerivedType() = XercesAdditions::DERIVATION_NONE; XercesType() = XercesAdditions::NO_DECLARATION; Global()=false; SqlCount()=0; SubstitutionGroupAffiliation().clear(); symbols.push_back(this); Variable()=NULL; SimpleContent()=false; List()=false; Atomic()=false; Level()=0; ListSize()=0; intrusive_ptr_add_ref((IExpress *) symbols.back().get());}
开发者ID:usnistgov,项目名称:QIF,代码行数:25,
示例24: LOGDimensionNameRepo::dimension(const vespalib::string &name){ size_t id = _dimensionNames.resolve(name); LOG(debug, "dimension name %s -> %zu", name.c_str(), id); return Dimension(id);}
开发者ID:songhtdo,项目名称:vespa,代码行数:7,
注:本文中的Dimension函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ Dir函数代码示例 C++ DimException函数代码示例 |