00001 #include "crsection1d.h"
00002 #include "globalt.h"
00003 #include "stochdrivert.h"
00004
00005 crsection1d::crsection1d (void)
00006 {
00007 a=0.0; rho=0.0;
00008 }
00009 crsection1d::~crsection1d (void)
00010 {
00011
00012 }
00013
00014 void crsection1d::read (XFILE *in)
00015 {
00016 switch (Tp->tprob){
00017 case stationary_problem:{
00018 xfscanf (in,"%lf",&a);
00019 break;
00020 }
00021 case nonlinear_stationary_problem:{
00022 xfscanf (in,"%lf",&a);
00023 break;
00024 }
00025 case nonstationary_problem:{
00026 xfscanf (in,"%lf %lf",&rho,&a);
00027 break;
00028 }
00029 case nonlinear_nonstationary_problem:{
00030 xfscanf (in,"%lf %lf",&rho,&a);
00031 break;
00032 }
00033 case discont_nonstat_problem:{
00034 xfscanf (in,"%lf %lf",&rho,&a);
00035 break;
00036 }
00037 case discont_nonlin_nonstat_problem:{
00038 xfscanf (in,"%lf %lf",&rho,&a);
00039 break;
00040 }
00041 case growing_np_problem:{
00042 xfscanf (in,"%lf %lf",&rho,&a);
00043 break;
00044 }
00045 case growing_np_problem_nonlin:{
00046 xfscanf (in,"%lf %lf",&rho,&a);
00047 break;
00048 }
00049 default:{
00050 print_err("unknown problem type is required",__FILE__,__LINE__,__func__);
00051 }
00052 }
00053 }
00054
00055 void crsection1d::print (FILE *out)
00056 {
00057 switch (Tp->tprob){
00058 case stationary_problem:{
00059 fprintf (out," %lf\n",a);
00060 break;
00061 }
00062 case nonstationary_problem:{
00063 fprintf (out," %lf %lf\n",rho,a);
00064 break;
00065 }
00066 case nonlinear_nonstationary_problem:
00067 case discont_nonlin_nonstat_problem:
00068 case growing_np_problem:
00069 case growing_np_problem_nonlin:{
00070 fprintf (out," %lf %lf",rho,a);
00071 break;
00072 }
00073 default:{
00074 print_err("unknown problem type is required",__FILE__,__LINE__,__func__);
00075 }
00076 }
00077 }
00078
00079 void crsection1d::changeparam (atsel &atcs,vector &val)
00080 {
00081 long i;
00082
00083 for (i=0;i<atcs.num;i++){
00084 switch (atcs.atrib[i]){
00085 case 0:{
00086 a=val[0];
00087 break;
00088 }
00089 case 1:{
00090 rho=val[1];
00091 break;
00092 }
00093 default:{
00094 print_err("wrong number of atribute is required",__FILE__,__LINE__,__func__);
00095 }
00096 }
00097 }
00098 }