Skip to content

Commit

Permalink
Refactor main and fix gcc warning
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethassogba committed Nov 16, 2024
1 parent f0ab66a commit 2ed6abc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions examples/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
#include <Eigen/Dense>
#include "demeter/model/material.hpp"

int main() {
void CheckOpenMP() {
#if defined(_OPENMP)
std::cerr << "OpenMP version " << _OPENMP << '\n';
unsigned num_threads = 0;
#pragma omp parallel reduction(+ : num_threads)
num_threads += 1;
std::cerr << "OpenMP version " << _OPENMP << " number of threads "
<< num_threads << '\n';
#endif
}

#pragma omp parallel for
for (int i = 0; i < 9; ++i) {
std::cerr << "rank = " << omp_get_thread_num()
<< " size = " << omp_get_num_threads() << '\n';
}
int main() {
CheckOpenMP();

using Eigen::MatrixXd;

Expand Down
2 changes: 1 addition & 1 deletion src/demeter/model/material.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Material {
private:
void check() const;
size_t check(size_t group) const {
assert((group >= 0) and (group < num_groups_));
assert(group < num_groups_);
return group;
}

Expand Down

0 comments on commit 2ed6abc

Please sign in to comment.