本文整理汇总了C++中FlowField::getCellsX方法的典型用法代码示例。如果您正苦于以下问题:C++ FlowField::getCellsX方法的具体用法?C++ FlowField::getCellsX怎么用?C++ FlowField::getCellsX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlowField
的用法示例。
在下文中一共展示了FlowField::getCellsX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write
void VTKStencil:: write ( FlowField & flowField, int timeStep ){
FieldIterator<FlowField> _it(flowField,_parameters,*this);
int i,j,k;
int Nx=flowField.getNx();
int Ny=flowField.getNy();
int Nz;
int dim=_parameters.geometry.dim;
if(dim == 2){Nz=0;}else{Nz=flowField.getNz();}
int cellx=flowField.getCellsX();
int celly=flowField.getCellsY();
int cellz;
if(dim == 2){cellz=3;}else{cellz=flowField.getCellsZ();}
//generate the file name
std::stringstream filename;
filename << this->_parameters.vtk.prefix << "_" << timeStep << ".vtk";
std::cout << filename.str() << std::endl;
// Open the file
std::ofstream vtkFile;
vtkFile.open(filename.str().c_str());
vtkFile << std::fixed << std::setprecision(6);
(this->_outputFile) = &vtkFile;
// Print file header
vtkFile << "# vtk DataFile Version 2.0" << std::endl;
vtkFile << "WS_1" << std::endl;
vtkFile << "ASCII" << "\n" << std::endl;
vtkFile << "DATASET STRUCTURED_GRID" << std::endl;
vtkFile << "DIMENSIONS " << Nx+1 << " " << Ny+1 << " " << Nz+1 << std::endl;
vtkFile << "POINTS " << (Nx+1)*(Ny+1)*(Nz+1) << " float" << std::endl;
// Print grids
for (k=2; k<cellz; k++){
for (j=2; j<celly; j++ ){
for(i=2; i<cellx; i++){
vtkFile << (_parameters.meshsize)->getPosX(i,j,k) << " " \
<< (_parameters.meshsize)->getPosY(i,j,k) << " " \
<< (_parameters.meshsize)->getPosZ(i,j,k) << std::endl;
}
}
}
// Output pressure field
vtkFile <<std::endl;
if(dim==2){
vtkFile << "CELL_DATA " << (cellx-3)*(celly-3)*(cellz-2) << std::endl;}
else{
vtkFile << "CELL_DATA " << (cellx-3)*(celly-3)*(cellz-3) << std::endl;}
vtkFile << "SCALARS pressure float 1" << std::endl;
vtkFile << "LOOKUP_TABLE default" << std::endl;
output_flag=0;
_it.iterate();
// Output velocity field
vtkFile << std::endl;
vtkFile << "VECTORS velocity float" << std::endl;
output_flag=1;
_it.iterate();
}