本文整理汇总了C++中meshlib::Mesh::getID方法的典型用法代码示例。如果您正苦于以下问题:C++ Mesh::getID方法的具体用法?C++ Mesh::getID怎么用?C++ Mesh::getID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meshlib::Mesh
的用法示例。
在下文中一共展示了Mesh::getID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeSparsityPatternNonPETSc
GlobalSparsityPattern computeSparsityPatternNonPETSc(
NumLib::LocalToGlobalIndexMap const& dof_table, MeshLib::Mesh const& mesh)
{
MeshLib::NodeAdjacencyTable node_adjacency_table;
node_adjacency_table.createTable(mesh.getNodes());
// A mapping mesh node id -> global indices
// It acts as a cache for dof table queries.
std::vector<std::vector<GlobalIndexType>> global_idcs;
global_idcs.reserve(mesh.getNumberOfNodes());
for (std::size_t n = 0; n < mesh.getNumberOfNodes(); ++n)
{
MeshLib::Location l(mesh.getID(), MeshLib::MeshItemType::Node, n);
global_idcs.push_back(dof_table.getGlobalIndices(l));
}
GlobalSparsityPattern sparsity_pattern(dof_table.dofSizeWithGhosts());
// Map adjacent mesh nodes to "adjacent global indices".
for (std::size_t n = 0; n < mesh.getNumberOfNodes(); ++n)
{
unsigned n_connected_dof = 0;
for (auto an : node_adjacency_table.getAdjacentNodes(n))
n_connected_dof += global_idcs[an].size();
for (auto global_index : global_idcs[n])
sparsity_pattern[global_index] = n_connected_dof;
}
return sparsity_pattern;
}
示例2: getNodalValue
// TODO that essentially duplicates code which is also present in ProcessOutput.
double getNodalValue(GlobalVector const& x, MeshLib::Mesh const& mesh,
NumLib::LocalToGlobalIndexMap const& dof_table,
std::size_t const node_id,
std::size_t const global_component_id)
{
MeshLib::Location const l{mesh.getID(), MeshLib::MeshItemType::Node,
node_id};
auto const index = dof_table.getLocalIndex(
l, global_component_id, x.getRangeBegin(), x.getRangeEnd());
return x.get(index);
}
示例3: l
SparsityPattern
computeSparsityPattern(LocalToGlobalIndexMap const& dof_table,
MeshLib::Mesh const& mesh
)
{
MeshLib::NodeAdjacencyTable node_adjacency_table;
node_adjacency_table.createTable(mesh.getNodes());
// A mapping mesh node id -> global indices
// It acts as a cache for dof table queries.
std::vector<std::vector<GlobalIndexType> > global_idcs;
global_idcs.reserve(mesh.getNNodes());
for (std::size_t n=0; n<mesh.getNNodes(); ++n)
{
MeshLib::Location l(mesh.getID(), MeshLib::MeshItemType::Node, n);
global_idcs.push_back(dof_table.getGlobalIndices(l));
}
SparsityPattern sparsity_pattern(dof_table.dofSize());
// Map adjacent mesh nodes to "adjacent global indices".
for (std::size_t n=0; n<mesh.getNNodes(); ++n)
{
auto const& node_ids = node_adjacency_table.getAdjacentNodes(n);
for (auto an : node_ids) {
auto const& row_ids = global_idcs[an];
auto const num_components = row_ids.size();
for (auto r : row_ids) {
// Each component leads to an entry in the row.
// For the sparsity pattern only the number of entries are needed.
sparsity_pattern[r] += num_components;
}
}
}
return sparsity_pattern;
}
示例4: giAtNodeForComponent
// Returns global index of a node location and a component.
std::size_t giAtNodeForComponent(std::size_t const n, std::size_t const c) const
{
return cmap->getGlobalIndex(Location(mesh->getID(), MeshItemType::Node, n), c);
}