Skip to content
Snippets Groups Projects
Commit 3736bf59 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[MeL] Replace throw with assert in getNodeID, getElementID.

parent e6304e56
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#ifndef MESHSUBSET_H_ #ifndef MESHSUBSET_H_
#define MESHSUBSET_H_ #define MESHSUBSET_H_
#include <cassert>
#include <vector> #include <vector>
#include "Mesh.h" #include "Mesh.h"
...@@ -65,13 +66,10 @@ public: ...@@ -65,13 +66,10 @@ public:
/// Returns the global node id Node::getID() of i-th node in the mesh /// Returns the global node id Node::getID() of i-th node in the mesh
/// subset. /// subset.
/// Throws std::out_of_range exception if there are no nodes available. /// \pre The _nodes must be a valid pointer to a vector of size > i.
std::size_t getNodeID(std::size_t const i) const std::size_t getNodeID(std::size_t const i) const
{ {
if (!_nodes) assert(_nodes && i < _nodes->size());
throw std::out_of_range(
"In MeshSubset::getNodeID(): no nodes or nodes are empty.");
return (*_nodes)[i]->getID(); return (*_nodes)[i]->getID();
} }
...@@ -83,13 +81,10 @@ public: ...@@ -83,13 +81,10 @@ public:
/// Returns the global element id Element::getID() of i-th element in the /// Returns the global element id Element::getID() of i-th element in the
/// mesh subset. /// mesh subset.
/// Throws std::out_of_range exception if there are no nodes available. /// \pre The _eles must be a valid pointer to a vector of size > i.
std::size_t getElementID(std::size_t const i) const std::size_t getElementID(std::size_t const i) const
{ {
if (!_eles) assert(_eles && i < _eles->size());
throw std::out_of_range(
"In MeshSubset::getElementID(): no elements or elements are empty.");
return (*_eles)[i]->getID(); return (*_eles)[i]->getID();
} }
......
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