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


C++ stk::CommSparse类代码示例

本文整理汇总了C++中stk::CommSparse的典型用法代码示例。如果您正苦于以下问题:C++ CommSparse类的具体用法?C++ CommSparse怎么用?C++ CommSparse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: unpack_remote_elem_side

void unpack_remote_elem_side(stk::CommSparse& commSparse, int procId, stk::mesh::GraphEdge& recvGraphEdge)
{
    stk::mesh::EntityId globalId;
    commSparse.recv_buffer(procId).unpack<stk::mesh::EntityId>(globalId);
    recvGraphEdge.elem2 = -globalId;
    commSparse.recv_buffer(procId).unpack<int>(recvGraphEdge.side2);
}
开发者ID:crtrott,项目名称:Trilinos,代码行数:7,代码来源:ElemGraphCoincidentElems.cpp

示例2: allocate_and_send

void allocate_and_send(stk::CommSparse& comm, const std::vector<SideSharingData>& sideSharingDataThisProc, const std::vector<stk::mesh::impl::IdViaSidePair>& idAndSides)
{
    pack_data(comm, sideSharingDataThisProc, idAndSides);
    comm.allocate_buffers();
    pack_data(comm, sideSharingDataThisProc, idAndSides);
    comm.communicate();
}
开发者ID:cihanuq,项目名称:Trilinos,代码行数:7,代码来源:SideSharingUsingGraph.cpp

示例3: pack_graph_edge_and_chosen_side_id_to_proc

void pack_graph_edge_and_chosen_side_id_to_proc(stk::CommSparse& commSparse, int otherProc, const stk::mesh::GraphEdge& graphEdge, stk::mesh::EntityId chosenSideId)
{
    commSparse.send_buffer(otherProc).pack<stk::mesh::EntityId>(graphEdge.elem1);
    commSparse.send_buffer(otherProc).pack<int>(graphEdge.side1);
    commSparse.send_buffer(otherProc).pack<stk::mesh::EntityId>(graphEdge.elem2);
    commSparse.send_buffer(otherProc).pack<int>(graphEdge.side2);
    commSparse.send_buffer(otherProc).pack<stk::mesh::EntityId>(chosenSideId);
}
开发者ID:crtrott,项目名称:Trilinos,代码行数:8,代码来源:ElemGraphCoincidentElems.cpp

示例4: pack_num_active_neighbors_into_buffer

void NoGhostGameofLife::pack_num_active_neighbors_into_buffer(stk::CommSparse& buffer,
                                                              int numActive, stk::mesh::EntityKey
                                                              remoteElemKey)
{
    int procNum = m_remoteElementKeyToOwningProcessor[remoteElemKey];
    buffer.send_buffer(procNum).pack<stk::mesh::EntityKey>(remoteElemKey);
    buffer.send_buffer(procNum).pack<int>(numActive);
}
开发者ID:vk1975,项目名称:trilinos,代码行数:8,代码来源:NoGhostGameofLife.cpp

示例5: unpack_local_elem_side

void unpack_local_elem_side(stk::CommSparse& commSparse,
                            int procId,
                            const IdMapper& idMapper,
                            stk::mesh::GraphEdge& recvGraphEdge)
{
    stk::mesh::EntityId globalId;
    commSparse.recv_buffer(procId).unpack<stk::mesh::EntityId>(globalId);
    recvGraphEdge.elem1 = idMapper.globalToLocal(globalId);
    commSparse.recv_buffer(procId).unpack<int>(recvGraphEdge.side1);
}
开发者ID:crtrott,项目名称:Trilinos,代码行数:10,代码来源:ElemGraphCoincidentElems.cpp

示例6: allocate_or_communicate

void allocate_or_communicate(int iphase, stk::CommSparse& comm)
{
    if (iphase == 0)
    {
        comm.allocate_buffers();
    }
    else
    {
        comm.communicate();
    }
}
开发者ID:rainiscold,项目名称:trilinos,代码行数:11,代码来源:DiffingTool.cpp

示例7: send_data_to_other_procs

void send_data_to_other_procs(const std::vector<double>& data, stk::CommSparse& comm)
{
    int myprocId = comm.parallel_rank();
    for(int i=0;i<comm.parallel_size();++i)
    {
        if(i!=myprocId)
        {
            stk::pack_vector_to_proc(comm, data, i);
        }
    }
}
开发者ID:mhoemmen,项目名称:Trilinos,代码行数:11,代码来源:UnitTestLoadImbalance.cpp

示例8: pack_edge

void pack_edge(stk::CommSparse &comm, const ElemElemGraph& graph, const stk::mesh::BulkData& bulkData, const stk::mesh::GraphEdge& edge, int other_proc)
{
    stk::mesh::EntityId id1 = bulkData.identifier(graph.get_entity(edge.elem1()));
    unsigned side1 = edge.side1();
    stk::mesh::EntityId id2 = -edge.elem2();
    unsigned side2 = edge.side2();
    comm.send_buffer(other_proc).pack<stk::mesh::EntityId>(id1);
    comm.send_buffer(other_proc).pack<unsigned>(side1);
    comm.send_buffer(other_proc).pack<stk::mesh::EntityId>(id2);
    comm.send_buffer(other_proc).pack<unsigned>(side2);
}
开发者ID:agrippa,项目名称:Trilinos,代码行数:11,代码来源:ParallelInfoForGraph.cpp

示例9: fill_buffer_with_local_neighbors_of_remote_keys

void NoGhostGameofLife::fill_buffer_with_local_neighbors_of_remote_keys(stk::CommSparse& buffer)
{
    for (int phase = 0; phase < 2; phase++)
    {
        for (stk::mesh::EntityKey remoteElemKey : m_remoteElementKeys)
            fill_buffer_with_local_neighbors_of_remote_element_key(remoteElemKey, buffer);
        if (0 == phase)
            buffer.allocate_buffers();
        else
            buffer.communicate();
    }
}
开发者ID:vk1975,项目名称:trilinos,代码行数:12,代码来源:NoGhostGameofLife.cpp

示例10: send_num_active_neighbors_of_remote_elem_keys

void NoGhostGameofLife::send_num_active_neighbors_of_remote_elem_keys(stk::CommSparse& buffer)
{
    for (int phase = 0 ; phase < 2; phase++)
    {
        for (stk::mesh::EntityKey remoteElemKey : m_remoteElementKeysToVisit)
            pack_number_of_local_neighbors_of_remote_element_into_buffer(buffer, remoteElemKey);
        if (0 == phase)
            buffer.allocate_buffers();
        else if (1 == phase)
            buffer.communicate();
    }
}
开发者ID:vk1975,项目名称:trilinos,代码行数:12,代码来源:NoGhostGameofLife.cpp

示例11: fill_buffer_with_local_neighbors_of_remote_element_key

void NoGhostGameofLife::fill_buffer_with_local_neighbors_of_remote_element_key(stk::mesh::EntityKey
                                                                               remoteKey,
                                                                               stk::CommSparse&
                                                                               buffer)
{
    int procNum = m_remoteElementKeyToOwningProcessor[remoteKey];
    size_t numNeighbors = m_remoteElementKeyToLocalNeighborElements[remoteKey].size();
    buffer.send_buffer(procNum).pack<stk::mesh::EntityKey>(remoteKey);
    buffer.send_buffer(procNum).pack<size_t>(numNeighbors);
    for (stk::mesh::Entity localElem : m_remoteElementKeyToLocalNeighborElements[remoteKey])
        buffer.send_buffer(procNum).pack<stk::mesh::EntityKey>(m_bulkData->entity_key(localElem));
}
开发者ID:vk1975,项目名称:trilinos,代码行数:12,代码来源:NoGhostGameofLife.cpp

示例12: fill_buffer_with_local_element_keys_and_remote_node_keys

void NoGhostGameofLife::fill_buffer_with_local_element_keys_and_remote_node_keys(stk::CommSparse&
                                                                                 buffer)
{
    for (int phase = 0; phase < 2; phase++)
    {
        for (stk::mesh::Entity elem : m_elements)
            fill_buffer_with_this_elements_info(elem, buffer);
        if (0 == phase)
            buffer.allocate_buffers();
        else
            buffer.communicate();
    }
}
开发者ID:vk1975,项目名称:trilinos,代码行数:13,代码来源:NoGhostGameofLife.cpp

示例13: communicate_remote_element_keys_to_check

void NoGhostGameofLife::communicate_remote_element_keys_to_check(stk::CommSparse& buffer)
{
    for (int phase = 0; phase < 2; phase++)
    {
        for (stk::mesh::EntityKey remoteElemKey : m_remoteElementKeysToVisit)
            buffer.send_buffer(m_remoteElementKeyToOwningProcessor[remoteElemKey]).
            pack<stk::mesh::EntityKey>(remoteElemKey);
        if (0 == phase)
            buffer.allocate_buffers();
        else
            buffer.communicate();
    }
}
开发者ID:vk1975,项目名称:trilinos,代码行数:13,代码来源:NoGhostGameofLife.cpp

示例14: fill_buffer_with_map_info

void NoGhostGameofLife::fill_buffer_with_map_info(stk::mesh::Entity elem, stk::CommSparse& buffer,
                                                  std::unordered_map<int,std::unordered_set
                                                  <stk::mesh::EntityKey, std::hash
                                                  <stk::mesh::EntityKey>>>& map)
{
    for (std::pair< const int,std::unordered_set<stk::mesh::EntityKey,
            std::hash<stk::mesh::EntityKey>>>& pair : map)
    {
        int remoteProc = pair.first;
        buffer.send_buffer(remoteProc).pack<stk::mesh::EntityKey>(m_bulkData->entity_key(elem));
        buffer.send_buffer(remoteProc).pack<size_t>(pair.second.size());
        for (stk::mesh::EntityKey nodeKey : pair.second)
            buffer.send_buffer(remoteProc).pack<stk::mesh::EntityKey>(nodeKey);
    }
}
开发者ID:vk1975,项目名称:trilinos,代码行数:15,代码来源:NoGhostGameofLife.cpp

示例15: unpack_edge

stk::mesh::GraphEdge unpack_edge(stk::CommSparse& comm, const stk::mesh::BulkData& bulkData, const ElemElemGraph& graph, int proc_id)
{
    stk::mesh::EntityId id1 = 0, id2 = 0;
    unsigned side1 = 0, side2 = 0;
    comm.recv_buffer(proc_id).unpack<stk::mesh::EntityId>(id1);
    comm.recv_buffer(proc_id).unpack<unsigned>(side1);
    comm.recv_buffer(proc_id).unpack<stk::mesh::EntityId>(id2);
    comm.recv_buffer(proc_id).unpack<unsigned>(side2);

    stk::mesh::Entity element = bulkData.get_entity(stk::topology::ELEM_RANK, id2);
    ThrowRequireWithSierraHelpMsg(bulkData.is_valid(element));

    stk::mesh::impl::LocalId localId2 = graph.get_local_element_id(element);
    stk::mesh::GraphEdge edge(localId2, side2, -id1, side1);
    return edge;
}
开发者ID:agrippa,项目名称:Trilinos,代码行数:16,代码来源:ParallelInfoForGraph.cpp


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