本文整理汇总了C++中FlowField::getPressure方法的典型用法代码示例。如果您正苦于以下问题:C++ FlowField::getPressure方法的具体用法?C++ FlowField::getPressure怎么用?C++ FlowField::getPressure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlowField
的用法示例。
在下文中一共展示了FlowField::getPressure方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
void VelocityStencil::apply ( FlowField & flowField, int i, int j ){
const FLOAT dt = _parameters.timestep.dt;
const int obstacle = flowField.getFlags().getValue(i, j);
VectorField & velocity = flowField.getVelocity();
if ((obstacle & OBSTACLE_SELF) == 0){ // If this is a fluid cell
if ((obstacle & OBSTACLE_RIGHT) == 0){ // Check whether the neighbor is also fluid
// we require a spatial finite difference expression for the pressure gradient, evaluated
// at the location of the u-component. We therefore compute the distance of neighbouring
// pressure values (dx) and use this as sort-of central difference expression. This will
// yield second-order accuracy for uniform meshsizes.
const FLOAT dx = 0.5*(_parameters.meshsize->getDx(i,j)+_parameters.meshsize->getDx(i+1,j));
velocity.getVector(i,j)[0] = flowField.getFGH().getVector(i,j)[0] - dt/dx *
(flowField.getPressure().getScalar(i+1,j) - flowField.getPressure().getScalar(i,j));
} else { // Otherwise, set to zero
velocity.getVector(i,j)[0] = 0;
} // Note that we only set one direction per cell. The neighbor at the left is
// responsible for the other side
if ((obstacle & OBSTACLE_TOP) == 0){
const FLOAT dy = 0.5*(_parameters.meshsize->getDy(i,j)+_parameters.meshsize->getDy(i,j+1));
velocity.getVector(i,j)[1] = flowField.getFGH().getVector(i,j)[1] - dt/dy *
(flowField.getPressure().getScalar(i,j+1) - flowField.getPressure().getScalar(i,j));
} else {
velocity.getVector(i,j)[1] = 0;
}
}
}
示例2: applyRightWall
void PressureBufferFillStencil::applyRightWall ( FlowField & flowField, int i, int j, int k) {
/* _lowOffset = 2; _highOffset = -1;
* from ParallelBoundaryIterater: i = _flowField.getCellsX()+_highOffset-1 ; j = _lowOffset ; k = _lowOffset;
*/
rightPressureFillBuffer[0+2*((k)+((localSize[2]+3)*(j)))] = flowField.getPressure().getScalar(i-2,j,k);
rightPressureFillBuffer[1+2*((k)+((localSize[2]+3)*(j)))] = flowField.getPressure().getScalar(i-1,j,k);
}
示例3: applyTopWall
void PressureBufferFillStencil::applyTopWall ( FlowField & flowField, int i, int j, int k) {
/* _lowOffset = 2; _highOffset = -1;
* from ParallelBoundaryIterater: i = _lowOffset ; j = Iterator<FlowField>::_flowField.getCellsY()+_highOffset-1 ; k = _lowOffset;
*/
topPressureFillBuffer[0+2*((k)+((localSize[2]+3)*(i)))] = flowField.getPressure().getScalar(i,j-2,k);
topPressureFillBuffer[1+2*((k)+((localSize[2]+3)*(i)))] = flowField.getPressure().getScalar(i,j-1,k);
}
示例4: applyBackWall
void PressureBufferFillStencil::applyBackWall ( FlowField & flowField, int i, int j, int k) {
/* _lowOffset = 2; _highOffset = -1;
* from ParallelBoundaryIterater: i = _lowOffset ; j = _lowOffset ; k = Iterator<FlowField>::_flowField.getCellsZ()+_highOffset-1 ;
*/
backPressureFillBuffer[0+2*((j)+((localSize[1]+3)*(i)))] = flowField.getPressure().getScalar(i,j,k-2);
backPressureFillBuffer[1+2*((j)+((localSize[1]+3)*(i)))] = flowField.getPressure().getScalar(i,j,k-1);
}
示例5: main
int main () {
std::cout << "Starting VTK test" << std::endl;
FlowField flowField ( 10, 10, 10 );
clock_t start = clock();
FLOAT velocity [3] = {1,1,1};
for (int k = 0; k < flowField.getNz() + 3; k++ ){
for (int j = 0; j < flowField.getNy() + 3; j++ ){
for (int i = 0; i < flowField.getNx() + 3; i++ ){
flowField.getPressure().getScalar(i,j,k) = (double) k;
flowField.getVelocity().setVector(velocity, i,j,k);
}
}
}
std::cout << "Initialization time: " << (double) (clock() - start) / CLOCKS_PER_SEC
<< std::endl;
start = clock();
Parameters parameters;
parameters.dx = 1;
parameters.dy = 1;
parameters.dz = 1;
VTKStencil stencil( "/tmp/some_file", parameters );
std::cout << "Stencil creation time: " << (double) (clock() - start) / CLOCKS_PER_SEC << std::endl;
start = clock();
stencil.openFile ( flowField, 5.0/3 );
std::cout << "File-openning and grid data writing time: " << (double) (clock() - start) / CLOCKS_PER_SEC << std::endl;
start = clock();
FieldIterator iterator( flowField, stencil );
iterator.iterateInnerCells();
std::cout << "Iteration time: " << (double) (clock() - start) / CLOCKS_PER_SEC << std::endl;
start = clock();
stencil.write( flowField );
std::cout << "Writing time: " << (double) (clock() - start) / CLOCKS_PER_SEC << std::endl;
stencil.closeFile();
}
示例6: apply
void CheckpointReadStencil::apply ( FlowField & flowField, int i, int j ){
FLOAT pressure_tmp;
FLOAT velocity_tmp[3];
FLOAT & pressure = flowField.getPressure().getScalar(i,j);
FLOAT * velocity = flowField.getVelocity().getVector(i,j);
fread(velocity_tmp, sizeof(FLOAT), 3, inputFile);
fread(&pressure_tmp, sizeof(FLOAT), 1, inputFile);
pressure = pressure_tmp;
velocity[0] = velocity_tmp[0];
velocity[1] = velocity_tmp[1];
velocity[2] = velocity_tmp[2];
}
示例7: applyRightWall
void PressureBufferFillStencil::applyRightWall (FlowField & flowField, int i, int j, int k){
const int index = j + (flowField.getNy()+3) * k;
_rightBufferOut[index] = flowField.getPressure().getScalar(flowField.getNx()+1, j, k);
}
示例8: applyBottomWall
void PressureBufferFillStencil::applyBottomWall ( FlowField & flowField, int i, int j, int k) {
/* _lowOffset = 2; _highOffset = -1;
* from ParallelBoundaryIterater: i = _lowOffset ; j = _lowOffset ; k = _lowOffset;
*/
bottomPressureFillBuffer[(k)+((localSize[2]+3)*(i))] = flowField.getPressure().getScalar(i,j+2,k);
}
示例9: applyBottomWall
void PressureBufferFillStencil::applyBottomWall (FlowField & flowField, int i, int j, int k){
const int index = i + (flowField.getNx()+3) * k;
_bottomBufferOut[index] = flowField.getPressure().getScalar(i, 2, k);
}
示例10: applyLeftWall
void PressureBufferFillStencil::applyLeftWall ( FlowField & flowField, int i, int j, int k) {
/* _lowOffset = 0; _highOffset = 0;
* from ParallelBoundaryIterater: i = _lowOffset ; j = _lowOffset ; k = _lowOffset;
*/
leftPressureFillBuffer[(k)+((localSize[2]+3)*(j))] = flowField.getPressure().getScalar(i+2,j,k);
}
示例11:
void PressureBufferFillStencil::applyTopWall (FlowField & flowField, int i, int j, int k){
const int index = i + (flowField.getNx()+3) * k;
_topBufferOut[index] = flowField.getPressure().getScalar(i, flowField.getNy()+1, k);
}
示例12: applyFrontWall
void PressureBufferFillStencil::applyFrontWall (FlowField & flowField, int i, int j, int k){
const int index = i + (flowField.getNx()+3) * j;
_frontBufferOut[index] = flowField.getPressure().getScalar(i, j, 2);
}
示例13: applyFrontWall
void PressureBufferFillStencil::applyFrontWall ( FlowField & flowField, int i, int j, int k) {
/* _lowOffset = 2; _highOffset = -1;
* from ParallelBoundaryIterater: i = _lowOffset ; j = _lowOffset ; k = _lowOffset;
*/
frontPressureFillBuffer[(j)+((localSize[1]+3)*(i))] = flowField.getPressure().getScalar(i,j,k+2);
}