Skip to content
Snippets Groups Projects
Commit 0e330edd authored by Boman Romain's avatar Boman Romain
Browse files

use clang-format-10

parent fa35f490
No related branches found
Tags flow-v1.3
1 merge request!58Improve Continuous Integration
Pipeline #1579 failed
......@@ -15,12 +15,13 @@ default:
stages:
- build
- test
# - test
format:
<<: *global_tag_def
stage: build
script:
- clang-format --version # we use clang-format-10 exclusively
- ./scripts/format_code.py
- mkdir -p patches
- if git diff --patch --exit-code > patches/clang-format.patch; then echo "Clang format changed nothing"; else echo "Clang format found changes to make!"; false; fi
......
......@@ -24,7 +24,7 @@ Timers::Timers()
}
Timer &
Timers::operator[](std::string const &name)
Timers::operator[](std::string const &name)
{
return timers[name];
}
......
......@@ -43,7 +43,7 @@ def main():
encs = {}
for f in all_files(os.getcwd(), patterns='*.cpp;*.c;*.h;*.hpp'):
# print(f)
cmd = ['clang-format', "-style=file", "-i", f]
cmd = ['clang-format-10', "-style=file", "-i", f]
retcode = subprocess.call(cmd)
if retcode != 0:
print(f'ERROR: retcode = {retcode}')
......
......@@ -183,24 +183,25 @@ void BruteForceSorter::execute(std::vector<Particle *> &prts, int step)
tbb::task_scheduler_init init(nthreads);
int grainsize = 200;
tbb::parallel_for(tbb::blocked_range<size_t>(0, prts.size(), grainsize),
[=](tbb::blocked_range<size_t> &r) {
//std::cout << r.size() << '\n';
for (size_t i = r.begin(); i < r.end(); ++i)
{
Particle *p = prts[i];
Eigen::Vector3d &x = p->dofs[step]->x;
//Eigen::Vector3d x = p->dofs[step]->x;
for (auto it2 = prts.begin(); it2 != prts.end(); ++it2)
{
Particle *pn = *it2;
Eigen::Vector3d &xn = pn->dofs[step]->x;
double R2 = (xn - x).squaredNorm();
if (R2 <= R2max)
p->neighs.push_back(pn);
}
}
},
tbb::simple_partitioner());
tbb::parallel_for(
tbb::blocked_range<size_t>(0, prts.size(), grainsize),
[=](tbb::blocked_range<size_t> &r) {
//std::cout << r.size() << '\n';
for (size_t i = r.begin(); i < r.end(); ++i)
{
Particle *p = prts[i];
Eigen::Vector3d &x = p->dofs[step]->x;
//Eigen::Vector3d x = p->dofs[step]->x;
for (auto it2 = prts.begin(); it2 != prts.end(); ++it2)
{
Particle *pn = *it2;
Eigen::Vector3d &xn = pn->dofs[step]->x;
double R2 = (xn - x).squaredNorm();
if (R2 <= R2max)
p->neighs.push_back(pn);
}
}
},
tbb::simple_partitioner());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment