00001 #include "isotherm.h"
00002 #include "globalt.h"
00003
00004
00005 isotherm::isotherm ()
00006 {
00007
00008
00009 isothermtype = noisotherm;
00010
00011 }
00012
00013 isotherm::~isotherm ()
00014 {
00015 }
00016
00017
00018
00019
00020
00021
00022
00023
00024 void isotherm::read(XFILE *in)
00025 {
00026
00027 xfscanf(in,"%k%m", "isothermtype", &isotypet_kwdset,(int*)&isothermtype);
00028
00029 switch (isothermtype){
00030 case ithdata:{
00031
00032
00033
00034 data.read (in);
00035
00036 break;
00037 }
00038 case grunewaldroot:{
00039
00040 rooti.read (in);
00041 break;
00042 }
00043 case hansen:{
00044
00045 hanseni.read (in);
00046 break;
00047 }
00048 default:{
00049 print_err("unknown type of isotherm is required",__FILE__,__LINE__,__func__);
00050 }
00051 }
00052
00053 }
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 void isotherm::print (FILE *out)
00065 {
00066 fprintf(out,"%d\n", isothermtype);
00067
00068 switch (isothermtype){
00069 case ithdata:{
00070
00071
00072 data.print (out);
00073 fprintf (out,"\n");
00074
00075 break;
00076 }
00077 case grunewaldroot:{
00078
00079 rooti.print (out);
00080 break;
00081 }
00082 case hansen:{
00083
00084 hanseni.print (out);
00085 break;
00086 }
00087 default:{
00088 print_err("unknown type of isotherm is required",__FILE__,__LINE__,__func__);
00089 }
00090 }
00091
00092 }
00093
00094
00095
00096
00097
00098
00099
00100
00101 double isotherm::isotherm_value (double in)
00102 {
00103
00104 double iv;
00105
00106 switch (isothermtype){
00107 case ithdata:{
00108 iv = data.getval (in);
00109 break;
00110 }
00111 case grunewaldroot:{
00112
00113
00114
00115 iv = rooti.sorption_isotherm (in);
00116 break;
00117 }
00118 case hansen:{
00119
00120
00121
00122 hanseni.hansen_sorption_isotherm (in);
00123 break;
00124 }
00125 default:{
00126 print_err("unknown type of isotherm is required",__FILE__,__LINE__,__func__);
00127 }
00128 }
00129
00130 return iv;
00131 }
00132
00133
00134
00135
00136
00137
00138 double isotherm::inverse_isotherm_value (double in)
00139 {
00140
00141 double iiv;
00142
00143 switch (isothermtype){
00144 case ithdata:{
00145 iiv = data.getinvval (in);
00146 break;
00147 }
00148 case grunewaldroot:{
00149
00150
00151
00152 iiv = rooti.inverse_sorption_isotherm (in);
00153 break;
00154 }
00155 case hansen:{
00156
00157
00158
00159 iiv = hanseni.hansen_inverse_sorption_isotherm (in);
00160 break;
00161 }
00162 default:{
00163 print_err("unknown type of isotherm is required",__FILE__,__LINE__,__func__);
00164 }
00165 }
00166
00167 return iiv;
00168 }
00169
00170
00171
00172
00173
00174
00175 double isotherm::derivative_isotherm_value (double in)
00176 {
00177
00178 double di;
00179
00180 switch (isothermtype){
00181 case ithdata:{
00182 di = data.getderiv (in);
00183 break;
00184 }
00185 case grunewaldroot:{
00186
00187
00188
00189 di = rooti.derivative_sorption_isotherm (in);
00190 break;
00191 }
00192 case hansen:{
00193
00194 break;
00195 }
00196 default:{
00197 print_err("unknown type of isotherm is required",__FILE__,__LINE__,__func__);
00198 }
00199 }
00200
00201 return di;
00202 }
00203
00204
00205
00206
00207
00208
00209 double isotherm::derivative_inverse_isotherm_value (double in)
00210 {
00211
00212 double dii;
00213
00214 switch (isothermtype){
00215 case ithdata:{
00216 dii = data.getinvderiv (in);
00217 break;
00218 }
00219 case grunewaldroot:{
00220
00221
00222
00223 dii = rooti.derivative_inverse_sorption_isotherm (in);
00224 break;
00225 }
00226 case hansen:{
00227
00228 break;
00229 }
00230 default:{
00231 print_err("unknown type of isotherm is required",__FILE__,__LINE__,__func__);
00232 }
00233 }
00234
00235 return dii;
00236 }