void KonfUpdate::copyGroup(const KConfigBase *cfg1, const QString &group1, KConfigBase *cfg2, const QString &group2) { KConfigGroup cg1(cfg1, group1); KConfigGroup cg2(cfg2, group2); copyGroup(cg1, cg2); }
void tst_QBrush::testQGradientCopyConstructor() { { QLinearGradient lg1(101, 102, 103, 104); QLinearGradient lg2 = lg1; QCOMPARE(lg1.start(), lg2.start()); QCOMPARE(lg1.finalStop(), lg2.finalStop()); QGradient g = lg1; QCOMPARE(((QLinearGradient *) &g)->start(), lg1.start()); QCOMPARE(((QLinearGradient *) &g)->finalStop(), lg1.finalStop()); } { QRadialGradient rg1(101, 102, 103, 104, 105); QRadialGradient rg2 = rg1; QCOMPARE(rg1.center(), rg2.center()); QCOMPARE(rg1.focalPoint(), rg2.focalPoint()); QCOMPARE(rg1.radius(), rg2.radius()); QGradient g = rg1; QCOMPARE(((QRadialGradient *) &g)->center(), rg1.center()); QCOMPARE(((QRadialGradient *) &g)->focalPoint(), rg1.focalPoint()); QCOMPARE(((QRadialGradient *) &g)->radius(), rg1.radius()); } { QConicalGradient cg1(101, 102, 103); QConicalGradient cg2 = cg1; QCOMPARE(cg1.center(), cg2.center()); QCOMPARE(cg1.angle(), cg2.angle()); QGradient g = cg1; QCOMPARE(((QConicalGradient *) &g)->center(), cg1.center()); QCOMPARE(((QConicalGradient *) &g)->angle(), cg1.angle()); } }
/*! This most be called after loading and before saving or using the LLK targets in any way. i.e. if you accumulate the log likelihood target in one program and use it in another, then you must call prep_llk() both before saving the targets in the first program and after loading in the second program. */ void LLK_map_target::prep_llk() { clipper::NXmap_base::Map_reference_index ix; // first make a llk target, if necessary if ( naccum != 0 ) { // aliases for maps clipper::NXmap<float>& mrho = target; clipper::NXmap<float>& mrho2 = weight; // calculate density moments for whole map clipper::ftype sn = 0.0, sr = 0.0, sr2 = 0.0; for ( ix = mrho.first(); !ix.last(); ix.next() ) if ( mrho2[ix] > 0.0 ) { sn += naccum; // overall desnity stats sr += mrho[ix]; sr2 += mrho2[ix]; } float rmap = sr/sn; float smap = sqrt( sn*sr2 - sr*sr )/sn; // and for individual positions within map for ( ix = mrho.first(); !ix.last(); ix.next() ) if ( mrho2[ix] > 0.0 ) { mrho[ix] /= naccum; // local density stats mrho2[ix] /= naccum; // limit std to no less than 3% of map std mrho2[ix] = sqrt( clipper::Util::max( mrho2[ix] - mrho[ix]*mrho[ix], 0.001f*smap*smap ) ); } // convert density moments to llk target float rho, std, v1, v2, w1, w2; for ( ix = mrho.first(); !ix.last(); ix.next() ) if ( mrho2[ix] > 0.0 ) { rho = mrho[ix]; std = mrho2[ix]; v1 = std*std; v2 = smap*smap; w1 = clipper::Util::max( v2/v1-1.0, 0.001 ); // weight must be +ve w2 = clipper::Util::min( 1.0/w1, 2.0 ); // limit density upweighting target[ix] = rho + w2*(rho-rmap); weight[ix] = w1 * 0.5/v2; } // done naccum = 0; } // now truncate the functions at the limit radii for ( ix = target.first(); !ix.last(); ix.next() ) if ( ix.coord_orth().lengthsq() > radius * radius ) weight[ix] = target[ix] = 0.0; // now assemble optimised llk lists clipper::Coord_grid cg, dg; clipper::Coord_orth co; clipper::Coord_map cm; const clipper::ftype r0 = radius * 3.0 / 8.0; clipper::Coord_grid cg0( clipper::Coord_map( target.operator_orth_grid() * clipper::Coord_map( 0.0, 0.0, 0.0 ) ).coord_grid() ); clipper::Coord_grid cg1( clipper::Coord_map( target.operator_orth_grid() * clipper::Coord_map( radius, 0.0, 0.0 ) ).coord_grid() ); int irad = cg1.u() - cg0.u(); // Make list of sites for the approximate LLK fn for ( cg.u() = -1; cg.u() <= 1; cg.u()++ ) for ( cg.v() = -1; cg.v() <= 1; cg.v()++ ) for ( cg.w() = -1; cg.w() <= 1; cg.w()++ ) if ( (cg.u()+cg.v()+cg.w())%2 == 0 ) { co = clipper::Coord_orth( r0 * cg.coord_map() ); cm = target.coord_map( co ); cm = clipper::Coord_map( target.operator_orth_grid() * co ); fasttgt.insert( co, target.interp<clipper::Interp_cubic>( cm ), weight.interp<clipper::Interp_cubic>( cm ) ); } // Make list of sites for the accurate LLK fn for ( ix = target.first(); !ix.last(); ix.next() ) { cg = ix.coord(); if ( (cg.u()+cg.v()+cg.w())%2 == 0 ) { // only use alternate grids dg = cg - cg0; if ( dg*dg <= irad*irad ) { co = target.coord_orth( cg.coord_map() ); slowtgt.insert( co, target[ix], weight[ix] ); } } } }