Skip to content
Snippets Groups Projects
Commit cb4c507c authored by Norihiro Watanabe's avatar Norihiro Watanabe
Browse files

[Mesh] check IDs of nonlinear nodes

parent 4086a353
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,8 @@ Mesh::Mesh(const std::string &name,
assert(n_base_nodes <= nodes.size());
this->resetNodeIDs();
this->resetElementIDs();
if (isNonlinear())
this->checkNonlinearNodeIDs();
this->setDimension();
this->setElementsConnectedToNodes();
//this->setNodesConnectedByEdges();
......@@ -253,6 +255,29 @@ void Mesh::setNodesConnectedByElements()
}
}
void Mesh::checkNonlinearNodeIDs() const
{
for (MeshLib::Element const* e : _elements)
{
for (unsigned i=0; i<e->getNumberOfBaseNodes(); i++)
{
if (!(e->getNodeIndex(i) < getNumberOfBaseNodes()))
OGS_FATAL(
"Node %d is a base/linear node, but the ID is not smaller "
"than the number of base nodes %d. Please renumber node IDs in the mesh.",
e->getNodeIndex(i), getNumberOfBaseNodes());
}
for (unsigned i=e->getNumberOfBaseNodes(); i<e->getNumberOfNodes(); i++)
{
if (!(e->getNodeIndex(i) >= getNumberOfBaseNodes()))
OGS_FATAL(
"Node %d is a non-linear node, but the ID is smaller "
"than the number of base nodes %d. Please renumber node IDs in the mesh.",
e->getNodeIndex(i), getNumberOfBaseNodes());
}
}
}
void scaleMeshPropertyVector(MeshLib::Mesh & mesh,
std::string const& property_name,
double factor)
......
......@@ -162,6 +162,9 @@ protected:
/// connected if they are shared by an element.
void setNodesConnectedByElements();
/// Check if all the nonlinear nodes are stored at the end of the node vector
void checkNonlinearNodeIDs() const;
std::size_t const _id;
unsigned _mesh_dimension;
/// The minimal and maximal edge length over all elements in the mesh
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment