/* ****************************************************************************
*
* processGenericEntities -
*
* If the request included some "generic" entity, some additional CPr could be needed in the CER array. There are
* three cases of "generic" entities: 1) not pattern + null type, 2) pattern + not null type, 3) pattern + null type
*
* The limitReached parameter is to prevent the addition of new entities, which is needed in the case of the pagination
* limit has been reached with local entities.
*
*/
void processGenericEntities(EntityIdVector& enV, ContextElementResponseVector& cerV, ContextRegistrationResponseVector& crrV, bool limitReached)
{
  for (unsigned int ix = 0; ix < enV.size(); ++ix)
  {
    EntityId* enP = enV.get(ix);
    if (enP->type == "" || isTrue(enP->isPattern))
    {
      addContextProviders(cerV, crrV, limitReached, enP);
    }
  }
}
Example #2
0
/* ****************************************************************************
*
* equalEntityIdVector -
*
*/
static bool equalEntityIdVector(EntityIdVector enExpectedV, EntityIdVector enArgV) {

    /* Check vector size */
    if (enExpectedV.size() != enArgV.size()) {
        LM_M(("different sizes: expected %d, actual %d", enExpectedV.size(), enArgV.size()));
        return false;
    }

    /* Check that every entity in 'enArgV' is in 'enExpectedV'. Order doesn't matter */
    for (unsigned int ix = 0; ix < enArgV.size(); ++ix) {
        bool entityMatch = false;
        for (unsigned int jx = 0; jx < enExpectedV.size(); ++jx) {
            EntityId enArg = *enArgV.get(ix);
            EntityId enExpected = *enExpectedV.get(jx);
            LM_M(("%d == %d?", ix, jx));
            if (equalEntity(enExpected, enArg)) {
                LM_M(("entity matches in EntityIdVector comparison, check next one..."));
                entityMatch = true;
                break; /* loop in jx */
            }
        }

        if (!entityMatch) {
            LM_M(("after looking everyone, entity doesn't match in EntityIdVector"));
            return false;
        }
    }

    LM_M(("EntityIdVector comparison ok"));
    return true;
}
Example #3
0
Entity declare_element(BulkData & mesh,
        PartVector & parts,
        const EntityId elem_id,
        const EntityIdVector & node_ids)
{
    MetaData & fem_meta = MetaData::get(mesh);
    stk::topology top = fem_meta.get_topology(*parts[0]);
    ThrowAssert(node_ids.size() >= top.num_nodes());

    ThrowErrorMsgIf(top == stk::topology::INVALID_TOPOLOGY,
            "Part " << parts[0]->name() << " does not have a local topology");

    PartVector empty;

    const EntityRank entity_rank = stk::topology::ELEMENT_RANK;

    Entity elem = mesh.declare_entity(entity_rank, elem_id, parts);

    const EntityRank node_rank = stk::topology::NODE_RANK;

    Permutation perm = stk::mesh::Permutation::INVALID_PERMUTATION;
    OrdinalVector ordinal_scratch;
    ordinal_scratch.reserve(64);
    PartVector part_scratch;
    part_scratch.reserve(64);

    for(unsigned i = 0; i < top.num_nodes(); ++i)
    {
        //declare node if it doesn't already exist
        Entity node = mesh.get_entity(node_rank, node_ids[i]);
        if(!mesh.is_valid(node))
        {
            node = mesh.declare_entity(node_rank, node_ids[i], empty);
        }

        mesh.declare_relation(elem, node, i, perm, ordinal_scratch, part_scratch);
    }
    return elem;
}