66 int nupdc = cnsv.size();
71 int mcompx = cnsv[ 0 ].mcompx;
74 DbgLv(1) <<
"dgC:upd_cns: mcompx" << mcompx <<
"nupdc" << nupdc;
85 DbgLv(1) <<
"dgC:upd_cns: ncompc" << ncompc <<
"fcx" << fcx;
88 if ( nupdc == ncompc )
93 for (
int ii = 0; ii < nupdc; ii++, kk++ )
95 DbgLv(1) <<
"dgC:upd_cns: att" << fcx <<
"flt" <<
attribs[fcx].floats;
96 DbgLv(1) <<
"dgC:upd_cns: att" << fcx+1 <<
"flt" <<
attribs[fcx+1].floats;
97 DbgLv(1) <<
"dgC:upd_cns: att" << fcx+2 <<
"flt" <<
attribs[fcx+2].floats;
100 else if ( nupdc < ncompc )
104 for (
int ii = 0; ii < nupdc; ii++, kk++ )
107 int frx = fcx + nupdc;
108 int fmx = fcx + ncompc;
111 for (
int ii = fmx; ii < nctot; ii++, kk++ )
114 nctot = nctot - ncompc + nupdc;
118 else if ( ncompc == 0 )
120 for (
int ii = 0; ii < nupdc; ii++ )
129 nctot = nctot - ncompc + nupdc;
130 int fmx = fcx + ncompc;
134 for (
int ii = ncold - 1; ii >= fmx; ii--, kk-- )
137 for (
int ii = 0, kk = fcx; ii < nupdc; ii++, kk++ )
141 DbgLv(1) <<
"dgC:upd_cns: nctot" << nctot;
151 DbgLv(1) <<
"dgC:ld_cns: cnsvsz" << cnsv.size();
164 double low,
double high,
bool floats,
bool logscl )
166 DbgLv(1) <<
"dgC:add_cns: atype" << atype;
171 cns.
high = floats ? high : low;
173 cns.
logscl = floats ? logscl :
false;
202 DbgLv(1) <<
"dgC:get_cmo: rtn";
210 DbgLv(1) <<
"dgC: *EMPTY* model";
224 DbgLv(1) <<
"dgC:GWM: EXISTING wmodel";
229 DbgLv(1) <<
"dgC:GWM: CALL init_work_model";
236 DbgLv(1) <<
"dgC:GWM: is_ok" << is_ok;
242 QVector< Constraint >* cnsvP,
int* kfltP )
244 DbgLv(1) <<
"dgC:cmp_cns: compx" << compx <<
"attrsz" <<
attribs.size();
247 QVector< Constraint > cnsv;
250 for (
int ii = 0; ii <
attribs.size(); ii++ )
252 DbgLv(1) <<
"dgC:cmp_cns: ii" << ii <<
"atype" <<
attribs[ii].atype
253 <<
"mcompx" <<
attribs[ii].mcompx;
257 if (
attribs[ ii ].mcompx != compx )
262 if ( attribs[ ii ].floats )
265 DbgLv(1) <<
"dgC:cmp_cns: ka kf cnssz" << kattrib << kfloat << cnsv.size();
278 QVector< Constraint >* cnsvP,
int* kfltP )
282 QVector< Constraint > cnsv;
283 DbgLv(1) <<
"dgC:ass_cns: assox" << assox <<
"attrsz" <<
attribs.size();
285 for (
int ii = 0; ii <
attribs.size(); ii++ )
290 if (
attribs[ ii ].mcompx != assox )
295 if ( attribs[ ii ].floats )
297 DbgLv(1) <<
"dgC:ass_cns: ii" << ii <<
"kattrib kfloat" << kattrib << kfloat;
313 QVector< Constraint > cnsv;
315 for (
int ii = 0; ii <
attribs.size(); ii++ )
353 DbgLv(1) <<
"dgC:f_att(c): atype xval" << atype << xval;
368 DbgLv(1) <<
"dgC:f_att(a): atype xval" << atype << xval;
437 QString tflag = QString( sc->
name ).left( 5 );
439 cname = QString( sc->
name ).mid( 5 );
442 double kval = sc->
f_f0;
443 double wval = sc->
mw;
447 DbgLv(1) <<
"dgC:cnsfrmo: ii" << ii <<
"s k w d f v" << sval << kval << wval
448 << dval << fval << vval;
461 else if ( kval != 0.0 )
466 else if ( wval != 0.0 )
471 else if ( dval != 0.0 )
476 else if ( fval != 0.0 )
481 else if ( vval != 0.0 )
536 DbgLv(1) <<
"dgC:cnsfrmo: tflag" << tflag <<
"xa ya za" <<
x_attr
538 if ( tflag.contains(
"V" ) )
549 attr.high = attr.low;
553 attr.high = attr.low;
557 attr.high = attr.low;
563 bool is_low = tflag.contains(
"L" );
564 bool log_x = tflag.contains(
"x" );
565 bool log_y = tflag.contains(
"y" );
566 bool log_z = tflag.contains(
"z" );
567 DbgLv(1) <<
"dgC:cnsfrmo: is_low" << is_low;
596 DbgLv(1) <<
"dgC:cnsfrmo: xattr xlow xhigh" <<
x_attr << xlow << xval;
613 DbgLv(1) <<
"dgC:cnsfrmo: yattr ylow yhigh" <<
y_attr << ylow << yval;
630 DbgLv(1) <<
"dgC:cnsfrmo: zattr zlow zhigh" << z_attr << zlow << zval;
666 for (
int ii = 0; ii <
nbassoc; ii++ )
673 double dval = as1->
k_d;
674 double oval = as1->
k_off;
675 double dhigh = as2->
k_d;
676 double ohigh = as2->
k_off;
678 if ( dval == dhigh && oval == ohigh )
690 attr.high = attr.low;
693 DbgLv(1) <<
"dgC:cnsfrmo: assoc fixed dval oval" << dval << oval;
698 bool log_d = ( as2->
rcomps[ 0 ] < 0.0 );
699 bool log_o = ( as2->
rcomps[ 1 ] < 0.0 );
700 bool flt_d = ( dval != dhigh );
701 bool flt_o = ( oval != ohigh );
721 nfloat += ( ( flt_d ? 1 : 0 ) + ( flt_o ? 1 : 0 ) );
722 DbgLv(1) <<
"dgC:cnsfrmo: assoc float dlow dhigh olow ohigh"
723 << dval << dhigh << oval << ohigh <<
"nfloat" <<
nfloat;
733 const QString pname_fix(
"000V_" );
736 qDebug() <<
"*ERROR* Unable to build a constraints model from an"
737 " empty constraints vector";
746 cmodel.
editGUID = QString(
"00000000-0000-0000-0000-000000000000" );
756 int mcompx =
attribs[ 0 ].mcompx;
760 for (
int ii = 0; ii <
attribs.size(); ii++ )
764 bool floats =
attribs[ ii ].floats;
765 nfloat += ( floats ? 1 : 0 );
766 DbgLv(1) <<
"dgC:modfrcn:scn: ii" << ii <<
" mcompx" << mcompx
767 <<
"atype" << atype <<
"floats" << floats;
773 ncflt += ( floats ? 1 : 0 );
774 if ( cndxs.contains( mcompx ) )
777 cflts[ mcompx ] += 1;
782 cflts << ( floats ? 1 : 0 );
790 naflt += ( floats ? 1 : 0 );
791 if ( andxs.contains( mcompx ) )
794 aflts[ mcompx ] += 1;
799 aflts << ( floats ? 1 : 0 );
810 DbgLv(1) <<
"dgC:modfrcn: bmodel compsz assosz"
816 QString pname = pname_fix;
832 for (
int ii = 0; ii <
attribs.size(); ii++ )
837 double xlow =
attribs[ ii ].low;
838 double xhigh =
attribs[ ii ].high;
839 bool floats =
attribs[ ii ].floats;
840 bool logscl =
attribs[ ii ].logscl;
841 DbgLv(1) <<
"dgC:modfrcn:cre: ii" << ii <<
"mcx pmcx" << mcompx << pmcomx
842 <<
"typ" << atype <<
"flt" << floats <<
"lo,hi" << xlow << xhigh;
844 if ( mcompx != pmcomx )
850 sc1.
name = pname + QString( sc1.
name );
852 DbgLv(1) <<
"dgC:modfrcn:cre: ii" << ii <<
"sc1.name" << sc1.
name;
857 pname = QString( pname ).left( 3 ) +
"L_";
858 sc1.
name = pname + QString( sc1.
name );
860 pname = QString( pname ).left( 3 ) +
"H_";
861 sc2.
name = pname + QString( sc2.
name );
863 DbgLv(1) <<
"dgC:modfrcn:cre: ii" << ii <<
"sc1.name" << sc1.
name;
864 DbgLv(1) <<
"dgC:modfrcn:cre: ii" << ii <<
"sc2.name" << sc2.
name;
887 sc1.
name = pname + QString( sc1.
name );
889 DbgLv(1) <<
"dgC:modfrcn:cre: ii" << ii <<
"sc1.name" << sc1.
name;
894 pname = QString( pname ).left( 3 ) +
"L_";
895 sc1.
name = pname + QString( sc1.
name );
897 pname = QString( pname ).left( 3 ) +
"H_";
898 sc2.
name = pname + QString( sc2.
name );
900 DbgLv(1) <<
"dgC:modfrcn:cre: ii" << ii <<
"sc1.name" << sc1.
name;
901 DbgLv(1) <<
"dgC:modfrcn:cre: ii" << ii <<
"sc2.name" << sc2.
name;
918 kfloat += ( floats ? 1 : 0 );
919 DbgLv(1) <<
"dgC:modfrcn:cre: kfloat" << kfloat;
933 QString xf = logscl ?
"x" :
"X";
936 else if ( kcompo == 2 )
938 QString yf = logscl ?
"y" :
"Y";
939 pname = QString( pname ).left( 1 ) + yf +
"0L_";
941 else if ( kcompo == 3 )
943 QString zf = logscl ?
"z" :
"Z";
944 pname = QString( pname ).left( 2 ) + zf +
"L_";
948 pname = QString( pname ).left( 3 ) +
"L_";
965 int mm = ( atype ==
ATYPE_KD ) ? 0 : 1;
966 as2.rcomps[ mm ] = -( mm + 1 );
970 DbgLv(1) <<
"dgC:modfrcn:cre: kassoc" << kassoc <<
"cmasz"
980 sc1.
name = pname + QString( sc1.
name );
986 pname = QString( pname ).left( 3 ) +
"L_";
987 sc1.
name = pname + QString( sc1.
name );
989 pname = QString( pname ).left( 3 ) +
"H_";
990 sc2.
name = pname + QString( sc2.
name );
1002 DbgLv(1) <<
"dgC:modfrcn:cre: att0 type flt" <<
attribs[0].atype
1004 DbgLv(1) <<
"dgC:modfrcn:cre: att1 type flt" <<
attribs[1].atype
1006 DbgLv(1) <<
"dgC:modfrcn:cre: att2 type flt" <<
attribs[2].atype
1015 qDebug() <<
"*ERROR* Unable to build constraints from empty base";
1040 attr.low = sc->
f_f0;
1041 attr.high = attr.low;
1046 attr.high = attr.low;
1051 attr.high = attr.low;
1056 attr.high = attr.low;
1066 for (
int ii = 0; ii <
nbassoc; ii++ )
1076 attr.low = as1->
k_off;
1077 attr.high = attr.low;
1080 DbgLv(1) <<
"dgC:cnfrbas: attr2 atype" <<
attribs[2].atype;
1091 for (
int ii = 0; ii <
attribs.size(); ii++ )
1096 int mcompx =
attribs[ ii ].mcompx;
1098 if ( mcompx != mcx )
1107 DbgLv(1) <<
"dgC:ccc: ii" << ii <<
"kconstr" << kconstr <<
"fattrx kfloat"
1108 << fattrx << kfloat;
1114 if ( countfP != NULL )
1128 for (
int ii = 0; ii <
attribs.size(); ii++ )
1133 int massox =
attribs[ ii ].mcompx;
1135 if ( massox != msx )
1149 if ( countfP != NULL )
1158 QVector< Constraint > cnsv;
1166 DbgLv(1) <<
"dgC:inwkmdl: CMODEL EMPTY";
1185 sc1.
name = QString( sc1.
name ).mid( 5 );
1186 DbgLv(1) <<
"dgC:inwkmdl: ii" << ii <<
"mcompx" << mcompx
1187 <<
"kconstr kfloat" << kconstr << kfloat;
1193 for (
int jj = 0; jj < kconstr; jj++ )
1195 if ( cnsv[ jj ].floats )
1197 x_attr = cnsv[ jj ].atype;
1200 if ( cnsv[ jj ].logscl )
1203 xval2 = log( xval2 );
1204 xval = ( xval + xval2 ) * 0.5;
1209 xval = ( xval + xval2 ) * 0.5;
1217 <<
"mcompx" << mcompx;
1233 for (
int jj = 0; jj < kconstr; jj++ )
1235 if ( cnsv[ jj ].floats )
1237 x_attr = cnsv[ jj ].atype;
1241 if ( cnsv[ jj ].logscl )
1244 xval2 = log( xval2 );
1245 xval = ( xval + xval2 ) * 0.5;
1251 xval = ( xval + xval2 ) * 0.5;
1260 <<
"mcompx" << mcompx;
1275 DbgLv(1) <<
"dgC:basefrcm: CMODEL EMPTY";
1285 "DMGA_Constraints",
"DMGA_Base" );
1293 QString anam = sc1.
name;
1294 QString aflg = QString( anam ).left( 4 );
1295 sc1.
name = QString( anam ).mid( 5 );
1297 if ( ! aflg.contains(
"V" ) )
1301 sc1.
s = ( sc1.
s + sc2.
s ) * 0.5;
1303 sc1.
mw = ( sc1.
mw + sc2.
mw ) * 0.5;
1304 sc1.
D = ( sc1.
D + sc2.
D ) * 0.5;
1305 sc1.
f = ( sc1.
f + sc2.
f ) * 0.5;