Beispiel #1
0
void verbs::
initialize_menu()
{
	setWindowTitle("Dictionary | Random sentences");
        setMinimumSize(MIN_WIDTH, MIN_HEIGHT);
	to_center_screen();
	initialize_words();
	initialize_random();
	layouts();
	setup_connections();
}
void allocateDescriptorSets(VkDevice device, VkDescriptorPool pool, VkDescriptorSetLayout layout, uint32_t count, std::vector<VkDescriptorSet>& sets)
{
  sets.resize(count);
  std::vector<VkDescriptorSetLayout>  layouts(count, layout);

  VkResult                    result;
  VkDescriptorSetAllocateInfo allocInfo = {VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO};
  allocInfo.descriptorPool              = pool;
  allocInfo.descriptorSetCount          = count;
  allocInfo.pSetLayouts                 = layouts.data();

  result = vkAllocateDescriptorSets(device, &allocInfo, sets.data());
  assert(result == VK_SUCCESS);
}
Beispiel #3
0
static int default_query_formats_common(AVFilterContext *ctx,
                                        AVFilterChannelLayouts *(layouts)(void))
{
    enum AVMediaType type = ctx->inputs  && ctx->inputs [0] ? ctx->inputs [0]->type :
                            ctx->outputs && ctx->outputs[0] ? ctx->outputs[0]->type :
                            AVMEDIA_TYPE_VIDEO;

    ff_set_common_formats(ctx, ff_all_formats(type));
    if (type == AVMEDIA_TYPE_AUDIO) {
        ff_set_common_channel_layouts(ctx, layouts());
        ff_set_common_samplerates(ctx, ff_all_samplerates());
    }

    return 0;
}
Beispiel #4
0
void LayoutManagement::slotLoadLayout(QAction *action)
{
    if (!action) {
        return;
    }

    QString layoutId = action->data().toString();
    if (layoutId.isEmpty()) {
        return;
    }

    KSharedConfigPtr config = KSharedConfig::openConfig();
    KConfigGroup layouts(config, "Layouts");
    QByteArray state = QByteArray::fromBase64(layouts.readEntry(layoutId).toLatin1());
    pCore->window()->restoreState(state);
}
Beispiel #5
0
void LayoutManagement::slotSaveLayout(QAction *action)
{
    QString originallayoutName = action->data().toString();
    int layoutId = originallayoutName.section('_', -1).toInt();

    QString layoutName = QInputDialog::getText(pCore->window(), i18n("Save Layout"), i18n("Layout name:"), QLineEdit::Normal,
                                               originallayoutName.section('_', 0, -2));
    if (layoutName.isEmpty()) {
        return;
    }
    KSharedConfigPtr config = KSharedConfig::openConfig();
    KConfigGroup layouts(config, "Layouts");
    layouts.deleteEntry(originallayoutName);

    QByteArray st = pCore->window()->saveState();
    layoutName.append('_' + QString::number(layoutId));
    layouts.writeEntry(layoutName, st.toBase64());
    initializeLayouts();
}
Beispiel #6
0
QStringList
XkbRules::getAvailableVariants(const QString& layout)
{
    if( layout.isEmpty() || !layouts().contains(layout) )
	  return QStringList();

    QStringList* result1 = m_varLists[layout];

#ifdef HAVE_XKLAVIER
        return *result1;
#else
    if( result1 )
        return *result1;

    QStringList* result = X11Helper::getVariants(layout, X11_DIR);

    m_varLists.insert(layout, result);
    return *result;
#endif
}
Beispiel #7
0
int
main(int argc,char **argv)
{
#ifdef CH_MPI
    MPI_Init(&argc, &argv);
#endif

    // registerDebugger();

    // begin forever present scoping trick
    {
        pout()<<std::endl;

        Vector<std::string> names0(1, "phi");
        Vector<int> refRatio(3,2);
        Vector<Real> coveredVal(1,3.0);

        const char* in_file = "sphere.inputs";
        // read in an input file or use default file
        // if (argc > 1)
        // {
        //   in_file = argv[1];
        // }

        //parse input file
        ParmParse pp(0,NULL,NULL,in_file);
        RealVect center;
        Real radius;
        RealVect origin;
        RealVect dx;
        Box domain;
        ProblemDomain pDomain(domain);

        int eekflag = 0;



        LevelData<EBCellFAB> fine, med, coarse;

        LevelData<EBCellFAB> fineRHS, medRHS, coarseRHS;
        LevelData<EBCellFAB> fineResidual, mediumResidual, coarseResidual;


        Vector<LevelData<EBCellFAB>* > ebvector(3,NULL);
        Vector<LevelData<EBCellFAB>* > vresidual(3,NULL);
        Vector<LevelData<EBCellFAB>* > rhsvector(3,NULL);
        ebvector[0]=&coarse;
        ebvector[1]=&med;
        ebvector[2]=&fine;
        vresidual[0]=&coarseResidual;
        vresidual[1]=&mediumResidual;
        vresidual[2]=&fineResidual;
        rhsvector[0] = &coarseRHS;
        rhsvector[1] = &medRHS;
        rhsvector[2] = &fineRHS;




        readGeometryInfo(domain,
                         dx,
                         origin,
                         center,
                         radius);

        Box domainFine(domain), domainMedi, domainCoar;
        ProblemDomain pFine(domain);
        RealVect dxFine(dx), dxMedi, dxCoar;

        CH_assert(eekflag == 0);

        domainMedi = coarsen(domainFine, 2);
        domainCoar = coarsen(domainMedi, 2);
        dxMedi = 2.0*dxFine;
        dxCoar = 2.0*dxMedi;
        Vector<RealVect> xVec(3, IntVect::Unit);
        xVec[0]*= dxCoar;
        xVec[1]*= dxMedi;
        xVec[2]*= dxFine;

        Vector<DisjointBoxLayout> grids(3);
        ProblemDomain baseDomain(domainCoar);
        ProblemDomain pMed(domainMedi);
        Vector<ProblemDomain> pd(3);
        pd[0] = baseDomain;
        pd[1] = pMed;
        pd[2] = ProblemDomain(domainFine);


        RefCountedPtr<BaseBCValue>value(new DirichletBC());
        DirichletPoissonDomainBC*  domainBC = new DirichletPoissonDomainBC();
        domainBC->setFunction(value);
        RefCountedPtr<BaseDomainBC> bc(domainBC);



        //make data holders
        Vector<int> comps(2,1);

        int steps= 5;
        int step = 0;


        while (step < steps)
        {


            eekflag = makeGeometry(
                          domain,
                          dx,
                          origin,
                          center,
                          radius);


            //make grids
            //IntVectSet tags = mfIndexSpace->interfaceRegion(2);
            IntVectSet   tags(domainCoar);
            tags.grow(1);
            makeHierarchy(grids, baseDomain, tags);


            const CH_XD::EBIndexSpace* ebisPtr = Chombo_EBIS::instance();

            Vector<EBISLayout> layouts(3);
            EBISLayout& fineLayout = layouts[2];
            ebisPtr->fillEBISLayout(fineLayout, grids[2], domainFine, 2);
            EBCellFactory fineFactory(fineLayout);
            ebvector[2]->define(grids[2], 1, IntVect::Unit, fineFactory);
            rhsvector[2]->define(grids[2], 1, IntVect::Zero, fineFactory);

            EBISLayout& medLayout = layouts[1];
            ebisPtr->fillEBISLayout(medLayout, grids[1], domainMedi, 2);
            EBCellFactory medFactory(medLayout);
            ebvector[1]->define(grids[1], 1, IntVect::Unit, medFactory);
            rhsvector[1]->define(grids[1], 1, IntVect::Zero, medFactory);

            EBISLayout& coarseLayout = layouts[0];
            ebisPtr->fillEBISLayout(coarseLayout, grids[0], domainCoar, 2);
            EBCellFactory coarseFactory(coarseLayout);
            ebvector[0]->define(grids[0], 1, IntVect::Unit, coarseFactory);
            rhsvector[0]->define(grids[0], 1, IntVect::Zero, coarseFactory);



            for (int lev=0; lev<3; lev++)
            {
                setValue(*rhsvector[lev], RHS(), pd[lev].domainBox(), xVec[lev], origin, true);
            }



            Vector<int> refRatio(3,2);

            int max_iter = 40;
            pp.get("max_iter", max_iter);
            Real eps = 1.e-6;
            pp.get("eps", eps);
            int relaxType;
            pp.get("relaxType",relaxType);

            DirichletPoissonDomainBCFactory* domDirBC = new DirichletPoissonDomainBCFactory();
            domDirBC->setFunction(value);
            RefCountedPtr<BaseDomainBCFactory> domBC( domDirBC );
            DirichletPoissonEBBCFactory* ebDirBC = new DirichletPoissonEBBCFactory();
            ebDirBC->setFunction(value);
            RefCountedPtr<BaseEBBCFactory> ebBC( ebDirBC );

            Vector<EBLevelGrid> eblgs(3);
            Vector<RefCountedPtr<EBQuadCFInterp> > quadCFI(3, RefCountedPtr<EBQuadCFInterp>());
            for (int i=0; i<3; i++)
            {
                eblgs[i] = EBLevelGrid(grids[i], layouts[i], pd[i]);
                if (i > 0)
                {
                    quadCFI[i] = RefCountedPtr<EBQuadCFInterp>(
                                     new EBQuadCFInterp(grids[i],
                                                        grids[i-1],
                                                        layouts[i],
                                                        layouts[i-1],
                                                        pd[i-1],
                                                        refRatio[i-1],
                                                        1, *eblgs[i].getCFIVS()));
                }
            }

            EBAMRPoissonOpFactory opFact(eblgs, refRatio, quadCFI, xVec[0], RealVect::Zero,
                                         4, relaxType, domBC, ebBC, 0.0, 1.0, 0.0,
                                         IntVect::Unit, IntVect::Zero);
            for (int i=0; i<3; i++)
            {

                LevelData<EBCellFAB> &phi=*ebvector[i], &rhs=*rhsvector[i], &residual=*vresidual[i];
                LevelData<EBCellFAB> correction;

                DisjointBoxLayout dblMGCoar;
                EBISLayout ebislMGCoar;

                EBAMRPoissonOp* opPtr = opFact.AMRnewOp(pd[i]);
                EBAMRPoissonOp& op = *opPtr;


                RelaxSolver<LevelData<EBCellFAB> > solver;
                solver.define(&op, false);
                solver.m_imax = max_iter;
                solver.m_eps  = eps;

                op.create(residual, rhs);
                op.create(correction, phi);
                op.setToZero(residual);
                op.setToZero(phi);

                op.residual(residual, phi, rhs);
                Real r2norm = op.norm(residual, 2);
                Real r0norm = op.norm(residual, 0);


                pout()<<indent<<"Residual L2 norm "<<r2norm<<"Residual max norm = "
                      <<r0norm<<std::endl;

                solver.solve(phi, rhs);

                op.residual(residual, phi, rhs);
                r2norm = op.norm(residual, 2);
                r0norm = op.norm(residual, 0);


                pout()<<indent2<<"Residual L2 norm "<<r2norm<<" Residual max norm = "
                      <<r0norm<<std::endl;

                delete opPtr;
            }


#ifdef CH_USE_HDF5
            sprintf(iter_str, "residual.%03d.%dd.hdf5",step, SpaceDim);
            Vector<std::string> names(1);
            names[0]="residual";

            writeEBHDF5(iter_str, grids, vresidual, names, domainCoar,
                        dxCoar[0], 1, step, refRatio, 3, true, coveredVal);

            sprintf(iter_str, "phi.%03d.%dd.hdf5",step, SpaceDim);
            names[0]="phi";
            writeEBHDF5(iter_str, grids, ebvector ,names, domainCoar,
                        dxCoar[0], 1, step, refRatio, 3, true, coveredVal);
#endif
            step++;

            center[0]-= dx[0]/3.0;
            center[1]-= dx[1]/2.0;
            radius += dx[0]/6.0;

            Chombo_EBIS::instance()->clear();
            pout()<<step<<std::endl;
        }

        pout() <<"\n "<<indent2<<pgmname<<" test passed " << endl;



    } // end scoping trick





#ifdef CH_MPI
    MPI_Finalize();
#endif

    return 0;
}