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

clang-format

parent 4ca830a9
No related branches found
No related tags found
1 merge request!2Upgrade docker image & clang-format
Pipeline #16294 failed
Showing with 56 additions and 55 deletions
...@@ -54,4 +54,4 @@ class HeatTerm; ...@@ -54,4 +54,4 @@ class HeatTerm;
class DisplayHook; class DisplayHook;
}; // namespace heat }; // namespace heat
#endif //HEAT_H #endif // HEAT_H
...@@ -21,12 +21,12 @@ using namespace heat; ...@@ -21,12 +21,12 @@ using namespace heat;
Boundary::Boundary(std::shared_ptr<MshData> _msh, int no, std::shared_ptr<Fct0> _f) : Group(_msh, no), f(_f) Boundary::Boundary(std::shared_ptr<MshData> _msh, int no, std::shared_ptr<Fct0> _f) : Group(_msh, no), f(_f)
{ {
//pbl.bnds.push_back(this); // pbl.bnds.push_back(this);
} }
Boundary::Boundary(std::shared_ptr<MshData> _msh, std::string const &name, std::shared_ptr<Fct0> _f) : Group(_msh, name), f(_f) Boundary::Boundary(std::shared_ptr<MshData> _msh, std::string const &name, std::shared_ptr<Fct0> _f) : Group(_msh, name), f(_f)
{ {
//pbl.bnds.push_back(this); // pbl.bnds.push_back(this);
} }
void Boundary::write(std::ostream &out) const void Boundary::write(std::ostream &out) const
......
...@@ -47,4 +47,4 @@ public: ...@@ -47,4 +47,4 @@ public:
} // namespace heat } // namespace heat
#endif //WBOUNDARY_H #endif // WBOUNDARY_H
...@@ -101,4 +101,4 @@ public: ...@@ -101,4 +101,4 @@ public:
}; // namespace heat }; // namespace heat
#endif //WCOMPILEDFCT_H #endif // WCOMPILEDFCT_H
...@@ -31,7 +31,7 @@ Dirichlet::Dirichlet(std::shared_ptr<MshData> _msh, int no, double _val) : Group ...@@ -31,7 +31,7 @@ Dirichlet::Dirichlet(std::shared_ptr<MshData> _msh, int no, double _val) : Group
auto it = std::unique(nodes.begin(), nodes.end()); auto it = std::unique(nodes.begin(), nodes.end());
nodes.resize(std::distance(nodes.begin(), it)); nodes.resize(std::distance(nodes.begin(), it));
//pbl.dBCs.push_back(this); // pbl.dBCs.push_back(this);
} }
Dirichlet::Dirichlet(std::shared_ptr<MshData> _msh, std::string const &name, double _val) : Group(_msh, name), val(_val) Dirichlet::Dirichlet(std::shared_ptr<MshData> _msh, std::string const &name, double _val) : Group(_msh, name), val(_val)
...@@ -43,7 +43,7 @@ Dirichlet::Dirichlet(std::shared_ptr<MshData> _msh, std::string const &name, dou ...@@ -43,7 +43,7 @@ Dirichlet::Dirichlet(std::shared_ptr<MshData> _msh, std::string const &name, dou
auto it = std::unique(nodes.begin(), nodes.end()); auto it = std::unique(nodes.begin(), nodes.end());
nodes.resize(std::distance(nodes.begin(), it)); nodes.resize(std::distance(nodes.begin(), it));
//pbl.dBCs.push_back(this); // pbl.dBCs.push_back(this);
} }
/** /**
......
...@@ -52,4 +52,4 @@ public: ...@@ -52,4 +52,4 @@ public:
} // namespace heat } // namespace heat
#endif //WDIRICHLET_H #endif // WDIRICHLET_H
...@@ -38,4 +38,4 @@ public: ...@@ -38,4 +38,4 @@ public:
} // namespace heat } // namespace heat
#endif //WDISPLAYHOOK_H #endif // WDISPLAYHOOK_H
...@@ -47,4 +47,4 @@ public: ...@@ -47,4 +47,4 @@ public:
} // namespace heat } // namespace heat
#endif //WEXTRACTOR_H #endif // WEXTRACTOR_H
...@@ -42,4 +42,4 @@ public: ...@@ -42,4 +42,4 @@ public:
}; };
} // namespace heat } // namespace heat
#endif //WHEATTERM_H #endif // WHEATTERM_H
...@@ -24,7 +24,7 @@ Medium::Medium(std::shared_ptr<MshData> _msh, int no, ...@@ -24,7 +24,7 @@ Medium::Medium(std::shared_ptr<MshData> _msh, int no,
std::shared_ptr<Fct2> _k, double _rhoc) : Group(_msh, no), std::shared_ptr<Fct2> _k, double _rhoc) : Group(_msh, no),
k(_k), rhoc(_rhoc) k(_k), rhoc(_rhoc)
{ {
//pbl.media.push_back(this); // pbl.media.push_back(this);
} }
Medium::Medium(std::shared_ptr<MshData> _msh, std::string const &name, Medium::Medium(std::shared_ptr<MshData> _msh, std::string const &name,
...@@ -32,7 +32,7 @@ Medium::Medium(std::shared_ptr<MshData> _msh, std::string const &name, ...@@ -32,7 +32,7 @@ Medium::Medium(std::shared_ptr<MshData> _msh, std::string const &name,
k(_k), rhoc(_rhoc) k(_k), rhoc(_rhoc)
{ {
std::cout << "tag=" << *tag << std::endl; std::cout << "tag=" << *tag << std::endl;
//pbl.media.push_back(this); // pbl.media.push_back(this);
} }
void Medium::write(std::ostream &out) const void Medium::write(std::ostream &out) const
......
...@@ -48,4 +48,4 @@ public: ...@@ -48,4 +48,4 @@ public:
} // namespace heat } // namespace heat
#endif //WMEDIUM_H #endif // WMEDIUM_H
...@@ -45,7 +45,7 @@ NodePair::NodePair(Node *_n, Node *_d, double tol) : n(_n), d(_d) ...@@ -45,7 +45,7 @@ NodePair::NodePair(Node *_n, Node *_d, double tol) : n(_n), d(_d)
Periodic::Periodic(std::shared_ptr<heat::Problem> _pbl, Periodic::Periodic(std::shared_ptr<heat::Problem> _pbl,
double _TM, double _dTxM, double _dTyM) : wSharedObject(), pbl(_pbl) double _TM, double _dTxM, double _dTyM) : wSharedObject(), pbl(_pbl)
{ {
//pbl->pdic = this; // pbl->pdic = this;
reset(_TM, _dTxM, _dTyM); reset(_TM, _dTxM, _dTyM);
verbose = false; verbose = false;
} }
...@@ -70,7 +70,7 @@ void Periodic::init() ...@@ -70,7 +70,7 @@ void Periodic::init()
if (!LR.empty()) if (!LR.empty())
return; return;
//std::cout << "Periodic::init()\n"; // std::cout << "Periodic::init()\n";
// build a list of nodes related to all the media // build a list of nodes related to all the media
if (verbose) if (verbose)
......
...@@ -39,7 +39,7 @@ public: ...@@ -39,7 +39,7 @@ public:
NodePair(Node *_n, Node *_d, double tol = 1e-12); NodePair(Node *_n, Node *_d, double tol = 1e-12);
friend HEAT_API std::ostream &operator<<(std::ostream &out, NodePair const &obj); friend HEAT_API std::ostream &operator<<(std::ostream &out, NodePair const &obj);
}; };
#endif //SWIG #endif // SWIG
/** /**
* @brief manages periodic BCs * @brief manages periodic BCs
...@@ -79,4 +79,4 @@ private: ...@@ -79,4 +79,4 @@ private:
} // namespace heat } // namespace heat
#endif //WPERIODIC_H #endif // WPERIODIC_H
...@@ -64,4 +64,4 @@ public: ...@@ -64,4 +64,4 @@ public:
} // namespace heat } // namespace heat
#endif //WPROBLEM_H #endif // WPROBLEM_H
...@@ -146,8 +146,8 @@ void Solver::start(MshExport *mshWriter) ...@@ -146,8 +146,8 @@ void Solver::start(MshExport *mshWriter)
// K matrix assembly // K matrix assembly
Eigen::SparseMatrix<double, Eigen::RowMajor> K(msh->nodes.size(), msh->nodes.size()); Eigen::SparseMatrix<double, Eigen::RowMajor> K(msh->nodes.size(), msh->nodes.size());
buildK(K, rhs_); buildK(K, rhs_);
//tomatlab("K.txt", K); // tomatlab("K.txt", K);
//throw std::runtime_error("stop!"); // throw std::runtime_error("stop!");
tms["Kass"].stop(); tms["Kass"].stop();
tms["BCs"].start(); tms["BCs"].start();
...@@ -162,7 +162,7 @@ void Solver::start(MshExport *mshWriter) ...@@ -162,7 +162,7 @@ void Solver::start(MshExport *mshWriter)
dBC->apply(rhs); dBC->apply(rhs);
} }
tms["BCs"].stop(); tms["BCs"].stop();
//std::cout << rhs << "\n"; // std::cout << rhs << "\n";
// residual calculation // residual calculation
tms["residual"].start(); tms["residual"].start();
...@@ -176,7 +176,7 @@ void Solver::start(MshExport *mshWriter) ...@@ -176,7 +176,7 @@ void Solver::start(MshExport *mshWriter)
Eigen::VectorXd qint2; Eigen::VectorXd qint2;
buildqint(qint2); // calcul de q_int par integration du flux sur l'elem buildqint(qint2); // calcul de q_int par integration du flux sur l'elem
double normdiff = (qint - qint2).norm(); double normdiff = (qint - qint2).norm();
//if(verbose>1) // if(verbose>1)
std::cout << "norm diff=" << normdiff << '\n'; std::cout << "norm diff=" << normdiff << '\n';
} }
...@@ -256,7 +256,8 @@ void Solver::start(MshExport *mshWriter) ...@@ -256,7 +256,8 @@ void Solver::start(MshExport *mshWriter)
Eigen::Vector2d qM = Eigen::Vector2d::Zero(); Eigen::Vector2d qM = Eigen::Vector2d::Zero();
for (auto mat : pbl->media) for (auto mat : pbl->media)
{ {
tbb::parallel_for_each(mat->tag->elems.begin(), mat->tag->elems.end(), [&](Element *e) { tbb::parallel_for_each(mat->tag->elems.begin(), mat->tag->elems.end(), [&](Element *e)
{
if (e->type() != ElType::TRI3) if (e->type() != ElType::TRI3)
return; return;
//std::cout << "processing element #" << e->no << "\n"; //std::cout << "processing element #" << e->no << "\n";
...@@ -295,8 +296,7 @@ void Solver::start(MshExport *mshWriter) ...@@ -295,8 +296,7 @@ void Solver::start(MshExport *mshWriter)
tbb::spin_mutex::scoped_lock lock(mutex); tbb::spin_mutex::scoped_lock lock(mutex);
Vtot += V; Vtot += V;
qM += qV; // qM = qM + qV qM += qV; // qM = qM + qV });
});
} }
qM /= Vtot; qM /= Vtot;
...@@ -371,7 +371,8 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map ...@@ -371,7 +371,8 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map
{ {
if (verbose > 1) if (verbose > 1)
std::cout << "\tprocessing " << *mat << '\n'; std::cout << "\tprocessing " << *mat << '\n';
tbb::parallel_for_each(mat->tag->elems.begin(), mat->tag->elems.end(), [&](Element *e) { tbb::parallel_for_each(mat->tag->elems.begin(), mat->tag->elems.end(), [&](Element *e)
{
if (e->type() != ElType::TRI3) if (e->type() != ElType::TRI3)
return; return;
//std::cout << "processing element #" << e->no << "\n"; //std::cout << "processing element #" << e->no << "\n";
...@@ -388,8 +389,7 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map ...@@ -388,8 +389,7 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map
Node *nodj = e->nodes[jj]; Node *nodj = e->nodes[jj];
T.push_back(Eigen::Triplet<double>(rows[nodi->row], nodj->row, Ke(ii, jj))); T.push_back(Eigen::Triplet<double>(rows[nodi->row], nodj->row, Ke(ii, jj)));
} }
} } });
});
} }
} }
else else
...@@ -406,7 +406,8 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map ...@@ -406,7 +406,8 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map
if (verbose > 1) if (verbose > 1)
std::cout << "\tprocessing " << *mat << '\n'; std::cout << "\tprocessing " << *mat << '\n';
std::for_each(mat->tag->elems.begin(), mat->tag->elems.end(), std::for_each(mat->tag->elems.begin(), mat->tag->elems.end(),
[&](Element *e) { [&](Element *e)
{
if (e->type() != ElType::TRI3) if (e->type() != ElType::TRI3)
return; return;
Eigen::MatrixXd Ke = HeatTerm::build(*e, T1, *mat->k, true); // bidon Eigen::MatrixXd Ke = HeatTerm::build(*e, T1, *mat->k, true); // bidon
...@@ -436,7 +437,7 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map ...@@ -436,7 +437,7 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map
Eigen::MatrixXd Ke = HeatTerm::build(*e, T1, *mat->k, false); Eigen::MatrixXd Ke = HeatTerm::build(*e, T1, *mat->k, false);
// assembly // assembly
//tbb::spin_mutex::scoped_lock lock(mutex); // tbb::spin_mutex::scoped_lock lock(mutex);
for (size_t ii = 0; ii < e->nodes.size(); ++ii) for (size_t ii = 0; ii < e->nodes.size(); ++ii)
{ {
Node *nodi = e->nodes[ii]; Node *nodi = e->nodes[ii];
...@@ -520,8 +521,9 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map ...@@ -520,8 +521,9 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map
double rhocM_Vtot = 0; double rhocM_Vtot = 0;
for (auto mat : pbl->media) for (auto mat : pbl->media)
{ {
//std::cout << "\tprocessing " << *mat << '\n'; // std::cout << "\tprocessing " << *mat << '\n';
tbb::parallel_for_each(mat->tag->elems.begin(), mat->tag->elems.end(), [&](Element *e) { tbb::parallel_for_each(mat->tag->elems.begin(), mat->tag->elems.end(), [&](Element *e)
{
if (e->type() != ElType::TRI3) if (e->type() != ElType::TRI3)
return; return;
//std::cout << "processing element #" << e->no << "\n"; //std::cout << "processing element #" << e->no << "\n";
...@@ -538,8 +540,7 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map ...@@ -538,8 +540,7 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map
Vtot += Ce(jj); Vtot += Ce(jj);
rhocM_Vtot += (mat->rhoc) * Ce(jj); rhocM_Vtot += (mat->rhoc) * Ce(jj);
} } });
});
} }
rhs(n1->row) = rhocM_Vtot * TM; rhs(n1->row) = rhocM_Vtot * TM;
if (verbose > 1) if (verbose > 1)
...@@ -558,7 +559,7 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map ...@@ -558,7 +559,7 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map
{ {
for (auto nod : dBC->nodes) for (auto nod : dBC->nodes)
{ {
//std::cout << "processing " << *nod << "\n"; // std::cout << "processing " << *nod << "\n";
for (Eigen::SparseMatrix<double, Eigen::RowMajor>::InnerIterator it(K2, nod->row); it; ++it) for (Eigen::SparseMatrix<double, Eigen::RowMajor>::InnerIterator it(K2, nod->row); it; ++it)
{ {
if (it.row() == it.col()) if (it.row() == it.col())
...@@ -592,7 +593,8 @@ void Solver::buildqint(Eigen::VectorXd &qint) ...@@ -592,7 +593,8 @@ void Solver::buildqint(Eigen::VectorXd &qint)
{ {
if (verbose > 1) if (verbose > 1)
std::cout << "\tprocessing " << *mat << '\n'; std::cout << "\tprocessing " << *mat << '\n';
tbb::parallel_for_each(mat->tag->elems.begin(), mat->tag->elems.end(), [&](Element *e) { tbb::parallel_for_each(mat->tag->elems.begin(), mat->tag->elems.end(), [&](Element *e)
{
if (e->type() != ElType::TRI3) if (e->type() != ElType::TRI3)
return; return;
//std::cout << "processing element #" << e->no << "\n"; //std::cout << "processing element #" << e->no << "\n";
...@@ -605,8 +607,7 @@ void Solver::buildqint(Eigen::VectorXd &qint) ...@@ -605,8 +607,7 @@ void Solver::buildqint(Eigen::VectorXd &qint)
{ {
Node *nodi = e->nodes[ii]; Node *nodi = e->nodes[ii];
qint(nodi->row) += qe(ii); qint(nodi->row) += qe(ii);
} } });
});
} }
if (!pbl->dBCs.empty()) if (!pbl->dBCs.empty())
...@@ -640,8 +641,9 @@ void Solver::builds(Eigen::Map<Eigen::VectorXd> &s) ...@@ -640,8 +641,9 @@ void Solver::builds(Eigen::Map<Eigen::VectorXd> &s)
for (auto src : pbl->srcs) for (auto src : pbl->srcs)
{ {
//std::cout << "\tprocessing " << *src << '\n'; // std::cout << "\tprocessing " << *src << '\n';
tbb::parallel_for_each(src->tag->elems.begin(), src->tag->elems.end(), [&](Element *e) { tbb::parallel_for_each(src->tag->elems.begin(), src->tag->elems.end(), [&](Element *e)
{
if (e->type() != ElType::TRI3 && e->type() != ElType::LINE2) if (e->type() != ElType::TRI3 && e->type() != ElType::LINE2)
return; return;
//std::cout << "processing element #" << e->no << "\n"; //std::cout << "processing element #" << e->no << "\n";
...@@ -656,8 +658,7 @@ void Solver::builds(Eigen::Map<Eigen::VectorXd> &s) ...@@ -656,8 +658,7 @@ void Solver::builds(Eigen::Map<Eigen::VectorXd> &s)
{ {
Node *nodi = e->nodes[ii]; Node *nodi = e->nodes[ii];
s(nodi->row) += se(ii); s(nodi->row) += se(ii);
} } });
});
} }
if (verbose > 1) if (verbose > 1)
...@@ -679,8 +680,9 @@ void Solver::buildq(Eigen::Map<Eigen::VectorXd> &q) ...@@ -679,8 +680,9 @@ void Solver::buildq(Eigen::Map<Eigen::VectorXd> &q)
for (auto bnd : pbl->bnds) for (auto bnd : pbl->bnds)
{ {
//std::cout << "\tprocessing " << *src << '\n'; // std::cout << "\tprocessing " << *src << '\n';
tbb::parallel_for_each(bnd->tag->elems.begin(), bnd->tag->elems.end(), [&](Element *e) { tbb::parallel_for_each(bnd->tag->elems.begin(), bnd->tag->elems.end(), [&](Element *e)
{
if (e->type() != ElType::LINE2) if (e->type() != ElType::LINE2)
return; return;
//std::cout << "processing element #" << e->no << "\n"; //std::cout << "processing element #" << e->no << "\n";
...@@ -695,8 +697,7 @@ void Solver::buildq(Eigen::Map<Eigen::VectorXd> &q) ...@@ -695,8 +697,7 @@ void Solver::buildq(Eigen::Map<Eigen::VectorXd> &q)
{ {
Node *nodi = e->nodes[ii]; Node *nodi = e->nodes[ii];
q(nodi->row) += qe(ii); q(nodi->row) += qe(ii);
} } });
});
} }
if (verbose > 1) if (verbose > 1)
......
...@@ -76,4 +76,4 @@ private: ...@@ -76,4 +76,4 @@ private:
} // namespace heat } // namespace heat
#endif //WSOLVER_H #endif // WSOLVER_H
...@@ -21,12 +21,12 @@ using namespace heat; ...@@ -21,12 +21,12 @@ using namespace heat;
Source::Source(std::shared_ptr<MshData> _msh, int no, std::shared_ptr<Fct0> _f) : Group(_msh, no), f(_f) Source::Source(std::shared_ptr<MshData> _msh, int no, std::shared_ptr<Fct0> _f) : Group(_msh, no), f(_f)
{ {
//pbl.srcs.push_back(this); // pbl.srcs.push_back(this);
} }
Source::Source(std::shared_ptr<MshData> _msh, std::string const &name, std::shared_ptr<Fct0> _f) : Group(_msh, name), f(_f) Source::Source(std::shared_ptr<MshData> _msh, std::string const &name, std::shared_ptr<Fct0> _f) : Group(_msh, name), f(_f)
{ {
//pbl.srcs.push_back(this); // pbl.srcs.push_back(this);
} }
void Source::write(std::ostream &out) const void Source::write(std::ostream &out) const
......
...@@ -49,4 +49,4 @@ public: ...@@ -49,4 +49,4 @@ public:
} // namespace heat } // namespace heat
#endif //WSOURCE_H #endif // WSOURCE_H
...@@ -35,9 +35,9 @@ public: ...@@ -35,9 +35,9 @@ public:
Dofs() : wObject(), dofs(0) {} Dofs() : wObject(), dofs(0) {}
//~Dofs(); //~Dofs();
//void add(Dof &dof); // void add(Dof &dof);
size_t size() const { return dofs.size(); } size_t size() const { return dofs.size(); }
//virtual void write(std::ostream &out) const; // virtual void write(std::ostream &out) const;
}; };
#endif //WDOF_H #endif // WDOF_H
...@@ -38,4 +38,4 @@ public: ...@@ -38,4 +38,4 @@ public:
virtual void write(std::ostream &out) const; virtual void write(std::ostream &out) const;
}; };
#endif //WFIELD_H #endif // WFIELD_H
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