本文整理汇总了C++中Dimension函数的典型用法代码示例。如果您正苦于以下问题:C++ Dimension函数的具体用法?C++ Dimension怎么用?C++ Dimension使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Dimension函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mat
float 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();
}
示例2: cell_index
int 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;
}
}
示例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");
}
}
示例4: fflush
void 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;
}
}
}
示例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;
}
示例6: matRet
cMatrix 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;
}
示例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;
}
示例8: component
void 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
}
}
示例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();
}
示例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());
}
}
示例11: NULL_USE
/*
*************************************************************************
*
* Get data from input database.
*
*************************************************************************
*/
void
CVODEModel::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
}
示例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));
}
示例13: return
float 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;
}
示例14: Dimension
void Vector::Dimension(int d, double value) {
int original = dim;
Dimension(d);
for (int i = original; i < dim; i++) data[i] = value;
}
示例15: Dimension
ON_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;
}