예제 #1
0
    // CONSTRUCTORS
    explicit StatsReport(std::ofstream* aofp)
	: os(*aofp) {
	header();
	sumit();
	stars();
	stages();
    }
예제 #2
0
void NewTableDialog::okClicked()
{
    if (teams().size() == 0 || stages().size() == 0) {
        QMessageBox::critical(this, "Ошибка", "Вы должны добавить хотя "
                              "бы одну команду и один конкурс!");
    } else {
        accept();
    }
}
  ModelObject CoilHeatingGasMultiStage_Impl::clone(Model model) const {
    auto t_clone = StraightComponent_Impl::clone(model).cast<CoilHeatingGasMultiStage>();

    auto t_stages = stages();
    for( auto stage: t_stages ) {
      auto stageClone = stage.clone(model).cast<CoilHeatingGasMultiStageStageData>();
      t_clone.addStage(stageClone);
    }
    return t_clone;
  }
ModelObject CoilCoolingDXMultiSpeed_Impl::clone(Model model) const {
    auto t_clone = StraightComponent_Impl::clone(model).cast<CoilCoolingDXMultiSpeed>();

    auto t_stages = stages();
    for( auto stage: t_stages ) {
        auto stageClone = stage.clone(model).cast<CoilCoolingDXMultiSpeedStageData>();
        t_clone.addStage(stageClone);
    }
    return t_clone;
}
예제 #5
0
파일: plan.hpp 프로젝트: ddemidov/vexcl
 // splits n into a list of powers 2^a 2^b 2^c 3^d 5^e...
 // exponents are limited by available kernels,
 // if no kernel for prime is available, exponent will be 0, interpret as 1.
 std::vector<pow> factor(size_t n) const {
     std::vector<pow> out, factors = prime_factors(n);
     for(auto f = factors.begin() ; f != factors.end() ; f++) {
         if(std::find(primes.begin(), primes.end(), f->base) != primes.end()) {
             // split exponent into reasonable parts.
             auto qs = stages(*f);
             // use smallest radix first
             std::copy(qs.rbegin(), qs.rend(), std::back_inserter(out));
         } else {
             // unsupported prime.
             for(size_t i = 0 ; i != f->exponent ; i++)
                 out.push_back(pow(f->base, 0));
         }
     }
     return out;
 }
예제 #6
0
int main (int , char** )
{
  // const int NB_STAGE = 5;
  // const int RANK[] = { 3, 5, 3, 5, 3 };
  // const int NR[] = { 5, 5, 5, 5, 8 };
  // const int NC = 20;

  const unsigned int NB_STAGE = 3;
  const int RANK[] =       { 3, 4, 3, 5, 3 };
  const int RANKLINKED[] = { 0, 0, 0, 0, 0 };
  const int NR[] =         { 5, 4, 5, 5, 8 };
  const unsigned int NC = 12;
  /* Initialize J and b. */
  std::vector<Eigen::MatrixXd> J(NB_STAGE);
  std::vector<soth::VectorBound> b(NB_STAGE);

  soth::generateDeficientDataSet( J,b,NB_STAGE,RANK,RANKLINKED,NR,NC );

  for( unsigned int i=0;i<NB_STAGE;++i )
    {
      std::cout << "J"<<i<<" = " << (soth::MATLAB)J[i] << std::endl;
    }

  /* SOTH structure construction. */
  soth::BaseY Y(NC);
  typedef boost::shared_ptr<soth::Stage> stage_ptr_t;
  typedef std::vector<stage_ptr_t> stage_list_t;
  stage_list_t stages(NB_STAGE);
  for( unsigned int i=0;i<NB_STAGE;++i )
    {
      std::cout <<" --- STAGE " <<i<< " --------------------------------- " << std::endl;
      /* Compute the initial COD for each stage. */
      stages[i] = stage_ptr_t(new soth::Stage( J[i],b[i],Y ));
      stages[i]->setInitialActiveSet();
      stages[i]->computeInitialCOD(Y);
      Eigen::MatrixXd Jrec; stages[i]->recompose(Jrec);
      std::cout << "Jrec" <<i<<" = " << (soth::MATLAB)Jrec << std::endl;
    }

  Eigen::MatrixXd rec;
  stages[0]->recompose(rec);
  return 0;
}
예제 #7
0
bool GrGpuGL::programUnitTest(int maxStages) {

    GrTextureDesc dummyDesc;
    dummyDesc.fFlags = kRenderTarget_GrTextureFlagBit;
    dummyDesc.fConfig = kSkia8888_GrPixelConfig;
    dummyDesc.fWidth = 34;
    dummyDesc.fHeight = 18;
    SkAutoTUnref<GrTexture> dummyTexture1(this->createTexture(dummyDesc, NULL, 0));
    dummyDesc.fFlags = kNone_GrTextureFlags;
    dummyDesc.fConfig = kAlpha_8_GrPixelConfig;
    dummyDesc.fWidth = 16;
    dummyDesc.fHeight = 22;
    SkAutoTUnref<GrTexture> dummyTexture2(this->createTexture(dummyDesc, NULL, 0));

    if (!dummyTexture1 || ! dummyTexture2) {
        return false;
    }

    static const int NUM_TESTS = 512;

    SkRandom random;
    for (int t = 0; t < NUM_TESTS; ++t) {

#if 0
        GrPrintf("\nTest Program %d\n-------------\n", t);
        static const int stop = -1;
        if (t == stop) {
            int breakpointhere = 9;
        }
#endif

        GrGLProgramDesc pdesc;

        int currAttribIndex = 1;  // we need to always leave room for position
        int currTextureCoordSet = 0;
        GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()};

        int numStages = random.nextULessThan(maxStages + 1);
        int numColorStages = random.nextULessThan(numStages + 1);
        int numCoverageStages = numStages - numColorStages;

        SkAutoSTMalloc<8, const GrFragmentStage*> stages(numStages);

        bool usePathRendering = this->glCaps().pathRenderingSupport() && random.nextBool();

        GrGpu::DrawType drawType = usePathRendering ? GrGpu::kDrawPath_DrawType :
                                                      GrGpu::kDrawPoints_DrawType;

        SkAutoTDelete<GrGeometryStage> geometryProcessor;
        bool hasGeometryProcessor = usePathRendering ? false : random.nextBool();
        if (hasGeometryProcessor) {
            while (true) {
                SkAutoTUnref<const GrGeometryProcessor> effect(
                        GrProcessorTestFactory<GrGeometryProcessor>::CreateStage(&random, this->getContext(), *this->caps(),
                                                         dummyTextures));
                SkASSERT(effect);
                // Only geometryProcessor can use vertex shader
                GrGeometryStage* stage = SkNEW_ARGS(GrGeometryStage, (effect.get()));
                geometryProcessor.reset(stage);

                // we have to set dummy vertex attribs
                const GrGeometryProcessor::VertexAttribArray& v = effect->getVertexAttribs();
                int numVertexAttribs = v.count();

                SkASSERT(GrGeometryProcessor::kMaxVertexAttribs == 2 &&
                         GrGeometryProcessor::kMaxVertexAttribs >= numVertexAttribs);
                size_t runningStride = GrVertexAttribTypeSize(genericVertexAttribs[0].fType);
                for (int i = 0; i < numVertexAttribs; i++) {
                    genericVertexAttribs[i + 1].fOffset = runningStride;
                    genericVertexAttribs[i + 1].fType =
                            convert_sltype_to_attribtype(v[i].getType());
                    runningStride += GrVertexAttribTypeSize(genericVertexAttribs[i + 1].fType);
                }

                // update the vertex attributes with the ds
                GrDrawState* ds = this->drawState();
                ds->setVertexAttribs<genericVertexAttribs>(numVertexAttribs + 1, runningStride);
                currAttribIndex = numVertexAttribs + 1;
                break;
            }
        }
        for (int s = 0; s < numStages;) {
            SkAutoTUnref<const GrFragmentProcessor> effect(
                    GrProcessorTestFactory<GrFragmentProcessor>::CreateStage(
                                                                            &random,
                                                                            this->getContext(),
                                                                            *this->caps(),
                                                                            dummyTextures));
            SkASSERT(effect);

            // If adding this effect would exceed the max texture coord set count then generate a
            // new random effect.
            if (usePathRendering && this->glPathRendering()->texturingMode() ==
                                    GrGLPathRendering::FixedFunction_TexturingMode) {;
                int numTransforms = effect->numTransforms();
                if (currTextureCoordSet + numTransforms > this->glCaps().maxFixedFunctionTextureCoords()) {
                    continue;
                }
                currTextureCoordSet += numTransforms;
            }
            GrFragmentStage* stage = SkNEW_ARGS(GrFragmentStage, (effect.get()));

            stages[s] = stage;
            ++s;
        }
        const GrTexture* dstTexture = random.nextBool() ? dummyTextures[0] : dummyTextures[1];
        if (!pdesc.setRandom(&random,
                             this,
                             dummyTextures[0]->asRenderTarget(),
                             dstTexture,
                             geometryProcessor.get(),
                             stages.get(),
                             numColorStages,
                             numCoverageStages,
                             currAttribIndex,
                             drawType)) {
            return false;
        }

        SkAutoTUnref<GrOptDrawState> optState(GrOptDrawState::Create(this->getDrawState(),
                                                                     *this->caps(),
                                                                     drawType));
        SkAutoTUnref<GrGLProgram> program(
                        GrGLProgramBuilder::CreateProgram(*optState,
                                                          pdesc,
                                                          drawType,
                                                          geometryProcessor,
                                                          stages,
                                                          stages + numColorStages,
                                                          this));
        for (int s = 0; s < numStages; ++s) {
            SkDELETE(stages[s]);
        }
        if (NULL == program.get()) {
            return false;
        }

        // We have to reset the drawstate because we might have added a gp
        this->drawState()->reset();
    }
    return true;
}
 std::vector<ModelObject> CoilHeatingGasMultiStage_Impl::children() const {
   return subsetCastVector<ModelObject>(stages());
 }
예제 #9
0
bool GrGpuGL::programUnitTest(int maxStages) {

    GrTextureDesc dummyDesc;
    dummyDesc.fFlags = kRenderTarget_GrTextureFlagBit;
    dummyDesc.fConfig = kSkia8888_GrPixelConfig;
    dummyDesc.fWidth = 34;
    dummyDesc.fHeight = 18;
    SkAutoTUnref<GrTexture> dummyTexture1(this->createTexture(dummyDesc, NULL, 0));
    dummyDesc.fFlags = kNone_GrTextureFlags;
    dummyDesc.fConfig = kAlpha_8_GrPixelConfig;
    dummyDesc.fWidth = 16;
    dummyDesc.fHeight = 22;
    SkAutoTUnref<GrTexture> dummyTexture2(this->createTexture(dummyDesc, NULL, 0));

    static const int NUM_TESTS = 512;

    SkRandom random;
    for (int t = 0; t < NUM_TESTS; ++t) {

#if 0
        GrPrintf("\nTest Program %d\n-------------\n", t);
        static const int stop = -1;
        if (t == stop) {
            int breakpointhere = 9;
        }
#endif

        GrGLProgramDesc pdesc;

        int currAttribIndex = 1;  // we need to always leave room for position
        int currTextureCoordSet = 0;
        int attribIndices[2] = { 0, 0 };
        GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()};

        int numStages = random.nextULessThan(maxStages + 1);
        int numColorStages = random.nextULessThan(numStages + 1);
        int numCoverageStages = numStages - numColorStages;

        SkAutoSTMalloc<8, const GrEffectStage*> stages(numStages);

        bool useFixedFunctionTexturing = this->shouldUseFixedFunctionTexturing();

        for (int s = 0; s < numStages;) {
            SkAutoTUnref<const GrEffectRef> effect(GrEffectTestFactory::CreateStage(
                                                                            &random,
                                                                            this->getContext(),
                                                                            *this->caps(),
                                                                            dummyTextures));
            SkASSERT(effect);
            int numAttribs = (*effect)->numVertexAttribs();

            // If adding this effect would exceed the max attrib count then generate a
            // new random effect.
            if (currAttribIndex + numAttribs > GrDrawState::kMaxVertexAttribCnt) {
                continue;
            }


            // If adding this effect would exceed the max texture coord set count then generate a
            // new random effect.
            if (useFixedFunctionTexturing && !(*effect)->hasVertexCode()) {
                int numTransforms = (*effect)->numTransforms();
                if (currTextureCoordSet + numTransforms > this->glCaps().maxFixedFunctionTextureCoords()) {
                    continue;
                }
                currTextureCoordSet += numTransforms;
            }

            useFixedFunctionTexturing = useFixedFunctionTexturing && !(*effect)->hasVertexCode();

            for (int i = 0; i < numAttribs; ++i) {
                attribIndices[i] = currAttribIndex++;
            }
            GrEffectStage* stage = SkNEW_ARGS(GrEffectStage,
                                              (effect.get(), attribIndices[0], attribIndices[1]));
            stages[s] = stage;
            ++s;
        }
        const GrTexture* dstTexture = random.nextBool() ? dummyTextures[0] : dummyTextures[1];
        pdesc.setRandom(&random,
                        this,
                        dummyTextures[0]->asRenderTarget(),
                        dstTexture,
                        stages.get(),
                        numColorStages,
                        numCoverageStages,
                        currAttribIndex);

        SkAutoTUnref<GrGLProgram> program(GrGLProgram::Create(this,
                                                              pdesc,
                                                              stages,
                                                              stages + numColorStages));
        for (int s = 0; s < numStages; ++s) {
            SkDELETE(stages[s]);
        }
        if (NULL == program.get()) {
            return false;
        }
    }
    return true;
}
예제 #10
0
void FrameRenderer::render( Camera& cam, Node& root, const Viewport& vp ) const
{
    /* Start time measurement.
     */
    Stopwatch stopwatch;

    /* Check for errors.
     */
    REPORT_GL_ERROR;

    /* Reshape render stages' buffers.
     */
    for( std::size_t rsIdx = 0; rsIdx < stages(); ++rsIdx )
    {
        RenderStage& rs = stageAt( rsIdx );
        
        /* Ensure buffers are properly sized.
         */
        if( pimpl->reshaped || !rs.isInitialized() )
        {
            /* This 'const_cast' is okay, because 'RenderStage' objects are clearly
             * stated to be components of a 'FrameRenderer', thus "it runs in the
             * family" as long as an immutable 'RenderStage' reference not induces a
             * mutable 'FrameRenderer' reference.
             */
            FrameRenderer& fr = const_cast< FrameRenderer& >( *this );
            rs.reshape( fr, pimpl->viewport->width(), pimpl->viewport->height() );
        }

        /* Notify stages of beginning frame.
         */
        rs.prepareFrame( root );
    }
    
    /* Mark that all buffer sizes have been established.
     */
    pimpl->reshaped = false;

    /* Clear buffers.
     */
    glClearColor
        ( pimpl->backgroundColor[ 0 ]
        , pimpl->backgroundColor[ 1 ]
        , pimpl->backgroundColor[ 2 ]
        , pimpl->backgroundColor[ 3 ] );
    
    /* Render frame.
     */
    RenderTask task( *this, cam.projection(), cam.viewTransform() );
    task.render( vp, GLContext::COLOR_BUFFER_BIT | GLContext::DEPTH_BUFFER_BIT );

    /* Check for errors.
     */
    REPORT_GL_ERROR;
    
    /* Stop and evaluate time measurement.
     */
    const double time = stopwatch.result();
    const double fps  = 1 / time;
    pimpl->fpsData.push( fps );
    pimpl->fpsStatistics = math::Statistics< double >( pimpl->fpsData.size(),
        [&]( std::size_t idx )->double
        {
            return pimpl->fpsData[ idx ];
        }
    );
}
std::vector<ModelObject> CoilCoolingDXMultiSpeed_Impl::children() const {
    return subsetCastVector<ModelObject>(stages());
}