/**
 * See the derivations of ΔA in SonntagUpdate.h
 *
 * @see SonntagUpdate.h
 */
float SonntagUpdate::calculateDeltaActivity() {
     const float A = currentState->activity;
     const float V = calculateV();
     const float thetaC = parameters[DECAY_COMPETITION];
     const float thetaL = parameters[DECAY_LOSS];
     const float thetaA = parameters[ACTIVATION_DAMPENING];

     // allow for manual input (CSV, GUI, etc)
     float I;
     if (currentState->manual_input > 0) {
          I = currentState->manual_input;
     } else {
          I = calculateInput();
     }

     // equation 4.6, pg79
     const float deltaA = (pow(A, thetaA) + I * (1 - A)) * (1 - A) * V - ((pow(A, thetaL) + A * pow((1 - A),
                                                                                                    thetaC))) * (1 - V);
     // wolfram input, x=A, y=I (no V term):
     // (x + y*(1-x)) * (1-x) - (x^5 + x * (1-x)^9) from x = 0 to x = 1, y= 0 to y = 1

#ifdef DEBUG_UPDATES
     printf("current A: %f\n", A);
     printf("current I: %f\n", I);
     printf("V term: %f\n", V);
     printf("deltaA: %f\n", deltaA);
#endif

     return deltaA;
}
Пример #2
0
void FractalGenerator::calculateRegion( const QRect& region )
{
    GeneratorCore::Input input;
    calculateInput( &input, region );

    GeneratorCore::Output output;
    calculateOutput( &output, region );

    int maxIterations = maximumIterations();
    double threshold = m_settings.detailThreshold();

    m_mutex.unlock();

#if defined( HAVE_SSE2 )
    if ( m_functorSSE2 ) {
        GeneratorCore::generatePreviewSSE2( input, output, m_functorSSE2, maxIterations );
        GeneratorCore::interpolate( output );
        GeneratorCore::generateDetailsSSE2( input, output, m_functorSSE2, maxIterations, threshold );
    } else
#endif
    if ( m_functor ) {
        GeneratorCore::generatePreview( input, output, m_functor, maxIterations );
        GeneratorCore::interpolate( output );
        GeneratorCore::generateDetails( input, output, m_functor, maxIterations, threshold );
    }

    m_mutex.lock();

    appendValidRegion( region );

    if ( !m_preview && m_update == NoUpdate )
        postUpdate( PartialUpdate );
}