void BoundDescriptor::setBoundaries(vector<double>& eigenvalues){
	double tmp[this->size];
	for(unsigned int i = 0; i < this->size;++i){
		tmp[i]= eigenvalues[i];
	}

	setBoundaries(tmp);
}
示例#2
0
void QniteTicker::setValues(const QList<qreal> &values) {
  if (m_values != values) {

    m_values = values;
    emit valuesChanged();

    // compute min and max bounds
    std::sort(m_values.begin(), m_values.end(), std::less<qreal>());
    setBoundaries(m_values.first(), m_values.last());
  }
}
示例#3
0
文件: TimeLine.cpp 项目: GDXN/Natron
void
TimeLine::setFrameRange(SequenceTime first,
                        SequenceTime last)
{
    bool changed = false;
    {
        QMutexLocker l(&_lock);
        if ( (_firstFrame != first) || (_lastFrame != last) ) {
            _firstFrame = first;
            _lastFrame = last;
            changed = true;
        }
    }

    if (changed) {
        emit frameRangeChanged(first, last);
        setBoundaries(first,last);
    }
}
/*!
*  \brief      Contructor of the Joint class
*  \param[in]  minimum Boundary
*  \param[in]  maximum Boundary
*  \param[in]  MeshContainer
*  \author     Sascha Kaden
*  \date       2016-08-25
*/
Joint::Joint(double minBound, double maxBound, std::shared_ptr<ModelContainer> model) {
    setBoundaries(minBound, maxBound);
    setModel(model);
}
/*!
*  \brief      Contructor of the Joint class
*  \param[in]  minimum Boundary
*  \param[in]  maximum Boundary
*  \author     Sascha Kaden
*  \date       2016-08-25
*/
Joint::Joint(double minBound, double maxBound) {
    setBoundaries(minBound, maxBound);
}
示例#6
0
Multigrid::Multigrid(double Lx, double Ly, vector<double> ul, vector<double> ut, vector<double> ur, vector<double> ub, bool leftIsDirichlet, bool topIsDirichlet, bool rightIsDirichlet, bool bottomIsDirichlet,  size_t level_number, Multigrid *lp, MultigridController *MGC)
{
    // Check that sizes are consistent
    if ( ut.size() != ub.size() || ul.size() != ur.size() )
        throw invalid_argument("boundary condition vectors must be the same size");
    
    // Assign domain values
    Nx = ub.size();
    Ny = ul.size();
    
    // Check that N is a power of 2
    //if (Nx % 2 != 0 || Ny % 2 != 0)
    //    throw invalid_argument("Nx and Ny must be a power of 2");
    
    // Assign inputs
    nlev = level_number - 1;
    controller = MGC;
    superlevel = lp;
    
    // Assign domain values
    Nx = ub.size();
    Ny = ul.size();
    this->Lx = Lx;
    this->Ly = Ly;
    dx = Lx/Nx;
    dy = Ly/Ny;
    
    // Boundary condition booleans
    this->leftIsDirichlet = (double)leftIsDirichlet;
    this->topIsDirichlet = (double)topIsDirichlet;
    this->rightIsDirichlet = (double)rightIsDirichlet;
    this->bottomIsDirichlet = (double)bottomIsDirichlet;
    
    if (!leftIsDirichlet && !topIsDirichlet && !rightIsDirichlet && !bottomIsDirichlet)
        allNeumann = true;
    else
        allNeumann = false;
    
    // Boundary flags
    atLeftBoundary = vector<vector<double>>(Nx+2,vector<double>(Ny+2, 0.0));
    atTopBoundary = vector<vector<double>>(Nx+2,vector<double>(Ny+2, 0.0));
    atRightBoundary = vector<vector<double>>(Nx+2,vector<double>(Ny+2, 0.0));
    atBottomBoundary = vector<vector<double>>(Nx+2,vector<double>(Ny+2, 0.0));
    for (size_t i = 1; i < Nx+1; i++)
    {
        atTopBoundary[i][Ny] = 1.0;
        atBottomBoundary[i][1] = 1.0;
    }
    for (size_t j = 1; j < Ny+1; j++)
    {
        atLeftBoundary[1][j] = 1.0;
        atRightBoundary[Nx][j] = 1.0;
    }
    
    // Construct grid with buffer lines
    u = vector<vector<double>>(Nx+2);
    for (size_t i = 0; i < Nx+2; i++)
        u[i] = vector<double>(Ny+2,0.0);
    
    setBoundaries(ul, ut, ur, ub);
    
    // Allocate right hand side and error term with same same size as u
    R = vector<vector<double>>(Nx+2);
    e = vector<vector<double>>(Nx+2);
    for (size_t i = 0; i < Nx+2; i++)
    {
        R[i] = vector<double>(Ny+2,0.0);
        e[i] = vector<double>(Ny+2,0.0);
    }
    
    // Generate coordinate values
    x = vector<vector<double>>(Nx+2, vector<double>(Ny+2));
    y = vector<vector<double>>(Nx+2, vector<double>(Ny+2));
    for (size_t i = 1; i <= Nx; i++)
        for (size_t j = 1; j<= Ny; j++)
        {
            x[i][j] = i*dx - dx/2;
            y[i][j] = j*dy - dy/2;
        }
    
    // Internal boundary
    isSolid = vector<vector<double>>(Nx+2, vector<double>(Ny+2, 0.0));
    
    // Create sublevel
    if (nlev == 0)
        sublevel = nullptr;
    else
        sublevel = new Multigrid(Lx, Ly, vector<double>(Ny/2, 0.0), vector<double>(Nx/2, 0.0), vector<double>(Ny/2, 0.0), vector<double>(Nx/2, 0.0), leftIsDirichlet, topIsDirichlet, rightIsDirichlet, bottomIsDirichlet, nlev, this, MGC);
}
示例#7
0
void BounceAnimation::setBoundaries(float sideLength) {
  assert(sideLength > 0.0f);
  float negative = sideLength * -1;
  setBoundaries(sideLength, negative, negative, sideLength);
}