コード例 #1
0
ファイル: Grid.hpp プロジェクト: htphuc/FVlite
void Grid::init( Setting& cfg){

    mNx = cfg.lookup("cells.x");
    mNy = cfg.lookup("cells.y");
    mLx = cfg.lookup("size.x");
    mLy = cfg.lookup("size.y");

    // Boundary size, hardcoded
    mBound = 2;

    // Determine grid parameters
    mDx = mLx/mNx;
    mDy = mLy/mNy;
    mSizeX = mNx + 2*mBound;
    mSizeY = mNy + 2*mBound;
    mStartX = mBound;
    mStartY = mBound;
    mEndX = mBound + mNx;
    mEndY = mBound + mNy;

    // Initialise pointers
    int size   = mSizeX * mSizeY;
    pState     = new vector<StateVector>(size);
    pStateRef  = new vector<StateVector>(size);
    pFlux      = new vector<FluxVector>(size);
    pGeometry  = new vector<BoundaryGeometry>(size);

    // Initialise LevelSet
    pLevelSet = new LevelSet(mNx,mNy,mBound,mDx,mDy,mLx,mLy);
    pLevelSet->init();

    return;
}
コード例 #2
0
std::map<unsigned int, Encoder>
config_get_encoder_gpios(const Setting &c)
{
    std::map<unsigned int, Encoder> gpios;

    gpios[unsigned(c.lookup("gpioA"))] = Encoder::A;
    gpios[unsigned(c.lookup("gpioB"))] = Encoder::B;
    gpios[unsigned(c.lookup("gpioC"))] = Encoder::C;
    gpios[unsigned(c.lookup("gpioD"))] = Encoder::D;

    return gpios;
}
コード例 #3
0
RaspberryPiController::RaspberryPiController(const Setting &cfg)
    : StageController(cfg),
      motor_cw_gpio(unsigned(cfg.lookup("motor_cw_gpio"))),
      motor_ccw_gpio(unsigned(cfg.lookup("motor_ccw_gpio"))),
      encoder_gpios(config_get_encoder_gpios(cfg))
{
    gpioSetMode(motor_cw_gpio, PI_OUTPUT);
    gpioSetMode(motor_ccw_gpio, PI_OUTPUT);

    for (auto& g: encoder_gpios)
    {
        gpioSetMode(g.first, PI_INPUT);
        gpioSetAlertFuncEx(g.first, static_encoder_callback, this);
    }

}
コード例 #4
0
void BoundaryModuleDrivenBase::init( Grid* pGrid, Setting& cfg){
    BoundaryModule::init(pGrid,cfg);
    Setting& params = cfg.lookup("params");
    string polString = params.lookup("polarisation");
    if( polString == "x" || polString == "TE") mPOL = TE;
    if( polString == "y" || polString == "TM") mPOL = TM;
    return;
}