Skip to content

Commit

Permalink
Fix Issue #140
Browse files Browse the repository at this point in the history
  • Loading branch information
thelfer committed Dec 6, 2024
1 parent 3de56d3 commit f22eeb4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 169 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if(enable-python-bindings)
message(STATUS "python include path ${PYTHON_INCLUDE_DIRS}")
message(STATUS "python libraries path ${PYTHON_LIBRARY_PATH}")
message(STATUS "python library ${PYTHON_LIBRARY}")
string(REGEX REPLACE "[a-z]+.*$" "" PYTHONLIBS_VERSION_CLEANED ${PYTHONLIBS_VERSION_STRING})
string(REGEX REPLACE "[-a-z+]+.*$" "" PYTHONLIBS_VERSION_CLEANED "${PYTHONLIBS_VERSION_STRING}")
find_package(PythonInterp ${PYTHONLIBS_VERSION_CLEANED} REQUIRED)
message(STATUS "python interpreter ${PYTHON_EXECUTABLE}")
if(NOT HAVE_PYTHON)
Expand Down
9 changes: 5 additions & 4 deletions bindings/python/src/FiniteStrainSupport.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
// forward declaration
void declareFiniteStrainSupport();

void py_convertFiniteStrainStress(boost::python::object o,
const mgis::behaviour::MaterialDataManager& m,
const mgis::behaviour::FiniteStrainStress t) {
static void py_convertFiniteStrainStress(
boost::python::object o,
const mgis::behaviour::MaterialDataManager& m,
const mgis::behaviour::FiniteStrainStress t) {
auto s = mgis::python::mgis_convert_to_span(o);
mgis::behaviour::convertFiniteStrainStress(s, m, t);
} // end of py_py_convertFiniteStrainStress

void py_convertFiniteStrainTangentOperator(
static void py_convertFiniteStrainTangentOperator(
boost::python::object o,
const mgis::behaviour::MaterialDataManager& m,
const mgis::behaviour::FiniteStrainTangentOperator t) {
Expand Down
6 changes: 3 additions & 3 deletions bindings/python/src/Variable.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ static const char* Variable_getType(const mgis::behaviour::Variable& v) {
case Variable::TENSOR:
return "Tensor";
default:
mgis::raise("Variable_getType: unsupported type");
break;
}
return "";
mgis::raise("Variable_getType: unsupported type");
} // end of Variable_getType

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

} // end of declareVariable
} // end of declareVariable
36 changes: 0 additions & 36 deletions include/MGIS/StringView.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -362,42 +362,6 @@ namespace mgis {

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

//------------------------------------------------------------------------

size_type find_last_of(basic_string_view v, size_type pos = npos) const;

size_type find_last_of(char_type c, size_type pos = npos) const;

size_type find_last_of(const char_type* s,
size_type pos,
size_type count) const;

size_type find_last_of(const char_type* s, size_type pos = npos) const;

//------------------------------------------------------------------------

size_type find_first_not_of(basic_string_view v, size_type pos = 0) const;

size_type find_first_not_of(char_type c, size_type pos = 0) const;

size_type find_first_not_of(const char_type* s,
size_type pos,
size_type count) const;

size_type find_first_not_of(const char_type* s, size_type pos = 0) const;

//------------------------------------------------------------------------

size_type find_last_not_of(basic_string_view v, size_type pos = npos) const;

size_type find_last_not_of(char_type c, size_type pos = npos) const;

size_type find_last_not_of(const char_type* s,
size_type pos,
size_type count) const;

size_type find_last_not_of(const char_type* s, size_type pos = npos) const;

//------------------------------------------------------------------------
// Iterators
//------------------------------------------------------------------------
Expand Down
125 changes: 0 additions & 125 deletions include/MGIS/StringView.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -351,131 +351,6 @@ namespace mgis {
return find_first_of(basic_string_view<CharT, Traits>(s), pos);
}

//--------------------------------------------------------------------------

template <typename CharT, typename Traits>
inline typename basic_string_view<CharT, Traits>::size_type
basic_string_view<CharT, Traits>::find_last_of(basic_string_view v,
size_type pos) const {
if (this->empty()) {
return npos;
}
if (pos >= size()) {
return find_last_of(v, this->size() - 1);
}
const auto p =
std::find_first_of(const_reverse_iterator(this->cbegin() + pos + 1),
this->crend(), v.cbegin(), v.cend(), Traits::eq);
if (p == this->crend()) {
return npos;
}
return static_cast<size_type>(this->crend() - p - 1);
}

template <typename CharT, typename Traits>
inline typename basic_string_view<CharT, Traits>::size_type
basic_string_view<CharT, Traits>::find_last_of(char_type c,
size_type pos) const {
return find_last_of(basic_string_view<CharT, Traits>(&c, 1), pos);
}

template <typename CharT, typename Traits>
inline typename basic_string_view<CharT, Traits>::size_type
basic_string_view<CharT, Traits>::find_last_of(const char_type* s,
size_type pos,
size_type count) const {
return find_last_of(basic_string_view<CharT, Traits>(s, count), pos);
}

template <typename CharT, typename Traits>
inline typename basic_string_view<CharT, Traits>::size_type
basic_string_view<CharT, Traits>::find_last_of(const char_type* s,
size_type pos) const {
return find_last_of(basic_string_view<CharT, Traits>(s), pos);
}

//--------------------------------------------------------------------------

template <typename CharT, typename Traits>
inline typename basic_string_view<CharT, Traits>::size_type
basic_string_view<CharT, Traits>::find_first_not_of(basic_string_view v,
size_type pos) const {
for (size_type i = pos; i < m_size; ++i) {
for (size_type j = 0; j < v.size(); ++j) {
if (v[j] == m_str[i]) {
break;
}
return i;
}
}
return npos;
}

template <typename CharT, typename Traits>
inline typename basic_string_view<CharT, Traits>::size_type
basic_string_view<CharT, Traits>::find_first_not_of(char_type c,
size_type pos) const {
return find_first_not_of(basic_string_view<CharT, Traits>(&c, 1), pos);
}

template <typename CharT, typename Traits>
inline typename basic_string_view<CharT, Traits>::size_type
basic_string_view<CharT, Traits>::find_first_not_of(const char_type* s,
size_type pos,
size_type count) const {
return find_first_not_of(basic_string_view<CharT, Traits>(s, count), pos);
}

template <typename CharT, typename Traits>
inline typename basic_string_view<CharT, Traits>::size_type
basic_string_view<CharT, Traits>::find_first_not_of(const char_type* s,
size_type pos) const {
return find_first_not_of(basic_string_view<CharT, Traits>(s), pos);
}

//--------------------------------------------------------------------------

template <typename CharT, typename Traits>
inline typename basic_string_view<CharT, Traits>::size_type
basic_string_view<CharT, Traits>::find_last_not_of(basic_string_view v,
size_type pos) const {
if (this->empty()) {
return npos;
}
if (pos >= this->size()) {
return this->find_last_not_of(v, size() - 1);
}
const auto p =
std::find_if(const_reverse_iterator(this->cbegin() + pos + 1),
this->crend(), not_in_view(v));
if (p == this->crend()) {
return npos;
}
return static_cast<size_type>(this->crend() - p - 1);
}

template <typename CharT, typename Traits>
inline typename basic_string_view<CharT, Traits>::size_type
basic_string_view<CharT, Traits>::find_last_not_of(char_type c,
size_type pos) const {
return find_last_not_of(basic_string_view<CharT, Traits>(&c, 1), pos);
}

template <typename CharT, typename Traits>
inline typename basic_string_view<CharT, Traits>::size_type
basic_string_view<CharT, Traits>::find_last_not_of(const char_type* s,
size_type pos,
size_type count) const {
return find_last_not_of(basic_string_view<CharT, Traits>(s, count), pos);
}

template <typename CharT, typename Traits>
inline typename basic_string_view<CharT, Traits>::size_type
basic_string_view<CharT, Traits>::find_last_not_of(const char_type* s,
size_type pos) const {
return find_last_not_of(basic_string_view<CharT, Traits>(s), pos);
}

//--------------------------------------------------------------------------
// Iterator
//--------------------------------------------------------------------------
Expand Down

0 comments on commit f22eeb4

Please sign in to comment.