当前位置: 首页>>代码示例>>C++>>正文


C++ FlowField::getDim方法代码示例

本文整理汇总了C++中FlowField::getDim方法的典型用法代码示例。如果您正苦于以下问题:C++ FlowField::getDim方法的具体用法?C++ FlowField::getDim怎么用?C++ FlowField::getDim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FlowField的用法示例。


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

示例1: if

PetscParallelManager::PetscParallelManager(FlowField & flowField, const Parameters & parameters):

    ParallelManager<FlowField> (flowField, parameters),

    _fillVelocityStencil(parameters, _leftBufferOut, _rightBufferOut, _bottomBufferOut,
                                     _topBufferOut, _frontBufferOut, _backBufferOut),
    _readVelocityStencil(parameters, _leftBufferIn, _rightBufferIn, _bottomBufferIn,
                                     _topBufferIn, _frontBufferIn, _backBufferIn),
    _fillPressureStencil(parameters, _leftBufferOut, _rightBufferOut, _bottomBufferOut,
                                     _topBufferOut, _frontBufferOut, _backBufferOut),
    _readPressureStencil(parameters, _leftBufferIn, _rightBufferIn, _bottomBufferIn,
                                     _topBufferIn, _frontBufferIn, _backBufferIn),

    _fillVelocityIterator(_flowField, parameters, _fillVelocityStencil, 1, 0),
    _readVelocityIterator(_flowField, parameters, _readVelocityStencil, 1, 0),
    _fillPressureIterator(_flowField, parameters, _fillPressureStencil, 1, 0),
    _readPressureIterator(_flowField, parameters, _readPressureStencil, 1, 0)

{

    // Allocate buffers and set number of pressure values
    if (flowField.getDim() == 2){
        _bufferSize[0] = 2 * (flowField.getNy() + 3); // Allocate space for all values
        _bufferSize[1] = 2 * (flowField.getNx() + 3);

        _pressureSize[0] = (flowField.getNy() + 3);
        _pressureSize[1] = (flowField.getNx() + 3);

        _leftBufferIn  = new FLOAT[_bufferSize[0]];
        _leftBufferOut = new FLOAT[_bufferSize[0]];

        _rightBufferIn  = new FLOAT[_bufferSize[0]];
        _rightBufferOut = new FLOAT[_bufferSize[0]];

        _bottomBufferIn  = new FLOAT[_bufferSize[1]];
        _bottomBufferOut = new FLOAT[_bufferSize[1]];

        _topBufferIn  = new FLOAT[_bufferSize[1]];
        _topBufferOut = new FLOAT[_bufferSize[1]];

    } else if (flowField.getDim() == 3) {

        _bufferSize[0] = 3 * ((flowField.getNy()+3) * (flowField.getNz()+3));
        _bufferSize[1] = 3 * ((flowField.getNx()+3) * (flowField.getNz()+3));
        _bufferSize[2] = 3 * ((flowField.getNx()+3) * (flowField.getNy()+3));

        _pressureSize[0] = (flowField.getNy()+3) * (flowField.getNz()+3);
        _pressureSize[1] = (flowField.getNx()+3) * (flowField.getNz()+3);
        _pressureSize[2] = (flowField.getNx()+3) * (flowField.getNy()+3);

        _leftBufferIn  = new FLOAT[_bufferSize[0]];
        _leftBufferOut = new FLOAT[_bufferSize[0]];

        _rightBufferIn  = new FLOAT[_bufferSize[0]];
        _rightBufferOut = new FLOAT[_bufferSize[0]];

        _bottomBufferIn  = new FLOAT[_bufferSize[1]];
        _bottomBufferOut = new FLOAT[_bufferSize[1]];

        _topBufferIn  = new FLOAT[_bufferSize[1]];
        _topBufferOut = new FLOAT[_bufferSize[1]];

        _frontBufferIn  = new FLOAT[_bufferSize[2]];
        _frontBufferOut = new FLOAT[_bufferSize[2]];

        _backBufferIn  = new FLOAT[_bufferSize[2]];
        _backBufferOut = new FLOAT[_bufferSize[2]];

    }
}
开发者ID:ascodt-users,项目名称:ascodt-nightly,代码行数:70,代码来源:PetscParallelManager.cpp


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