Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • c1f879879aa9c11b97153e99facb4504fc6b88d1
  • master par défaut protégée
  • rust-playlist-sync
  • rust
  • fix-qt-deprecated-qvariant-type
  • fix-mpris-qtwindow-race-condition
  • rust-appimage-wayland
  • windows-build-rebased
  • v2.5 protégée
  • v2.4 protégée
  • v2.3-1 protégée
  • v2.3 protégée
  • v2.2 protégée
  • v2.1 protégée
  • v2.0 protégée
  • v1.8-3 protégée
  • v1.8-2 protégée
  • v1.8-1 protégée
  • v1.8 protégée
  • v1.7 protégée
  • v1.6 protégée
  • v1.5 protégée
  • v1.4 protégée
  • v1.3 protégée
  • v1.2 protégée
  • v1.1 protégée
  • v1.0 protégée
27 résultats

mpvwidget_interface.cc

Blame
  • implicite.cpp 2,55 Kio
    #include <iostream>
    #include <limits>
    #include <iomanip>
    #include <fstream>
    #include <vector>
    #include "tab.h"
    
    using namespace std;
    typedef std::numeric_limits< double > dbl;
    
    Materiaux::Materiaux(const char* materiaux,double lambda, double kho, double c)
    {
        materiaux_=materiaux;
        lambda_= lambda;
        kho_ = kho;
        c_ = c;
    }
    
    vector<double> resolution(double lambda, vector<double> T){
        int n= T.size();
        vector<double> d(n,0);
        vector<double> l(n-1,0);
        d[0]=1+2*lambda;
    
        for (int i =1;i<n;i++){
            l[i-1]=(-1)*lambda/d[i-1];
            d[i]=1+2*lambda+lambda*l[i-1];
        }
        vector<double> y(n,0);
        y[0]=T[0];
        for (int i =1;i<n;i++){
            y[i]=T[i]-l[i-1]*y[i-1];
        }
       vector<double> x(n,0);
       x[n-1]=y[n-1]/d[n-1];
       for (int i =n-2;i>0;i--){
            x[i]=(y[i]+lambda*x[i+1])/d[i];
        }
    
        return x;
    }
    
    vector<double> sum_vect(vector <double> T,vector <double> F){
    
        vector <double> res(T.size(),0);
        for (size_t i=0;i<T.size();i++){
            res[i]= T[i]+F[i];
        }
        return res;
    
    }
    
    void settab(Materiaux mat, int u0, double f)
    {
        double T=16;
        double L=1;
        double dt, dx;
        dt= T/100.;
        dx= L/100.;
        double coef= (mat.getlambda()*dt)/(mat.getc()*mat.getkho()*(dx*dx));
        double F2=16*f*f;
        vector<double> F(101,0);
        F[10]=F2/(mat.getc()*mat.getkho());
        for(int j=50;j<61;j++){
            F[j]=F2*0.75/(mat.getc()*mat.getkho());
        }
    
        vector<vector<double> > temp;
        vector<double> tp;
        temp.push_back(vector<double>(101,u0));
    
    
        std::cout<< std::setprecision(std::numeric_limits<double>::digits10)<<  coef<<std::endl;
    
        for (int i = 1; i < 100; i++){
            tp=temp[i-1];
            tp[0]=tp[0]+coef*u0;
            tp[100]=tp[100]+coef*u0;
            temp.push_back(resolution(coef,sum_vect(tp,F)));
            temp[i][0]=u0;
            temp[i][100]=u0;
        }
        const char separateur(' ');
        std::ofstream sortie(mat.get_mat(),std::ios::out);
    
    
         for (int i = 0; i < 100; i++){
            for (int j = 0; j < 101; j++){
                sortie << temp[i][j] << separateur;
            }
            sortie<< std::endl;
         }
    
         sortie.close();
    
    }
    
    int main(){
    
    Materiaux cuivre = Materiaux("cuivre",389, 8940,380);
    Materiaux fer= Materiaux ("fer",80.2,7874,440);
    Materiaux verre= Materiaux("verre",1.2,2530,840);
    Materiaux polystyrene= Materiaux("polystyrene",0.1,1040,1200);
    
    
    settab(cuivre, 273.5+13,273.5+80);
    std::cout<<1<<std::endl;
    settab(fer,273.5+13,273.5+80);
    std::cout<<2<<std::endl;
    settab(verre,273.5+13,273.5+80);
    std::cout<<3<<std::endl;
    settab(polystyrene,273.5+13,273.5+80);
    std::cout<<4<<std::endl;
    
    return 0;
    }