Part: refactor ViewProviderPartExt::getDetail

This commit is contained in:
wmayer
2023-08-25 14:06:16 +02:00
committed by wwmayer
parent 56ccef84c2
commit 66fb1c7777
3 changed files with 37 additions and 23 deletions

View File

@@ -27,6 +27,7 @@
# include <cmath>
# include <cstdlib>
# include <sstream>
# include <boost/regex.hpp>
# include <APIHeaderSection_MakeHeader.hxx>
# include <BinTools.hxx>
@@ -292,6 +293,21 @@ TopoShape::TopoShape(const TopoShape& shape)
Tag = shape.Tag;
}
std::pair<std::string, unsigned long> TopoShape::getElementTypeAndIndex(const char* Name)
{
int index = 0;
std::string element;
boost::regex ex("^(Face|Edge|Vertex)([1-9][0-9]*)$");
boost::cmatch what;
if (boost::regex_match(Name, what, ex)) {
element = what[1].str();
index = std::atoi(what[2].str().c_str());
}
return std::make_pair(element, index);
}
std::vector<const char*> TopoShape::getElementTypes() const
{
static const std::vector<const char*> temp = {"Face","Edge","Vertex"};