Skip to content

Commit

Permalink
Apply clang-format to nblib *.hpp files
Browse files Browse the repository at this point in the history
  • Loading branch information
al42and committed Aug 5, 2023
1 parent 7cc6771 commit 0c5644d
Show file tree
Hide file tree
Showing 8 changed files with 371 additions and 307 deletions.
6 changes: 3 additions & 3 deletions api/nblib/include/nblib/util/traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ using AccessTypeMemberIfPresent_t = typename AccessTypeMemberIfPresent<T>::type;
*/
template<int N, typename T, typename Tuple>
struct MatchTypeOrTypeMember :
std::disjunction<std::is_same<T, std::tuple_element_t<N, Tuple>>,
std::is_same<T, AccessTypeMemberIfPresent_t<std::tuple_element_t<N, Tuple>>>>
std::disjunction<std::is_same<T, std::tuple_element_t<N, Tuple>>,
std::is_same<T, AccessTypeMemberIfPresent_t<std::tuple_element_t<N, Tuple>>>>
{
};

Expand All @@ -203,7 +203,7 @@ struct MatchField_ : std::integral_constant<size_t, MatchField_<N + 1, T, Tuple,
//! \brief recursion stop when Comparison<N, T, Tuple>::value is true
template<int N, class T, class Tuple, template<int, class, class> class Comparison>
struct MatchField_<N, T, Tuple, Comparison, std::enable_if_t<Comparison<N, T, Tuple>{}>> :
std::integral_constant<size_t, N>
std::integral_constant<size_t, N>
{
};

Expand Down
6 changes: 2 additions & 4 deletions api/nblib/include/nblib/util/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ std::string formatString(std::string fmt, Args... args)
std::ostringstream os;
std::string delimiter = "{}";

auto next_token = [](std::string& s, const std::string& delimiter_)
{
auto next_token = [](std::string& s, const std::string& delimiter_) {
std::string token = s.substr(0, s.find(delimiter_));

std::size_t next = s.find(delimiter_);
Expand All @@ -171,8 +170,7 @@ std::string formatString(std::string fmt, Args... args)
return token;
};

[[maybe_unused]]
std::initializer_list<int> unused{ 0, (os << next_token(fmt, delimiter) << args, 0)... };
[[maybe_unused]] std::initializer_list<int> unused{ 0, (os << next_token(fmt, delimiter) << args, 0)... };

os << next_token(fmt, delimiter);

Expand Down
321 changes: 188 additions & 133 deletions api/nblib/listed_forces/dataflow.hpp

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions api/nblib/listed_forces/helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,9 @@ class ForceBufferProxy
using HashMap = std::unordered_map<int, T>;

public:
ForceBufferProxy() : rangeStart_(0), rangeEnd_(0) { }
ForceBufferProxy() : rangeStart_(0), rangeEnd_(0) {}

ForceBufferProxy(int rangeStart, int rangeEnd) : rangeStart_(rangeStart), rangeEnd_(rangeEnd)
{
}
ForceBufferProxy(int rangeStart, int rangeEnd) : rangeStart_(rangeStart), rangeEnd_(rangeEnd) {}

void clearOutliers() { outliers.clear(); }

Expand All @@ -119,14 +117,17 @@ class ForceBufferProxy
typename HashMap::const_iterator begin() { return outliers.begin(); }
typename HashMap::const_iterator end() { return outliers.end(); }

[[nodiscard]] bool inRange(int index) const { return (index >= rangeStart_ && index < rangeEnd_); }
[[nodiscard]] bool inRange(int index) const
{
return (index >= rangeStart_ && index < rangeEnd_);
}

void setMainBuffer(gmx::ArrayRef<T> buffer) { mainForceBuffer = buffer; }

private:
gmx::ArrayRef<T> mainForceBuffer;
int rangeStart_;
int rangeEnd_;
int rangeStart_;
int rangeEnd_;

HashMap outliers;
};
Expand Down Expand Up @@ -156,10 +157,9 @@ static int computeChunkIndex(int index, int totalRange, int nSplits)
* \param nSplits number to divide the total work by
* \return
*/
inline
std::vector<ListedInteractionData> splitListedWork(const ListedInteractionData& interactions,
int totalRange,
int nSplits)
inline std::vector<ListedInteractionData> splitListedWork(const ListedInteractionData& interactions,
int totalRange,
int nSplits)
{
std::vector<ListedInteractionData> workDivision(nSplits);

Expand Down
Loading

0 comments on commit 0c5644d

Please sign in to comment.