Skip to content

Commit f22eeb4

Browse files
committed
Fix Issue #140
1 parent 3de56d3 commit f22eeb4

5 files changed

Lines changed: 9 additions & 169 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ if(enable-python-bindings)
3838
message(STATUS "python include path ${PYTHON_INCLUDE_DIRS}")
3939
message(STATUS "python libraries path ${PYTHON_LIBRARY_PATH}")
4040
message(STATUS "python library ${PYTHON_LIBRARY}")
41-
string(REGEX REPLACE "[a-z]+.*$" "" PYTHONLIBS_VERSION_CLEANED ${PYTHONLIBS_VERSION_STRING})
41+
string(REGEX REPLACE "[-a-z+]+.*$" "" PYTHONLIBS_VERSION_CLEANED "${PYTHONLIBS_VERSION_STRING}")
4242
find_package(PythonInterp ${PYTHONLIBS_VERSION_CLEANED} REQUIRED)
4343
message(STATUS "python interpreter ${PYTHON_EXECUTABLE}")
4444
if(NOT HAVE_PYTHON)

bindings/python/src/FiniteStrainSupport.cxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@
2121
// forward declaration
2222
void declareFiniteStrainSupport();
2323

24-
void py_convertFiniteStrainStress(boost::python::object o,
25-
const mgis::behaviour::MaterialDataManager& m,
26-
const mgis::behaviour::FiniteStrainStress t) {
24+
static void py_convertFiniteStrainStress(
25+
boost::python::object o,
26+
const mgis::behaviour::MaterialDataManager& m,
27+
const mgis::behaviour::FiniteStrainStress t) {
2728
auto s = mgis::python::mgis_convert_to_span(o);
2829
mgis::behaviour::convertFiniteStrainStress(s, m, t);
2930
} // end of py_py_convertFiniteStrainStress
3031

31-
void py_convertFiniteStrainTangentOperator(
32+
static void py_convertFiniteStrainTangentOperator(
3233
boost::python::object o,
3334
const mgis::behaviour::MaterialDataManager& m,
3435
const mgis::behaviour::FiniteStrainTangentOperator t) {

bindings/python/src/Variable.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ static const char* Variable_getType(const mgis::behaviour::Variable& v) {
3131
case Variable::TENSOR:
3232
return "Tensor";
3333
default:
34-
mgis::raise("Variable_getType: unsupported type");
34+
break;
3535
}
36-
return "";
36+
mgis::raise("Variable_getType: unsupported type");
3737
} // end of Variable_getType
3838

3939
// mgis::string_view is not exposed
@@ -80,4 +80,4 @@ void declareVariable() {
8080
boost::python::def("getArraySize", &mgis::behaviour::getArraySize);
8181
boost::python::def("getVariableOffset", getVariableOffsetByString);
8282

83-
} // end of declareVariable
83+
} // end of declareVariable

include/MGIS/StringView.hxx

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -362,42 +362,6 @@ namespace mgis {
362362

363363
size_type find_first_of(const char_type* s, size_type pos = 0) const;
364364

365-
//------------------------------------------------------------------------
366-
367-
size_type find_last_of(basic_string_view v, size_type pos = npos) const;
368-
369-
size_type find_last_of(char_type c, size_type pos = npos) const;
370-
371-
size_type find_last_of(const char_type* s,
372-
size_type pos,
373-
size_type count) const;
374-
375-
size_type find_last_of(const char_type* s, size_type pos = npos) const;
376-
377-
//------------------------------------------------------------------------
378-
379-
size_type find_first_not_of(basic_string_view v, size_type pos = 0) const;
380-
381-
size_type find_first_not_of(char_type c, size_type pos = 0) const;
382-
383-
size_type find_first_not_of(const char_type* s,
384-
size_type pos,
385-
size_type count) const;
386-
387-
size_type find_first_not_of(const char_type* s, size_type pos = 0) const;
388-
389-
//------------------------------------------------------------------------
390-
391-
size_type find_last_not_of(basic_string_view v, size_type pos = npos) const;
392-
393-
size_type find_last_not_of(char_type c, size_type pos = npos) const;
394-
395-
size_type find_last_not_of(const char_type* s,
396-
size_type pos,
397-
size_type count) const;
398-
399-
size_type find_last_not_of(const char_type* s, size_type pos = npos) const;
400-
401365
//------------------------------------------------------------------------
402366
// Iterators
403367
//------------------------------------------------------------------------

include/MGIS/StringView.ixx

Lines changed: 0 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -351,131 +351,6 @@ namespace mgis {
351351
return find_first_of(basic_string_view<CharT, Traits>(s), pos);
352352
}
353353

354-
//--------------------------------------------------------------------------
355-
356-
template <typename CharT, typename Traits>
357-
inline typename basic_string_view<CharT, Traits>::size_type
358-
basic_string_view<CharT, Traits>::find_last_of(basic_string_view v,
359-
size_type pos) const {
360-
if (this->empty()) {
361-
return npos;
362-
}
363-
if (pos >= size()) {
364-
return find_last_of(v, this->size() - 1);
365-
}
366-
const auto p =
367-
std::find_first_of(const_reverse_iterator(this->cbegin() + pos + 1),
368-
this->crend(), v.cbegin(), v.cend(), Traits::eq);
369-
if (p == this->crend()) {
370-
return npos;
371-
}
372-
return static_cast<size_type>(this->crend() - p - 1);
373-
}
374-
375-
template <typename CharT, typename Traits>
376-
inline typename basic_string_view<CharT, Traits>::size_type
377-
basic_string_view<CharT, Traits>::find_last_of(char_type c,
378-
size_type pos) const {
379-
return find_last_of(basic_string_view<CharT, Traits>(&c, 1), pos);
380-
}
381-
382-
template <typename CharT, typename Traits>
383-
inline typename basic_string_view<CharT, Traits>::size_type
384-
basic_string_view<CharT, Traits>::find_last_of(const char_type* s,
385-
size_type pos,
386-
size_type count) const {
387-
return find_last_of(basic_string_view<CharT, Traits>(s, count), pos);
388-
}
389-
390-
template <typename CharT, typename Traits>
391-
inline typename basic_string_view<CharT, Traits>::size_type
392-
basic_string_view<CharT, Traits>::find_last_of(const char_type* s,
393-
size_type pos) const {
394-
return find_last_of(basic_string_view<CharT, Traits>(s), pos);
395-
}
396-
397-
//--------------------------------------------------------------------------
398-
399-
template <typename CharT, typename Traits>
400-
inline typename basic_string_view<CharT, Traits>::size_type
401-
basic_string_view<CharT, Traits>::find_first_not_of(basic_string_view v,
402-
size_type pos) const {
403-
for (size_type i = pos; i < m_size; ++i) {
404-
for (size_type j = 0; j < v.size(); ++j) {
405-
if (v[j] == m_str[i]) {
406-
break;
407-
}
408-
return i;
409-
}
410-
}
411-
return npos;
412-
}
413-
414-
template <typename CharT, typename Traits>
415-
inline typename basic_string_view<CharT, Traits>::size_type
416-
basic_string_view<CharT, Traits>::find_first_not_of(char_type c,
417-
size_type pos) const {
418-
return find_first_not_of(basic_string_view<CharT, Traits>(&c, 1), pos);
419-
}
420-
421-
template <typename CharT, typename Traits>
422-
inline typename basic_string_view<CharT, Traits>::size_type
423-
basic_string_view<CharT, Traits>::find_first_not_of(const char_type* s,
424-
size_type pos,
425-
size_type count) const {
426-
return find_first_not_of(basic_string_view<CharT, Traits>(s, count), pos);
427-
}
428-
429-
template <typename CharT, typename Traits>
430-
inline typename basic_string_view<CharT, Traits>::size_type
431-
basic_string_view<CharT, Traits>::find_first_not_of(const char_type* s,
432-
size_type pos) const {
433-
return find_first_not_of(basic_string_view<CharT, Traits>(s), pos);
434-
}
435-
436-
//--------------------------------------------------------------------------
437-
438-
template <typename CharT, typename Traits>
439-
inline typename basic_string_view<CharT, Traits>::size_type
440-
basic_string_view<CharT, Traits>::find_last_not_of(basic_string_view v,
441-
size_type pos) const {
442-
if (this->empty()) {
443-
return npos;
444-
}
445-
if (pos >= this->size()) {
446-
return this->find_last_not_of(v, size() - 1);
447-
}
448-
const auto p =
449-
std::find_if(const_reverse_iterator(this->cbegin() + pos + 1),
450-
this->crend(), not_in_view(v));
451-
if (p == this->crend()) {
452-
return npos;
453-
}
454-
return static_cast<size_type>(this->crend() - p - 1);
455-
}
456-
457-
template <typename CharT, typename Traits>
458-
inline typename basic_string_view<CharT, Traits>::size_type
459-
basic_string_view<CharT, Traits>::find_last_not_of(char_type c,
460-
size_type pos) const {
461-
return find_last_not_of(basic_string_view<CharT, Traits>(&c, 1), pos);
462-
}
463-
464-
template <typename CharT, typename Traits>
465-
inline typename basic_string_view<CharT, Traits>::size_type
466-
basic_string_view<CharT, Traits>::find_last_not_of(const char_type* s,
467-
size_type pos,
468-
size_type count) const {
469-
return find_last_not_of(basic_string_view<CharT, Traits>(s, count), pos);
470-
}
471-
472-
template <typename CharT, typename Traits>
473-
inline typename basic_string_view<CharT, Traits>::size_type
474-
basic_string_view<CharT, Traits>::find_last_not_of(const char_type* s,
475-
size_type pos) const {
476-
return find_last_not_of(basic_string_view<CharT, Traits>(s), pos);
477-
}
478-
479354
//--------------------------------------------------------------------------
480355
// Iterator
481356
//--------------------------------------------------------------------------

0 commit comments

Comments
 (0)