本文整理汇总了C++中xr函数的典型用法代码示例。如果您正苦于以下问题:C++ xr函数的具体用法?C++ xr怎么用?C++ xr使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tc
void SanitiseTool::parseLinkFlankers(xercesc::DOMElement * parentNode,
crispr::xml::writer& xmlParser)
{
for (xercesc::DOMElement * currentElement = parentNode->getFirstElementChild();
currentElement != NULL;
currentElement = currentElement->getNextElementSibling()) {
if (ST_Flank) {
char * c_flid = tc( currentElement->getAttribute(xmlParser.attr_Flid()));
std::string flid = c_flid;
XMLCh * x_new_flid = tc( ST_FlankMap[flid].c_str());
currentElement->setAttribute(xmlParser.attr_Flid(), x_new_flid);
xr(&c_flid);
xr(&x_new_flid);
}
if (ST_Repeats) {
char * c_drid = tc( currentElement->getAttribute(xmlParser.attr_Drid()));
std::string drid = c_drid;
XMLCh * x_new_drid = tc(ST_RepeatMap[drid].c_str());
currentElement->setAttribute(xmlParser.attr_Drid(), x_new_drid);
xr(&c_drid);
xr(&x_new_drid);
}
}
}
示例2: StatManager
void StatTool::parseGroup(xercesc::DOMElement * parentNode,
crispr::xml::base& xmlParser)
{
StatManager * sm = new StatManager();
ST_StatsVec.push_back(sm);
char * c_cons = tc(parentNode->getAttribute(xmlParser.attr_Drseq()));
std::string concensusRepeat =c_cons;
sm->setConcensus(concensusRepeat);
xr(&c_cons);
char * c_gid = tc(parentNode->getAttribute(xmlParser.attr_Gid()));
std::string gid = c_gid;
xr(&c_gid);
sm->setGid(gid);
for (xercesc::DOMElement * currentElement = parentNode->getFirstElementChild();
currentElement != NULL;
currentElement = currentElement->getNextElementSibling()) {
if (xercesc::XMLString::equals(currentElement->getTagName(), xmlParser.tag_Data())) {
parseData(currentElement, xmlParser, sm);
} else if (xercesc::XMLString::equals(currentElement->getTagName(), xmlParser.tag_Metadata())) {
parseMetadata(currentElement, xmlParser, sm);
}
}
}
示例3: xr
void
CachedView<View>::cache(Space& home) {
_firstRange->dispose(home,_lastRange);
ViewRanges<View> xr(x);
_firstRange = new (home) RangeList(xr.min(),xr.max(),NULL);
++xr;
RangeList* cur = _firstRange;
for (; xr(); ++xr) {
RangeList* next = new (home) RangeList(xr.min(),xr.max(),NULL);
cur->next(next);
cur = next;
}
_lastRange = cur;
_size = x.size();
}
示例4: tc
//void DrawTool::parseDrs(xercesc::DOMElement * parentNode, crispr::xml::parser& xmlParser)
//{
// xercesc::DOMNodeList * children = parentNode->getChildNodes();
// const XMLSize_t nodeCount = children->getLength();
//
// // For all nodes, children of "root" in the XML tree.
// for( XMLSize_t xx = 0; xx < nodeCount; ++xx ) {
// xercesc::DOMNode * currentNode = children->item(xx);
// if( currentNode->getNodeType() && currentNode->getNodeType() == xercesc::DOMNode::ELEMENT_NODE ) {
// // Found node which is an Element. Re-cast node as element
// xercesc::DOMElement* currentElement = dynamic_cast< xercesc::DOMElement* >( currentNode );
// if (xercesc::XMLString::equals(currentElement->getTagName(), xmlParser.getDr())) {
//
// }
// }
// }
//}
void DrawTool::parseSpacers(xercesc::DOMElement * parentNode,
crispr::xml::parser& xmlParser,
crispr::graph * currentGraph)
{
for (xercesc::DOMElement * currentElement = parentNode->getFirstElementChild();
currentElement != NULL;
currentElement = currentElement->getNextElementSibling()) {
if (xercesc::XMLString::equals(currentElement->getTagName(), xmlParser.tag_Spacer())) {
char * node_name = tc(currentElement->getAttribute(xmlParser.attr_Spid()));
Agnode_t * current_graphviz_node = currentGraph->addNode(node_name);
char * shape = strdup("shape");
char * circle = strdup("circle");
currentGraph->setNodeAttribute(current_graphviz_node, shape, circle);
delete shape;
delete circle;
char * c_spid = tc(currentElement->getAttribute(xmlParser.attr_Spid()));
std::string spid = c_spid;
if (currentElement->hasAttribute(xmlParser.attr_Cov())) {
char * c_cov = tc(currentElement->getAttribute(xmlParser.attr_Cov()));
double current_cov;
if (from_string<double>(current_cov, c_cov, std::dec)) {
recalculateLimits(current_cov);
DT_SpacerCoverage[spid] = std::pair<bool, double>(true,current_cov);
} else {
throw crispr::runtime_exception(__FILE__,
__LINE__,
__PRETTY_FUNCTION__,
"Unable to convert serialized coverage");
}
xr(&c_cov);
} else {
DT_SpacerCoverage[spid] = std::pair<bool, double>(false,0);
}
xr(&c_spid);
xr(&node_name);
}
}
}
示例5: linearizeCarDynamics
// Jacobians: dg(b,u)/db, dg(b,u)/du
void linearizeCarDynamics(const Matrix<C_DIM>& c, const Matrix<U_DIM>& u, Matrix<C_DIM,C_DIM>& F, Matrix<C_DIM,U_DIM>& G, Matrix<C_DIM>& h)
{
Matrix<X_DIM,1> x;
x.insert(0, 0, c);
x.insert(C_DIM, 0, x0.subMatrix<L_DIM,1>(C_DIM,0));
F.reset();
Matrix<X_DIM> xr(x), xl(x), ddx;
for (size_t i = 0; i < C_DIM; ++i) {
xr[i] += step; xl[i] -= step;
ddx = (dynfunc(xr, u, zeros<Q_DIM,1>()) - dynfunc(xl, u, zeros<Q_DIM,1>())) / (xr[i] - xl[i]);
F.insert(0,i, ddx.subMatrix<C_DIM,1>(0, 0));
xr[i] = x[i]; xl[i] = x[i];
}
G.reset();
Matrix<U_DIM> ur(u), ul(u);
Matrix<X_DIM> ddg;
for (size_t i = 0; i < U_DIM; ++i) {
ur[i] += step; ul[i] -= step;
ddg = (dynfunc(x, ur, zeros<Q_DIM,1>()) - dynfunc(x, ul, zeros<Q_DIM,1>())) / (ur[i] - ul[i]);
G.insert(0,i, ddg.subMatrix<C_DIM,1>(0, 0));
ur[i] = u[i]; ul[i] = u[i];
}
h = dynfunc(x, u, zeros<Q_DIM,1>()).subMatrix<C_DIM,1>(0,0);
}
示例6: tc
xercesc::DOMElement * CrisprParser::getWantedGroupFromRoot(xercesc::DOMElement * parentNode,
std::string& wantedGroup,
std::string& directRepeat)
{
for (xercesc::DOMElement * currentElement = parentNode->getFirstElementChild();
currentElement != NULL;
currentElement = currentElement->getNextElementSibling())
{
if (xercesc::XMLString::equals(currentElement->getTagName(), tag_Group()))
{
// new group
// test if it's one that we want
char * c_group_name = tc(currentElement->getAttribute(attr_Gid()));
std::string current_group_name = c_group_name;
xr(&c_group_name);
if (current_group_name == wantedGroup)
{
// get the length of the direct repeat
char * c_dr = tc(currentElement->getAttribute(attr_Drseq()));
directRepeat = c_dr;
return currentElement;
}
}
}
// we should theoretically never get here but if the xml is bad then it might just happen
// or if the user has put in a group that doesn't exist by mistake
return NULL;
}
示例7: paintLinesToChildren
static void paintLinesToChildren( QGraphicsItem * qgi,
QPainter * painter,
QPen const & pen )
{
typedef QList<QGraphicsItem*> QGIL;
QGIL ch( qboard::childItems(qgi) );
if( ch.isEmpty() ) return;
QRectF prect( qgi->boundingRect() );
QPointF mid( prect.left() + (prect.width() / 2),
prect.top() + (prect.height() / 2) );
painter->save();
for( QGIL::iterator it = ch.begin();
ch.end() != it; ++it )
{
QGraphicsItem * x = *it;
QRectF xr( x->boundingRect() );
QPointF xmid( xr.center() );
//xmid = x->mapToParent( xmid );
xmid = qgi->mapFromItem( x, xmid );
painter->setPen( pen );
painter->drawLine( QLineF( mid, xmid ) );
}
painter->restore();
}
示例8: main
int main(){
V3f x(0,0,1); V3f xr(rot_x(x, 0.87)); same("x rotation", x.dot(xr), cos(0.87));
V3f y(0,0,1); V3f yr(rot_y(y, 0.23)); same("y rotation", y.dot(yr), cos(0.23));
V3f z(1,0,0); V3f zr(rot_z(z, 0.19)); same("z rotation", z.dot(zr), cos(0.19));
V3f nx(3,2,5);
V3f ny(-2,3,4);
V3f nz(-4,4,3.8);
V3f nnx(3,2,5);
V3f nny(-2,3,4);
V3f nnz(-4,4,3.8);
ortoNormalize(nnx, nny, nnz);
same("x unit", nnx.length(), 1.0);
same("y unit", nny.length(), 1.0);
same("z unit", nnz.length(), 1.0);
V3f tmp; tmp.cross(nnx, nx);
same("x colinear", tmp.length(), 0.0);
tmp.cross(nnx, nny); tmp-=nnz; same("x orto", tmp.length(), 0);
tmp.cross(nny, nnz); tmp-=nnx; same("y orto", tmp.length(), 0);
tmp.cross(nnz, nnx); tmp-=nny; same("z orto", tmp.length(), 0);
};
示例9: tc
void StatTool::parseMetadata(xercesc::DOMElement * parentNode,
crispr::xml::base& xmlParser,
StatManager * statManager) {
for (xercesc::DOMElement * currentElement = parentNode->getFirstElementChild();
currentElement != NULL;
currentElement = currentElement->getNextElementSibling()) {
if (xercesc::XMLString::equals(currentElement->getTagName(), xmlParser.tag_File())) {
char * c_type_attr = tc(currentElement->getAttribute(xmlParser.attr_Type()));
if (! strcmp(c_type_attr, "sequence")) {
char * c_url = tc(currentElement->getAttribute(xmlParser.attr_Url()));
statManager->setReadCount(calculateReads(c_url));
xr(&c_url);
}
xr(&c_type_attr);
}
}
}
示例10: vsr
forceinline Iter::Ranges::CompareStatus
ValSet::compare(View x) const {
if (empty() || (x.max() < min()) || (x.min() > max()))
return Iter::Ranges::CS_DISJOINT;
ValSet::Ranges vsr(*this);
ViewRanges<View> xr(x);
return Iter::Ranges::compare(xr,vsr);
}
示例11: assert
bool AztecOOSolver::solve()
{
#ifdef HAVE_AZTECOO
assert(m.size == rhs.size);
// no output
aztec.SetAztecOption(AZ_output, AZ_none); // AZ_all | AZ_warnings | AZ_last | AZ_summary
#ifndef COMPLEX
// setup the problem
aztec.SetUserMatrix(m.mat);
aztec.SetRHS(rhs.vec);
Epetra_Vector x(*rhs.std_map);
aztec.SetLHS(&x);
if (pc != NULL) {
Epetra_Operator *op = pc->get_obj();
assert(op != NULL); // can work only with Epetra_Operators
aztec.SetPrecOperator(op);
}
// solve it
aztec.Iterate(max_iters, tolerance);
delete [] sln;
sln = new scalar[m.size];
memset(sln, 0, m.size * sizeof(scalar));
// copy the solution into sln vector
for (int i = 0; i < m.size; i++) sln[i] = x[i];
#else
double c0r = 1.0, c0i = 0.0;
double c1r = 0.0, c1i = 1.0;
Epetra_Vector xr(*rhs.std_map);
Epetra_Vector xi(*rhs.std_map);
Komplex_LinearProblem kp(c0r, c0i, *m.mat, c1r, c1i, *m.mat_im, xr, xi, *rhs.vec, *rhs.vec_im);
Epetra_LinearProblem *lp = kp.KomplexProblem();
aztec.SetProblem(*lp);
// solve it
aztec.Iterate(max_iters, tolerance);
kp.ExtractSolution(xr, xi);
delete [] sln;
sln = new scalar[m.size];
memset(sln, 0, m.size * sizeof(scalar));
// copy the solution into sln vector
for (int i = 0; i < m.size; i++) sln[i] = scalar(xr[i], xi[i]);
#endif
return true;
#else
return false;
#endif
}
示例12: xr
inline std::string
Comparator::compare(std::string x_n, IntVar x, IntVar y) {
IntVarRanges xr(x), yr(y);
if (!Iter::Ranges::equal(xr,yr)) {
std::ostringstream ret;
ret << x_n << "=" << x << " -> " << y;
return ret.str();
}
return "";
}
示例13: dhdx
inline Matrix<_zDim,_xDim> dhdx(Matrix<_zDim> (*h)(const Matrix<_xDim>&), const Matrix<_xDim>& x)
{
Matrix<_zDim,_xDim> H;
Matrix<_xDim> xr(x), xl(x);
for (size_t i = 0; i < _xDim; ++i) {
xr[i] += step; xl[i] -= step;
H.insert(0,i, (h(xr) - h(xl)) / (2.0*step));
xr[i] = xl[i] = x[i];
}
return H;
}
示例14: dfdx
inline Matrix<_xDim,_xDim> dfdx(Matrix<_xDim> (*f)(const Matrix<_xDim>&, const Matrix<_uDim>&), const Matrix<_xDim>& x, const Matrix<_uDim>& u)
{
Matrix<_xDim,_xDim> A;
Matrix<_xDim> xr(x), xl(x);
for (size_t i = 0; i < _xDim; ++i) {
xr[i] += step; xl[i] -= step;
A.insert(0,i, (f(xr, u) - f(xl, u)) / (2.0*step));
xr[i] = xl[i] = x[i];
}
return A;
}
示例15: xr
osg::Quat KeyframeController::getXYZRotation(float time) const
{
float xrot = 0, yrot = 0, zrot = 0;
if (!mXRotations.empty())
xrot = mXRotations.interpKey(time);
if (!mYRotations.empty())
yrot = mYRotations.interpKey(time);
if (!mZRotations.empty())
zrot = mZRotations.interpKey(time);
osg::Quat xr(xrot, osg::Vec3f(1,0,0));
osg::Quat yr(yrot, osg::Vec3f(0,1,0));
osg::Quat zr(zrot, osg::Vec3f(0,0,1));
return (xr*yr*zr);
}