当前位置: 首页>>代码示例>>C++>>正文


C++ BaseMolecule::getEdgeTopology方法代码示例

本文整理汇总了C++中BaseMolecule::getEdgeTopology方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseMolecule::getEdgeTopology方法的具体用法?C++ BaseMolecule::getEdgeTopology怎么用?C++ BaseMolecule::getEdgeTopology使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseMolecule的用法示例。


在下文中一共展示了BaseMolecule::getEdgeTopology方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _compare_in_loop

int MoleculeSubstructureMatcher::_compare_in_loop (BaseMolecule &mol, int i1, int i2)
{
   const Vertex &v1 = mol.getVertex(i1);
   const Vertex &v2 = mol.getVertex(i2);

   int in_loop1 = 0;
   for (int nei = v1.neiBegin(); nei != v1.neiEnd(); nei = v1.neiNext(nei))
   {
      int nei_edge = v1.neiEdge(nei);
      if (mol.getEdgeTopology(nei_edge) == TOPOLOGY_RING)
      {
         in_loop1 = 1;
         break;
      }
   }
   int in_loop2 = 0;
   for (int nei = v2.neiBegin(); nei != v2.neiEnd(); nei = v2.neiNext(nei))
   {
      int nei_edge = v2.neiEdge(nei);
      if (mol.getEdgeTopology(nei_edge) == TOPOLOGY_RING)
      {
         in_loop2 = 1;
         break;
      }
   }
   return in_loop2 - in_loop1;
}
开发者ID:mojca,项目名称:indigo,代码行数:27,代码来源:molecule_substructure_matcher.cpp

示例2: matchQueryBond

bool MoleculeSubstructureMatcher::matchQueryBond (QueryMolecule::Bond *query,
             BaseMolecule &target, int sub_idx, int super_idx, AromaticityMatcher *am, dword flags)
{
   int i;

   // MR TODO: match topology. Query bond in ring cannot match 
   // target bond that is not in ring. But R-groups should be 
   // handled carefully

   switch (query->type)
   {
      case QueryMolecule::OP_NONE:
         return true;
      case QueryMolecule::OP_AND:
         for (i = 0; i < query->children.size(); i++)
            if (!matchQueryBond(query->child(i), target, sub_idx, super_idx, am, flags))
               return false;
         return true;
      case QueryMolecule::OP_OR:
         for (i = 0; i < query->children.size(); i++)
            if (matchQueryBond(query->child(i), target, sub_idx, super_idx, am, flags))
               return true;
         return false;
      case QueryMolecule::OP_NOT:
         return !matchQueryBond(query->child(0), target, sub_idx, super_idx, am, 
            flags ^ MATCH_DISABLED_AS_TRUE);

      case QueryMolecule::BOND_ORDER:
      {
         if (flags & MATCH_BOND_TYPE)
         {
            if (am != 0)
            {
               if (target.getBondOrder(super_idx) == BOND_AROMATIC)
                  return am->canFixQueryBond(sub_idx, true);
               else 
               {
                  if (!am->canFixQueryBond(sub_idx, false))
                     return false;
               }
            }
            return target.possibleBondOrder(super_idx, query->value);
         }
         return (flags & MATCH_DISABLED_AS_TRUE) != 0;
      }
      case QueryMolecule::BOND_TOPOLOGY:
         return target.getEdgeTopology(super_idx) == query->value;
      case QueryMolecule::HIGHLIGHTING:
         return query->value == (int)target.isAtomHighlighted(super_idx);
      default:
         throw Error("bad query bond type: %d", query->type);
   }
}
开发者ID:mojca,项目名称:indigo,代码行数:53,代码来源:molecule_substructure_matcher.cpp


注:本文中的BaseMolecule::getEdgeTopology方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。