Py::Object Transformation::seq_x_y(const Py::Tuple & args) { _VERBOSE("Transformation::seq_x_y"); args.verify_length(2); Py::SeqBase<Py::Object> x = args[0]; Py::SeqBase<Py::Object> y = args[1]; size_t Nx = x.length(); size_t Ny = y.length(); if (Nx!=Ny) throw Py::ValueError("x and y must be equal length sequences"); // evaluate the lazy objects if (!_frozen) eval_scalars(); Py::Tuple xo(Nx); Py::Tuple yo(Nx); for (size_t i=0; i< Nx; ++i) { double thisx = Py::Float(x[i]); double thisy = Py::Float(y[i]); this->operator()(thisx, thisy); xo[i] = Py::Float( xy.first ); yo[i] = Py::Float( xy.second ); } Py::Tuple ret(2); ret[0] = xo; ret[1] = yo; return ret; }
void Ottava::setYoff(qreal val) { qreal _spatium = spatium(); qreal yo(score()->styleS(StyleIdx::ottavaY).val() * _spatium); if (placement() == Element::Placement::BELOW) yo = -yo + staff()->height(); rUserYoffset() += val * _spatium - yo; }
void OttavaSegment::layout() { TextLineSegment::layout1(); if (parent()) { // for palette qreal yo(score()->styleS(StyleIdx::ottavaY).val() * spatium()); if (ottava()->placement() == Placement::BELOW) yo = -yo + staff()->height(); rypos() += yo; } adjustReadPos(); }
int main(void) { yo(); return 0; }
/* * Use the contents of the VCS_PROB to specify the contents of the * private data, VCS_SOLVE. * * It's assumed we are solving the same problem. * * @param pub Pointer to VCS_PROdB that will be used to * initialize the current equilibrium problem */ int VCS_SOLVE::vcs_prob_specify(const VCS_PROB* pub) { size_t kspec, k, i, j, iph; string yo("vcs_prob_specify ERROR: "); int retn = VCS_SUCCESS; bool status_change = false; m_temperature = pub->T; m_pressurePA = pub->PresPA; m_VCS_UnitsFormat = pub->m_VCS_UnitsFormat; m_doEstimateEquil = pub->iest; m_totalVol = pub->Vol; m_tolmaj = pub->tolmaj; m_tolmin = pub->tolmin; m_tolmaj2 = 0.01 * m_tolmaj; m_tolmin2 = 0.01 * m_tolmin; for (kspec = 0; kspec < m_numSpeciesTot; ++kspec) { k = m_speciesMapIndex[kspec]; m_molNumSpecies_old[kspec] = pub->w[k]; m_molNumSpecies_new[kspec] = pub->mf[k]; m_feSpecies_old[kspec] = pub->m_gibbsSpecies[k]; } /* * Transfer the element abundance goals to the solve object */ for (i = 0; i < m_numElemConstraints; i++) { j = m_elementMapIndex[i]; m_elemAbundancesGoal[i] = pub->gai[j]; } /* * Try to do the best job at guessing at the title */ if (pub->Title.size() == 0) { if (m_title.size() == 0) { m_title = "Unspecified Problem Title"; } } else { m_title = pub->Title; } /* * Copy over the phase information. * -> For each entry in the phase structure, determine * if that entry can change from its initial value * Either copy over the new value or create an error * condition. */ for (iph = 0; iph < m_numPhases; iph++) { vcs_VolPhase* vPhase = m_VolPhaseList[iph]; vcs_VolPhase* pub_phase_ptr = pub->VPhaseList[iph]; if (vPhase->VP_ID_ != pub_phase_ptr->VP_ID_) { plogf("%sPhase numbers have changed:%d %d\n", yo.c_str(), vPhase->VP_ID_, pub_phase_ptr->VP_ID_); retn = VCS_PUB_BAD; } if (vPhase->m_singleSpecies != pub_phase_ptr->m_singleSpecies) { plogf("%sSingleSpecies value have changed:%d %d\n", yo.c_str(), vPhase->m_singleSpecies, pub_phase_ptr->m_singleSpecies); retn = VCS_PUB_BAD; } if (vPhase->m_gasPhase != pub_phase_ptr->m_gasPhase) { plogf("%sGasPhase value have changed:%d %d\n", yo.c_str(), vPhase->m_gasPhase, pub_phase_ptr->m_gasPhase); retn = VCS_PUB_BAD; } vPhase->m_eqnState = pub_phase_ptr->m_eqnState; if (vPhase->nSpecies() != pub_phase_ptr->nSpecies()) { plogf("%sNVolSpecies value have changed:%d %d\n", yo.c_str(), vPhase->nSpecies(), pub_phase_ptr->nSpecies()); retn = VCS_PUB_BAD; } if (vPhase->PhaseName != pub_phase_ptr->PhaseName) { plogf("%sPhaseName value have changed:%s %s\n", yo.c_str(), vPhase->PhaseName.c_str(), pub_phase_ptr->PhaseName.c_str()); retn = VCS_PUB_BAD; } if (vPhase->totalMolesInert() != pub_phase_ptr->totalMolesInert()) { status_change = true; } /* * Copy over the number of inert moles if it has changed. */ TPhInertMoles[iph] = pub_phase_ptr->totalMolesInert(); vPhase->setTotalMolesInert(pub_phase_ptr->totalMolesInert()); if (TPhInertMoles[iph] > 0.0) { vPhase->setExistence(2); vPhase->m_singleSpecies = false; } /* * Copy over the interfacial potential */ double phi = pub_phase_ptr->electricPotential(); vPhase->setElectricPotential(phi); } if (status_change) { vcs_SSPhase(); } /* * Calculate the total number of moles in all phases. */ vcs_tmoles(); return retn; }