void array<T>::increment_array_on_the_left()
        {
                bool ee_error_flag=false;
                error ee_error("",0);
                T *d_elem_new=NULL;

                try
                {
                try
                {
                        d_dim+=d_step;
                        d_ind0-=d_step;

                        d_elem_new=new T[d_dim+1];
                        alp_data::assert_mem(d_elem_new);

                        Int4 i;

                        for(i=0;i<d_step;i++)
                        {
                                d_elem_new[i]=0;
                        };

                        for(i=0;i<d_dim+1-d_step;i++)
                        {
                                d_elem_new[i+d_step]=d_elem[i];
                        };

                        if(d_alp_data)
                        {
                                d_alp_data->d_memory_size_in_MB+=(double)sizeof(T)*(double)d_step/mb_bytes;
                        };

                        delete[]d_elem;d_elem=NULL;
                        d_elem=d_elem_new;d_elem_new=NULL;


                }
                catch (error er)
                {
                        ee_error_flag=true;
                        ee_error=er;                
                };
                }
                catch (...)
                { 
                        ee_error_flag=true;
                        ee_error=error("Internal error in the program\n",4);
                };

                //memory release

                if(ee_error_flag)
                {
                        delete[]d_elem_new;d_elem_new=NULL;
                        throw error(ee_error.st,ee_error.error_code);
                };

        };
示例#2
0
pvalues::pvalues()
{
        bool ee_error_flag=false;
        error ee_error("",0);
        
        p_normal=NULL;

        try
        {
        try
        {

                blast=false;
                eps=0.0001;
                a_normal=-10;
                b_normal=10;
                N_normal=NORMAL_DISTR_ARRAY_DIM;
                h_normal=(b_normal-a_normal)/(double)N_normal;
                p_normal=GetNormalDistrArrayForPvaluesCalculation();

        }
        catch (error er)
        {
                ee_error_flag=true;
                ee_error=er;                
        };
        }
        catch (...)
        { 
                ee_error_flag=true;
                ee_error=error("Internal error in the program\n",1);
        };

        //memory release

        if(ee_error_flag)
        {
                this->~pvalues();
                throw error(ee_error.st,ee_error.error_code);
        };


};
                void get_memory_for_matrix(
                Int4 dim_,
                T ** &matr_)
                {
                        matr_=NULL;
                        bool ee_error_flag=false;
                        error ee_error("",0);

                        try
                        {
                        try
                        {

                                Int4 i;
                                matr_=new T *[dim_];
                                assert_mem(matr_);

                                for(i=0;i<dim_;i++)
                                {
                                        matr_[i]=NULL;
                                };

                                for(i=0;i<dim_;i++)
                                {
                                        matr_[i]=new T [dim_];
                                        assert_mem(matr_[i]);
                                };
                                d_memory_size_in_MB+=(double)sizeof(T)*(double)dim_*(double)dim_/mb_bytes;

                        }
                        catch (error er)
                        {
                                ee_error_flag=true;
                                ee_error=er;                
                        };
                        }
                        catch (...)
                        { 
                                ee_error_flag=true;
                                ee_error=error("Internal error in the program\n",4);
                        };

                        //memory release

                        if(ee_error_flag)
                        {

                                if(matr_)
                                {
                                        Int4 i;
                                        for(i=0;i<dim_;i++)
                                        {
                                                if(matr_[i])
                                                {
                                                        delete[]matr_[i];matr_[i]=NULL;
                                                };
                                        };

                                        delete[]matr_;matr_=NULL;
                                };

                                throw error(ee_error.st,ee_error.error_code);
                        };

                };