本文整理汇总了C++中NodeMap::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeMap::GetSize方法的具体用法?C++ NodeMap::GetSize怎么用?C++ NodeMap::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeMap
的用法示例。
在下文中一共展示了NodeMap::GetSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void MeshBasedCellPopulationWithGhostNodes<DIM>::UpdateGhostNodesAfterReMesh(NodeMap& rMap)
{
// Copy mIsGhostNode to a temporary vector
std::vector<bool> ghost_nodes_before_remesh = mIsGhostNode;
// Reinitialise mIsGhostNode
mIsGhostNode.clear();
mIsGhostNode.resize(this->GetNumNodes());
// Update mIsGhostNode using the node map
for (unsigned old_index=0; old_index<rMap.GetSize(); old_index++)
{
if (!rMap.IsDeleted(old_index))
{
unsigned new_index = rMap.GetNewIndex(old_index);
mIsGhostNode[new_index] = ghost_nodes_before_remesh[old_index];
}
}
}
示例2: big_map
//.........这里部分代码省略.........
assert(mRightOriginals.size() == mRightImages.size());
for (unsigned i=0; i<mLeftOriginals.size(); i++)
{
mLeftOriginals[i] = big_map.GetNewIndex(mLeftOriginals[i]);
mLeftImages[i] = big_map.GetNewIndex(mLeftImages[i]);
mImageToLeftOriginalNodeMap[mLeftImages[i]] = mLeftOriginals[i];
}
for (unsigned i=0; i<mRightOriginals.size(); i++)
{
mRightOriginals[i] = big_map.GetNewIndex(mRightOriginals[i]);
mRightImages[i] = big_map.GetNewIndex(mRightImages[i]);
mImageToRightOriginalNodeMap[mRightImages[i]] = mRightOriginals[i];
}
for (unsigned i=0; i<mTopHaloNodes.size(); i++)
{
mTopHaloNodes[i] = big_map.GetNewIndex(mTopHaloNodes[i]);
mBottomHaloNodes[i] = big_map.GetNewIndex(mBottomHaloNodes[i]);
}
/*
* Check that elements crossing the periodic boundary have been meshed
* in the same way at each side.
*/
CorrectNonPeriodicMesh();
/*
* Take the double-sized mesh, with its new boundary elements, and
* remove the relevant nodes, elements and boundary elements to leave
* a proper periodic mesh.
*/
ReconstructCylindricalMesh();
DeleteHaloNodes();
/*
* Create a random boundary element between two nodes of the first
* element if it is not deleted. This is a temporary measure to get
* around re-index crashing when there are no boundary elements.
*/
unsigned num_elements = GetNumAllElements();
bool boundary_element_made = false;
unsigned elem_index = 0;
while (elem_index<num_elements && !boundary_element_made)
{
Element<2,2>* p_element = GetElement(elem_index);
if (!p_element->IsDeleted())
{
boundary_element_made = true;
std::vector<Node<2>*> nodes;
nodes.push_back(p_element->GetNode(0));
nodes.push_back(p_element->GetNode(1));
BoundaryElement<1,2>* p_boundary_element = new BoundaryElement<1,2>(0, nodes);
p_boundary_element->RegisterWithNodes();
mBoundaryElements.push_back(p_boundary_element);
this->mBoundaryElementWeightedDirections.push_back(zero_vector<double>(2));
this->mBoundaryElementJacobianDeterminants.push_back(0.0);
}
elem_index++;
}
// Now call ReIndex() to remove the temporary nodes which are marked as deleted
NodeMap reindex_map(GetNumAllNodes());
ReIndex(reindex_map);
assert(!reindex_map.IsIdentityMap()); // maybe don't need this
/*
* Go through the reindex map and use it to populate the original NodeMap
* (the one that is returned to the user).
*/
for (unsigned i=0; i<rMap.GetSize(); i++) // only going up to be size of map, not size of reindex_map
{
if (reindex_map.IsDeleted(i))
{
/*
* i < num_original_nodes and node is deleted, this should correspond to
* a node that was labelled as before the remeshing, so should have already
* been set as deleted in the map above.
*/
assert(rMap.IsDeleted(i));
}
else
{
rMap.SetNewIndex(i, reindex_map.GetNewIndex(i));
}
}
// We can now clear the index vectors and maps; they are only used for remeshing
mLeftOriginals.clear();
mLeftImages.clear();
mImageToLeftOriginalNodeMap.clear();
mRightOriginals.clear();
mRightImages.clear();
mImageToRightOriginalNodeMap.clear();
mLeftPeriodicBoundaryElementIndices.clear();
mRightPeriodicBoundaryElementIndices.clear();
}