Exemplo n.º 1
0
void StructuredHexRaster::resize(size_t num_i, size_t num_j, size_t num_k)
{
  m_NumI = num_i;
  m_NumJ = num_j;
  m_NumK = num_k;
  computeDeltas();
//  if(m_CellLink) {
//    delete m_CellLink;
//  }
//  size_t num_cells = m_NumI * m_NumJ * m_NumK;
//  m_CellLink = new List(num_cells, num_cells/10);  /// @todo Our version of "List" sets a minimum increment
}
Exemplo n.º 2
0
void StructuredHexRaster::setupAligned(real xo1, real yo1, real zo1, real xo2, real yo2, real zo2)
{

  /** @todo Use a more general alignment method with trafo-matrix and internal coord system.
   *  I assume these are co-aligned here. */

  m_Xo = xo1;
  m_Yo = yo1;
  m_Zo = zo1;

  m_Uxo = xo2 - xo1;
  m_Uyo = 0;
  m_Uzo = 0;
  countFlops(1);

  m_Vxo = 0;
  m_Vyo = yo2 - yo1;
  m_Vzo = 0;
  countFlops(1);

  m_Wxo = 0;
  m_Wyo = 0;
  m_Wzo = zo2 - zo1;
  countFlops(1);

  // position relative to inertial system
  vec3_t shift_inertial2this;
  shift_inertial2this[0] = -m_Xo;
  shift_inertial2this[1] = -m_Yo;
  shift_inertial2this[2] = -m_Zo;
  m_transformInertial2This.setVector(shift_inertial2this);
/// @todo rotation NOT implemented!!!

  computeDeltas();

//  Transformation t;    /// @todo keep for compatibility
//  t.setVector(vec3_t(xo1, yo1, zo1));
//  setTransformation(t.inverse());
}
Exemplo n.º 3
0
void Rcompoundpoisson_useBeta(double *alpha, double *beta, 
                double *beta3p, double *beta5p,
                double *hitdistribution, int *nseq, 
                int *lseq, int * mhit, int *mclump, int *sstrand) {
    int seqlen, i;
    int maxclumpsize, maxhits, singlestranded;
    double lambda;
    double *theta, extention[3];
    double *delta, *deltap;

    if (!Rpwm||!Rcpwm||!Rstation||!Rtrans) {
        error("load forground and background properly");
        return;
    }
    if (!alpha||!beta||!beta3p||!beta5p||
            !hitdistribution||!nseq||!lseq||!mhit||!mclump) {
        error("parameters are null");
        return;
    }
    if (Rgran==0.0 || Rsiglevel==0.0) {
        error("call mdist.option  first");
        return;
    }

    //compute the total length of the sequence
    seqlen=0;
    for (i=0; i<*nseq; i++) {
        seqlen+=lseq[i]-Rpwm->nrow+1;
    }
    //init the maximal clump size and the max number of hits
    maxclumpsize=(double)mclump[0];
    maxhits=(double)mhit[0];
    singlestranded=*sstrand;

    delta=Calloc(Rpwm->nrow,double);
    deltap=Calloc(Rpwm->nrow,double);
    if (delta==NULL||deltap==NULL) {
        error("Memory-allocation in Rcompoundpoisson_useBeta failed");
    }

    // initialize the extention factors
    memset(extention, 0, 3*sizeof(double));

    if (singlestranded==1) {
        computeDeltasSingleStranded(delta, beta, Rpwm->nrow);

        computeExtentionFactorsKoppSingleStranded(extention, beta, Rpwm->nrow);
        theta=initThetaSingleStranded(maxclumpsize);
        if (theta==NULL) {
            error("Memory-allocation in initTheta failed");
        }

        computeInitialClumpKoppSingleStranded(theta, delta, Rpwm->nrow);
        computeThetaSingleStranded(maxclumpsize, theta, extention, Rpwm->nrow);

        lambda=computePoissonParameterSingleStranded(seqlen, Rpwm->nrow, 
                    maxclumpsize, alpha[0],theta);

        computeCompoundPoissonDistributionKempSingleStranded(lambda, maxhits, 
                    maxclumpsize, theta, hitdistribution);
    } else {
        beta3p[0]=(beta3p[0]+EPSILON)/(1+2*EPSILON);
        computeDeltas(delta, deltap, beta, beta3p,beta5p,Rpwm->nrow);


        computeExtentionFactorsKopp(extention, delta, deltap, beta, 
                    beta3p, beta5p, Rpwm->nrow);
        theta=initTheta(maxclumpsize);
        if (theta==NULL) {
            error("Memory-allocation in initTheta failed");
        }

        computeInitialClumpKopp(theta, beta3p,delta, deltap, Rpwm->nrow);
        computeTheta(maxclumpsize, theta, extention, Rpwm->nrow);

        lambda=computePoissonParameter(seqlen, Rpwm->nrow, maxclumpsize, 
                                alpha[0],theta);

        computeCompoundPoissonDistributionKemp(lambda, maxhits, maxclumpsize, 
                                theta, hitdistribution);
    }



    deleteTheta(theta);
    Free(delta);
    Free(deltap);
}