您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ Grid函数代码示例

51自学网 2021-06-01 21:19:44
  C++
这篇教程C++ Grid函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中Grid函数的典型用法代码示例。如果您正苦于以下问题:C++ Grid函数的具体用法?C++ Grid怎么用?C++ Grid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了Grid函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: stepsVector

returnValue ModelData::setIntegrationGrid(	const Grid& _ocpGrid, const uint _numSteps										){	uint i;	N = _ocpGrid.getNumIntervals();	BooleanType equidistantControl = _ocpGrid.isEquidistant();	double T = _ocpGrid.getLastTime() - _ocpGrid.getFirstTime();	double h = T/((double)_numSteps);	Vector stepsVector( N );	if (integrationGrid.isEmpty() == BT_TRUE)	{		for( i = 0; i < stepsVector.getDim(); i++ )		{			stepsVector(i) = (int) acadoRound((_ocpGrid.getTime(i+1)-_ocpGrid.getTime(i))/h);		}		if( equidistantControl )		{			// Setup fixed integrator grid for equidistant control grid			integrationGrid = Grid( 0.0, ((double) T)/((double) N), (int) ceil((double)_numSteps/((double) N) - 10.0*EPS) + 1 );		}		else		{			// Setup for non equidistant control grid			// NOTE: This grid defines only one integration step because the control			// grid is non equidistant.			integrationGrid = Grid( 0.0, h, 2 );			numSteps = stepsVector;		}	}	return SUCCESSFUL_RETURN;}
开发者ID:francesco-romano,项目名称:acado,代码行数:33,


示例2: Wall

Wall* Wall::create(Field* field, const Grid &pos){    Wall* wall = new Wall();    if (wall && wall->initWithGrid(field, "rWall_0003", pos))    {        wall->autorelease();        wall->retain();    }    else    {        CC_SAFE_DELETE(wall);        wall = nullptr;    }        wall->_is_top_wall_exist   = wall->_isWallExist(wall->m_grid_pos + Grid(0, -1));    wall->_is_right_wall_exist = wall->_isWallExist(wall->m_grid_pos + Grid(1, 0));    wall->_refreshWall();        auto left_wall   = wall->_getWall(wall->m_grid_pos + Grid(-1, 0));    if (left_wall)    {        left_wall->notifyRightWallExist();    }        auto bottom_wall = wall->_getWall(wall->m_grid_pos + Grid(0, 1));    if (bottom_wall)    {        bottom_wall->notifyTopWallExist();    }        return wall;}
开发者ID:wevet,项目名称:Cocos2dxResources,代码行数:33,


示例3: main

int main(){  Grid g = Grid();  Grid g2 = Grid();  assert(g == g2);  for (int i = 0; i < 9; i++) {    for (int j = 0; j < 9; j++) {      if ((i+j)%7 == 0) {        g2.set(i,j,-1*(i+1)*(j+1));      } else {        g2.set(i,j,(i-1)*(j+1));      }    }  }  assert(g != g2);  g = g2;  assert (g == g2);  g.set(8,8, -10);  g.set(4,8, -10);  g.set(3,8, -10);  g.set(8,5, -10);  g.set(1,3, -10);  g.print();  std::cout << "All tests passed!/n";  return 0;}
开发者ID:dhrupadb,项目名称:C-doku-,代码行数:35,


示例4: int

Grid GameWorld::GetGridPos(float x, float y){	if (x < rect.left || x >= rect.right || y > rect.top || y <= rect.bottom) return Grid(-1, -1);	int tx = int((x - rect.left) / gridWidth);	int ty = int((rect.top - y) / gridHeight);	return Grid(tx, ty);}
开发者ID:MagicBlocks,项目名称:Pac-man,代码行数:9,


示例5: m_boundsManager

//#################### CONSTRUCTORS ####################BroadPhaseCollisionDetector::BroadPhaseCollisionDetector(const BoundsManager_CPtr& boundsManager,														 double minObjectSize, double maxObjectSize):	m_boundsManager(boundsManager){	for(double gridSize=minObjectSize; gridSize<maxObjectSize*2; gridSize*=2)	{		m_hgrid.insert(std::make_pair(gridSize, Grid()));	}	m_hgrid.insert(std::make_pair(std::numeric_limits<double>::max(), Grid()));}
开发者ID:longde123,项目名称:hesperus2,代码行数:12,


示例6: getBrickAt

void Board::addDestroyedBricks(Brick* brick, std::vector<Brick*> &destroyedBricks){    Grid location = brick->_currentLocation;    Brick* north = getBrickAt(location + Grid(-1,0));    Brick* south = getBrickAt(location + Grid(1,0));    Brick* east = getBrickAt(location + Grid(0,1));    Brick* west = getBrickAt(location + Grid(0,-1));        if(north != 0 ) // not sure why some times short circuit works sometime it doesn't.    {        if(!north->tmp_moves)        {            if(brick->getType() == north->getType())            {                north->tmp_moves = true;                    destroyedBricks.push_back(north);            }        }    }    if(south != 0 )    {        if(!south->tmp_moves)        {            if(brick->getType() == south->getType())            {                south->tmp_moves = true;                    destroyedBricks.push_back(south);            }        }    }    if(east != 0)    {        if(!east->tmp_moves)        {            if(brick->getType() == east->getType() )            {                east->tmp_moves = true;                    destroyedBricks.push_back(east);            }        }    }    if(west != 0 )    {        if(!west->tmp_moves)        {            if(brick->getType() == west->getType() )            {                west->tmp_moves = true;                    destroyedBricks.push_back(west);            }        }    }}
开发者ID:ZwodahS,项目名称:DestroyTheBrick,代码行数:53,


示例7: Grid

bool Board::fireBrick(Grid location, Brick* nextBrick, zf::Direction direction){    if(isMoving())    {        return false;    }    Grid directionGrid = Grid(0,0);    switch(direction)    {        case zf::North:            directionGrid = Grid(-1,0);            break;        case zf::South:            directionGrid = Grid(1,0);            break;        case zf::East:            directionGrid = Grid(0,1);            break;        case zf::West:            directionGrid = Grid(0,-1);            break;    }    Grid nextGrid = location + directionGrid;    Brick* brick = getBrickAt(nextGrid.row , nextGrid.col);    if(brick != 0)    {        return false; // if there is a brick blocking directly, don't allow it to shoot.    }    //find the first block that it will hit    // move nextGrid back first    nextGrid -= directionGrid;    while(brick == 0)    {        nextGrid += directionGrid;        Grid temp = nextGrid + directionGrid;        if(!inShootableRange(temp.row,temp.col)) // if the next is not in shootable range , break        {            // prevent out of bound            break;        }        brick = getBrickAt(temp.row, temp.col);    }    _knock = -1;    putBrickInto(location.row,location.col,nextBrick);    nextBrick->moveToLocation(nextGrid.row, nextGrid.col);    _currentMovingDirection = directionGrid;     _movingBricks.push_back(nextBrick);    return true;}
开发者ID:ZwodahS,项目名称:DestroyTheBrick,代码行数:50,


示例8: hasBot

bool World::hasBot(int row, int col){    for(int i = 0 ; i < _enemyBots.size() ; i++)    {        if(_enemyBots[i]->getLocation() == Grid(row,col))        {            return true;        }    }    if(_player->getLocation() == Grid(row, col))    {        return true;    }    return false;}
开发者ID:ZwodahS,项目名称:LD26,代码行数:15,


示例9: GetSlot

void cSlotAreaCrafting::ClickedResult(cPlayer & a_Player){	const cItem * ResultSlot = GetSlot(0, a_Player);	cItem & DraggingItem = a_Player.GetDraggingItem();	// Get the current recipe:	cCraftingRecipe & Recipe = GetRecipeForPlayer(a_Player);	cItem * PlayerSlots = GetPlayerSlots(a_Player) + 1;	cCraftingGrid Grid(PlayerSlots, m_GridSize, m_GridSize);	// If possible, craft:	if (DraggingItem.IsEmpty())	{		DraggingItem = Recipe.GetResult();		Recipe.ConsumeIngredients(Grid);		Grid.CopyToItems(PlayerSlots);	}	else if (DraggingItem.IsEqual(Recipe.GetResult()))	{		cItemHandler * Handler = ItemHandler(Recipe.GetResult().m_ItemType);		if (DraggingItem.m_ItemCount + Recipe.GetResult().m_ItemCount <= Handler->GetMaxStackSize())		{			DraggingItem.m_ItemCount += Recipe.GetResult().m_ItemCount;			Recipe.ConsumeIngredients(Grid);			Grid.CopyToItems(PlayerSlots);		}	}	// Get the new recipe and update the result slot:	UpdateRecipe(a_Player);		// We're done. Send all changes to the client and bail out:	m_ParentWindow.BroadcastWholeWindow();}
开发者ID:l0ud,项目名称:MCServer,代码行数:35,


示例10: run_soft_sphere

double run_soft_sphere(double reduced_density, double temp) {  Functional f = SoftFluid(sigma, 1, 0);  const double mu = find_chemical_potential(OfEffectivePotential(f), temp, reduced_density*pow(2,-5.0/2.0));  printf("mu is %g for reduced_density = %g at temperature %g/n", mu, reduced_density, temp);  //printf("Filling fraction is %g with functional %s at temperature %g/n", reduced_density, teff);  //fflush(stdout);  temperature = temp;  //if (kT == 0) kT = ;1  Lattice lat(Cartesian(xmax,0,0), Cartesian(0,ymax,0), Cartesian(0,0,zmax));  GridDescription gd(lat, dx);  Grid softspherepotential(gd);  softspherepotential.Set(soft_sphere_potential);  f = SoftFluid(sigma, 1, mu); // compute approximate energy with chemical potential mu  const double approx_energy = f(temperature, reduced_density*pow(2,-5.0/2.0))*xmax*ymax*zmax;  const double precision = fabs(approx_energy*1e-9);  f = OfEffectivePotential(SoftFluid(sigma, 1, mu) + ExternalPotential(softspherepotential));  static Grid *potential = 0;  potential = new Grid(gd);  *potential = softspherepotential - temperature*log(reduced_density*pow(2,-5.0/2.0)/(1.0*radius*radius*radius))*VectorXd::Ones(gd.NxNyNz); // Bad starting guess  printf("/tMinimizing to %g absolute precision from %g from %g.../n", precision, approx_energy, temperature);  fflush(stdout);  Minimizer min = Precision(precision,                            PreconditionedConjugateGradient(f, gd, temperature,                                potential,                                QuadraticLineMinimizer));  took("Setting up the variables");  for (int i=0; min.improve_energy(true) && i<100; i++) {  }  took("Doing the minimization");  min.print_info();  Grid density(gd, EffectivePotentialToDensity()(temperature, gd, *potential));  //printf("# per area is %g at filling fraction %g/n", density.sum()*gd.dvolume/dw/dw, reduced_density);  char *plotname = (char *)malloc(1024);  sprintf(plotname, "papers/fuzzy-fmt/figs/radial-wca-%06.4f-%04.2f.dat", temp, reduced_density);  z_plot(plotname, Grid(gd, pow(2,5.0/2.0)*density));  free(plotname);  {    //double peak = peak_memory()/1024.0/1024;    //double current = current_memory()/1024.0/1024;    //printf("Peak memory use is %g M (current is %g M)/n", peak, current);  }  took("Plotting stuff");  printf("density %g gives ff %g for reduced_density = %g and T = %g/n", density(0,0,gd.Nz/2),         density(0,0,gd.Nz/2)*4*M_PI/3, reduced_density, temp);  return density(0, 0, gd.Nz/2)*4*M_PI/3; // return bulk filling fraction}
开发者ID:droundy,项目名称:deft,代码行数:60,


示例11: PushCallStack

inline voidAbstractDistMatrix<T,Int>::Write( const std::string filename, const std::string msg ) const{#ifndef RELEASE    PushCallStack("AbstractDistMatrix::Write");#endif    const elem::Grid& g = Grid();    const int commRank = mpi::CommRank( g.VCComm() );     if( commRank == 0 )    {        std::ofstream file( filename.c_str() );        file.setf( std::ios::scientific );        PrintBase( file, msg );        file.close();    }    else    {        NullStream nullStream;        PrintBase( nullStream, msg );    }#ifndef RELEASE    PopCallStack();#endif}
开发者ID:jimgoo,项目名称:Elemental,代码行数:26,


示例12: logic_error

inline voidAbstractDistMatrix<T,Int>::AssertSameGrid( const AbstractDistMatrix<U,Int>& A ) const{    if( Grid() != A.Grid() )        throw std::logic_error("Assertion that grids match failed");}
开发者ID:jimgoo,项目名称:Elemental,代码行数:7,


示例13: Grid

FixPaintSelection::GridMap::iteratorFixPaintSelection::addGrid(const Point& pt){    std::pair<GridMap::iterator, bool> inserted =        mGrids.insert(GridMap::value_type(pt, Grid()));    return inserted.first;}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:7,


示例14: sol

Grid Grid::exact_solution(int time_steps) {	std::vector<double> sol(size, 0);	int shift = (int) (dt * xi / dh * time_steps / dh);	for (int i = 0; i < size - shift; i++)		sol[i + shift] = data[i];	return Grid(sol, dh, dt, xi);};
开发者ID:liviniuk,项目名称:MIPT_base,代码行数:7,


示例15: Game

		 : Game(rm, dbGraphics, screenBounds, gameFont, fontBrush, sound){	// Create random instance	rGen = gcnew Random();		// Load background image	//background = Image::FromFile("background.jpg");	// Create gamegrid and preview	grid = gcnew GameGrid(rm, Point(302,-30), graphics, sound, GAMEGRID_COLS, GAMEGRID_ROWS);	preview = gcnew Grid(rm, Point(757,480), graphics, PREVIEW_COLS, PREVIEW_ROWS); 	// Create arrays for tracking block stats	tetriminoStats = gcnew array<int>(7);	tetriminoTypes = gcnew array<ETetriminoType>	{		I_TETRIMINO,		J_TETRIMINO, 		L_TETRIMINO, 		O_TETRIMINO, 		S_TETRIMINO, 		T_TETRIMINO,		Z_TETRIMINO	};	// Create first two tetriminos	tetriminoInPlay = generateTetrimino();	nextTetrimino = generateTetrimino();	// Initialize game update time	waitTime = 50;}
开发者ID:appsromch,项目名称:CPlusPlus,代码行数:32,


示例16: Grid

//Constructs the grid based on the polygon's bounding box and generates a random point if inside polygonPoints PathPlanner::getRandGridPoints(){	//Grid	CGAL::Bbox_2 box = this->BPpoly.bbox();	long double xmini = box.xmin();	long double ymini = box.ymin();	long double xmaxi = box.xmax();	long double ymaxi = box.ymax();	cout<<xmini<<" "<<xmaxi<<" "<<ymini<<" "<<ymaxi<<'/n';	Point_2 iterator;	vector<Grid> grids;	Points randGridPoints;	for(long double i =ymini; i<ymaxi; i += this->gridSideLen ){		for(long double j = xmini; j<xmaxi; j+= this->gridSideLen ){			grids.push_back( Grid( Point_2(j,i) , this->gridSideLen) );			cout<<"row: "<<i<<" column: "<<j<<'/n';		}	}	for (int i =0 ; i <grids.size();i++){		if(grids[i].is_bounded(BPpoly)){			randGridPoints.push_back(grids[i].genRandPoint());			grids[i].printGrid();		}	}	return randGridPoints;}
开发者ID:enc5271,项目名称:coverageAlgorithm,代码行数:27,


示例17: Parameters

//---------------------------------------------------------bool CFilter_Resample::On_Execute(void){	double		Cellsize;	CSG_Grid	*pGrid, *pLoPass, *pHiPass;	//-----------------------------------------------------	pGrid		= Parameters("GRID"  )->asGrid();	pLoPass		= Parameters("LOPASS")->asGrid();	pHiPass		= Parameters("HIPASS")->asGrid();	Cellsize	= Parameters("SCALE" )->asDouble() * Get_Cellsize();	//-----------------------------------------------------	if( Cellsize > 0.5 * SG_Get_Length(Get_System()->Get_XRange(), Get_System()->Get_YRange()) )	{		Error_Set(_TL("resampling cell size is too large"));		return( false );	}	//-----------------------------------------------------	CSG_Grid	Grid(CSG_Grid_System(Cellsize, Get_XMin(), Get_YMin(), Get_XMax(), Get_YMax()), SG_DATATYPE_Float);	Grid.Assign(pGrid, GRID_RESAMPLING_Mean_Cells);	//-----------------------------------------------------	pLoPass->Set_Name(CSG_String::Format(SG_T("%s [%s]"), pGrid->Get_Name(), _TL("Low Pass")));	pHiPass->Set_Name(CSG_String::Format(SG_T("%s [%s]"), pGrid->Get_Name(), _TL("High Pass")));	CSG_Colors	Colors;	DataObject_Get_Colors(pGrid  , Colors);	DataObject_Set_Colors(pLoPass, Colors);	DataObject_Set_Colors(pHiPass, 11, SG_COLORS_RED_GREY_BLUE);	//-----------------------------------------------------	for(int y=0; y<Get_NY() && Set_Progress(y); y++)	{		double	py	= Get_YMin() + y * Get_Cellsize();		#pragma omp parallel for		for(int x=0; x<Get_NX(); x++)		{			double	z, px	= Get_XMin() + x * Get_Cellsize();			if( !pGrid->is_NoData(x, y) && Grid.Get_Value(px, py, z) )			{				pLoPass->Set_Value(x, y, z);				pHiPass->Set_Value(x, y, pGrid->asDouble(x, y) - z);			}			else			{				pLoPass->Set_NoData(x, y);				pHiPass->Set_NoData(x, y);			}		}	}	//-----------------------------------------------------	return( true );}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:61,


示例18: Grid

void cSlotAreaCrafting::UpdateRecipe(cPlayer & a_Player){	cCraftingGrid   Grid(GetPlayerSlots(a_Player) + 1, m_GridSize, m_GridSize);	cCraftingRecipe & Recipe = GetRecipeForPlayer(a_Player);	cRoot::Get()->GetCraftingRecipes()->GetRecipe(&a_Player, Grid, Recipe);	SetSlot(0, a_Player, Recipe.GetResult());	m_ParentWindow.SendSlot(a_Player, this, 0);}
开发者ID:RedEnraged96,项目名称:MCServer-1,代码行数:8,


示例19: _getWall

void Wall::_destroy(){    Building::_destroy();    m_field->notifyWallWatchers();        auto left_wall   = _getWall(m_grid_pos + Grid(-1, 0));    if (left_wall)    {        left_wall->notifyRightWallBroken();    }        auto bottom_wall = _getWall(m_grid_pos + Grid(0, 1));    if (bottom_wall)    {        bottom_wall->notifyTopWallBroken();    }}
开发者ID:wevet,项目名称:Cocos2dxResources,代码行数:17,


示例20: fromVariantMap

bool Grid::fromVariantMap(const QVariantMap& vm){    *this = Grid();    valueFromVariantMap(vm, QLatin1String(KEY_VISIBLE), m_visible);    valueFromVariantMap(vm, QLatin1String(KEY_SNAPX), m_snapX);    valueFromVariantMap(vm, QLatin1String(KEY_SNAPY), m_snapY);    valueFromVariantMap(vm, QLatin1String(KEY_DELTAX), m_deltaX);    return valueFromVariantMap(vm, QLatin1String(KEY_DELTAY), m_deltaY);}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:9,


示例21: Grid

Grid World::gridAt(Grid g, direction::Direction d){    if(d == direction::North)    {        return Grid(g.row-1,g.col);    }    else if(d == direction::South)    {        return Grid(g.row+1,g.col);    }    else if(d == direction::East)    {        return Grid(g.row,g.col+1);    }    else    {        return Grid(g.row,g.col-1);    }}
开发者ID:ZwodahS,项目名称:LD26,代码行数:19,


示例22: getTerrainData

boolGridSelection::add(int x, int z){    if (!getTerrainData()->isValidGrid(x, z))        return false;    size_t index = getTerrainData()->_getGridIndex(x, z);    std::pair<GridMap::iterator, bool> inserted =        mGrids.insert(GridMap::value_type(index, Grid(x, z, getTerrainData()->mGridInfos[index])));    return inserted.second;}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:11,


示例23: data

Grid Grid::solve(int time_steps) {	std::vector< double > data(this->data);		std::vector< double > auxiliary;	int steps = time_steps / dh;	for (int i = 0; i < steps; i++) {		vector_copy(auxiliary, data);		for (int j = 1; j < size; j++) {			data[j] = auxiliary[j] - xi * dt * (auxiliary[j] - auxiliary[j - 1]) / dh;		}	}	return Grid(data, dh, dt, xi);}
开发者ID:liviniuk,项目名称:MIPT_base,代码行数:12,


示例24: ROS_INFO

bool leatherman::ReadBinvox(const std::string& filename){    ROS_INFO("Reading binvox file: %s", filename.c_str());    std::ifstream* input = new std::ifstream(            filename.c_str(), std::ios::in | std::ios::binary);    // read header    std::string line;    *input >> line;  // #binvox    if (line.compare("#binvox") != 0) {        ROS_INFO_STREAM("Error: first line reads [" << line << "] instead of [#binvox]");        delete input;        return false;    }    *input >> Grid().version;    ROS_INFO_STREAM("reading binvox version " << Grid().version);    Grid().depth = -1;    int done = 0;    while (input->good() && !done) {        *input >> line;        if (line.compare("data") == 0) {            done = 1;        }        else if (line.compare("dim") == 0) {            *input >> Grid().depth >> Grid().height >> Grid().width;        }        else if (line.compare("translate") == 0) {
开发者ID:shivamvats,项目名称:leatherman,代码行数:28,


示例25: rates

void HSolveUtils::rates(	Id gateId,	HSolveUtils::Grid grid,	vector< double >& A,	vector< double >& B ){	double min = HSolveUtils::get< HHGate, double >( gateId, "min" );	double max = HSolveUtils::get< HHGate, double >( gateId, "max" );	unsigned int divs = HSolveUtils::get< HHGate, unsigned int >(		gateId, "divs" );		if ( grid == Grid( min, max, divs ) ) {		A = HSolveUtils::get< HHGate, vector< double > >( gateId, "tableA" );		B = HSolveUtils::get< HHGate, vector< double > >( gateId, "tableB" );				return;	}		A.resize( grid.size() );	B.resize( grid.size() );		/*	 * Getting Id of original (prototype) gate, so that we can set fields on	 * it. Copied gates are read-only.	 */	HHGate* gate = reinterpret_cast< HHGate* >( gateId.eref().data() );	gateId = gate->originalGateId();		/*	 * Setting interpolation flag on. Will set back to its original value once	 * we're done.	 */	bool useInterpolation = HSolveUtils::get< HHGate, bool >		( gateId, "useInterpolation" );	//~ HSolveUtils::set< HHGate, bool >( gateId, "useInterpolation", true );	Qinfo* qDummy = NULL;	gate->setUseInterpolation( gateId.eref(), qDummy, true );		unsigned int igrid;	double* ia = &A[ 0 ];	double* ib = &B[ 0 ];	for ( igrid = 0; igrid < grid.size(); ++igrid ) {		gate->lookupBoth( grid.entry( igrid ), ia, ib );				++ia, ++ib;	}		// Setting interpolation flag back to its original value.	//~ HSolveUtils::set< HHGate, bool >		//~ ( gateId, "useInterpolation", useInterpolation );	gate->setUseInterpolation( gateId.eref(), qDummy, useInterpolation );}
开发者ID:Vivek-sagar,项目名称:moose-1,代码行数:52,


示例26: run_walls

double run_walls(double reduced_density, const char *name, Functional fhs, double teff) {  double kT = teff;  if (kT == 0) kT = 1;  Functional f = OfEffectivePotential(fhs);  const double zmax = width + 2*spacing;  Lattice lat(Cartesian(dw,0,0), Cartesian(0,dw,0), Cartesian(0,0,zmax));  GridDescription gd(lat, dx);  Grid constraint(gd);  constraint.Set(notinwall);  f = constrain(constraint, f);  Grid potential(gd);  potential = pow(2,-5.0/2.0)*(reduced_density*constraint + 1e-4*reduced_density*VectorXd::Ones(gd.NxNyNz));  potential = -kT*potential.cwise().log();  const double approx_energy = fhs(kT, reduced_density*pow(2,-5.0/2.0))*dw*dw*width;  const double precision = fabs(approx_energy*1e-11);  printf("/tMinimizing to %g absolute precision from %g from %g.../n", precision, approx_energy, kT);  fflush(stdout);  Minimizer min = Precision(precision,                            PreconditionedConjugateGradient(f, gd, kT,                                                            &potential,                                                            QuadraticLineMinimizer));  took("Setting up the variables");  if (strcmp(name, "hard") != 0 && false) {    printf("For now, SoftFluid doesn't work properly, so we're skipping the/n");    printf("minimization at temperature %g./n", teff);  } else {    for (int i=0;min.improve_energy(false) && i<100;i++) {    }  }  took("Doing the minimization");  min.print_info();  Grid density(gd, EffectivePotentialToDensity()(kT, gd, potential));  //printf("# per area is %g at filling fraction %g/n", density.sum()*gd.dvolume/dw/dw, eta);  char *plotname = (char *)malloc(1024);  sprintf(plotname, "papers/fuzzy-fmt/figs/walls%s-%06.4f-%04.2f.dat", name, teff, reduced_density);  z_plot(plotname, Grid(gd, density*pow(2,5.0/2.0)));  free(plotname);  took("Plotting stuff");  printf("density %g gives ff %g for reduced density = %g and T = %g/n", density(0,0,gd.Nz/2),         density(0,0,gd.Nz/2)*4*M_PI/3, reduced_density, teff);  return density(0, 0, gd.Nz/2)*4*M_PI/3; // return bulk filling fraction}
开发者ID:rscheirer,项目名称:deft,代码行数:52,


示例27: grid_toggle_button

wxButton* grid_toggle_button(wxWindow* parent,  wxSizer* sizer,  const Art& art){  // Create the button that enables/disables the grid  wxButton* button = noiseless_button(parent,    "",    Tooltip(""),    IntSize(60,50));  update_grid_toggle_button(Grid(), button, art);  sizer->Add(button, 0, wxEXPAND);  return button;}
开发者ID:lukas-ke,项目名称:faint-graphics-editor,代码行数:13,


示例28: frameprops_set_grid

/* method: "set_grid((x,y), dashed, enabled, spacing)/nSpecify the grid." */static void frameprops_set_grid(ImageProps& self,  const Point& anchor,  bool dashed,  bool enabled,  int spacing){  self.SetGrid(Grid(enabled_t(enabled),    dashed_t(dashed),    spacing,    default_grid_color(),    anchor));}
开发者ID:lukas-ke,项目名称:faint-graphics-editor,代码行数:15,


示例29: establish_root_environment

int establish_root_environment(void) {    spawn_env(NULL, Primordial_Grid(GC_SKIPREG));    rootEnvironment=Car(env);    rootBacros=Grid();    unknownSymbolError=Err(Cons(String("Unknown symbol"), NULL));    Set(rootEnvironment, "nil", NULL);    Set(rootEnvironment, "true", Atom("true"));    Set(rootEnvironment, "add", Routine(&dirty_sum));    Set(rootEnvironment, "+", Get(rootEnvironment, "add"));    Set(rootEnvironment, "subtract", Routine(&dirty_sub));    Set(rootEnvironment, "-", Get(rootEnvironment, "subtract"));    Set(rootEnvironment, "if", Method(&funky_if));    Set(rootEnvironment, "&ver", String("Funky Lisp Draft 3"));    Set(rootEnvironment, "set!", Routine(&funky_set));    Set(rootEnvironment, "print_", Routine(&funky_print));    Set(rootEnvironment, "list", Routine(&funky_list));    Set(rootEnvironment, "pair", Routine(&funky_pair));    Set(rootEnvironment, "grid", Routine(&funky_grid));    Set(rootEnvironment, "get", Routine(&funky_grid_get));    Set(rootEnvironment, "quote", Method(&funky_quote));    Set(rootEnvironment, "apply", Routine(&apply));    Set(rootEnvironment, "mac", Method(&funky_macro));    Set(rootEnvironment, "def", Method(&funky_def));    Set(rootEnvironment, "head", Routine(&funky_head));    Set(rootEnvironment, "rest_", Routine(&funky_rest));    Set(rootEnvironment, "last", Routine(&funky_last));    Set(rootEnvironment, "err", Routine(&funky_err));    Set(rootEnvironment, "dump", Routine(&funky_dump));    Set(rootEnvironment, "&bacros", rootBacros);    Set(rootEnvironment, ">", Routine(&funky_greater_than));    Set(rootEnvironment, "<", Routine(&funky_less_than));    Set(rootEnvironment, "=", Routine(&funky_equivalent));    Set(rootEnvironment, "not", Routine(&funky_not_operator));    Set(rootEnvironment, "eval", Method(&funky_evaluator));    Set(rootEnvironment, "true?", Routine(&funky_truthy));    Set(rootEnvironment, "false?", Routine(&funky_nilly));    Set(rootEnvironment, "lambda?", Routine(&funky_callable));    Set(rootEnvironment, "atom?", Routine(&funky_is_atom));    Set(rootEnvironment, "gen?", Routine(&funky_is_gen));    Set(rootEnvironment, "len", Routine(&funky_length));    Set(rootEnvironment, "gen", Routine(&funky_gen));    Set(rootEnvironment, "cons", Routine(&funky_cons));    Set(rootEnvironment, "append", Routine(&funky_append));    Set(rootEnvironment, "error?", Routine(&funky_is_error));    Set(rootEnvironment, "grid?", Routine(&funky_is_grid));    Set(rootEnvironment, "txt-concatenate_", Routine(&funky_make_txt));    Set(rootEnvironment, "type", Routine(&funky_type_symbol));    Set(rootEnvironment, UNKNOWN_HANDLER, Atom(UNKNOWN_LIT));    establish_bacros(rootBacros);    return new_env();}
开发者ID:gregghz,项目名称:funky,代码行数:51,



注:本文中的Grid函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ Gt函数代码示例
C++ GreenSystemMessage函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。